Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Completed
    • Affects versions: Release 1.4
    • Fix versions: Release 1.5
    • Labels:
      None
    • Environment:

      Mac OS X 10.8.1, Java 1.7.0_06

    • Approval:
      Ok
    • Patch:
      Code

      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 x (first ~xs)
      - ~@body))))
      + `(when-let xs# (seq ~xs)
      + (let ~x (first xs#)
      + ~@body))))

        Attachments

          Activity

            People

            • Assignee:
              stuart.sierra Stuart Sierra
              Reporter:
              steveminer@gmail.com Steve Miner
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: