Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between "flet" and "labels" in Common Lisp?

Tags:

common-lisp

Whether or not it is similar as setq and setf? There is no big difference between flet and labels?

Sincerely!

like image 885
z_axis Avatar asked Feb 02 '12 01:02

z_axis


1 Answers

In Common Lisp, both flet and labels make lexical bindings of slightly different sorts:

  • flet is a special form for local function binding. Bindings are not recursive and cannot refer to each other. Each binding contains function name, arguments, and function body.

  • labels is a special form for local function binding. Bindings can be recursive and can refer to each other. Each binding contains function name, arguments, and function body.

In Emacs Lisp, there is a small difference. The labels form is like flet, except that it makes lexical bindings of the function names rather than dynamic bindings.

like image 199
Raymond Hettinger Avatar answered Sep 20 '22 14:09

Raymond Hettinger