Hi,
I am a returning lisp user, and I am working through the books ANSI
Common Lisp and Paradigms of AI Programming to refresh a little.
Both the books mention a function mappend which doesn't seem to be
available as standard in MCL 4.2. Does anyone have a definition that I
can use? If it had a doc string a la MCL that would be great so that I
could just create a new image with it included.
Please let me know if you have something.
Kindest regards,
Colin
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
MAPPEND is defined in the 'auxfns.lisp' files of Paradigms of AI
Programming. It is defined as:
(defun mappend (fn list)
"Append the results of calling fn on each element of list.
Like mapcon, but uses append instead of nconc."
(apply #'append (mapcar fn list)))
[From http://www.norvig.com/paip/auxfns.lisp]
In their Norvig and Russell's AI, a Modern Approach, it's defined as:
(defun mappend (fn &rest lists)
"Apply fn to respective elements of list(s), and append results."
(reduce #'append (apply #'mapcar fn lists) :from-end t))
[From http://http.cs.berkeley.edu/~russell/code/utilities/utilities.lisp]
······@my-deja.com wrote in message <············@nnrp1.deja.com>...
>Hi,
>
>I am a returning lisp user, and I am working through the books ANSI
>Common Lisp and Paradigms of AI Programming to refresh a little.
>
>Both the books mention a function mappend which doesn't seem to be
>available as standard in MCL 4.2. Does anyone have a definition that I
>can use? If it had a doc string a la MCL that would be great so that I
>could just create a new image with it included.
>
>Please let me know if you have something.
>
>Kindest regards,
>
>Colin
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.
Colin,
I substitute this:
(apply #'append (mapcar ... ))
for:
(mappend ... )
Thanks,
Jeff Sandys
······@my-deja.com wrote:
>
> Hi,
>
> I am a returning lisp user, and I am working through the books ANSI
> Common Lisp and Paradigms of AI Programming to refresh a little.
>
> Both the books mention a function mappend which doesn't seem to be
> available as standard in MCL 4.2. Does anyone have a definition that I
> can use? If it had a doc string a la MCL that would be great so that I
> could just create a new image with it included.
>
> Please let me know if you have something.
>
> Kindest regards,
>
> Colin
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
In article <············@nnrp1.deja.com>,
······@my-deja.com wrote:
> Hi,
>
> I am a returning lisp user, and I am working through the books ANSI
> Common Lisp and Paradigms of AI Programming to refresh a little.
>
> Both the books mention a function mappend which doesn't seem to be
> available as standard in MCL 4.2. Does anyone have a definition that
I
> can use? If it had a doc string a la MCL that would be great so that
I
> could just create a new image with it included.
>
> Please let me know if you have something.
>
> Kindest regards,
>
> Colin
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>
I prefer this definition:
(defun mappend (function &rest lists)
(apply #'append (apply #'mapcar function lists)))
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.