maybeToList (Just a) = [a]
maybeToList _ = []
+"""
+`takeWhile p l`, returns the longest prefix (possibly empty) of list `l` of elements that satisfy `p`
+"""
+takeWhile :: (a -> <e> Boolean) -> [a] -> <e> [a]
+takeWhile f l = loop 0
+ where
+ len = length l
+ loop i | i == len = l
+ | f (l!i) = loop (i+1)
+ | otherwise = take i l
+
partition :: (a -> <e> Boolean) -> [a] -> <e> ([a], [a])
partition p l = runProc do
res1 = newArrayList