Subject: Re: Scheme's awful syntax (was Re: prompting a user)
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 1998/01/28
Newsgroups: comp.lang.scheme
Message-ID: <6amdbu$7upu9@fido.asd.sgi.com>

Thant Tessman  <thant@nospam.acm.org> wrote:
+---------------
| Shriram Krishnamurthi wrote:
| > [...]  The key observation for case-lambda is that, most of the 
| > time, what you really want is a set of distinct, but fixed, number 
| > of arguments.  [...]
| 
| Question:  Can anyone think of any uses of functions that take
| a variable number of arguments that *can't* be replaced like this?
+---------------

The first thing I think of is "printf"-like (oops! "format"-like) things,
where the complexity of handling the arbitrary-number-of-args in the called
routine is offset by the convenience of being able to write the call in a
freestyle way, e.g.:

	(define (print . x) (for-each display x) (newline))
	...
	(print "x=" x ", y=" y ", x*y-1=" (- (* x y) 1))

And then of course, there are various ways of approximating Common-Lisp
keyword argument lists, often using quoted symbols, e.g.:

	(define my-blue-box
		(make-instance box
			       'color 'blue
			       'width 5
			       ; depth -- let it default
			       'height (- (box-height my-other-box) 2)))

Note: I'm not saying this is particularly good style, only that it's
another plausible use for variable argument lists. And some may find it
easier to read than, say:

	(define my-blue-box
		(make-instance box
			       `((color blue)
				 (width 5)
				 ; depth -- let it default
				 (height ,(- (box-height my-other-box) 2)))))

[Besides which, whenever I give an example like the latter somebody always
flames me for abusing quasiquotes...]


-Rob

-----
Rob Warnock, 7L-551		rpw3@sgi.com   http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673 [New area code!]
2011 N. Shoreline Blvd.		FAX: 650-933-4392
Mountain View, CA  94043	PP-ASEL-IA