[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [elpa] master 96e61a9 26/26: Add packages/darkroom by merging its up
From: |
Stefan Monnier |
Subject: |
Re: [elpa] master 96e61a9 26/26: Add packages/darkroom by merging its upstream subtree |
Date: |
Sun, 21 Dec 2014 22:04:11 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
>>> + (mapc #'(lambda (w)
>>> + (with-selected-window w
>>> + (darkroom--set-margins)))
>>> + (get-buffer-window-list (current-buffer))))
>>
>> I recommend the use of `dolist' instead of `mapc' when the body of the
>> loop is provided by an anonymous function and we're looping over a list.
>>
>> If the compiler could tell that we're looping over a list, it could
>> auto-transform the mapc call into a dolist (which is slightly more
>> efficient), but having to expend it to a loop that handles both lists
>> and arrays (like `mapc' does) makes the resulting code no more efficient
>> than just using `mapc'.
>>
> Alright, makes sense. What if I use `(cl-loop for w in ...list...)`
> which is my preferred cl-idiom anyway?
Use whichever you prefer. I was just pointing out the style I tend
to prefer, partly for efficiency reasons (and also because I haven't
managed to plug that efficiency problem in the optimizer).
Stefan