stencila / libcore

📚 Stencila core function library
Apache License 2.0
5 stars 5 forks source link

Implement Mini operator functions #9

Closed nokome closed 6 years ago

nokome commented 6 years ago

A PR in the stencila/mini repo implements operators as function calls https://github.com/stencila/mini/pull/18. These functions need to be implemented in libcore. Awaiting FunctionJsDocConverter to be implemented https://github.com/stencila/convert/pull/2 before doing this.

Precedence Operator Usage example Function call equivalent
1 . value.member select(value, member)
1 [] value[member] select(value, member)
2 ! !value not(value)
2 + +value positive(value)
2 - -value negative(value)
3 ^ value ^ expon pow(value, expon)
4 * value * other multiply(value, other)
4 / value / other divide(value, other)
4 % value % other remainder(value, other)
5 + value + other add(value, other)
5 - value - other subtract(value, other)
6 < value < other less(value, other)
6 <= value <= other less_or_equal(value, other)
6 > value > other greater(value, other)
6 >= value >= other greater_or_equal(value, other)
7 == value == other equal(value, other)
7 != value != other not_equal(value, other)
8 && value && other and(value, other)
9 \|\| value \|\| other or(value, other)
nokome commented 6 years ago

Now that stencila/convert#2 is complete, this issue has been started in #13. Progress: