From: Timofei Shatrov
Subject: Re: How can I sort symbols in alphabetical order?
Date: 
Message-ID: <438c58c3.1375310@news.readfreenews.net>
On 29 Nov 2005 04:08:54 -0800, "Kubilay" <···········@gmail.com> tried
to confuse everyone with this message:

>How can I sort symbols in alpahbetical order? I mean:
>
>(my-dear-function '(car) '(window) '(apple)) should return
>
>apple
>car
>window
>
>or something like that. Is there a built-in function?
>
>Thanks in advance.
>

A simple combination of three built-in functions will do the job.

(sort '(car window apple) 
    (lambda (x y) (string< (symbol-name x) (symbol-name y))))

-- 
|a\o/r|,-------------.,---------- Timofei Shatrov aka Grue ------------.
| m"a ||FC AMKAR PERM|| mail: grue at mail.ru  http://grue3.tripod.com |
|  k  ||  PWNZ J00   || Kingdom of Loathing: Grue3 lvl 18 Seal Clubber |
`-----'`-------------'`-------------------------------------------[4*72]

From: Zach Beane
Subject: Re: How can I sort symbols in alphabetical order?
Date: 
Message-ID: <m3mzjnh6oi.fsf@unnamed.xach.com>
····@mail.ru (Timofei Shatrov) writes:

> On 29 Nov 2005 04:08:54 -0800, "Kubilay" <···········@gmail.com> tried
> to confuse everyone with this message:
> 
> >How can I sort symbols in alpahbetical order? I mean:
[snip]
> 
> A simple combination of three built-in functions will do the job.
> 
> (sort '(car window apple) 
>     (lambda (x y) (string< (symbol-name x) (symbol-name y))))
> 

STRING< takes string designators, and symbols are string designators.

   (sort (list 'foo 'bar 'baz) #'string<) => (BAR BAZ FOO)

Zach
From: Zach Beane
Subject: Re: How can I sort symbols in alphabetical order?
Date: 
Message-ID: <m3irubh3ws.fsf@unnamed.xach.com>
"Kubilay" <···········@gmail.com> writes:

> Good Lord! Was it so simple? How did you know the "sort" function? Did
> you already somehow learned it or did you looked at a reference? What
> should I do in such situations? Should I think in plain English and
> after that use "apropos"?
> 
> I cannot always find great people like you to ask ;-)

Although it's not completely accurate any more, I found it helpful to
read Common Lisp, the Language, 2nd Ed, from cover to cover. Even if
not everything sticks perfectly in your mind, the next time you run
into a problem you may think "Oh yeah, I remember something about
this..."

Zach
From: Bulent Murtezaoglu
Subject: Re: How can I sort symbols in alphabetical order?
Date: 
Message-ID: <87r78z8ny6.fsf@p4.internal>
>>>>> "ZB" == Zach Beane <····@xach.com> writes:
[...]
    ZB> Although it's not completely accurate any more, I found it
    ZB> helpful to read Common Lisp, the Language, 2nd Ed, from cover
    ZB> to cover. [...]

I'll second this.  Reading random sections helps too.  I have the physical
book, but printing and comb binding etc. would also work.  It is downladable.
Here's the cliki link: http://www.cliki.net/CLtL2

cheers,

BM
From: Edi Weitz
Subject: Re: How can I sort symbols in alphabetical order?
Date: 
Message-ID: <uk6ersd9r.fsf@agharta.de>
On 29 Nov 2005 06:44:19 -0800, "Kubilay" <···········@gmail.com> wrote:

> Good Lord! Was it so simple? How did you know the "sort" function?
> Did you already somehow learned it or did you looked at a reference?

Oh, you don't know /the/ reference?  Here it is:

  <http://www.lispworks.com/documentation/HyperSpec/Front/index.htm>

Note (we just had this) that this is not a tutorial or something like
that - don't expect to be able to learn CL from this alone - see

  <http://www.lispworks.com/documentation/HyperSpec/Body/01_aa.htm>

> What should I do in such situations? Should I think in plain English
> and after that use "apropos"?

That's a good first step.

Cheers,
Edi.

-- 

Lisp is not dead, it just smells funny.

Real email: (replace (subseq ·········@agharta.de" 5) "edi")