Jón Fairbairn <[EMAIL PROTECTED]> writes: > "Jason Dagit" <[EMAIL PROTECTED]> writes: > > > Well, this is basically just a zip with a special base case. But you > > [...] > I wonder if there is mileage to be had from persuing > something like this, rather different (off top of head, very > provisional, E&OE &c) approach: > > extend_infinitely l = map Just l ++ repeat Nothing > promote1 rel (Just a) b = rel a b > promote1 rel Nothing b = False > is_pfx_of l1 l2 = and (zipWith (promote1 (==)) (extend_infinitely l2) l1)
or, possibly better extend_infinitely l = map Just l ++ repeat Nothing is_pfx_of l1 l2 = and (zipWith (==) (extend_infinitely l2) (map Just l1)) -- Jón Fairbairn [EMAIL PROTECTED] _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe