Wrong example in docs
ariady-putra opened this issue · comments
List.reduce
example-arguments are flipped:
https://aiken-lang.github.io/stdlib/aiken/list.html#reduce
reduce(self: List<a>, zero: b, with: fn(b, a) -> b) -> bReduce a list from left to right using the accumulator as left operand. Said differently, this is foldl with callback arguments swapped.
list.reduce([#[1], #[2], #[3]], bytearray.concat, #[0]) == #[0, 1, 2, 3] list.reduce([True, False, True], fn(b, a) { or([b, a]) }, False) == True
It should be:
list.reduce([#[1], #[2], #[3]], #[0], bytearray.concat) == #[0, 1, 2, 3] list.reduce([True, False, True], False, fn(b, a) { or([b, a]) }) == True
Line 1336 in c42b613
Ah yes, we had switched the arguments in the definitions last release, thanks for pointing this out