Quelqu'un peut-il me rappeler ce que signifie la notation #' ?
J'ai chercher la notation #' dans les 868 page du « GNU Emacs Lisp
Reference Manual » sans rien trouver.
Par exemple, on trouve dans pas mal de code la notation #'(lambda et
il me semble bien que le #' ne sert à rien dans ce cas.
Quelqu'un peut-il me rappeler ce que signifie la notation #' ?
J'ai chercher la notation #' dans les 868 page du « GNU Emacs Lisp
Reference Manual » sans rien trouver.
Par exemple, on trouve dans pas mal de code la notation #'(lambda et
il me semble bien que le #' ne sert à rien dans ce cas.
Quelqu'un peut-il me rappeler ce que signifie la notation #' ?
J'ai chercher la notation #' dans les 868 page du « GNU Emacs Lisp
Reference Manual » sans rien trouver.
Par exemple, on trouve dans pas mal de code la notation #'(lambda et
il me semble bien que le #' ne sert à rien dans ce cas.
* Ph. Ivaldi in fr.comp.applications.emacs:Quelqu'un peut-il me rappeler ce que signifie la notation #' ?
J'ai chercher la notation #' dans les 868 page du « GNU Emacs Lisp
Reference Manual » sans rien trouver.
Elle est expliquée dans ce paragraphe :
http://www.gnu.org/software/emacs/manual/html_mono/elisp.html#Anonymous-Functions
* Ph. Ivaldi <invalid@dev.null> in fr.comp.applications.emacs:
Quelqu'un peut-il me rappeler ce que signifie la notation #' ?
J'ai chercher la notation #' dans les 868 page du « GNU Emacs Lisp
Reference Manual » sans rien trouver.
Elle est expliquée dans ce paragraphe :
http://www.gnu.org/software/emacs/manual/html_mono/elisp.html#Anonymous-Functions
* Ph. Ivaldi in fr.comp.applications.emacs:Quelqu'un peut-il me rappeler ce que signifie la notation #' ?
J'ai chercher la notation #' dans les 868 page du « GNU Emacs Lisp
Reference Manual » sans rien trouver.
Elle est expliquée dans ce paragraphe :
http://www.gnu.org/software/emacs/manual/html_mono/elisp.html#Anonymous-Functions
Il est quand m¨ºme ¨¦tonnant que des programmeurs tr¨¨s comp ¨¦tents
¨¦crivent #'(lambda¡).
Il est quand m¨ºme ¨¦tonnant que des programmeurs tr¨¨s comp ¨¦tents
¨¦crivent #'(lambda¡).
Il est quand m¨ºme ¨¦tonnant que des programmeurs tr¨¨s comp ¨¦tents
¨¦crivent #'(lambda¡).
Voici quelques liens pour approfondir la question :
[…]
#'(lambda ...) => bien, mais compliqué
'(lambda ...) => mal
(lambda ...) => bien et simple.
Voici quelques liens pour approfondir la question :
[…]
#'(lambda ...) => bien, mais compliqué
'(lambda ...) => mal
(lambda ...) => bien et simple.
Voici quelques liens pour approfondir la question :
[…]
#'(lambda ...) => bien, mais compliqué
'(lambda ...) => mal
(lambda ...) => bien et simple.
Le 23 février 2010, Damien Wyart écrivit :Voici quelques liens pour approfondir la question :
[…]
Voici ce que j'en ai rapidement extraits/compris.
http://www.emacswiki.org/emacs/QuotedLambda :
So the moral of the story seems to be: Use (lambda …) or #’(lambda …)
for fastest possible byte-compiled lambda expressions, but avoid
’(lambda …).
http://groups.google.fr/group/fr.comp.applications.emacs/browse_thread/thread/68adc05bdf1b5c5/ :#'(lambda ...) => bien, mais compliqué
'(lambda ...) => mal
(lambda ...) => bien et simple.
Oui. Mais '(lambda ...) n'est pas forcément mal. Ça dépend de ce
qu'on veut faire.
'(lambda (x) (+ 3 x)) est une list (facile à modifier)
#'(lambda (x) (+ 3 x)) est une function
http://groups.google.fr/group/comp.lang.lisp/browse_thread/thread/1e8797055c4e1c45/ :
(lambda…) ne sait pas toujours développé en (function (lambda…)), donc
historiquement on utilise #'(lambda…)
« #'(lambda ...) it is the same as (function (lambda ...)) » sauf que
« ((lambda (x) (+ x 5)) 10) => 15
((function (lambda (x) (+ x 5))) 10) => illegal function call error »
Là ça semble important mais je ne comprends strictement rien, à part que
j'ai intérêt à m'en souvenir :D
8<------8<------8<------8<------8<------8<------8<------8<------
The former is a macro which expands into the latter. The latter
includes the #' _reader macro_ that expands to (function (lambda (x)
(+ 3 x))). FUNCTION is a special form. Once you've grokked how this
can work when it seems 'obvious' that the second form recursively
expands itself, you'll understand a great bit more about CL's
evaluation model.
This is also one of the most FAQs in c.l.l, so try the archives next
time first. :)
8<------8<------8<------8<------8<------8<------8<------8<------
http://www.gigamonkeys.com/book/functions.html (la note 13, tout en bas
de la page):
In other words, it's pure syntactic sugar. Most folks either always use
#' before LAMBDA expressions in value positions or never do. In this
book, I always use #'.
Mais d'un point de vue logique (funcall (lambda (...) ...)) et incorrect.
« the symbol LAMBDA was a special syntactic construct that Lisp
recognized as a kind of function name.
(funcall (lambda (...) ...)) would be illegal because FUNCALL is a
function and the normal evaluation rule for a function call would
require that the LAMBDA expression be evaluated »
Autrement dit, pour respecter le standard, (funcall (lambda (...) ...))
devrait d'abord évaluer (lambda…) et donc la syntaxe ne fait plus sens.
Merci pour ces liens,
Le 23 février 2010, Damien Wyart écrivit :
Voici quelques liens pour approfondir la question :
[…]
Voici ce que j'en ai rapidement extraits/compris.
http://www.emacswiki.org/emacs/QuotedLambda :
So the moral of the story seems to be: Use (lambda …) or #’(lambda …)
for fastest possible byte-compiled lambda expressions, but avoid
’(lambda …).
http://groups.google.fr/group/fr.comp.applications.emacs/browse_thread/thread/68adc05bdf1b5c5/ :
#'(lambda ...) => bien, mais compliqué
'(lambda ...) => mal
(lambda ...) => bien et simple.
Oui. Mais '(lambda ...) n'est pas forcément mal. Ça dépend de ce
qu'on veut faire.
'(lambda (x) (+ 3 x)) est une list (facile à modifier)
#'(lambda (x) (+ 3 x)) est une function
http://groups.google.fr/group/comp.lang.lisp/browse_thread/thread/1e8797055c4e1c45/ :
(lambda…) ne sait pas toujours développé en (function (lambda…)), donc
historiquement on utilise #'(lambda…)
« #'(lambda ...) it is the same as (function (lambda ...)) » sauf que
« ((lambda (x) (+ x 5)) 10) => 15
((function (lambda (x) (+ x 5))) 10) => illegal function call error »
Là ça semble important mais je ne comprends strictement rien, à part que
j'ai intérêt à m'en souvenir :D
8<------8<------8<------8<------8<------8<------8<------8<------
The former is a macro which expands into the latter. The latter
includes the #' _reader macro_ that expands to (function (lambda (x)
(+ 3 x))). FUNCTION is a special form. Once you've grokked how this
can work when it seems 'obvious' that the second form recursively
expands itself, you'll understand a great bit more about CL's
evaluation model.
This is also one of the most FAQs in c.l.l, so try the archives next
time first. :)
8<------8<------8<------8<------8<------8<------8<------8<------
http://www.gigamonkeys.com/book/functions.html (la note 13, tout en bas
de la page):
In other words, it's pure syntactic sugar. Most folks either always use
#' before LAMBDA expressions in value positions or never do. In this
book, I always use #'.
Mais d'un point de vue logique (funcall (lambda (...) ...)) et incorrect.
« the symbol LAMBDA was a special syntactic construct that Lisp
recognized as a kind of function name.
(funcall (lambda (...) ...)) would be illegal because FUNCALL is a
function and the normal evaluation rule for a function call would
require that the LAMBDA expression be evaluated »
Autrement dit, pour respecter le standard, (funcall (lambda (...) ...))
devrait d'abord évaluer (lambda…) et donc la syntaxe ne fait plus sens.
Merci pour ces liens,
Le 23 février 2010, Damien Wyart écrivit :Voici quelques liens pour approfondir la question :
[…]
Voici ce que j'en ai rapidement extraits/compris.
http://www.emacswiki.org/emacs/QuotedLambda :
So the moral of the story seems to be: Use (lambda …) or #’(lambda …)
for fastest possible byte-compiled lambda expressions, but avoid
’(lambda …).
http://groups.google.fr/group/fr.comp.applications.emacs/browse_thread/thread/68adc05bdf1b5c5/ :#'(lambda ...) => bien, mais compliqué
'(lambda ...) => mal
(lambda ...) => bien et simple.
Oui. Mais '(lambda ...) n'est pas forcément mal. Ça dépend de ce
qu'on veut faire.
'(lambda (x) (+ 3 x)) est une list (facile à modifier)
#'(lambda (x) (+ 3 x)) est une function
http://groups.google.fr/group/comp.lang.lisp/browse_thread/thread/1e8797055c4e1c45/ :
(lambda…) ne sait pas toujours développé en (function (lambda…)), donc
historiquement on utilise #'(lambda…)
« #'(lambda ...) it is the same as (function (lambda ...)) » sauf que
« ((lambda (x) (+ x 5)) 10) => 15
((function (lambda (x) (+ x 5))) 10) => illegal function call error »
Là ça semble important mais je ne comprends strictement rien, à part que
j'ai intérêt à m'en souvenir :D
8<------8<------8<------8<------8<------8<------8<------8<------
The former is a macro which expands into the latter. The latter
includes the #' _reader macro_ that expands to (function (lambda (x)
(+ 3 x))). FUNCTION is a special form. Once you've grokked how this
can work when it seems 'obvious' that the second form recursively
expands itself, you'll understand a great bit more about CL's
evaluation model.
This is also one of the most FAQs in c.l.l, so try the archives next
time first. :)
8<------8<------8<------8<------8<------8<------8<------8<------
http://www.gigamonkeys.com/book/functions.html (la note 13, tout en bas
de la page):
In other words, it's pure syntactic sugar. Most folks either always use
#' before LAMBDA expressions in value positions or never do. In this
book, I always use #'.
Mais d'un point de vue logique (funcall (lambda (...) ...)) et incorrect.
« the symbol LAMBDA was a special syntactic construct that Lisp
recognized as a kind of function name.
(funcall (lambda (...) ...)) would be illegal because FUNCALL is a
function and the normal evaluation rule for a function call would
require that the LAMBDA expression be evaluated »
Autrement dit, pour respecter le standard, (funcall (lambda (...) ...))
devrait d'abord évaluer (lambda…) et donc la syntaxe ne fait plus sens.
Merci pour ces liens,