The array-based part of the structure is really direction-neutral. It's happy with all the folds. The list tail is another story. Thanks to that list, the "natural" folds for Vector are foldl and foldr'—the opposite of plain lists. Unfortunately, we need foldl' to implement things like filter. My experiments so far produced wretched and complicated Core. I need something better. Next attempt: use List.reverse clunkily on the tail, then dance along the result with foldr or foldl'.
The array-based part of the structure is really direction-neutral. It's happy with all the folds. The list tail is another story. Thanks to that list, the "natural" folds for
Vector
arefoldl
andfoldr'
—the opposite of plain lists. Unfortunately, we needfoldl'
to implement things likefilter
. My experiments so far produced wretched and complicated Core. I need something better. Next attempt: useList.reverse
clunkily on the tail, then dance along the result withfoldr
orfoldl'
.