polterguy / lizzie

A script language for .Net and the CLR
https://ainiro.io/
MIT License
189 stars 27 forks source link

Unary minus #26

Closed SapphireBrand closed 5 years ago

SapphireBrand commented 5 years ago

Should have a function for negation. The alternative of coding -(0, 17) is possible, but seems...like a workaround for an obvious shortcoming.

polterguy commented 5 years ago

I think your scenario could be done by making sure -17 is parsed as a numeric ...

SapphireBrand commented 5 years ago

Parsing negative numbers would cover one case.

Additionally, there is no way to say "-@variable", unless you write "-(0, @variable)"

polterguy commented 5 years ago

Well, its nature is that everything is a function. I see how it becomes unintuitive that you'd have to use 0, -x. Maybe change it such that it allows for -(x) ...

polterguy commented 5 years ago

Fixed in repo, now it allows for the following ...

var(@foo,10)
-(foo)