A DSP task in Erlang ?
Tue Jan 20 16:14:05 CET 2004
I'm trying to simulate a DSP operation in Erlang, but I have
difficulties in figuring out the best way to write it.
My aim is to be able to sum the contents of several lists, e.g.:
if A = [1,2,3], and B = [1,2,3] and C = [1,2,3], I'd like to findaa fast
end efficient way to get a resulting list summing the elements such as D
= [3, 6, 9], i.e. the first element of the result is the sum of the
first element of the lists, etc.
I checked with list comprehension, but I found that they are useful to
write generators rather than adders:
Erlang (BEAM) emulator version 5.2 [source] [hipe]
Eshell V5.2 (abort with ^G)
1> A = [1,2,3].
4> [X+Y+Z || X <- A, Y <- B, Z <- C].
clearly not what I need.
The "best way" I'm looking for is something that could be used in a soft
real time system. Given a fixed input length of lists, I'd like to have
a predictable and constant time of execution of the function.
Anybody have suggestions on this ?
More information about the erlang-questions