From: ········@gmail.com
Subject: Trying to learn Common Lisp
Date: 
Message-ID: <1189665140.187440.201070@y42g2000hsy.googlegroups.com>
Hello all,

I'm currently fairly familiar with newLISP, and yes, I know that most
Lispers think it sucks, and now I'm coming to see its faults. So, I'm
trying to learn Common Lisp.

However, there are some things I just can't figure out. Most of these
are "what the fuck were the designers thinking?"

First, when using mapcar, why should I have to "quote" functions?

(mapcar #'+ '(1 2 3) '(4 5 6))

Second, why is it called mapcar? Every other Lisp I've looked at calls
this function map.

Maybe I should learn a different Lisp instead. Is there a Lisp as
powerful as Common Lisp, but as beautiful and elegant as Scheme?

From: Tim Bradshaw
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <1189676027.141846.322310@22g2000hsm.googlegroups.com>
On Sep 13, 7:32 am, ········@gmail.com wrote:

>
> Second, why is it called mapcar? Every other Lisp I've looked at calls
> this function map.

It's called MAPCAR because pretty much every other existing Lisp
called it MAPCAR too, and the CL designers wanted to cause minimal
upheaval to the millions of existing lines of code.

Which other Lisp's have you looked at, exactly?

--tim
From: Tim Bradshaw
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <1189678211.306611.241780@d55g2000hsg.googlegroups.com>
On Sep 13, 10:33 am, Tim Bradshaw <··········@tfeb.org> wrote:

>
> Which other Lisp's have you looked at, exactly?
              ^^^^^^

Now I will have to saw my fingers off.
From: Barry Margolin
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <barmar-17ECA1.21240813092007@comcast.dca.giganews.com>
In article <························@22g2000hsm.googlegroups.com>,
 Tim Bradshaw <··········@tfeb.org> wrote:

> On Sep 13, 7:32 am, ········@gmail.com wrote:
> 
> >
> > Second, why is it called mapcar? Every other Lisp I've looked at calls
> > this function map.
> 
> It's called MAPCAR because pretty much every other existing Lisp
> called it MAPCAR too, and the CL designers wanted to cause minimal
> upheaval to the millions of existing lines of code.

Which begs the question: why did those earlier Lisps call it MAPCAR?

I think earlier Lisps had a function called MAP.  So when new mapping 
functions were added to the language, they were given different names: 
MAPC, MAPCAR, MAPCAN, MAPCON.

By the time of Maclisp (the primary inspiration for CL) I think MAP had 
disappeared, but renaming one of the new functions would have caused 
compatibility problems.  CL introduced a new MAP function, since the 
name was then available.

-- 
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
From: Rob Warnock
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <DJ6dnfI-v7C5m3fbnZ2dnUVZ_vmlnZ2d@speakeasy.net>
Barry Margolin  <······@alum.mit.edu> wrote:
+---------------
|  Tim Bradshaw <··········@tfeb.org> wrote:
| > > Second, why is it called mapcar? Every other Lisp I've looked at
| > > calls this function map.
| > 
| > It's called MAPCAR because pretty much every other existing Lisp
| > called it MAPCAR too, and the CL designers wanted to cause minimal
| > upheaval to the millions of existing lines of code.
| 
| Which begs the question: why did those earlier Lisps call it MAPCAR?
| 
| I think earlier Lisps had a function called MAP.  So when new mapping 
| functions were added to the language, they were given different names: 
| MAPC, MAPCAR, MAPCAN, MAPCON.
| 
| By the time of Maclisp (the primary inspiration for CL) I think MAP had 
| disappeared...
+---------------

According to <http://pdp-10.trailing-edge.com/mit_emacs_170_teco_1220/
01/info/maclisp-commands.info>, Maclisp still had MAP, but its args
and semantics were those of Common Lisp's MAPL, that is:

- Traversal like MAPLIST
- No accumulation of values; side-effecting only like MAPC
- Returns the first list arg as its value

     > (mapl (lambda (x y z) (print (list x y z)))
	       '(1 2 3 4) '(a b c d e) '(+ - * /)) 

     ((1 2 3 4) (A B C D E) (+ - * /)) 
     ((2 3 4) (B C D E) (- * /)) 
     ((3 4) (C D E) (* /)) 
     ((4) (D E) (/)) 
     (1 2 3 4)
     > 

+---------------
| ...but renaming one of the new functions would have caused 
| compatibility problems.  CL introduced a new MAP function,
| since the name was then available.
+---------------

The above URL says Maclisp had all of MAP, MAPC, MAPCAR, MAPLIST,
MAPCAN, & MAPCON -- all as we know them in CL, except that in CL
MAP got renamed to MAPL and MAP got recycled for the new function.


-Rob

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Kent M Pitman
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <u7imu7xaj.fsf@nhplace.com>
Barry Margolin <······@alum.mit.edu> writes:

> In article <························@22g2000hsm.googlegroups.com>,
>  Tim Bradshaw <··········@tfeb.org> wrote:
> 
> > On Sep 13, 7:32 am, ········@gmail.com wrote:
> > 
> > >
> > > Second, why is it called mapcar? Every other Lisp I've looked at calls
> > > this function map.
> > 
> > It's called MAPCAR because pretty much every other existing Lisp
> > called it MAPCAR too, and the CL designers wanted to cause minimal
> > upheaval to the millions of existing lines of code.
> 
> Which begs the question: why did those earlier Lisps call it MAPCAR?
> 
> I think earlier Lisps had a function called MAP.  So when new mapping 
> functions were added to the language, they were given different names: 
> MAPC, MAPCAR, MAPCAN, MAPCON.

Right.
 
> By the time of Maclisp (the primary inspiration for CL) I think MAP had 
> disappeared, but renaming one of the new functions would have caused 
> compatibility problems.  CL introduced a new MAP function, since the 
> name was then available.

Nope.  (I just checked the MACLISP manual and my personal notes for
MACLISP->CL conversion, so I'm not working from flakey memory on the
technical part of this one.)  MACLISP had MAP.  MACLISP's MAP became
MAPL in CL.

On the other hand, I don't have the design notes handy for early CLTL
(though I think I have a box of such documents in storage).  My guess
is that MAPCAR was so heavily used, that references to it in both code
and literature needed to persist.  I'll bet MACLISP's MAP wasn't used 
nearly as heavily as MAPCAR (how often do CL programmers use MAPL?),
so an incompatible change to that one was acceptable.

And since having two names (MAPCAR and MAP) that both meant the same
thing would hav been awkward, I'm pretty sure MAP was generalized in
order to make it kind of like MAPCAR, as befitting its very generic name,
but enough different to justify leaving MAPCAR in place.
From: Eli Bendersky
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <1189672235.757899.100760@g4g2000hsf.googlegroups.com>
> Maybe I should learn a different Lisp instead. Is there a Lisp as
> powerful as Common Lisp, but as beautiful and elegant as Scheme?

What's wrong with Scheme itself ?

Eli
From: Rainer Joswig
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <joswig-9A8C16.08455013092007@news-europe.giganews.com>
In article <························@y42g2000hsy.googlegroups.com>,
 ········@gmail.com wrote:

> Hello all,
> 
> I'm currently fairly familiar with newLISP, and yes, I know that most
> Lispers think it sucks, and now I'm coming to see its faults. So, I'm
> trying to learn Common Lisp.
> 
> However, there are some things I just can't figure out. Most of these
> are "what the fuck were the designers thinking?"

But you found the Common Lisp Hyperspec already? It explains
the functions in detail.

> First, when using mapcar, why should I have to "quote" functions?

Common Lisp makes a difference between names for functions and
variable names. A symbol has both a value and a function value.
#'+ is a shorthand for (FUNCTION +) . So If you want to pass
the function object as a value, you need to get the function
object from the name.

see the difference:

CL-USER> 42
42                                                                                                                                                   
CL-USER> (list + '+ #'+)
(42 + #<Function + {101AE8F9}>)                                                                                                                      

+ is a variable. '+ is the symbol +. #'+ is the function +.

> 
> (mapcar #'+ '(1 2 3) '(4 5 6))
> 
> Second, why is it called mapcar? Every other Lisp I've looked at calls
> this function map.

MAP is a more general function in CL which works over
sequences (vectors, strings and lists).

(map 'list #'+ '(1 2 3) '(4 5 6))

> Maybe I should learn a different Lisp instead. Is there a Lisp as
> powerful as Common Lisp, but as beautiful and elegant as Scheme?

A language is sum of

* the people
* the language
* the implementations
* an existing body of code, lore, papers, books, presentations
* the infrastructure

If you look at the sum, there is currently nothing close to
Common Lisp.

It is some price to pay to learn Common Lisp and then being
able to use it for the next many years. We are not in a
hurry: 'Teach Yourself Programming in Ten Years'
http://norvig.com/21-days.html

-- 
http://lispm.dyndns.org
From: Jon Harrop
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <13ei09snhblb736@corp.supernews.com>
········@gmail.com wrote:
> First, when using mapcar, why should I have to "quote" functions?
> 
> (mapcar #'+ '(1 2 3) '(4 5 6))
> 
> Second, why is it called mapcar? Every other Lisp I've looked at calls
> this function map.
> 
> Maybe I should learn a different Lisp instead. Is there a Lisp as
> powerful as Common Lisp, but as beautiful and elegant as Scheme?

There are dozens of Lisp derivatives that are variations on a theme. Sounds
like you might prefer to use Scheme itself.

-- 
Dr Jon D Harrop, Flying Frog Consultancy
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists/?usenet
From: Ken Tilton
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <hXbGi.25$Uk3.0@newsfe12.lga>
········@gmail.com wrote:
> Hello all,
> 
> I'm currently fairly familiar with newLISP, and yes, I know that most
> Lispers think it sucks, and now I'm coming to see its faults. So, I'm
> trying to learn Common Lisp.
> 
> However, there are some things I just can't figure out. Most of these
> are "what the fuck were the designers thinking?"
> 
> First, when using mapcar, why should I have to "quote" functions?
> 
> (mapcar #'+ '(1 2 3) '(4 5 6))
> 
> Second, why is it called mapcar? Every other Lisp I've looked at calls
> this function map.
> 
> Maybe I should learn a different Lisp instead. Is there a Lisp as
> powerful as Common Lisp, but as beautiful and elegant as Scheme?
> 

Yes, try Java. Then Smalltalk, then K and C++ and Pl/I and then come back.

kt

-- 
http://www.theoryyalgebra.com/

"We are what we pretend to be." -Kurt Vonnegut
From: Klaus Schilling
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <87y7f9yrel.fsf@web.de>
Ken Tilton <···········@optonline.net> writes:

> ········@gmail.com wrote:
>> Maybe I should learn a different Lisp instead. Is there a Lisp as
>> powerful as Common Lisp, but as beautiful and elegant as Scheme?
>>

Arc and Croma (if they ever get done ...)
>
> Yes, try Java. Then Smalltalk, then K and C++ and Pl/I and then come back.
>

those are not programming languages, but balls and chains to the mind
of creative abstract thinkers

Klaus Schilling
From: Pascal Costanza
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <5l1dhgF60m64U1@mid.individual.net>
Klaus Schilling wrote:
> Ken Tilton <···········@optonline.net> writes:
> 
>> ········@gmail.com wrote:
>>> Maybe I should learn a different Lisp instead. Is there a Lisp as
>>> powerful as Common Lisp, but as beautiful and elegant as Scheme?
>>>
> 
> Arc and Croma (if they ever get done ...)

Since they are not done, you don't know how beautiful or elegant they 
will actually turn out to be.

It's always easy to _imagine_ a clean and powerful Lisp dialect, but 
it's infinitely much harder to get it actually _done_.



Pascal

-- 
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Ken Tilton
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <ugWGi.47$P42.3@newsfe12.lga>
Klaus Schilling wrote:
> Ken Tilton <···········@optonline.net> writes:
> 
> 
>>········@gmail.com wrote:
>>
>>>Maybe I should learn a different Lisp instead. Is there a Lisp as
>>>powerful as Common Lisp, but as beautiful and elegant as Scheme?
>>>
> 
> 
> Arc and Croma (if they ever get done ...)
> 
>>Yes, try Java. Then Smalltalk, then K and C++ and Pl/I and then come back.
>>
> 
> 
> those are not programming languages, but balls and chains to the mind
> of creative abstract thinkers

Oh, ok, I did not realize you were a creative abstract thinker. Try 
Prolog or F#, there is a lot of support for the latter on this NG.

kenny

-- 
http://www.theoryyalgebra.com/

"We are what we pretend to be." -Kurt Vonnegut
From: Damien Kick
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <13flhv2qdtdar03@corp.supernews.com>
Ken Tilton wrote:

> Oh, ok, I did not realize you were a creative abstract thinker. Try 
> Prolog or F#, there is a lot of support for the latter on this NG.

But can you use F# to implement a ray tracer?
From: Ken Tilton
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <VaGKi.743$fT2.421@newsfe12.lga>
Damien Kick wrote:
> Ken Tilton wrote:
> 
>> Oh, ok, I did not realize you were a creative abstract thinker. Try 
>> Prolog or F#, there is a lot of support for the latter on this NG.
> 
> 
> But can you use F# to implement a ray tracer?

yes, Dr. Jon has an implementation in his journal next month, you just 
have to subscribe now and get also a free set of ginsu knives.

ken

-- 
http://www.theoryyalgebra.com/

"We are what we pretend to be." -Kurt Vonnegut
From: Alberto Riva
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <fcbti4$d412$1@usenet.osg.ufl.edu>
········@gmail.com wrote:
> 
> Maybe I should learn a different Lisp instead. Is there a Lisp as
> powerful as Common Lisp, but as beautiful and elegant as Scheme?

Yes, Common Lisp.

--
Alberto
From: Rayiner Hashem
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <1189709967.549563.89120@g4g2000hsf.googlegroups.com>
> First, when using mapcar, why should I have to "quote" functions?
>
> (mapcar #'+ '(1 2 3) '(4 5 6))
>
> Second, why is it called mapcar? Every other Lisp I've looked at calls
> this function map.
>
> Maybe I should learn a different Lisp instead. Is there a Lisp as
> powerful as Common Lisp, but as beautiful and elegant as Scheme?

Others will probably explain the map thing, so I'm not going to bother
with that. What I am going to say is that a lot of the stuff that
seems "unclean" is really quite _internally_ consistent --- it's just
different from what you might be used to in other languages. It really
makes much more sense when you think hard about Lisp's basic rules
(evaluation, naming, etc). Aside from some naming conventions, there
isn't a lot in there that's actually arbitrary or inconsistent.

Consider, for example, how classes are referred to in CLOS. To create
an object, you do:

(make-instance 'foo)

But when you refer to a class in a method specifier, you do:

(defmethod bar ((x foo)) ...)

Why quote "foo" in one place, and not another? It helps to think about
what exactly each thing is (make-instance is a function, defmethod is
a macro), when things need to be evaluated, when the association
between class names and classes needs to be made, etc. When you can
answer questions like this, you'll be much better positioned to figure
out why certain things are the way they are.
From: Klaus Schilling
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <87tzpxyqve.fsf@web.de>
Rayiner Hashem <·······@gmail.com> writes:
>
> Consider, for example, how classes are referred to in CLOS. To create
> an object, you do:
>
> (make-instance 'foo)
>
> But when you refer to a class in a method specifier, you do:
>
> (defmethod bar ((x foo)) ...)
>
> Why quote "foo" in one place, and not another? It helps to think about
> what exactly each thing is (make-instance is a function, defmethod is
> a macro), when things need to be evaluated, when the association
> between class names and classes needs to be made, etc. When you can
> answer questions like this, you'll be much better positioned to figure
> out why certain things are the way they are.

if the class name is only known at runtime, 
which might occur in meta-programming,
may one use eval?

Klaus Schilling
From: Tim Bradshaw
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <1189854881.233262.283340@g4g2000hsf.googlegroups.com>
On Sep 14, 8:43 pm, Klaus Schilling <···············@web.de> wrote:

> if the class name is only known at runtime,
> which might occur in meta-programming,
> may one use eval?

No, you'd use CLOS's functional (not in the FP sense) layer.
From: Thomas A. Russ
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <ymitzpt80u4.fsf@blackcat.isi.edu>
Klaus Schilling <···············@web.de> writes:

> Rayiner Hashem <·······@gmail.com> writes:
> >
> > Consider, for example, how classes are referred to in CLOS. To create
> > an object, you do:
> >
> > (make-instance 'foo)
> >
> > But when you refer to a class in a method specifier, you do:
> >
> > (defmethod bar ((x foo)) ...)
> >
> > Why quote "foo" in one place, and not another? It helps to think about
> > what exactly each thing is (make-instance is a function, defmethod is
> > a macro), when things need to be evaluated, when the association
> > between class names and classes needs to be made, etc. When you can
> > answer questions like this, you'll be much better positioned to figure
> > out why certain things are the way they are.
> 
> if the class name is only known at runtime, 
> which might occur in meta-programming,
> may one use eval?

That is one option.

For methods, there is always ADD-METHOD, and perhaps other items in the
MOP, which is ever more widely supported.

Finally, there may be the option of doing your meta-progamming at
macro-expansion time, and using the macro expansion function to do the
dynamic computation and emit the code.


-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: Rainer Joswig
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <joswig-9A395F.00070318092007@news-europe.giganews.com>
In article <···············@blackcat.isi.edu>,
 ···@sevak.isi.edu (Thomas A. Russ) wrote:

> Klaus Schilling <···············@web.de> writes:
> 
> > Rayiner Hashem <·······@gmail.com> writes:
> > >
> > > Consider, for example, how classes are referred to in CLOS. To create
> > > an object, you do:
> > >
> > > (make-instance 'foo)
> > >
> > > But when you refer to a class in a method specifier, you do:
> > >
> > > (defmethod bar ((x foo)) ...)
> > >
> > > Why quote "foo" in one place, and not another? It helps to think about
> > > what exactly each thing is (make-instance is a function, defmethod is
> > > a macro), when things need to be evaluated, when the association
> > > between class names and classes needs to be made, etc. When you can
> > > answer questions like this, you'll be much better positioned to figure
> > > out why certain things are the way they are.
> > 
> > if the class name is only known at runtime, 
> > which might occur in meta-programming,
> > may one use eval?
> 
> That is one option.
> 
> For methods, there is always ADD-METHOD, and perhaps other items in the
> MOP, which is ever more widely supported.
> 
> Finally, there may be the option of doing your meta-progamming at
> macro-expansion time, and using the macro expansion function to do the
> dynamic computation and emit the code.

It might be even useful to write the method definitions to
a file (PPRINT), compile the file (COMPILE-FILE) and load
(LOAD) the compiled code.
From: Slobodan Blazeski
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <1189717464.742975.150340@57g2000hsv.googlegroups.com>
On Sep 13, 8:32 am, ········@gmail.com wrote:
> Hello all,
>
> I'm currently fairly familiar with newLISP, and yes, I know that most
> Lispers think it sucks, and now I'm coming to see its faults. So, I'm
> trying to learn Common Lisp.
>
> However, there are some things I just can't figure out. Most of these
> are "what the fuck were the designers thinking?"
>
> First, when using mapcar, why should I have to "quote" functions?
>
> (mapcar #'+ '(1 2 3) '(4 5 6))
>
> Second, why is it called mapcar? Every other Lisp I've looked at calls
> this function map.
>
> Maybe I should learn a different Lisp instead. Is there a Lisp as
> powerful as Common Lisp, but as beautiful and elegant as Scheme?

If you don't mind ending up with lisp, that has more designers than
users, single digit community, lack of libraries, lack of quality
compilers, no books, no tutorials, no papers be my guest and than
search google. I'm sure you'll found plenty of vapourware, abandonware
& marginalised lisps that their authors clame they are so great that
other lispers are so stupid & unable to appreciate the power of the
new language.

Else I suggest to stick little more with common lisp you might start
to like it.

cheers
bobi
From: Pascal Costanza
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <5ktqm3F5dpg7U1@mid.individual.net>
········@gmail.com wrote:

> Maybe I should learn a different Lisp instead. Is there a Lisp as
> powerful as Common Lisp, but as beautiful and elegant as Scheme?

EuLisp and Dylan were attempts at that. Dylan even has some reasonably 
active implementations.


Pascal

-- 
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Kent M Pitman
Subject: Re: Trying to learn Common Lisp
Date: 
Message-ID: <uy7faozti.fsf@nhplace.com>
Pascal Costanza <··@p-cos.net> writes:

> ········@gmail.com wrote:
> 
> > Maybe I should learn a different Lisp instead. Is there a Lisp as
> > powerful as Common Lisp, but as beautiful and elegant as Scheme?
> 
> EuLisp and Dylan were attempts at that. Dylan even has some reasonably
> active implementations.

Yes, indeed. Early Dylan, as published by Apple, before it went infix
was really quite elegant and powerful.

It lost my personal interest as it evolved toward C++ and away from
Lisp.  My article about languages as political parties 
( http://www.nhplace.com/kent/PS/Lambda.html ) 
is quite relevant in understanding that phenomenon, even though I
didn't write it with Dylan in particular in mind...  
See, particularly, the subsection titled "A Thought Experiment".