Hi Waldek,

In jfricas I needed a function that could interpret multiline code.
Initially, this was done by writing out the code to a file and then use
)read file.input. Eventually, I traced down what actually happens when
fricas reads a .input file and so put together a function that as input
gets a string (possibly with newlines) that is then interpreted as if it
came from a file.

I think |interpret-block| should be part of FriCAS. Maybe under another
name, which one would you like?

I do not exactly know where it would best fit in FriCAS, so it would be
good, if you can put this on your TODO-list.

It certainly could also help in the fricas terminal input if there where
a method that not immediately sends input to the interpreter, but waits,
for example, if the input line contained an open parenthesis.

Ralf

https://github.com/fricas/jfricas/blob/master/jfricas/webspad.lisp#L101

;;; interpret-block takes a code string that is interpreted as if it
;;; comes from a .input file.
(DEFUN |interpret-block| (|code|)
  (PROG (|$ncMsgList| |$erMsgToss| |$lastPos| |$EchoLines| |st|)
    (DECLARE (SPECIAL |$ncMsgList| |$erMsgToss| |$lastPos| |$EchoLines|))
    (RETURN
     (PROGN
      (SETQ |$EchoLines| NIL)
      (SETQ |$lastPos| |$nopos|)
      (SETQ |$erMsgToss| NIL)
      (SETQ |$ncMsgList| NIL)
      (SETQ |st| (MAKE-STRING-INPUT-STREAM |code|))
      (|intloopInclude0| |st| '|webspad| 0)))))

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/099e0bb9-2183-db6a-c496-5dd069268e48%40hemmecke.org.

Reply via email to