Subject: Re: Why Scheme?
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 1999/11/20
Newsgroups: comp.lang.scheme
Message-ID: <8175pp$2pvqo@fido.engr.sgi.com>
Antonio Leitao  <aml@gia.ist.utl.pt> wrote:
+---------------
| I don't know the Scheme limits but, in CommonLisp, there's a limit on
| the number of arguments that a function must accept.  From CLTL2, the
| minimum acceptable is 50 (I don't have here the ANSI spec).
...
| OTOH, we can use fold (from SRFI1) to achieve the same effect:
| (define (mysum nums) (fold + 0 nums))
+---------------

On the third hand[*], Common Lisp has "reduce", which does the same thing
as "fold" -- except "reduce" has more optional knobs you can turn for the
edge cases. In the case above, though, it's even simpler than "fold":

	(reduce #'+ nums)

or, if you insist on providing an initial result value (even though one
isn't needed in this case):

	(reduce #'+ nums :initial-value 0)


-Rob

[*] Tip o' the hat to Larry Niven & Jerry Pournelle

-----
Rob Warnock, 8L-846		rpw3@sgi.com
Applied Networking		http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673
1600 Amphitheatre Pkwy.		FAX: 650-933-0511
Mountain View, CA  94043	PP-ASEL-IA