[erlang-questions] : Human readable errors in lists module
Fri Feb 13 10:59:04 CET 2009
2009/2/13 Raimo Niskanen <raimo+erlang-questions@REDACTED>:
> On Fri, Feb 13, 2009 at 09:32:30AM +0100, Ulf Wiger (TN/EAB) wrote:
>> Zvi skrev:
>> > I think instead of "fixing" lists:zipwith, it's better to add
>> > parallel list comprehensions, i.e.:
>> This is actually more difficult than it seems
>> at first glance.
> Is not the suggestion that lists run in parallel, not execution.
Of course. I was a bit hasty there...
Sequence comprehensions in Cryptol are pretty cool:
Rounds (State, (initialKey, rndKeys, finalKey)) = final
istate = State ^ initialKey;
rnds = [istate] # [| Round (state, key)
| | state < - rnds
| | key < - rndKeys | ];
final = FinalRound (last rnds, finalKey);
"The value rnds is defined as a recursive sequence. The first element
of the sequence
is the value of istate. The second element is the result of applying the Round
function on the first element of the rnds sequence (i.e. istate) and
the first element
of the rndKeys sequence. The third element of rnds is the result of
Round function on the second element of rnds (which is the result of
iteration) and the second element of rndKeys. This pattern continues until we
exhaust rndKeys, at which point the sequence rnds is complete and its
is the result of iterating the Round function once for each element of rndKeys."
http://www.galois.com/files/Cryptol/Cryptol_Programming_Guide.pdf (page 46)
There - both recursive and parallel list comprehensions. ;-)
More information about the erlang-questions