I want to be able to write a J-like language using the mathjs math.parser()
function result.
Let's say I want to define an operator #
that returns the length of an array. Ideally it would work like this:
a = [1, 2, 3]
#a // yields 3
Then, for fun, an operator $
that takes two arrays and combines them.
a = [1, 2, 3, 4]
b = [4, 5, 6]
a $ b // yields [1, 2, 3, 4, 4, 5, 6]
How might I do these things with mathjs? If I cannot do them, what tool might I use instead?
Why it's different
I want to be able to use it like this:
var parser = math.parser();
parser.eval("a = [1,2,3]; #a");