[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LET-IF



I will give an example to illustrate why I think that we need LET-IF.
If there is a clean way to get around my need for a conditional bind,
then please let me know.

(defvar *flag*)

(defun f ()
  (let-if (some-condition-that-may-be-satisfied-several-times)
          ((*flag* nil))
    ;; large body that will call f recursively and possibly set *flag*
    (when *flag*
      ;; perform special processing
      )))

I don't want to have to double the size of the function by having the body
twice.

I can't use catch and throw when the event happens because I only wish to
note that the event has happened, not terminate processing.

The function f is to be called very frequently and I want it to be as
fast as possible, hence PROGV seems like overkill.

Binding *flag* to a mutable object ...

  (let ((*flag* (if (condition) (cons nil nil) *flag*))) ...

seems like a real hack.

-- Rich
------