0.0.12 permalink Arrow_down_16x16

pop-optional-args

circumspec.utils

  • (pop-optional-args preds coll)
Pops args from coll as/if they match preds. Used for binding forms
that have optional arguments at the beginning.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source circumspec/utils.clj:6 top

(defn pop-optional-args
  "Pops args from coll as/if they match preds. Used for binding forms
   that have optional arguments at the beginning."
  [preds coll]
  (if (seq preds)
    (if ((first preds) (first coll))
      (cons (first coll) (pop-optional-args (rest preds) (rest coll)))
      (cons nil (pop-optional-args (rest preds) coll)))
    (list coll)))
Vars in circumspec.utils/pop-optional-args: cons defn first list rest seq
Used in 0 other vars

Comments top

No comments for pop-optional-args. Log in to add a comment.