Invoking return through a function?

Alberto Riva alb at nospam.chip.org
Sun Oct 29 12:45:58 EDT 2017


On 10/29/2017 11:13 AM, bartc wrote:
> 
> (What the OP wants was also proposed a few weeks back in comp.lang.c. 
> But that was only within nested functions, so if H is inside G, and G is 
> inside F, then a 'returnall' from H would return directly directly from 
> F. Apparently Lisp allows this...)

Well, not directly, but it can be simulated with the condition system 
(equivalent to try/except) or with throw/catch, which is similar but 
doesn't use exceptions.

But my point was that in Lisp you don't need to do this, because you can 
write a macro that expands into a return *in place*, without calling a 
separate function, and this eliminates the problem entirely. Since 
Python doesn't have macros I was looking for the next-best solution, but 
there doesn't seem to be one. Oh, well...

Thanks,

Alberto

-- 
                 E-mail address:
((lambda (s a b c) (map 'string #'code-char (mapcar (lambda (v)
(setq s (+ a (mod (+ s v (- a)) b)))) (map 'list (lambda (v)
(- (char-code v) c)) " 1`-THUZ&+Wh1")))) 97 46 73 32)



More information about the Python-list mailing list