You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
813 B
55 lines
813 B
def (f a b)
|
|
(a ++ b)
|
|
|
|
def (add a b)
|
|
(a + b)
|
|
|
|
def (catstrs strs)
|
|
(foldr f
|
|
(head strs)
|
|
(tail strs))
|
|
|
|
def strs ["aa", "bb"]
|
|
|
|
def (mymap f xs)
|
|
if ((length xs) == 0)
|
|
then
|
|
xs
|
|
else
|
|
((f (head xs))
|
|
: (mymap f (tail xs)))
|
|
|
|
def empty []
|
|
|
|
def getFile
|
|
(readFile "./parse.js")
|
|
|
|
def fileLines
|
|
(getFile >>=
|
|
((mapM_ putStrLn) . lines))
|
|
|
|
def (testUnary n)
|
|
((-n) + n)
|
|
|
|
def (splitHelp acc xs ys)
|
|
if (null xs)
|
|
then ((reverse acc), ys)
|
|
else if (null (tail xs))
|
|
then ((reverse acc), ys)
|
|
else
|
|
(splitHelp ((head ys) : acc)
|
|
(tail (tail xs))
|
|
(tail ys))
|
|
|
|
def (splitxs xs)
|
|
(splitHelp [] xs xs)
|
|
|
|
def main
|
|
((print (testUnary 6)) >>
|
|
if False
|
|
then
|
|
undefined
|
|
else fileLines
|
|
>>
|
|
(print
|
|
(splitxs [12,3,4,56])))
|
|
|