34

Is there an equivalent to the expr command which works for complex numbers (represented lists of two doubles)?

This library provides functions for complex number arithmetic, and this seems to be a useful utility to define the required cexpr function, but it doesn't work well.

E.g. it doesn't handle properly the brackets.

ParseExpressions::ParseExpr { (1) + ((2) + (3)) } { }

returns

+ [+ 1 ((2)] (3))

while it should return

+ [+ 1 2] 3

Also ParseExpressions::ParseExpr { {1 2} + {3 4} } {}

returns

+ 1 2 3 4

while it should return

+ {1 2} {3 4}

So basically I am asking for a robust version of this utility.

Vahagn
  • 4,670
  • 9
  • 43
  • 72

2 Answers2

3

Why don't you try this: http://wiki.tcl.tk/11415 or something like this too: http://wiki.tcl.tk/13885

I hope these are easy to use alternatives for the mentioned utility.

askmish
  • 6,464
  • 23
  • 42
0

You can use pretty much an C library if you link it with FFIDL.

drysdam
  • 8,341
  • 1
  • 20
  • 23