[alexandria-devel] A clean-room implementation of FILTER-IF from Paul Graham's "On Lisp."

23 Apr
2007
23 Apr
'07
8:34 p.m.
Good day, perhaps the function below meets the Alexandria's standards for conservativeness/usefulness: (defun filter-if (fn &rest sequences) (labels ((iterate (acc sequences) (if (notany #'null sequences) (iterate (if-let ((testval (apply fn (mapcar #'car sequences)))) (cons testval acc) acc) (mapcar #'cdr sequences)) acc))) (nreverse (iterate nil sequences)))) The idea, but not the implementation, was taken from Paul Graham's book "On Lisp". Also, i cannot come up with a good docstring, so such one would be appreciated. regards, Samium Gromoff
6533
Age (days ago)
6533
Last active (days ago)
0 comments
1 participants
participants (1)
-
Samium Gromoff