Erik Naggum <erik@naggum.net> wrote:
+---------------
| (apply #'concatenate 'string (mapcar #'string list))
|
| If you have a Scheme background (where apply takes two arguments),
| you could have consed 'string onto the list of arguments, too.
+---------------
Erik, just as Lisp has evolved beyond the outdated concepts of
"interpreter/slow/etc." and Common Lisp has evolved beyond CLtL1,
Scheme too has made *some* progress over its life, and in fact has
had multi-arg "apply" since at least 1986 with the release of R3RS.
Granted, in R3RS and R4RS the two-arg form was called an "essential
procedure" and the multi-arg form was just a "procedure", but by the
time of the IEEE Scheme Standard in 1991 (and in R5RS today), this
distinction had vanished:
(apply proc arg1 ... args)
Proc must be a procedure and args must be a list. Calls proc
with the elements of the list (append (list arg1 ...) args)
as the actual arguments.
For example:
> (apply vector 1 2 3 '(4 5 6))
#(1 2 3 4 5 6)
> (apply string-append (map string '(#\a #\c #\e) '(#\b #\d #\f)))
"abcdef"
>
-Rob
-----
Rob Warnock, 31-2-510 rpw3@sgi.com
Network Engineering http://reality.sgi.com/rpw3/
Silicon Graphics, Inc. Phone: 650-933-1673
1600 Amphitheatre Pkwy. PP-ASEL-IA
Mountain View, CA 94043