From: Harrie Hoenjet
Subject: illegal function call
Date: 
Message-ID: <3e7d7c2c$0$29710$19deed1b@news.inter.NL.net>
Hi,
This is e newbie question.
I'm working on a list ((a b) (c d)(e f))
I use CADADDR to extract F.
But i get a error message

I'm using XLISP, personal edition.
What do I do wrong?

Harry

From: Lieven Marchand
Subject: Re: illegal function call
Date: 
Message-ID: <87of42b8me.fsf@wyrd.be>
"Harrie Hoenjet" <·········@inter.NL.net> writes:

> I'm working on a list ((a b) (c d)(e f))
> I use CADADDR to extract F.
> But i get a error message
> 
> I'm using XLISP, personal edition.
> What do I do wrong?

Traditionally, only 4 levels of c*r are available. So (CAR (CDADDR
...)) should work.

-- 
And I'm wilder than her and it drives her out of her mind
I guess she thought that she was just one of a kind
But she's a summer storm and I'm a hurricane
One just blows through town, one blows the town away
From: Adam Warner
Subject: Re: illegal function call
Date: 
Message-ID: <pan.2003.03.23.10.48.07.530915@consulting.net.nz>
Hi Harrie Hoenjet,

> Hi,
> This is e newbie question.
> I'm working on a list ((a b) (c d)(e f))
> I use CADADDR to extract F.
> But i get a error message

Are you expecting every combination of CAR and CDR to be predefined
exported symbols within the language?

Take a look at the ones that are predefined in Common Lisp:
http://www.lispworks.com/reference/HyperSpec/Body/f_car_c.htm

Notice how no symbol name is longer than six characters.

I'd just use (second (third '((a b) (c d) (e f))))

It looks like you have been set a problem that can't be completely solved
using trial and error within an implementation. You can get as far as
CDADDR within the implementation before you need to take the CAR of '(f).

Regards,
Adam
From: Steven M. Haflich
Subject: Re: illegal function call
Date: 
Message-ID: <3E7E8A7F.9010705@alum.mit.edu>
Adam Warner wrote:

> Are you expecting every combination of CAR and CDR to be predefined
> exported symbols within the language?

This was in fact the case in franz lisp (twenty years ago) and possibly
also in MACSYMA (even longer ago -- I can't remember what I had for
breakfast this morning, so don't expect me to remember details of
ancient computer languages).

The notion was that a programmer ought be able to write any combination
of C&r functions as a single word.  Iforget whether it was the reader
of the undefined function handler that accomplished this magic, but
when such a function was used, it was defined on demand.  I never
thought this was a particularly good idea on two grounds:  First,
defining functions this way is confusing and contrary to the way
that functions are normally defined, or that a finite set of functions
are provided by the implementation.  Second, use of c&r functions
beyond 2-3 dereferences if hard to read, almost opaque, and higher-level
facilities should be used.
From: Kent M Pitman
Subject: Re: illegal function call
Date: 
Message-ID: <sfw65q9hs70.fsf@shell01.TheWorld.com>
"Steven M. Haflich" <·················@alum.mit.edu> writes:

> Adam Warner wrote:
> 
> > Are you expecting every combination of CAR and CDR to be predefined
> > exported symbols within the language?
> 
> This was in fact the case in franz lisp (twenty years ago) and possibly
> also in MACSYMA (even longer ago -- I can't remember what I had for
> breakfast this morning, so don't expect me to remember details of
> ancient computer languages).

I used to have a patch for Maclisp that ran in the undefined function handler
that would cause these to come into effect (compiled and all, even though
there was not a runtime-accessible compiler in Maclisp).

I tried to suggest that this should be true in CL, too, but I was convinced
by people that it was a good idea if CL had a finite number of symbols.
[Paul Dietz better chime in here with a thank you for whoever suggested that.
 :-]
 
Also, neither Maclisp nor Franz Lisp had had packages, so they didn't
confront the issue of whether autodefinition would imply autoexport.
And the latter would have been the REAL problem.  It's not just a 
philosophical question but a practical one whether the name is on the
export list.  Some programs need to do-external-symbols and know they
have touched all of the symbols.  Internal symbols of another 'using'
package might clash, and when a later export happens, that might create
a problem. (It's for this latter reason that some lisps actually 'lock'
the package [in violation of the spec, I suppose, but still usefully since
it mostly prevents program errors] once it has been used, or else sometimes
under explicit instruction.)

> The notion was that a programmer ought be able to write any combination
> of C&r functions as a single word.

Did your version have CR as an identity?  This was the other thing that
made me not like having the full set.  I was torn between whether CR should
be the same as IDENTITY or the same as TERPRI.  Heh.

> Iforget whether it was the reader
> of the undefined function handler that accomplished this magic, but
> when such a function was used, it was defined on demand.  I never
> thought this was a particularly good idea on two grounds:  First,
> defining functions this way is confusing and contrary to the way
> that functions are normally defined, or that a finite set of functions
> are provided by the implementation.

Yep!

> Second, use of c&r functions
> beyond 2-3 dereferences if hard to read, almost opaque, and higher-level
> facilities should be used.

This was something I came to appreciate later, and though my style rule
is not merely length-oriented.

I only like the functions C A D* R, C D D* R, and CAAR.

I don't think there's anything inherently opaque about CADDDDDDR, though
I do think SEVENTH is easier to count.  I think CADAR is more likely to 
be opaque because it's not just about counting; it probably means
CADAR of CAR [two unnamed abstractions implemented as conses], but it 
might mean CAR of CDR or CAR [three unnamed abstractions implemented
as conses].
From: Barry Margolin
Subject: Re: illegal function call
Date: 
Message-ID: <T6Ffa.4$qi4.255@paloalto-snr1.gtei.net>
In article <···············@shell01.TheWorld.com>,
Kent M Pitman  <······@world.std.com> wrote:
>"Steven M. Haflich" <·················@alum.mit.edu> writes:
>
>> Adam Warner wrote:
>> 
>> > Are you expecting every combination of CAR and CDR to be predefined
>> > exported symbols within the language?
>> 
>> This was in fact the case in franz lisp (twenty years ago) and possibly
>> also in MACSYMA (even longer ago -- I can't remember what I had for
>> breakfast this morning, so don't expect me to remember details of
>> ancient computer languages).
>
>I used to have a patch for Maclisp that ran in the undefined function handler
>that would cause these to come into effect (compiled and all, even though
>there was not a runtime-accessible compiler in Maclisp).

This also seems like one of those things that Interlisp's DWIM might have
done automatically.

-- 
Barry Margolin, ··············@level3.com
Genuity Managed Services, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Steven M. Haflich
Subject: Re: illegal function call
Date: 
Message-ID: <gKUfa.1161$Jc1.228@newssvr19.news.prodigy.com>
Barry Margolin wrote:

>>I used to have a patch for Maclisp that ran in the undefined function handler
>>that would cause these to come into effect (compiled and all, even though
>>there was not a runtime-accessible compiler in Maclisp).
> 
> This also seems like one of those things that Interlisp's DWIM might have
> done automatically.

To that nonsense I can only repond with one word:

MAPCADDDDADAADADDAADADDR

Have we -- despite being Lisp programmers -- learned _nothing_ about
healthy programming over the past 43 years?  Orthogonality of language
constructs is a good thing, _except_ when combined with DWIM, because
computers are never as smart as you are.

Sheeesh.
From: Barry Margolin
Subject: Re: illegal function call
Date: 
Message-ID: <ay_fa.3$bK.648@paloalto-snr1.gtei.net>
In article <··················@newssvr19.news.prodigy.com>,
Steven M. Haflich <·················@alum.mit.edu> wrote:
>Barry Margolin wrote:
>
>>>I used to have a patch for Maclisp that ran in the undefined function handler
>>>that would cause these to come into effect (compiled and all, even though
>>>there was not a runtime-accessible compiler in Maclisp).
>> 
>> This also seems like one of those things that Interlisp's DWIM might have
>> done automatically.
>
>To that nonsense I can only repond with one word:
>
>MAPCADDDDADAADADDAADADDR
>
>Have we -- despite being Lisp programmers -- learned _nothing_ about
>healthy programming over the past 43 years?  Orthogonality of language
>constructs is a good thing, _except_ when combined with DWIM, because
>computers are never as smart as you are.

Interlisp predates about half of those 43 years.

Don't forget that Lisp was heavily oriented towards AI at the time.  My
guess is DWIM was considered a demonstration of a "cool AI-like feature"
for interactive development environments.

-- 
Barry Margolin, ··············@level3.com
Genuity Managed Services, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Kent M Pitman
Subject: Re: illegal function call
Date: 
Message-ID: <sfw4r5r5tt8.fsf@shell01.TheWorld.com>
Barry Margolin <··············@level3.com> writes:

I went back and read the part of the thread that introduced DWIM and am
still not sure why it came in as relevant at all, so I can't figure out
if this is off topic.

> Don't forget that Lisp was heavily oriented towards AI at the time.  My
> guess is DWIM was considered a demonstration of a "cool AI-like feature"
> for interactive development environments.

I'm sure this must be so.  

In addition, though, I came later to thin of DWIM as the key earmark
of a cultural preference for catering to end-users instead of
implementors.  You saw this in more subtle ways in their early
emphasis on window system capabilities and other stuff that at the
time seemed more like eye-candy than "stuff that did something
interesting".  When Interlisp went away, we lost a lot of the heavy
investment the Lisp community had in graphics, browsers, etc. and it
took a while for that to come back.  Likewise, DWIM seemed not at all
necessary to the careful coder, but was very focused on empowering the
end-user without requiring that user to constantly go back and edit
code before starting over.  In that sense not just a demonstration of
a technology, but of a political preference (bias toward end-user),
something CL might be argued to have actually moved away from, leaving
it as an exercise to vendors and/or layered standards.  DWIM sort of
said "the end justifies the means" while the other political camp said
"the end must be constructed in a somewhat more principled way".  I
suppose this debate continues in computer science.  Some houses of
cards continue to be stacked pretty high.
From: Thomas F. Burdick
Subject: Re: illegal function call
Date: 
Message-ID: <xcv7kan47ov.fsf@apocalypse.OCF.Berkeley.EDU>
Kent M Pitman <······@world.std.com> writes:

> Barry Margolin <··············@level3.com> writes:
> 
> I went back and read the part of the thread that introduced DWIM and am
> still not sure why it came in as relevant at all, so I can't figure out
> if this is off topic.

I think he was suggesting that rewriting calls to C*R into code that
could actually be run [eg, (cdddddr x) => (cdr (cdr (cdr (cdr (cdr x)))))]
would have been a good job for DWIM?

> Likewise, DWIM seemed not at all necessary to the careful coder, but
> was very focused on empowering the end-user without requiring that
> user to constantly go back and edit code before starting over.  In
> that sense not just a demonstration of a technology, but of a
> political preference (bias toward end-user), something CL might be
> argued to have actually moved away from, leaving it as an exercise
> to vendors and/or layered standards.

Inspired by having read an Interlisp manual, I wrote a simple
DWIM-like mechanism that I used to make a repl that could be used as a
command shell for a particular application.  Its end users are
nontechnical people, but they use the application enough that a
large-ish learning curve was okay.  It was definately a success.  If
the language had already had DWIM, this would have been much easier,
and the resulting product would probably be better, because I would
have spent more time customizing DWIM rather than faking it.

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: Gorbag
Subject: Re: illegal function call
Date: 
Message-ID: <BAA649CA.1C64%gorbagNOSPAM@NOSPAMmac.com>
On 3/25/03 1:49 AM, in article
··················@newssvr19.news.prodigy.com, "Steven M. Haflich"
<·················@alum.mit.edu> wrote:

> Barry Margolin wrote:
> 
>>> I used to have a patch for Maclisp that ran in the undefined function
>>> handler
>>> that would cause these to come into effect (compiled and all, even though
>>> there was not a runtime-accessible compiler in Maclisp).
>> 
>> This also seems like one of those things that Interlisp's DWIM might have
>> done automatically.
> 
> To that nonsense I can only repond with one word:
> 
> MAPCADDDDADAADADDAADADDR
> 
> Have we -- despite being Lisp programmers -- learned _nothing_ about
> healthy programming over the past 43 years?  Orthogonality of language
> constructs is a good thing, _except_ when combined with DWIM, because
> computers are never as smart as you are.
> 
> Sheeesh.
> 

There's a large difference in HCI depending on just who represents the "H".