purescript/purescript-lists

Is this actually a lazy left scan?

drewolson opened this issue · 1 comments

scanrLazy :: forall a b. (a -> b -> b) -> b -> List a -> List b

The more I look at this, the more I am convinced that this is a left scan with the args to the function swapped. The following test seems to confirm this:

> fromFoldable $ scanrLazy (flip (-)) 10 (1..3)
(9 : 7 : 4 : Nil)

I believe I named this incorrectly when submitting the PR. Would love more input from folks who are more experienced.

Yes, this is a left scan, since you accumulate the head of the list before casing on the tail.