[erlang-questions] re moving nth element from a list

Richard A. O'Keefe <>
Wed Jun 25 08:41:34 CEST 2008

On 25 Jun 2008, at 5:46 pm, Anupam Kapoor wrote:
> i have written the simplex (linear programming) in couple of languages
> before, and i just wanted to contrast that experience in erlang. now,
> for doing this, i can :
>    - either learn erlang's ffi for interfacing with external math libs

Strictly speaking, there isn't one.  Various people have been saying
that a decent interface to something like (say) GSL would be nice, and
it's hard to disagree (although I might be willing to give it a go  

>    - or develop my own elementary matrix/vector manipulation routines.
> for better or for worse, i chose the latter. now, vector-dot-products
> are easy, however while computing vector-cross-products, i need the
> 'remove-nth' thingie.

Eh?  The vector cross product is only defined for 3-dimensional space,
	[A,B,C] x [D,E,F] = [B*F-C*E, C*D-A*F, A*E-B*D]
(Warning: untested code.)
If you mean something other than the traditional vector cross product,
what might it be?

For what it's worth, I wrote a simplex algorithm implementation in
Burroughs Algol back in, oh, maybe 1977 or 1978, and I don't recall
any cross products turning up in it at all.  With hindsight, I think
everything I needed was in the level 1 or level 2 BLAS, not that they
existed as such back then.

I'm not sure that this particular exercise will teach you anything
other than "Erlang wasn't designed for this."   Implementing the TFTP
protocol might be more illuminating, or even the Dining Philosophers.

More information about the erlang-questions mailing list