Closed dbenn closed 3 days ago
There are occasions when writing VeLa code that I want simple arithmetic vector operations over 2 lists, e.g.
VeLa
[1 2 3 4] - [5 6 7 8]
A variant of map that takes 2 lists as arguments would also be a useful generalisation, e.g.
map
map(function(n:real m:real):real{n-m} [1 2 3 4] [5 6 7 8])
or
map(λ(n:real m:real):real{n-m} [1 2 3 4] [5 6 7 8])
would yield the same result but does not provide the more pleasant syntactic sugar.
A mix of list and numeric operands should also be allowed, e.g.
2 * [5 6 7 8] [1 2 3 4] - 42
Operations + - * / ^ should be handled.
Currently, VeLaInterpreter.applyBinaryOperation() assumes unified types. For mixed scalar/list operations, we'll have to handle this differently.
VeLaInterpreter.applyBinaryOperation()
There are occasions when writing
VeLa
code that I want simple arithmetic vector operations over 2 lists, e.g.A variant of
map
that takes 2 lists as arguments would also be a useful generalisation, e.g.or
would yield the same result but does not provide the more pleasant syntactic sugar.
A mix of list and numeric operands should also be allowed, e.g.
Operations + - * / ^ should be handled.