On Fri, 7 Sep 2012 07:51:03 +0200
Alexander Burger <a...@software-lab.de> wrote:

> Hi José,
> 
> > Because the world wasn't weird enough already I took the liberty to
> 
> Bravo! That's a valid idea ;)
> 
> 
> Let me suggest two small changes:
> 
> > (de prog+ "Prg"
> >    (use ("Thunk" "Ret" "L")
> >       (setq "Thunk" "Prg" "Ret" NIL)
> >       (while
> 
> Did you have any special reason for 'use'? Otherwise I would use
> 'let':
> 
> (de prog+ "Prg"
>    (let ("Thunk" "Prg"  "Ret" NIL  "L" NIL)
>       (while
> 
> 
> The call to 'seek'
> 
> >    (seek '[(X) (= (car X) "L")] "Prg")
> 
> can in this case be replaced by member:
> 
>    (member "L" "Prg")
> 
> Cheers,
> - Alex

I "picolisped" a bit the functions and came up with this:

(de prog+ "Prg"
   (let ("Thunk" "Prg" "Ret" NIL "L" NIL)
      (while (setq "Thunk" (catch 'goto (setq "Ret" (run "Thunk")))))
      "Ret" ) )

(de goto (L)
   # "Prg" from 'prog+
   (throw 'goto (member L "Prg")) )

(====)

Now goto throws the thunk itself, passing it as a continuation. You can
manually throw any code (even code generated on the fly).

I wonder if there is an use case where this could be actually faster
than other alternatives.

Cheers,
José
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to