sergiotaborda / lense-lang

The Lense Language Compiler
1 stars 0 forks source link

Support Exponenciation operator #34

Closed sergiotaborda closed 6 years ago

sergiotaborda commented 8 years ago

Support * operator to mean exponentiation so 2 * 3 = 8 The ^ operator remains for XOR operations.

A possibility to investigate is to change ^to be the exponentiation operator and $ to be the XOR operator (since identifiers cannot start with $. But this rule can be quite annoying when manipulating javascript libraries like angular or jquery that use $ heavily)

sergiotaborda commented 6 years ago

the * operator causes confusion with the operator

val sqrt = (x 2 + y 2) * 0.5 val noop = (x 2 + y 2) 0.5

So the exponentiation operator is now ^^ val sqrt = ( x ^^ 2 + y ^^ 2) ^^ 0.5