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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

- 141 -λ[a,b].(SUM_SQ2 a b)so:def uncurry_SUM_SQ [a,b] = SUM_SQ2 a bNow, the use of uncurry_SUM_SQ with an argument list is equivalent <strong>to</strong> the use of SUM_SQ2 with nestedarguments.The functions curry and uncurry are inverses. For an arbitrary function:consider:uncurry (curry ) ==λg.λ[a,b].(g a b) (λf.λx.λy.(f [x,y]) ) ->λg.λ[a,b].(g a b) λx.λy.( [x,y]) =>λ[a,b].(λx.λy.( [x,y]) a b)which simplifies <strong>to</strong>:λ[a,b].( [a,b]) ==Here we have used a form of η reduction <strong>to</strong> simplify:<strong>to</strong>:Similarly:λ[,]).( [,])curry (uncurry ) ==λf.λx.λy.(f [x,y]) (λg.λ[a,b].(g a b) ) ->λf.λx.λy.(f [x,y]) (λ[a,b].(λx.λy.(λ[a,b].( a b) [x,y])which simplifies <strong>to</strong>:λx.λy.( x y) ==Again we have used a form of η reduction <strong>to</strong> simplify:λ.λ.( )

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

Saved successfully!

Ooh no, something went wrong!