Skip to content

Latest commit

 

History

History
13 lines (7 loc) · 521 Bytes

2023-09-27-fix foldr.md

File metadata and controls

13 lines (7 loc) · 521 Bytes

Fix foldr

Context

Currently foldr for ListL is implemented with a simple foreach loop. But that is actually equivalent to foldl.

Decision

We change the implementation to use recursion instead of a foreach`` to achieve the correct behavior of foldr`.

Consequences

The incorrect implementation of foldr made me to swap the order of the arguments in the ConcatenationMonoid for ListL. With this change, now the append operation can become more natural preserving the order of the arguments.