Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {-factorial :: Integer -> Integer
- factorial n = n * (if (n == 1) then 1 else factorial (n-1))
- myfactorial 0 = 1
- myfactorial n = n * myfactorial(n-1)
- len [] = 0
- len s = 1 + len(tail s)
- len2 (x:xs) = 1 + len2 xs
- sum_pair p = fst p + snd p
- sum_pair2 (x, y) = x + y
- sum_triple (x, y, z) = x + y + z
- --siis pirveli ori ricxvis shekreba
- fs xs = head xs + head (tail xs)
- fs1 (a:b:cs) = a + b
- myhead (x:xs) = x
- myhead2 (x:_) = x
- mytail (_:xs) = xs
- func2 [] = 0
- func2 (x:y:xs) = x-y + func2 xs
- square [] = []
- square (x:xs) = x*x : square xs-}
- --------------------------------------------------------------
- kenti 0 = []
- kenti n = if (n < 0) then []
- else if ((mod n 2) == 0) then kenti (n-1)
- else n:kenti (n-2)
- luwi 0 = []
- luwi n = if (n < 0) then []
- else if ((mod n 2) /= 0) then luwi (n-1)
- else n:luwi (n-2)
- squares 0 = []
- squares n = (n*n):squares (n-1)
- myfactorial 0 = 1
- myfactorial n = n * myfactorial(n-1)
- factorials 0 = [1]
- factorials n = myfactorial(n):factorials(n-1)
- xarisxebi 0 = [1]
- xarisxebi n = 2^n:xarisxebi (n-1)
- --sashualo (x:xs) = x + sashualo xs
Advertisement
Add Comment
Please, Sign In to add comment