Re:Ask YC: Ruby and Lisp devs, please answer this (Not a fla...
by pg on Tuesday January 15, 2008 @01:49AM
(#98589)
Close, except trues returns the values returned by the function, not the elements for which the function returned true.
(def keep (f seq) (rem [no (f _)] seq))
(def trues (f seq) (rem nil (map f seq)))
each = mutant foreach
dedup = remove duplicates
(trues [] (keys profs*)) would mean "map the lambda (predicate) over the list of keys to the hash of profiles, returning a list of elements for which it returned #t."
A few more specifics about the application and language would make this comprehensible.