10.07.2015 Views

An Introduction to Functional Programming Through Lambda Calculus

An Introduction to Functional Programming Through Lambda Calculus

An Introduction to Functional Programming Through Lambda Calculus

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

- 235 -λy.y5 reductionsλf.λa.(f a) λx.x λy.y reduced onceii)Normal orderλx.λy.x λx.x (λs.(s s) λs.(s s)) =>λy.λx.x (λs.(s s) λs.(s s)) =>λx.x2 reductionsλs.(s s) λs.(s s) not reducedApplicative orderλx.λy.x λx.x (λs.(s s) λs.(s s)) ->λx.λy.x λx.x (λs.(s s) λs.(s s)) -> ...Non-terminating - 1 reduction/cycleλs.(s s) λs.(s s) reduced every cycleLazyλx.λy.x λx.x (λs.(s s) λs.(s s)) =>λy.λx.x (λs.(s s) λs.(s s)) =>λx.x2 reductions - as normal orderiii)Normal orderλa.(a a) (λf.λs.(f (s s)) λx.x) =>(λf.λs.(f (s s)) λx.x) (λf.λs.(f (s s)) λx.x) =>λs.(λx.x (s s)) (λf.λs.(f (s s)) λx.x) =>λx.x ((λf.λs.(f (s s)) λx.x) (λf.λs.(f (s s)) λx.x)) =>(λf.λs.(f (s s)) λx.x) (λf.λs.(f (s s)) λx.x) => ...Non-terminating - 3 reductions/cycleλf.λs.(f (s s)) λx.x reduced every cycleApplicative orderλa.(a a) (λf.λs.(f (s s)) λx.x) ->λa.(a a) λs.(λx.x (s s)) ->λs.(λx.x (s s)) λs.(λx.x (s s)) ->λx.x (λs.(λx.x (s s)) λs.(λx.x (s s))) ->λs.(λx.x (s s)) λs.(λx.x (s s)) -> ...Non-terminating - 2 reductions/cycleλf.λs.(f (s s)) λx.x reduced before non-terminating cycleLazyλa.(a a) (λf.λs.(f (s s)) λx.x) 1=>(λf.λs.(f (s s)) λx.x) 1(λf.λs.(f (s s)) λx.x) 1=>λs.(λx.x (s s)) λs.(λx.x (s s)) =>λx.x (λs.(λx.x (s s)) λs.(λx.x (s s))) =>λs.(λx.x (s s)) λs.(λx.x (s s)) => ...Non-terminating - 2 reductions/cycleλf.λs.(f (s s)) λx.x reduced before non-terminating cycle

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!