[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

Re: novice: mapcan use?

William James

9/3/2015 7:29:00 PM

Pascal Costanza wrote:

> >>Do you understand what nreconc is there for? Have you ever used it?
> >
> > Here's an example:
> >
> > <http://groups.google.com/group/comp.lang.lisp/msg/2520fe9bc7...
>
> Yes, I am aware of that example, but I find it too obfuscated. I prefer
> this:
>
> (loop for (key value) on plist by #'cddr
> unless (member key keys-to-be-removed)
> nconc (list key value))

Gauche Scheme:

(concatenate
(remove (^x (member (car x) keys-to-be-removed)) (slices plist 2)))


MatzLisp (Ruby):

plist.each_slice(2).reject{|k,v| keys_to_be_removed.include? k}.flatten

--
The fact that I have no remedy for all the sorrows of the
world is no reason for my accepting yours. It simply
supports the strong probability that yours is a fake.
--- H. L. Mencken