Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.lisp
Re: setf'able?
William James
1/22/2016 8:52:00 AM
Pierre Mai wrote:
> (defmacro for-each* (bindings &body body)
> "FOR-EACH* ({(Var Sequence)}+) Declaration* Form*
> Loops over body with the symbols `var' bound to each element of the
> corresponding sequences. The variables are bound in parallel.
> Returns nil."
> (loop for (var seq) in bindings
> collect var into var-list
> collect seq into seq-list
> finally
> (return
> `(map nil (function (lambda (,@var-list) ,@body)) ,@seq-list))))
>
> #|
> ;;; Examples:
>
> * (for-each (x (list 'a 'b 'c)) (print x))
> A
> B
> C
> NIL
> * (for-each* ((x (list 1 2 3)) (y (vector 3 2 1))) (print (+ x y)))
> 4
> 4
> 4
> NIL
MatzLisp (Ruby):
[1,2,3].zip([3,2,1]){|x,y| p x+y}
4
4
4
--
[A]n unholy alliance of leftists, capitalists, and Zionist supremacists has
schemed to promote immigration and miscegenation with the deliberate aim of
breeding us out of existence in our own homelands.... [T]he real aim stays the
same: the biggest genocide in human history.... --- Nick Griffin
(
https://www.youtube.com/watch?v=K...
)
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: setf'able?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password