Talk:Burrows–Wheeler transform: Difference between revisions

From Rosetta Code
Content added Content deleted
(Haskell foldr -> iterate edit worthwhile ?)
 
 
Line 1: Line 1:
===Haskell foldr -> iterate edit worthwhile ?===
===Haskell foldr -> iterate edit worthwhile ?===


I have often learned from Spoon!'s useful Haskell edits, not least to always consider using '''iterate'''.
I have often learned from [[User:Spoon!|Spoon!]]'s useful Haskell edits, not least to always consider using '''iterate'''.


On this occasion, I suspect that I may be missing something ?
On this occasion, I suspect that I may be missing something ?

Latest revision as of 13:24, 25 March 2019

Haskell foldr -> iterate edit worthwhile ?

I have often learned from Spoon!'s useful Haskell edits, not least to always consider using iterate.

On this occasion, I suspect that I may be missing something ?

The 2019 March 25 (Globules -> Spoon!) edit rewrites foldr f to iterate g !! length (where the f to g rewrite is a type-change – the pruning out of an accumulator argument).

Perhaps under the influence of Graham Hutton's tutorial on the universality and expressiveness of fold I tend to think of foldr as something fairly clean and fundamental, and this particular use of iterate appears, at first glance, to risk entailing some cost, with (!!) and length, which might not be offset by dispensing with an accumulator argument, but perhaps I am missing a point about fusion and laziness here ? Hout (talk) 13:11, 25 March 2019 (UTC)