bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17623: 24.4.50; incorrect example for `apply-partially' in (elisp) `


From: Stefan Monnier
Subject: bug#17623: 24.4.50; incorrect example for `apply-partially' in (elisp) `Calling Functions'
Date: Sun, 29 Jun 2014 17:46:28 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

> There's nothing wrong per see in the current text, but it sounds as if
> `apply-partially` would somehow analyze the argument list of its first
> argument.  But it's semantic is very simple.

> Say that

>   (apply-partially f arg_1 ... arg_n) 

> is equivalent to

>   (lambda (&rest args) (apply f arg_1 ... arg_n args))

This equivalence is not true either.  E.g.

    (prog1 (apply-partially #'message format)
      (setq format "hello"))

BTW, `apply-partially' is mostly a crutch to have "simple closures" in
a dynamically scoped setting.  In code that uses lexical-binding, it's
generally better to use a straight closure.


        Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]