new_alg_rec(stream) in i-output.boot

8 views
Skip to first unread message

Grégory Vanuxem

unread,
Mar 22, 2026, 2:20:21 PM (5 days ago) Mar 22
to fricas...@googlegroups.com
Hello,

I know some more changes will be committed but what about:

--- /home/greg/Tmp/fricas/src/interp/i-output.boot 2026-03-22
12:43:18.175003142 +0100
+++ src/interp/i-output.boot 2026-03-22 19:12:52.459689994 +0100
@@ -275,9 +275,10 @@

new_alg_rec(stream) ==
res := GETREFV(3)
- ref.$stream_off := CONS([], stream)
- ref.$file_off := '"CONSOLE"
- ref.$on_off := true
+ res.$stream_off := CONS([], stream)
+ res.$file_off := '"CONSOLE"
+ res.$on_off := true
+ res

Greg

Waldek Hebisch

unread,
Mar 22, 2026, 3:15:17 PM (5 days ago) Mar 22
to fricas...@googlegroups.com
Thanks for noticing this. Using 'ref' in 'new_alg_rec' is very
wrong. But it did not cause trouble with tests: apparenty it
is never called. More precisely, it is called in
'applyWithOutputToString'. 'applyWithOutputToString' is called
in 'parseAndInterpToString' which AFAICS is unused.
'applyWithOutputToString' is also called in 'parseAndEval1'
which is called from 'parseAndEval' which is called
from 'checkCondition'. 'checkCondition' may be called from
'typeCheckInputAreas' but the call is only done when
'$bcParseOnly' is false. And '$bcParseOnly' is set to true
and no code sets it to false.

So it seems that we should remove 'new_alg_rec',
'applyWithOutputToString', 'parseAndInterpToString',
''parseAndEval1', 'parseAndEval' and 'checkCondition'.
And we should remove '$bcParseOnly' and replace its uses by
true.

--
Waldek Hebisch

Grégory Vanuxem

unread,
Mar 24, 2026, 4:13:51 PM (3 days ago) Mar 24
to fricas...@googlegroups.com
Thanks for removing it if not necessary!
> --
> 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 fricas-devel...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/fricas-devel/acA_wrKEKmsJPXXA%40fricas.org.

Grégory Vanuxem

unread,
Mar 24, 2026, 4:56:35 PM (3 days ago) Mar 24
to fricas...@googlegroups.com
Just one question, any idea on how to replace parseAndInterpToString,
it is used by my (jl)FriCAS MCP server:

(defun capture-fricas-output (expr)
(handler-case
;; Establish FriCAS top-level catch tag
(let ((res (catch 'boot::|top_level|
(boot::|parseAndInterpToString| expr))))
(if (consp res)
(format nil "~{~A~^~%~}" res)
(format nil "~A" res)))
(error (c)
(format nil "Evaluation Error: ~A" c))))

I am using this MCP server in another context (a VSCode/Antigravity
addon for (jl)FriCAS) and I wouldn't want to let the IA modify the
code. Actually a (from LLM) "evaluate ')show SpadDoc'" no longer
works.

?

Greg

PS: https://github.com/gvanuxem/fricas-vscode (actually, just a toy,
but a useful toy)

Grégory Vanuxem

unread,
Mar 24, 2026, 5:10:04 PM (3 days ago) Mar 24
to fricas...@googlegroups.com
The preliminary mcp server Lisp code is available at
https://github.com/gvanuxem/jlfricas/blob/master/src/lisp/mcp.lisp

Waldek Hebisch

unread,
Mar 24, 2026, 5:32:15 PM (3 days ago) Mar 24
to fricas...@googlegroups.com
On Tue, Mar 24, 2026 at 09:55:56PM +0100, Grégory Vanuxem wrote:
> Just one question, any idea on how to replace parseAndInterpToString,
> it is used by my (jl)FriCAS MCP server:
>
> (defun capture-fricas-output (expr)
> (handler-case
> ;; Establish FriCAS top-level catch tag
> (let ((res (catch 'boot::|top_level|
> (boot::|parseAndInterpToString| expr))))
> (if (consp res)
> (format nil "~{~A~^~%~}" res)
> (format nil "~A" res)))
> (error (c)
> (format nil "Evaluation Error: ~A" c))))

Try 'parseAndEvalToString' instead (this one is used by Hyperdoc).

--
Waldek Hebisch

Grégory Vanuxem

unread,
Mar 25, 2026, 8:16:09 AM (2 days ago) Mar 25
to fricas...@googlegroups.com
Hello,

> Just one question, any idea on how to replace parseAndInterpToString,
> it is used by my (jl)FriCAS MCP server:
>
> (defun capture-fricas-output (expr)
> (handler-case
> ;; Establish FriCAS top-level catch tag
> (let ((res (catch 'boot::|top_level|
> (boot::|parseAndInterpToString| expr))))
> (if (consp res)
> (format nil "~{~A~^~%~}" res)
> (format nil "~A" res)))
> (error (c)
> (format nil "Evaluation Error: ~A" c))))
>
> Try 'parseAndEvalToString' instead (this one is used by Hyperdoc).
>

I am using it now, thanks,

Greg
Reply all
Reply to author
Forward
0 new messages