Lucas Stadler преди 11 години
родител
ревизия
5d5fd0ca92
променени са 1 файла, в които са добавени 6 реда и са изтрити 0 реда
  1. 6 0
      hs/DataStructures.hs

+ 6 - 0
hs/DataStructures.hs

36
fromList [] = nil
36
fromList [] = nil
37
fromList (x:xs) = cons x $ fromList xs
37
fromList (x:xs) = cons x $ fromList xs
38
38
39
toList :: (Seq s) => s a -> [a]
40
toList s | isEmpty s = []
41
toList s =
42
    case first s of
43
        Just x -> x : toList (rest s)
44
39
butLast :: (Seq s) => s a -> s a
45
butLast :: (Seq s) => s a -> s a
40
butLast s | isEmpty s = nil
46
butLast s | isEmpty s = nil
41
butLast s =
47
butLast s =