Code: Select all
(defun functional (this-function &rest other-functions)
(lambda (&rest closure-args)
(apply this-function (mapcar (rcurry #'apply closure-args) other-functions))))
The idea is you have a number of other-functions that take the same kind of arguments. Let's say you want to call these functions on the same args and pass all of the results to another function, this-function, as a test or an aggragation or something. And let's say you want to pass around this prepackaged test/aggragator and use it whereever you want. So that instead of saying (this-function ((function1 myargs) (function2 myargs) [...]) every time you use it, you simply create a new function with (functional this-function function1 function2 [...]), then pass the resulting closure whatever args you wish. I think it has a lot of potential, at least for my pet project, but it'd be much nicer if it worked with special operators and/or macros. I'm talking primarily about this-function, though it'd be cool if other-functions could be special ops or macros as well.
Ideas?