[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: historical rationale?



Taylor R. Campbell wrote:
I looked, by the way, into some old mail archives, dating back to
1983, and couldn't find any discussion of the rationale for =>.
From MIT AI Memo 452 (RRS), p. 13:

[quote]
This COND is a superset of the MacLISP COND. [...] The extension to the MacLISP COND made in SCHEME is flagged by the atom =>. [...] In this sitation the form /f/ following the => should have as its value a function of one argument; if the predicate /p/ is non-NIL, this function is determined and invoked on the value returne dby the predicate. This is useful for the common sutation encountered in LISP:

   (COND ((SETQ IT (GET X 'PROPERTY)) (HACK IT))
       ...)

which in SCHEME can be rendered without using a variable global to the COND:

   (COND ((GET X 'PROPERTY)
       => (LAMBDA (IT) (HACK IT)))
       ...)

or, in this specific instance, simply as:

   (COND ((GET X 'PROPERTY) => HACK)
       ...)

[end quote]

Steele and Sussman also present a variant of IF called TEST that works similarly.