Questions tagged [lambda-calculus]

λ-calculus is a formal system for function definition, function application and recursion which forms the mathematical basis of functional programming.

λ-calculus is a formal system for function definition, function application and recursion which forms the mathematical basis of functional programming.

Since many people ask how to reduce λ-expressions with the intermediate steps, take a look at Lambda calculus reduction workbench and its interpreter.

Related Tags

Church-Encoding

References
Lean - Function Abstraction and Evaluation

576 questions
881
votes
6 answers

What part of Hindley-Milner do you not understand?

I swear there used to be a T-shirt for sale featuring the immortal words: What part of do you not understand? In my case, the answer would be... all of it! In particular, I often see notation like this in Haskell papers, but I have no clue what…
286
votes
4 answers

Why is Haskell (GHC) so darn fast?

Haskell (with the GHC compiler) is a lot faster than you'd expect. Used correctly, it can get close-ish to low-level languages. (A favorite thing for Haskellers to do is to try and get within 5% of C (or even beat it, but that means you are using an…
PyRulez
  • 9,505
  • 9
  • 37
  • 82
138
votes
2 answers

Why are λ-calculus optimal evaluators able to compute big modular exponentiations without formulas?

Church numbers are an encoding of natural numbers as functions. (\ f x → (f x)) -- church number 1 (\ f x → (f (f (f x)))) -- church number 3 (\ f x → (f (f (f (f x))))) -- church number 4 Neatly, you can exponentiate 2 church…
73
votes
11 answers

How helpful is knowing lambda calculus?

To all the people who know lambda calculus: What benefit has it bought you, regarding programming? Would you recommend that people learn it?
TraumaPony
  • 10,573
  • 12
  • 52
  • 72
57
votes
8 answers

What are some resources for learning Lambda Calculus?

So the Wikipedia entry on Lambda Calculus was interesting but I've finished it. I wish to dive a little deeper and get a better understanding of Lambda Calculus. Can anyone recommend what they consider to be the best book or primer to Lambda…
mmcdole
  • 86,293
  • 60
  • 181
  • 221
54
votes
10 answers

What is call/cc?

I've tried several times to grasp the concept of continuations and call/cc. Every single attempt was a failure. Can somebody please explain me these concepts, ideally with more realistic examples than these on Wikipedia or in other SO posts. I have…
Michał Niedźwiedzki
  • 12,483
  • 7
  • 41
  • 47
45
votes
1 answer

How did Haskell add Turing-completeness to System F?

I've been reading up on various type systems and lambda calculi, and i see that all of the typed lambda calculi in the lambda cube are strongly normalizing rather than Turing equivalent. This includes System F, the simply typed lambda calculus plus…
36
votes
3 answers

What is meant by "Capture-avoiding substitutions"?

While reading the Lambda Calculus in Wiki, came across the term Capture-avoiding substitutions. Can someone please explain what it means as I couldn't find a definition from anywhere. Thanks PS What I want to know is the reason for telling that…
Pradeep
  • 577
  • 6
  • 17
35
votes
2 answers

Lambda Calculus Reduction steps

I am studying Lambda Calculus and I am stuck at Reduction.... Can anyone explain the types of reduction with this example, especially beta reduction in the simplest way possible. Also wouldn't mind an easy to understand tutorial. (λxyz .xyz )(λx .xx…
Alternator
  • 375
  • 1
  • 4
  • 8
34
votes
1 answer

Is it possible to build a comparatively fast untyped lambda calculus machine?

Pure untyped lambda calculus is a powerful concept. However, building a machine or interpreter for real-world use is often described as (close to) impossible. I want to investigate this. Is it theoretically possible to build a comparatively fast…
Jostein
  • 3,054
  • 1
  • 20
  • 26
32
votes
3 answers

Calling/applying lambda vs. function call - the syntax in Ruby is different. Why?

I am kinda new to Ruby and still trying to understand some of the language design principles. IF I've got it right, the lambda expression call in Ruby must be with square braces, while the "regular" function call is with "regular"/round braces. Is…
BreakPhreak
  • 9,150
  • 23
  • 65
  • 106
30
votes
1 answer

Code exercising the unique possibilities of each edge of the lambda calculus

I can't explain the term lambda cube much better than Wikipedia does: [...] the λ-cube is a framework for exploring the axes of refinement in Coquand's calculus of constructions, starting from the simply typed lambda calculus as the vertex of a…
soc
  • 27,310
  • 18
  • 99
  • 209
27
votes
3 answers

What type of lambda calculus would Lisp loosely be an example of?

I'm trying to get a better grip on how types come into play in lambda calculus. Admittedly, a lot of the type theory stuff is over my head. Lisp is a dynamically typed language, would that roughly correspond to untyped lambda calculus? Or is…
Jason Baker
  • 171,942
  • 122
  • 354
  • 501
26
votes
3 answers

Church lists in Haskell

I had to implement the haskell map function to work with church lists which are defined as following: type Churchlist t u = (t->u->u)->u->u In lambda calculus, lists are encoded as following: [] := λc. λn. n [1,2,3] := λc. λn. c 1 (c 2 (c 3…
jcdmb
  • 2,986
  • 5
  • 35
  • 53
24
votes
2 answers

Why can't (Set -> Set) have type Set?

In Agda, the type of a forall is determined in such a way that the following all have type Set1 (where Set1 is the type of Set and A has type Set): Set → A A → Set Set → Set However, the following has type Set: A → A I understand that if Set had…
1
2 3
38 39