
26 Oct
2009
26 Oct
'09
2:59 p.m.
Am Montag 26 Oktober 2009 18:49:51 schrieb Jordan Cooper:
I was wondering if there is a built-in way to do what this function I wrote does (or at least a more elegant way, preferably without explicit recursion).
f xss = map safeHead xss : f (map safeTail xss)
(where safeHead/Tail are versions of head/tail that don't crash on [] input)
Not quite the same, but Prelude> :m +Data.List Prelude Data.List> transpose [[1,2],[],[3,4,5]] [[1,3],[2,4],[5]] could be more or less what you want.