Hi Alex,

Great! It even handles the up- and down-arrow keys for access to command history. ;-) Thanks!

/Jon

On 18-12-13 21:19 , Alexander Burger wrote:
Hi Jon,

I just wrote a little PicoLisp script (for pil32) that "simulates"
the REPL, quite similar to the one I did for Ersatz a while ago,
<http://picolisp.com/5000/!wiki?SwingRepl>. The new REPL script
looks like this:

(in NIL
     (until (eof)
         (let (ProgText (pack (line))
                 Prog (str ProgText)
                 Result (run Prog) )
             (prinl "-> " (sym Result))
             (flush) ) ) )

It works quite fine, but one minor flaw is that, when you're running
this REPL, '@' always returns NIL. Is there some simple way to fix
that?
Yes, you could bind the symbol '@', like in

    (in NIL
       (use (Exe Res)
          (while (setq Exe (read))
             (prin "-> ")
             (println
                (setq Res
                   (let @ Res
                      (eval Exe) ) ) ) ) ) )

Note that I here use 'read', 'eval' and 'print' directly, so there is no
need to operate on the string level with 'pack', 'line', 'str' and
'sym'.

Note also that this REPL exits when NIL is read (while .. (read)), as
this is also the behavior of the built-in REPL. If you don't want this,
then your way of (until (eof) ..) is better.

♪♫ Alex

--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to