Remember that for expressions like
you can always use a function composer, e.g. some are found in
http://newlisp-on-noodles.org/wiki/inde ... _functions and write instead
I think it's more natural to write the function constituents right-to-left (like the mathematical convention of functional composition), but you could write another composer that took the functions in reverse order. I'd call it
rcompose, so as not to confuse it with the conventional composer (sorry cormullion, you may be in the minority):
Also, I agree with jrh. I'd rather write a composer (in general, these are called
combinators) which generates a new function than write a function that just applies its constituents right away. (Also, I think
dolist is ugly too, but it is a faster iterator, which I believe was Jeff's chief concern.) Utilizing a combinator leaves the door open for building computations and keeping them in symbol references for continued reuse. For instance, you can't use
s-apply (defined above) in a
fold operation, so the composer is more flexible:
Code: Select all
(let ((my-operator (compose more-func your-operator)))
(fold my-operator '(1 2 3 45 49 20 98 892)))
That is, now you can chose not only
when but also
how to apply the new function.
(λx. x x) (λx. x x)