I'm trying to use "let" for functions so I can apply a small function
several times without using defun inside my main function .
Example :
(let (
(fn (lambda (a) (< a 3))
)) (fn 2)) .
Could you please tell me the right way to do this ?
············@gmail.com writes:
> I'm trying to use "let" for functions so I can apply a small function
> several times without using defun inside my main function .
> Example :
> (let (
> (fn (lambda (a) (< a 3))
> )) (fn 2)) .
> Could you please tell me the right way to do this ?
(let ((fn (lambda (a) (< a 3))))
(funcall fn 2))
or most often:
(flet ((fn (a) (< a 3)))
(fn 2))
or use labels instead of flet if it's recursive or use other local
functions of the same form.
--
__Pascal Bourguignon__ http://www.informatimago.com/
THIS IS A 100% MATTER PRODUCT: In the unlikely event that this
merchandise should contact antimatter in any form, a catastrophic
explosion will result.