[Haskell-cafe] Re: [Haskell] ANN: random-access-list-0.1
lemming at henning-thielemann.de
Thu Jun 12 10:07:27 EDT 2008
On Thu, 12 Jun 2008, Isaac Dupree wrote:
> Henning Thielemann wrote:
>> On Wed, 11 Jun 2008, Isaac Dupree wrote:
>>> "extractHead" is an ugly name for a nevertheless standardish-meaning
>>> function... what is it usually called? uncons? headTail? (Data.Sequence,
>>> which is meant to be left-right symmetric, calls it "viewr"... except your
>>> version doesn't have the Maybe, it's partial instead, fails on empty
>> I like the 'viewL' and 'viewR' kind of functions, they are safer than
>> 'head' and 'tail', 'init' and 'last'. But since in most cases I used
>> 'viewL' in connection with 'maybe', the continuation style functions
>> switchL :: b -> (a -> Seq a -> b) -> Seq a -> b
>> switchR :: b -> (Seq a -> a -> b) -> Seq a -> b
> I think you got L and R backwards?
Why do you think so?
> it's a little confusing to me, but following Data.Sequence I think
> they're meant to match whether repeated L or R makes a foldl or a foldr.
viewl is like a 'case' for distinction of  and (:) and thus can be used
to implement both foldl and foldr.
More information about the Haskell-Cafe