[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Lexical binding
From: |
Christian Ohler |
Subject: |
Re: Lexical binding |
Date: |
Sun, 03 Apr 2011 22:05:51 +1000 |
On 3/04/11 4:57, Juanma Barranquero wrote:
The original trouble with `loop' is that, in a loop like this one,
with destructuring
(defsubst my--bs-file-width ()
(- (window-width)
(loop for (name width . rest) in bs-attributes-list
if (numberp width) sum width)
(bs--get-name-length)
1))
`name' is just a placeholder (as it is rest). I'm interested just in
`width'. And there's no way to write that loop as is without warnings.
In loop destructuring, you can use nil for fields that you want to ignore:
(loop for (nil width . nil) in bs-attributes-list
if (numberp width) sum width)
If you want to keep the ignored fields named, you could do something like
(loop for (name width . rest) in bs-attributes-list
do (progn name rest) ; ignore
if (numberp width) sum width)
Christian.
- Re: Lexical binding, (continued)
- Re: Lexical binding, Juanma Barranquero, 2011/04/01
- Re: Lexical binding, Stefan Monnier, 2011/04/02
- Re: Lexical binding, Juanma Barranquero, 2011/04/04
- Re: Lexical binding, Stefan Monnier, 2011/04/04
- Re: Lexical binding, Juanma Barranquero, 2011/04/04
- Re: Lexical binding, David Kastrup, 2011/04/04
- Re: Lexical binding, Stefan Monnier, 2011/04/04
- Re: Lexical binding, Stefan Monnier, 2011/04/02
- Re: Lexical binding, Juanma Barranquero, 2011/04/02
- Re: Lexical binding, Juanma Barranquero, 2011/04/02
- Re: Lexical binding,
Christian Ohler <=
- Re: Lexical binding, Juanma Barranquero, 2011/04/03
- Re: Lexical binding, Christian Ohler, 2011/04/03
- Re: Lexical binding, Juanma Barranquero, 2011/04/03
- Re: Lexical binding, Stefan Monnier, 2011/04/04