Lambda Calculus: A Core Language for Programming Concepts, Study notes of Programming Languages

The concept of lambda calculus, a minimal and turing complete programming language. It explains the intuition behind lambda calculus expressions, higher-order functions, and the puzzle game used to understand its rules. The eating rule, color rule, old alligator rule, and examples of lambda calculus expressions.

Typology: Study notes

Pre 2010

Uploaded on 02/13/2009

koofers-user-izl
koofers-user-izl 🇺🇸

9 documents

1 / 31

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CMSC 330: Organization of
Programming Languages
Lambda Calculus Introduction
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f

Partial preview of the text

Download Lambda Calculus: A Core Language for Programming Concepts and more Study notes Programming Languages in PDF only on Docsity!

CMSC 330: Organization of

Programming Languages

Lambda Calculus Introduction

Introduction

  • (^) We’ve seen that several language conveniences aren’t strictly necessary - (^) Multi-argument functions: use currying or tuples - (^) Loops: use recursion - (^) Side-effects: we don't need them either
  • (^) Goal: come up with a “core” language that’s as small as possible and still Turing complete - (^) This will give a way of illustrating important language features and algorithms

Intuitive Understanding

  • (^) Before we work more with the mathematical notation of lambda calculus, we’re going to play a puzzle game!
  • (^) From: http://worrydream.com/AlligatorEggs/

Puzzle Pieces

  • (^) Hungry alligators: eat and guard family
  • (^) Old alligators: guard family
  • (^) Eggs: hatch into new family

Puzzle Rule 1: The Eating Rule

  • (^) If families are side-by-side the top left alligator eats the entire family to her right
  • (^) The top left alligator dies
  • (^) Any eggs she was guarding of the same color hatch into what she just ate

Eating Rule Practice

  • (^) What happens to these alligators? Puzzle 1:

Eating Rule Practice

  • (^) What happens to these alligators? Puzzle 1: Puzzle 2: Answer 1: Answer 2:

Puzzle Rule 2: The Color Rule

  • (^) If an alligator is about to eat a family and a color appears in both families then we need to change that color in one of the families. - (^) In the picture below, green and red appear in both the first and second families. So, in the second family, we switch all of the greens to cyan, and all of the reds to blue.
  • (^) If a color appears in both families, but only as an egg, no color change is made.