Introduction to Lambda in Scheme Programming

undefined
 
CSSE 304 Day 5
 
Instructor intro, part 2
Reflexive? solution
Lambda is magnificent
Recursion practice (letrec, named let?)
 
 
What questions do you have?
 
Guy Steele Discussion
 
In breakout rooms
Each student,  about 1 minute:
What about this video made the biggest impression on
you
 
reflexive? solution
 
Lambda is magnificent!
 
A procedure can
create and return
a new procedure
 
Procedures can
be anonymous
Make-adder is
a “curried”
procedure.
 
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)))  
  
6
(largest-in-lists '(() ()))
  
 
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
Slide Note
Embed
Share

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.

  • Scheme Programming
  • Lambda Functions
  • Recursive Procedures
  • Functional Programming

Uploaded on Sep 29, 2024 | 0 Views


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


  1. CSSE 304 Day 5 Instructor intro, part 2 Reflexive? solution Lambda is magnificent Recursion practice (letrec, named let?) What questions do you have?

  2. reflexive? solution

  3. Lambda is magnificent! A procedure can create and return a new procedure Make-adder is a curried procedure. Procedures can be anonymous

  4. 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 .

  5. 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.

  6. 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

Related


More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#