[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
New special form suggestion: LET-CONSTANT
Date: Thu, 6 Aug 1987 10:18 EDT
From: SOLEY@xx.lcs.mit.edu
Date: Monday, 3 August 1987 12:07-EDT
From: Barry Margolin <barmar at Think.COM>
...
It seems like a LET-CONSTANT special form, or an &CONSTANT lambda-list
keyword, would be the right thing for this. LET-CONSTANT would be to
DEFPARAMETER what FLET is to DEFUN, and &CONSTANT would be analogous to
&AUX.
Yeah, and how about an &LOGOUT lambda-list keyword, to log out the current
process? Really, although I understand the trivial difference in scope
between LET and &AUX, do we need to continue adding random lambda-list
keywords, which (worse yet) aren't keywords at all?
Oh, wow! I don't mean to make fun of anyone, but you just gave me
a great idea for eliminating LOOP by folding it into LAMBDA.
(JONL, are you listening? That old idea resurfaces in new syntax.)
(defun factorial (n &for j &from 1 &to n &for a &= 1 &then (* a j) &finally (return a)))
A great feature of this is that it defuses the old quibble of
whether or not LOOP "keywords" should be :-keywords by making
them be &-keywords.
We can get declarations in this way, too.
(defun factorial (n &integer n
&for j &from 1 &to n
&for a &= 1 &then (* a j)
&integer j a
&finally (return a)))
Also, let's do for English as for Lisp and replace documentation
strings. What's sauce for the goose is sauce for the gander.
(defun factorial (n &integer n
&for j &from 1 &to n
&for a &= 1 &then (* a j)
&integer j a
&finally (return a))
&documentation &factorial &takes &a &nonnegative
&integer &n &and &returns &the &product &of
&all &positive &integers ¬ &greater
&than &n &.)
&Maybe &I &could &get &to &like &this &language &after &all &.
--Quux