PT wrote: > For predicates I usually use lambda functions. For example: > > (require 'cl) > (remove-if (lambda (x) (> x 2)) > '(1 2 3 4)) > > I'm not a lisp guru, therefore I often wonder if there are standard binder > functions in emacs lisp like for example bind2nd in C++ STL which > transforms a binary function into an unary function: > > find_if(L.begin(), L.end(), bind2nd(greater<int>(), 2)) // C++ > > So that I can write something like this: > > (remove-if (bind-second '< 2) > '(1 2 3 4))
So you are looking to do this? (defmacro bind-second (first &rest others) `(lambda (x) (,first x ,@others))) (remove-if (bind-second > 2) '(1 2 3 4)) I'd think that would make the code a bit more confusing to read. But maybe it's just me. _______________________________________________ Help-gnu-emacs mailing list Help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs