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

*To*: cl-iteration@SU-AI.ARPA*Subject*: LetS*From*: Dick@MC.LCS.MIT.EDU*Date*: Thu, 3 Apr 1986 15:00 EST*Sender*: DICK%OZ.AI.MIT.EDU@XX.LCS.MIT.EDU

A few days ago I sent out a message about LetS. Apparently because it was too long, it did not get through to all of the recipients. I am including a shortened form of the message below. I apologize to all the people who are getting this twice. Dick Waters SHORTENED LETS MESSAGE This message advertises a Common Lisp macro package called LetS (rhymes with lettuce) which it is hoped will become a standard iteration facility in Common Lisp. LetS makes it possible to write a wide class of algorithms which are typically written as loops in a functional style which is similar to expressions written with the Common Lisp sequence functions. LetS supports a number of features which make LetS expressions more expressive than sequence expressions. However, the key feature of LetS is that every LetS expression is automatically transformed into an efficient iterative loop. As a result, unlike sequence expressions, LetS expressions are just as efficient as the traditional loop expressions they replace. Extensive documentation of LetS is in the file "DICK;LETSD >" on the MIT-AI machine. You are invited to read this documentation and make comments on it. I am interested in getting as wide a feedback as possible. If you cannot access the documentation file directly, send me your US mail address and I will mail you a copy. After an initial testing and feedback period, a final version of LetS which runs under all Common Lisps will be created along with formal documentation. This should happen within a couple of months. The following is a couple of examples of using LetS This sums up the positive elements in a vector. (defun sum-pos-vect-lets (v) (Rsum (Tplusp (Evector v)))) Automatic mapping is used for ordinary fns applied to series of values. (defun sum-cube-abs-vect (v) (Rsum (expt (abs (Evector v)) 3))) (sum-cube-abs-vect #(1 -2 3)) => (+ 1 8 27) => 36 New series functions can be defined by using the form defunS. (defunS Rsum (numbers) (declare (series numbers)) (reduceS #'+ 0 numbers)) LetS provides two forms (LetS and LetS*) which are analogous to let and let*. (defun mean-and-deviation (observations) (letS* ((ob (Elist observations)) (num-obs (Rlength ob)) (mean (/ (Rsum ob) num-obs)) (deviation (- (/ (Rsum (expt ob 2)) num-obs) (expt mean 2)))) (list mean deviation)))

- Prev by Date:
**loop** - Next by Date:
**loop** - Previous by thread:
**LetS -- a new loop notation** - Next by thread:
**loop census** - Index(es):