On Sat, 17 May 2008, Luke Palmer wrote:
insertLine line csv = let (l,r) =
splitLast csv in l ++ [readCSVLine line] ++ r
where
splitLast [x] = ([],[x])
splitLast (x:xs) = let (l,r) = splitLast xs in (x:l,r)
(Note that I got rid of the "pos" parameter)
I'd like to have a function like
Data.List.viewR :: [a] -> Maybe ([a], a)
analogously to Data.Sequence, which is a safe replacement for 'init' and
'last'.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe