I seem to learn something new every day.

With the code below in a file f.input I get

(1) -> )r f
)assert blah
)if blah
print "blah"

   "blah"
                                                         Type: Void

But if I enter )assert manually in a fricas session I get the following.

(2) -> )assert blah
   Unknown system command: assert

So I suspected, that the )if construction might work inside a jfricas cell. Since jfricas essentially creates a file with the content of a cell and then let's fricas reads that. "Essentially", because it actually does that without ever creating a file on disk using "interpret_block".

The behaviour is weird as you see from the result. It accepts )assert, but completely ignores )if, )else and )endif.

====== jfricas cell
)assert foo
x:=0
y:=0
)if foo
x := 1
)else
y := 1
)endif
[x,y]
====================
====== output ======
0
            NonNegativeInteger

0
            NonNegativeInteger

1
            PositiveInteger

1
            PositiveInteger

[1, 1]
            List(PositiveInteger)
======= END =======

Waldek, do you know why interpret_block in src/interp/int-top.boot behaves different from reading a file? It's not a big deal, but I would like that virtually a jupyter cell can be considered as a file, that is read by fricas.

Ralf

On 6/12/24 20:53, Ralf Hemmecke wrote:
Interesting that I had to look into i-bugs.input in order to find
how to work with the )if directive and learn about ")assert".

)assert blah
)if blah
print "blah"
)else
print "foo"
)endif

Unfortunately, I am a bit reluctant to use undocumented stuff.
Any idea where such documentation could go to?

Ralf

--
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/64093986-692d-4dae-b23f-1b09b7c0016c%40hemmecke.org.

Reply via email to