when-first double evaluation

Description

The when-first macro will evaluate the xs expression twice. Admittedly, it does exactly what the doc string says, but that seems undesirable to me. Even without side effects, there's a potential performance issue if xs is some expensive operation.

Patch attached. The main diff is:

- `(when (seq ~xs)
- (let
- ~@body))))
+ `(when-let [xs# (seq ~xs)]
+ (let
+ ~@body))))

Environment

Mac OS X 10.8.1, Java 1.7.0_06

Status

Assignee

Stuart Sierra

Reporter

Steve Miner

Labels

None

Approval

Ok

Patch

Code

Fix versions

Affects versions

Release 1.4

Priority

Minor
Configure