[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Closures - do you understand them well?
From: |
Tassilo Horn |
Subject: |
Re: Closures - do you understand them well? |
Date: |
Sun, 11 Dec 2022 10:13:28 +0100 |
User-agent: |
mu4e 1.9.4; emacs 30.0.50 |
Michael Heerdegen <michael_heerdegen@web.de> writes:
>> Where's the difference to
>> this inlined version which returns (101 ... 101)?
>>
>> (let ((i 0) (funs))
>> (while (<= (cl-incf i) 100)
>> (push (lambda (&rest args2)
>> (apply #'identity (append (list i) args2)))
>> funs))
>> (mapcar #'funcall (nreverse funs)))
>
> Well - `apply-partially' is a function and I use a simple function call,
> so it is precisely not just something inlined: The important point is
> that only the _value_ of the variable i passed, not the variable or
> a reference to it:
>
> #+begin_src emacs-lisp
> (let ((i 27))
> (apply-partially #'identity i))
> ==>
> (closure
> ((args . (27))
> (fun . identity))
> (&rest args2)
> (apply fun (append args args2)))
> #+end_src
Thanks, that explains it.
Bye,
Tassilo
- Re: Closures - do you understand them well?, (continued)
- Re: Closures - do you understand them well?, Emanuel Berg, 2022/12/10
- Re: Closures - do you understand them well?, Michael Heerdegen, 2022/12/09
- Re: Closures - do you understand them well?, Tassilo Horn, 2022/12/10
- Re: Closures - do you understand them well?, Emanuel Berg, 2022/12/10
- Mutation - do you understand it really? (was: Closures - do you understand them well?), Stefan Monnier, 2022/12/10
- Re: Mutation - do you understand it really?, Michael Heerdegen, 2022/12/10
- Re: Closures - do you understand them well?, Michael Heerdegen, 2022/12/10
- Re: Closures - do you understand them well?,
Tassilo Horn <=
- Re: Closures - do you understand them well?, Emanuel Berg, 2022/12/10
- RE: [External] : Re: Closures - do you understand them well?, Drew Adams, 2022/12/10
- Iteration macros (was: [External] : Re: Closures - do you understand them well?), Stefan Monnier, 2022/12/10
- RE: Iteration macros (was: [External] : Re: Closures - do you understand them well?), Drew Adams, 2022/12/10
- Re: [External] : Re: Closures - do you understand them well?, Emanuel Berg, 2022/12/21
- Re: Closures - do you understand them well?, Emanuel Berg, 2022/12/08
- Re: Closures - do you understand them well?, Michael Heerdegen, 2022/12/08
- Re: Closures - do you understand them well?, tomas, 2022/12/08
- Re: Closures - do you understand them well?, Emanuel Berg, 2022/12/09
- Re: Closures - do you understand them well?, Michael Heerdegen, 2022/12/09