Hello Erik,
In light of the sxmath plug over at the "power function" thread, I decided to return the favor with a slightly tweaked SIC64.bas file. The changes are light and surgical:
At the top and bottom (respectively):
...
REM $Include: 'sxript.bm'
...And somewhere in the middle:
Out3 = SxriptEval$(Out3)
LastToken = False
... And that embeds the full-blown Sxript language into your project. It's dressed up as the "SXR" function of a single string argument. To test it out, I was doing a little calculus in the SIC terminal. First I dragged over the Sxript calculus header:
func(deriv, {
(([x]([y]+[z])) - ([x]([y]-[z]))) / (2*[z])
}):
func(itersolve,{
[y] - ([x]([y])) / deriv([x],[y],[z])
}):
func(newtonsolve, {
let(ans
,itersolve
([fxn
],[ans
],0.001)) }):
print_[ans]
})
}):
func(lhopital,{
deriv([x],[z],.001) / deriv([y],[z],.001)
}):
func(integral,{
let(tot
, [tot
] + [step] * [fxn
]([j
]) ) }):
print_[tot]
})
}):
print_`calculus.txt':
Next I wrote my first *.sic program:
10 PRINT SXR
("include(`calculus.txt')")
REM Define the problem
to solve.
20 p$ = "[x]^3 - 10"
30 g = 1.5
REM Set number of iterations.
40 i = 5
50 a$ = SXR("func(problem,{" + p$ + "})")
60 PRINT SXR
("newtonsolve(problem," + STR$(g
) + "," + STR$(i
) + ")")
Note that all of the Sxript-ish stuff is stashed away in its own parens and the BASIC user doesn't need to really understand it. That is, the editable lines are 20, 30, and 40. (There are other style remarks implied in the code that are not spelled out.)
... and voila, it does its job of computing the cube root of 10 in this case. See the screenshot below, along with all files needed to replicate the changes. Stick the *.bi/bm files in the same level as the *.BAS at compile time.