Hello Waldek, hello all,
First of all Julia is essentially aimed at scientific computing (numerical) so not a real competitor.
I continue to interface it and FriCAS with SBCL but I encounter an annoying bug. Maybe you will be able to help me here. At least explain to me how Domains and Packages are loaded and used.
The base is done for me, but... The Julia library requires an initialisation and I can't figure out how to initialize its environment at startup, I always encounter a fatal error: ReadOnlyMemoryError
See :
============================================================
└─$ fricas -nosman -rl
Checking for foreign routines
FRICAS="/usr/local/lib/fricas/target/x86_64-linux-gnu"
spad-lib="/usr/local/lib/fricas/target/x86_64-linux-gnu/lib/libspad.so"
gmp-lib="/usr/local/lib/fricas/target/x86_64-linux-gnu/lib/gmp_wrap.so"
julia-lib="/usr/local/lib/fricas/target/x86_64-linux-gnu/lib/julia_wrap.so"
foreign routines found
openServer result -2
FriCAS Computer Algebra System
Version: FriCAS 2022-07-16
Timestamp: mer. 21 déc. 2022 10:35:13 CET
(1) -> )lisp (init-julia-env)
Value = T
(1) -> )lisp (jl-dbl-function "exp" 1.0)
Value = 2.718281828459045
(1) -> exp(1.0)
fatal: error thrown and no exception handler available.
ReadOnlyMemoryError()
unknown function (ip: 0x52f7062f)
unknown function (ip: 0x52ca710e)
unknown function (ip: 0x52a47557)
unknown function (ip: 0x530ec65c)
unknown function (ip: 0x52e32622)
unknown function (ip: 0x52a146dd)
unknown function (ip: 0x52a1ed73)
unknown function (ip: 0x52c021fc)
unknown function (ip: 0x52af5b24)
unknown function (ip: 0x52a4a816)
unknown function (ip: 0x52c301b9)
unknown function (ip: 0x52aa254b)
unknown function (ip: 0x52a0e138)
unknown function (ip: 0x52b0ddf3)
unknown function (ip: 0x52a15b9a)
unknown function (ip: 0x52a49e58)
unknown function (ip: 0x52c38e76)
unknown function (ip: 0x52a1b335)
unknown function (ip: 0x52aa4ba8)
unknown function (ip: 0x52b0adb7)
unknown function (ip: 0x52c24c68)
unknown function (ip: 0x52a11f60)
unknown function (ip: 0x52ab0634)
unknown function (ip: 0x52b410cb)
unknown function (ip: 0x52b40de2)
unknown function (ip: 0x52c97778)
unknown function (ip: 0x52a4f136)
unknown function (ip: 0x52ca51db)
unknown function (ip: 0x52ca5059)
unknown function (ip: 0x52ca6283)
unknown function (ip: 0x52ca4ed8)
unknown function (ip: 0x52ca4afd)
unknown function (ip: 0x52ab1645)
unknown function (ip: 0x52ca3359)
unknown function (ip: 0x52b4498d)
unknown function (ip: 0x52ca2ee2)
unknown function (ip: 0x52ca2c04)
unknown function (ip: 0x52ca2a10)
unknown function (ip: 0x52ca2869)
unknown function (ip: 0x52aeaf1c)
unknown function (ip: 0x52a8914b)
unknown function (ip: 0x53366b14)
unknown function (ip: 0x53366919)
unknown function (ip: 0x53366741)
call_into_lisp_ at /usr/local/lib/fricas/target/x86_64-linux-gnu/bin/FRICASsys (unknown line)
initialize_lisp at /usr/local/lib/fricas/target/x86_64-linux-gnu/bin/FRICASsys (unknown line)
main at /usr/local/lib/fricas/target/x86_64-linux-gnu/bin/FRICASsys (unknown line)
unknown function (ip: 0x7fc6f30cb189)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
_start at /usr/local/lib/fricas/target/x86_64-linux-gnu/bin/FRICASsys (unknown line)
===============================================================
This is because above I begin by initializing Julia's env. So I can't even build FriCAS if I automatize at startup the Julia's env.
But, apparently, and I don't even know if I am in the right thinking direction, if I "play" with different FriCAS's domains this does not happen. Sometimes in fact.
See :
==============================================================
$ fricas -nosman -rl
Checking for foreign routines
FRICAS="/usr/local/lib/fricas/target/x86_64-linux-gnu"
spad-lib="/usr/local/lib/fricas/target/x86_64-linux-gnu/lib/libspad.so"
gmp-lib="/usr/local/lib/fricas/target/x86_64-linux-gnu/lib/gmp_wrap.so"
julia-lib="/usr/local/lib/fricas/target/x86_64-linux-gnu/lib/julia_wrap.so"
foreign routines found
openServer result -2
FriCAS Computer Algebra System
Version: FriCAS 2022-07-16
Timestamp: mer. 21 déc. 2022 10:35:13 CET
(1) -> sqrt(2)
+-+
(1) \|2
Type: AlgebraicNumber
(2) -> 2*x+7
(2) 2 x + 7
Type: Polynomial(Integer)
(3) -> sqrt %
+-------+
(3) \|2 x + 7
Type: Expression(Integer)
(4) -> sqrt(2.0)
(4) 1.
4142135623_730950488
Type: Float
(5) -> )lisp (init-julia-env)
Value = T
(5) -> )lisp (jl-dbl-function "exp" 1.0)
Value = 2.718281828459045
(5) -> )lisp (jl-eval-string "using SpecialFunctions")
Value = NIL
(5) -> )lisp (jl-eval-string "print(erf(0.7))")
0.6778011938374184
Value = NIL
(5) ->
(5) -> 2*x+7
(5) 2 x + 7
Type: Polynomial(Integer)
(6) -> sqrt(2.0)
(6) 1.
4142135623_730950488
Type: Float
(7) -> sqrt(2.0::SF)
(7) 1.4142135623730951
Type: DoubleFloat
========================================================
========================================================
As you can see I hope, it appears that it works in this case. And frankly I can't figure out why.
I was thinking that some times ago, Waldek, you explained that during the load of a FriCAS library (domain, package or whatever) a vector (array) was created or populated with addresses of its different functions among other things.
Am I wrong? And maybe here, someone can tell me in which direction I have to look?
__
Greg
PS2: If you want to give it a try, I insist it's just laying the foundations right now and I want good bases:
https://github.com/gvanuxem/fricas (jfricas branche). You'll also need Julia. My advice is to use the
julialang.org version not the Debian one, it's really a big project, difficult to maintain I think.
After, personally I do a:
$ ./configure --without-x --enable-gmp --enable-julia --with-julia-config=/usr/local/share/julia/julia-config.jl && make -j4 && sudo make install
Julia can also be run in a directory for info., your home directory for example.