From: ············@gmail.com
Subject: Need help on a lisp problem please ....
Date: 
Message-ID: <1184828883.518072.147550@z28g2000prd.googlegroups.com>
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 ?
From: Pascal Bourguignon
Subject: Re: Need help on a lisp problem please ....
Date: 
Message-ID: <87k5sw92kk.fsf@voyager.informatimago.com>
············@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.