Re: FLET vs LABELS

From: Alex Mizrahi (udodenko_at_hotmail.com)
Date: 01/15/05


Date: Sat, 15 Jan 2005 01:24:46 +0200


(message (Hello 'David)
(you :wrote :on '(14 Jan 2005 17:21:50 -0500))
(

 DS> FLET and LABELS are both special operators. They both do the same
 DS> thing except that, "labels is equivalent to flet except that the scope
 DS> of the defined function names for labels encompasses the function
 DS> definitions themselves as well as the body."

 DS> So why would FLET be used in preference to LABELS?

you cannot do stuff like

(flet ((+ (x y) (print (+ x y)))) (+ 3 4))

with labels.
there are situations when you really need to access outer function
definition, however i don't think they are very frequent.

)
(With-best-regards '(Alex Mizrahi) :aka 'killer_storm)
(prin1 "People, who lust for the Feel of keys on their fingertips (c)
Inity"))



Relevant Pages

  • FLET vs LABELS
    ... FLET and LABELS are both special operators. ... "labels is equivalent to flet except that the scope ...
    (comp.lang.lisp)
  • Re: FLET vs LABELS
    ... "Alex Mizrahi" writes: ... > DS> FLET and LABELS are both special operators. ... > DS> So why would FLET be used in preference to LABELS? ...
    (comp.lang.lisp)
  • Re: how to define a local function
    ... In a non-recursive definition, ... over labels? ... What FLET buys you is that even if a function X has a body which calls ... to be on the lookout for recursion, ...
    (comp.lang.lisp)
  • Re: how to define a local function
    ... them to be on the lookout for recursion, FLET means it isn't. ... Sorry for being picky, but it doesn't have to be recursion. ... Does anyone remember the historical reason for why _labels_ ...
    (comp.lang.lisp)
  • Re: FLET vs LABELS
    ... > FLET and LABELS are both special operators. ... -- because its name is outside its scope. ...
    (comp.lang.lisp)