[erlang-questions] Vector instructions

James Hague james.hague@REDACTED
Sun Apr 6 19:37:05 CEST 2008


>  Has anyone given any thought to adding vector instructions or otherwise
>  adding support for vectors to Erlang?

I've proposed adding APL-style vector operations on tuples:

{1,2,3} + 1 ==> {2,3,4}
{1,2,3) * 2 ==> {2,4,6}
2 * {1,2,3} ==> {2,4,6}
{1,2,3} + {3,2,1} ==> {4,4,4}

The operations apply to the top level only; they're not recursive.
This would make vector math style code a lot simpler to write in
Erlang.  One of the points raised in response to this was that we
shouldn't be overloading tuple operations like this, but have a
special "vector of float" type.  I'm not sure I agree with that.



More information about the erlang-questions mailing list