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.

- 27 -and body:λsecond.firstWhen applied <strong>to</strong> an argument, it returns a new function which when applied <strong>to</strong> another argument returns the firstargument. For example:((select_first identity) apply) ==((λfirst.λsecond.first identity) apply) =>(λsecond.identity apply) =>identityIn general, applying select_first <strong>to</strong> arbitrary arguments:and:returns the first argument:((select_first ) ) ==((λfirst.λsecond.first ) ) =>(λsecond. ) =>2.12.2. Selecting the second of two argumentsConsider the function:def select_second = λfirst.λsecond.secondThis function has bound variable:and body:firstλsecond.secondwhich is another version of the identity function. When applied <strong>to</strong> an argument select_second returns a newfunction which when applied <strong>to</strong> another argument returns the other argument. For example:((select_second identity) apply) ==((λfirst.λsecond.second identity) apply) =>(λsecond.second apply) =>apply

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

Saved successfully!

Ooh no, something went wrong!