202311041711

Tags : Programming Languages, Lambda Calculus

Pattern Matching to Ordinary Lambda Calculus


Here we remove the pattern matching used in Enriched Lambda Calculus.

For variable pattern we don’t have to do anything. For the Other patterns we can do the following


Reducing the Number of Built-in Functions

The trouble with the above 3 steps is that they introduce a lot of built in functions for each constructor.

The idea is to give each constructor a tag, and have a general function that takes in the tag and arity of the constructor as in input to return a function which acts the same. This is the simplification that we get

  • (sum constructor) is replaced with
  • is replaced with
  • (product constructor) is replace with
  • is replaced with
  • is replaced with where
  • is the arity
  • is the structure tag of
  • is the structure tag of

Summary


References

Enriched Lambda Calculus Patterns