Better extension for bang source files.

This commit is contained in:
2011-01-06 18:04:17 -08:00
parent 39ff973e81
commit 3f14f02eb3

24
bsrc/Data/List.bs Normal file
View File

@@ -0,0 +1,24 @@
module Data.List
data List a = Null | (:) a (List a)
(++) :: [a] -> [a] -> [a]
a ++ [] = a
[] ++ b = b
(af:ar) ++ b = af:(ar ++ b)
null :: [a] -> Bool
null [] = True
null _ = False
length :: [a] -> Word
length [] = 0
length (a:rest) = 1 + length rest
reverse :: [a] -> [a]
reverse xs = helper xs []
where
helper [] acc = acc
helper (a:rest) acc = helper rest (a:acc)