Pops args from coll as/if they match preds. Used for binding forms
that have optional arguments at the beginning.
(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)))
Comments top
No comments for pop-optional-args. Log in to add a comment.