Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Re: mapcar -- map for more than one list

by runrig (Abbot)
on Dec 01, 2001 at 01:48 UTC ( #128755=note: print w/ replies, xml ) Need Help??

in reply to Re: mapcar -- map for more than one list
in thread mapcar -- map for more than one list

Some lisp's have a limited mapcar which can only operate on one list (making it like perl's map), but in other lisp's mapcar will operate on a list of lists, taking the car of each list, making a list from that, and using that as the first argument to the function, then taking the next element of each list, etc., and returning a list of the results. I think Common Lisp has the limited version, I'm not positive. The Lisp's I've used, AutoLISP and UCI LISP (long ago), both would take a list of lists.

And tye's 'mapcaru' ('mapcar', but use the (u)ndefined value for missing elements) was just a different implementation which deals with lists of differing lengths in a different way.

Comment on Re: Re: mapcar -- map for more than one list
Replies are listed 'Best First'.
Re (tilly) 3: mapcar -- map for more than one list
by tilly (Archbishop) on Dec 01, 2001 at 07:51 UTC
    Common Lisp's mapcar can accept lists of lists. However it only iterates as long as all lists have more elements. In other words its handling of unequal lists is to stop rather than trying to continue calling while indicating the missing elements in some way.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://128755]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2015-10-10 13:37 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (257 votes), past polls