Introduction to Lambda in Scheme Programming
Explore the power of Lambda in Scheme programming through reflexive solutions, recursion practice, and creating curried procedures. Learn how procedures can be first-class data objects and try hands-on exercises like writing the largest-in-lists code using letrec and named let. Pair programming and practical examples enhance understanding of functional programming concepts.
Download Presentation
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
E N D
Presentation Transcript
CSSE 304 Day 5 Instructor intro, part 2 Reflexive? solution Lambda is magnificent Recursion practice (letrec, named let?) What questions do you have?
Lambda is magnificent! A procedure can create and return a new procedure Make-adder is a curried procedure. Procedures can be anonymous
A first-class data object Can be stored in a data structure Can be passed as an argument to a procedure Can be returned by a procedure In Scheme, procedures are first- class. In some other languages, they are second-class citizens .
Breakout rooms Work with the other group members to try to write the largest-in-lists code. Along the way, experiment with letrec and/or named let.
Exercise Write largest-in-lists, which takes a list of lists of numbers and finds the largest number. Returns #f if there are no numbers in any of the lists. Try to create at least one of your recursive procedures using use letrec or named let (largest-in-lists '((1 3 5) () (4) (2 6 1) (4))) (largest-in-lists '(() ())) 6 f#f Work with another student or two. Pair program. Test cases available on the PLC grading server. There is also a file with test code: Live-in-class/Day05