From: Lars Rune Nøstdal
Subject: Re: getting list of keys
Date: 
Message-ID: <1230664085.30458.4.camel@blackbox.nostdal.org>
On Tue, 2008-12-30 at 11:00 -0800, ·········@gmail.com wrote:
> Hi all, I'm new on Common Lisp programming.
> 
> I'm reading Practical Common Lisp of Peter Seibel. I want to implement
> an `update' function for the mp3 database.
> I need a function for doing something like this with a list:
> 
> * (xxxx (list :artist "something" :song "sss"))
> => (:artist :song)
> 
> Thanks in advance, and sorry for my bad english.
> --
> Pablo.

CL-USER> (loop :for (x y) :on (list :artist "something" :song "sss") :by #'cddr
            :collect x)
(:ARTIST :SONG)

From: ·········@gmail.com
Subject: Re: getting list of keys
Date: 
Message-ID: <69a5b5b1-7342-45f7-9e78-30ca1c9efd62@i20g2000prf.googlegroups.com>
On Dec 30, 5:08 pm, Lars Rune Nøstdal <···········@gmail.com> wrote:
> On Tue, 2008-12-30 at 11:00 -0800, ·········@gmail.com wrote:
> > Hi all, I'm new on Common Lisp programming.
>
> > I'm reading Practical Common Lisp of Peter Seibel. I want to implement
> > an `update' function for the mp3 database.
> > I need a function for doing something like this with a list:
>
> > * (xxxx (list :artist "something" :song "sss"))
> > => (:artist :song)
>
> > Thanks in advance, and sorry for my bad english.
> > --
> > Pablo.
>
> CL-USER> (loop :for (x y) :on (list :artist "something" :song "sss") :by #'cddr
>             :collect x)
> (:ARTIST :SONG)

Thank you.
From: ·········@yahoo.com
Subject: Re: getting list of keys
Date: 
Message-ID: <932471c6-7eaa-4370-a023-08ece0fc068b@i20g2000prf.googlegroups.com>
On Dec 30, 1:08 pm, Lars Rune Nøstdal <···········@gmail.com> wrote:
> On Tue, 2008-12-30 at 11:00 -0800, ·········@gmail.com wrote:
> > Hi all, I'm new on Common Lisp programming.
>
> > I'm reading Practical Common Lisp of Peter Seibel. I want to implement
> > an `update' function for the mp3 database.
> > I need a function for doing something like this with a list:
>
> > * (xxxx (list :artist "something" :song "sss"))
> > => (:artist :song)
>
> > Thanks in advance, and sorry for my bad english.
> > --
> > Pablo.
>
> CL-USER> (loop :for (x y) :on (list :artist "something" :song "sss") :by #'cddr
>             :collect x)
> (:ARTIST :SONG)

"We don't need no stinkin' loops!"

Ruby:

f=nil; [:artist, "something", :song, "sss"].partition{f=!f}[0]
    ==>[:artist, :song]
[:artist, "something", :song, "sss"].select{|x| x.class==Symbol}
    ==>[:artist, :song]
From: Kenneth Tilton
Subject: Re: getting list of keys
Date: 
Message-ID: <495a9f52$0$14289$607ed4bc@cv.net>
·········@yahoo.com wrote:
> On Dec 30, 1:08 pm, Lars Rune N�stdal <···········@gmail.com> wrote:
>> On Tue, 2008-12-30 at 11:00 -0800, ·········@gmail.com wrote:
>>> Hi all, I'm new on Common Lisp programming.
>>> I'm reading Practical Common Lisp of Peter Seibel. I want to implement
>>> an `update' function for the mp3 database.
>>> I need a function for doing something like this with a list:
>>> * (xxxx (list :artist "something" :song "sss"))
>>> => (:artist :song)
>>> Thanks in advance, and sorry for my bad english.
>>> --
>>> Pablo.
>> CL-USER> (loop :for (x y) :on (list :artist "something" :song "sss") :by #'cddr
>>             :collect x)
>> (:ARTIST :SONG)
> 
> "We don't need no stinkin' loops!"
> 
> Ruby:
> 
> f=nil; [:artist, "something", :song, "sss"].partition{f=!f}[0]
>     ==>[:artist, :song]

f=!f? Truly obscure, and I have not seen so much punctuation since an 
irate Opus cursed out another denizen of Bloom County.

> [:artist, "something", :song, "sss"].select{|x| x.class==Symbol}
>     ==>[:artist, :song]

I think you just changed the spec, but can't you do something at once 
cleaner and more intelligible such as:

    (remove-if-not 'keywordp stuff)

?
From: Lars Rune Nøstdal
Subject: Re: getting list of keys
Date: 
Message-ID: <1230672959.30458.9.camel@blackbox.nostdal.org>
On Tue, 2008-12-30 at 12:18 -0800, ·········@yahoo.com wrote:
> On Dec 30, 1:08 pm, Lars Rune Nøstdal <···········@gmail.com> wrote:
> > On Tue, 2008-12-30 at 11:00 -0800, ·········@gmail.com wrote:
> > > Hi all, I'm new on Common Lisp programming.
> >
> > > I'm reading Practical Common Lisp of Peter Seibel. I want to implement
> > > an `update' function for the mp3 database.
> > > I need a function for doing something like this with a list:
> >
> > > * (xxxx (list :artist "something" :song "sss"))
> > > => (:artist :song)
> >
> > > Thanks in advance, and sorry for my bad english.
> > > --
> > > Pablo.
> >
> > CL-USER> (loop :for (x y) :on (list :artist "something" :song "sss") :by #'cddr
> >             :collect x)
> > (:ARTIST :SONG)
> 
> "We don't need no stinkin' loops!"
> 
> Ruby:
> 
> f=nil; [:artist, "something", :song, "sss"].partition{f=!f}[0]
>     ==>[:artist, :song]
> [:artist, "something", :song, "sss"].select{|x| x.class==Symbol}
>     ==>[:artist, :song]


If I where to respond to this post of yours on a non-meta level
explaining "insert whatever I'd explain here" would you respond in turn,
or do you just post to post some random shit?
From: Lars Rune Nøstdal
Subject: Re: getting list of keys
Date: 
Message-ID: <1230673649.30458.18.camel@blackbox.nostdal.org>
On Tue, 2008-12-30 at 12:18 -0800, ·········@yahoo.com wrote:
> On Dec 30, 1:08 pm, Lars Rune Nøstdal <···········@gmail.com> wrote:
> > On Tue, 2008-12-30 at 11:00 -0800, ·········@gmail.com wrote:
> > > Hi all, I'm new on Common Lisp programming.
> >
> > > I'm reading Practical Common Lisp of Peter Seibel. I want to implement
> > > an `update' function for the mp3 database.
> > > I need a function for doing something like this with a list:
> >
> > > * (xxxx (list :artist "something" :song "sss"))
> > > => (:artist :song)
> >
> > > Thanks in advance, and sorry for my bad english.
> > > --
> > > Pablo.
> >
> > CL-USER> (loop :for (x y) :on (list :artist "something" :song "sss") :by #'cddr
> >             :collect x)
> > (:ARTIST :SONG)
> 
> "We don't need no stinkin' loops!"
> 
> Ruby:
> 
> f=nil; [:artist, "something", :song, "sss"].partition{f=!f}[0]
>     ==>[:artist, :song]
> [:artist, "something", :song, "sss"].select{|x| x.class==Symbol}
>     ==>[:artist, :song]

..or..

If I where to respond to this post of yours asking you to "please not
post off topic stuff" would you respond in turn, or do you just post to
post some random shit?

If I where to respond to this post of your asking you to "fuck off and
die" would you respond in turn (and/or blog/bitch/whatever about how
c.l.l. is a "bad place" becase of people "like me" (compared to people
"like you"..)), or do you just post to post some random shit?

..and finally; what do you actually want, and if you got it; what would
you do (next)?
From: Lars Rune Nøstdal
Subject: Re: getting list of keys
Date: 
Message-ID: <1230676640.30458.62.camel@blackbox.nostdal.org>
On Tue, 2008-12-30 at 12:18 -0800, ·········@yahoo.com wrote:
> On Dec 30, 1:08 pm, Lars Rune Nøstdal <···········@gmail.com> wrote:
> > On Tue, 2008-12-30 at 11:00 -0800, ·········@gmail.com wrote:
> > > Hi all, I'm new on Common Lisp programming.
> >
> > > I'm reading Practical Common Lisp of Peter Seibel. I want to implement
> > > an `update' function for the mp3 database.
> > > I need a function for doing something like this with a list:
> >
> > > * (xxxx (list :artist "something" :song "sss"))
> > > => (:artist :song)
> >
> > > Thanks in advance, and sorry for my bad english.
> > > --
> > > Pablo.
> >
> > CL-USER> (loop :for (x y) :on (list :artist "something" :song "sss") :by #'cddr
> >             :collect x)
> > (:ARTIST :SONG)
> 
> "We don't need no stinkin' loops!"
> 
> Ruby:
> 
> f=nil; [:artist, "something", :song, "sss"].partition{f=!f}[0]
>     ==>[:artist, :song]
> [:artist, "something", :song, "sss"].select{|x| x.class==Symbol}
>     ==>[:artist, :song]


PS: Ruby looks like, _and_ _is_, shit; just to be clear about that.
However, you do not care about small "details" like that (this is ofc.
part of the reason why you're here on a Lisp forum posting Ruby) so you
_will not_ respond to this either.
From: André Thieme
Subject: Re: getting list of keys
Date: 
Message-ID: <gjelsb$glu$1@news.motzarella.org>
·········@yahoo.com schrieb:

> Ruby:
> 
> f=nil; [:artist, "something", :song, "sss"].partition{f=!f}[0]
>     ==>[:artist, :song]
> [:artist, "something", :song, "sss"].select{|x| x.class==Symbol}
>     ==>[:artist, :song]

In Clojure:
(keys {:artist "something", :song "sss"}) ==> (:artist :song)

Yes, I know, Ruby also would have allowed you to say
{ "artist" => "something", "song" => "sss" }.keys ==> ["artist", "song"]

This would be more idiomatic. Also in CL one would not use a list
structure as Peter Seibel did, whose purpose was solely to give an idea
how Lisp works. It wasn't meant to outdate Oracles DB system.

But as you see, there is nothing about the Lisp language family that
somehow forbids to express things like that as concise as Ruby.
At the same time Clojure runs a good bit faster for typical tasks
and is much more flexible, as it supports Code=Data ==> macros.
Also it comes with a STM and MVCC, is functional and is (alongside
Erlang and Haskell) more or less the only language that makes
Multithreading nearly trivial and can use modern multicore machines
to the fullest.

Sorry, but in that regard... Ruby is outdated.


Andr�
-- 
Lisp is not dead. It�s just the URL that has changed:
http://clojure.org/
From: William James
Subject: Re: getting list of keys
Date: 
Message-ID: <gnqgng01ts1@enews2.newsguy.com>
Lars Rune N�stdal wrote:

> On Tue, 2008-12-30 at 11:00 -0800, ·········@gmail.com wrote:
> > Hi all, I'm new on Common Lisp programming.
> > 
> > I'm reading Practical Common Lisp of Peter Seibel. I want to
> > implement an `update' function for the mp3 database.
> > I need a function for doing something like this with a list:
> > 
> > * (xxxx (list :artist "something" :song "sss"))
> > => (:artist :song)
> > 
> > Thanks in advance, and sorry for my bad english.
> > --
> > Pablo.
> 
> CL-USER> (loop :for (x y) :on (list :artist "something" :song "sss")
> :by #'cddr             :collect x)
> (:ARTIST :SONG)

Clojure:

user=> (take-nth 2 (list :artist "something" :song "sss"))
(:artist :song)
user=> (take-nth 3 (list 3 4 5 6 7 8 9 ))
(3 6 9)
From: Marco Antoniotti
Subject: Re: getting list of keys
Date: 
Message-ID: <18a626ac-27ce-4f05-960e-d3c2efb97dd4@h20g2000yqn.googlegroups.com>
On Feb 22, 4:27 am, "William James" <·········@yahoo.com> wrote:
> Lars Rune Nøstdal wrote:
> > On Tue, 2008-12-30 at 11:00 -0800, ·········@gmail.com wrote:
> > > Hi all, I'm new on Common Lisp programming.
>
> > > I'm reading Practical Common Lisp of Peter Seibel. I want to
> > > implement an `update' function for the mp3 database.
> > > I need a function for doing something like this with a list:
>
> > > * (xxxx (list :artist "something" :song "sss"))
> > > => (:artist :song)
>
> > > Thanks in advance, and sorry for my bad english.
> > > --
> > > Pablo.
>
> > CL-USER> (loop :for (x y) :on (list :artist "something" :song "sss")
> > :by #'cddr             :collect x)
> > (:ARTIST :SONG)
>
> Clojure:
>
> user=> (take-nth 2 (list :artist "something" :song "sss"))
> (:artist :song)
> user=> (take-nth 3 (list 3 4 5 6 7 8 9 ))
> (3 6 9)

cl-prompt> (take-nth 3 #(3 4 5 6 7 8 9 ))
#(3 6 9)

cl-prompt> (take-nth 3 (list 3 4 5 6 7 8 9 ))
(3 6 9)

Cheers
--
Marco