Re: Porting Ruby snippet to Lisp
- From: stamant@xxxxxxxx (Rob St. Amant)
- Date: Sat, 17 Mar 2007 08:28:19 -0400
Brian Adkins <lojicdotcomNOSPAM@xxxxxxxxx> writes:
19 (when (setf logged-in-user ???)
20 (setf (gethash :user-id (session x)) (id logged-in-user))
21 (redirect-to-original))))))
In this situation some people like anaphoric macros:
(defmacro awhen (test-form &body body)
`(let ((it ,test-form))
(when it ,@body)))
.. . .
19 (awhen <something that computes a logged-in-user>
20 (setf (gethash :user-id (session x)) (id it))
21 (redirect-to-original x))))))
.
- Follow-Ups:
- Re: Porting Ruby snippet to Lisp
- From: Luís Oliveira
- Re: Porting Ruby snippet to Lisp
- References:
- Porting Ruby snippet to Lisp
- From: Brian Adkins
- Porting Ruby snippet to Lisp
- Prev by Date: Re: Idiomatic lisp - loops
- Next by Date: Re: Porting Ruby snippet to Lisp
- Previous by thread: Re: Porting Ruby snippet to Lisp
- Next by thread: Re: Porting Ruby snippet to Lisp
- Index(es):
Relevant Pages
|