Commit 85527acb authored by nx's avatar nx
Browse files

[project @ 2005-06-06 12:48:35 by nx]

add testing examples
for arity analysis
parent fccd6043
module F0 where
f0 :: Int -> Int -> Int -> Int
f0 x y = if (x>0) then let v = x + y
in \z -> v+z
else \z-> 1
\ No newline at end of file
module F1 where
f1 = let h1 n x = if x<n then let v = h1 n (x+1)
in \y -> v (x+y)
else \y -> y
in h1 5 1 5
\ No newline at end of file
module F10 where
f10f = \h -> (h 1 2, h 3)
f10g = \x -> \y -> x+y
f10h = f10f f10g
f10x1 = fst f10h
f10x2 = snd f10h
f10 = f10x2 f10x1
module F11 where
fib 0 = 1
fib 1 = 1
fib n = fib (n-1) + fib (n-2)
f11f = \z -> let x = fib 1000
in \y -> x+y
f11 = (f11f 5 6, f11f 7 8)
module F12 where
f12 = let f g x = g x
h = (+)
in f h 4 5
module F13 where
f13 x y = let f13f = if (x>0) then \z -> z x y
else \z -> y
f13h = let v = f13f 5
in \w -> w + v
in \u -> f13h u
module F14 where
f14 n x = if x<n then let v = f14 n (x+1)
in \y -> v (x+y)
else \y -> y
module F15 where
f15f = \h -> h 1
f15g = \x -> x+1
f15 = f15f f15g
\ No newline at end of file
module F2 where
f2f = \h -> \x -> h x 0
f2 = let g = \x -> \y -> if (x > 0)
then g (x-1) (x+y)
else y
in f2f g 5
\ No newline at end of file
module F3 where
fac :: Int -> Int
fac x = if (x==0) then 1
else x*fac (x-1)
f3 = let v = fac
in \y -> v y
\ No newline at end of file
module F4 where
f4h :: (Int -> Int) -> Int -> Int
f4h f x = if x==0 then (f x)
else f4h f (x-1) -- + (f x)
f4g = \y->y+1
f4 = f4h f4g 9
\ No newline at end of file
module F5 where
-- result not satisfiable
f5g h z = (h z) + 1
f5h f x g = f x + f5g g x -- + (f (x+1))
f5y = (\y -> y+1)
f5 = f5h f5y 0 f5y
\ No newline at end of file
module F6 where
f6f = \h -> \x -> h x 0
f6t = \y -> \z -> y + z
f6 = f6f f6t 3
\ No newline at end of file
module F7 where
f7f = \x -> x
f7g = \z -> \y -> z+y
f7 = f7f f7g 2 3
module F8 where
f8f b x y = let g = \z -> x+y+z
in if b then y else g (x*x)
f8 = f8f True 1 2
\ No newline at end of file
module F9 where
f91 = let f = \n -> if n<=100 then f (f (n+11)) else n-10
in f 10
\ No newline at end of file
module Prim where
map2 f [] = []
map2 f (x:xs) = f x : map2 f xs
zipWith2 f [] [] = []
zipWith2 f (a:x) (b:y) = (f a b):zipWith2 f x y
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment