Yet another proposal: Is it feasible to implement “return-from” in uLisp? This CommonLisp feature seems to make life a lot easier since it eliminates the need to construct functions/blocks that always “culminate” in the one and only single return. I’m not sure, though, if this request shows I haven’t really understood or embraced Lisp yet… currently, I’m having a really hard time to port a function that uses several different “exits” according to changing circumstances within the function block.
Would it be possible to provide "return-from" in uLisp?
I’m not a fan of return-from, and you can usually achieve the same effect more elegantly using cond.
For example, suppose you have three algorithms for solving a problem: special-case, which is fast but only works on some cases, quick-solution, which works on most cases, and brute-force, which is slow but always works. They each return t if they succeed in solving the problem. Then in Common Lisp one might write:
(defun solve-it (problem)
(when (special-case problem) (print "Special case OK!") (return-from solve-it))
(when (quick-solution problem) (print "Quick solution OK!") (return-from solve-it))
(when (brute-force problem) (print "Brute force OK!") (return-from solve-it))
(print "Something went wrong"))
However, it’s better to use cond:
(defun solve-it (problem)
(cond
((special-case problem) (print "Special case OK!"))
((quick-solution problem) (print "Quick solution OK!"))
((brute-force problem) (print "Brute force OK!"))
(t (print "Something went wrong"))))