Is it some reason why the curry function is limited to binary functions on input? Why not general any-arity to any-arity curry? This code seems to work well:
(define (cu fun)
(letex (Fun fun Args (args))
(lambda () (apply Fun (append 'Args (args))))))
((cu + 1 2 3) 4 5) → 15
As an observer, my view is that most things in newLISP are designed with an eye to simplicity, speed, practicality, size, and conciseness. (Perhaps that should be 'concision', but I don't like that word! :-)) So the answer to many of your questions about the design of newLISP is going to be related to the way these criteria can be met.
I suspect, from reading this:
//http://www.alh.net/newlisp/phpbb/viewtopic.php?t=1664
that the more basic *curry* filled most of the practical demands for curry quickly and speedily. You never know, a more extensive implementation may be on its way!
Quote from: "cormullion"
So the answer to many of your questions about the design of newLISP is going to be related to the way these criteria can be met.
Oh, yes, I must learn more about newlisp way. The problem is that I have too much previous mis-knowledge: I am fluent in both traditional scripting languages (perl, python) and traditional lisp (scheme), but newlisp is none of them. ;-) Right now I am converting some of my small python scripts to newlisp -- just to learn from experience. And I immediately found an usage for built-in curry:
(map (curry format markup) cookies)
Good it is!
But now another question arises: why find-all, when nothing is found, returns nil and not empty list? I believe that this special case is not special enough: parse a line into tokens is a common pattern, and empty line is a common case in this pattern. In current state I must write:
(dolist (word (or (find-all {pattern} (current-line)) '())) ...)
...and this seems awful. On the other hand, if you really want to check for "no match", '() serves as boolean as well as nil. Or I am missing something important again?
Quote
why find-all, when nothing is found, returns nil and not empty list?
'find-all' will be changed to return an empty list when nothing is found in the next development version.
Lutz
Quote from: "Lutz"
'find-all' will be changed to return an empty list when nothing is found in the next development version.
Oh. thank you! I'm I looking forward eagerly.