• Post Reply Bookmark Topic Watch Topic
  • New Topic

Slide Deck: Understanding Java 8 Lambdas and Streams - Part 1 - Lambda Calculus, Lambda Expression

 
Philip Schwarz
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Quick summary of the talk:
* We start playing a bit with integer streams
* We soon come across lambda expressions
* We introduce the Lambda Calculus and show that it is Turing Complete.
* We look at how Java lambda expressions relate to lambda Calculus ones
* We look at how the two differ
* We ask ourselves: are functions 1st class citizens in Java 8?
* We look at what ‘1st class functions‘ means in Haskell and Scala
* We compare Java’s approach to ‘1st class functions’ with Scala’s
* We ask ourselves:
o are Java lambda expressions objects?
o are Java lambda expressions syntactic sugar for anonymous instances of functional interfaces?
o Is it possible to write a recursive lambda expression in Java 8?
* We get answers to those questions
 
Stephan van Hulst
Bartender
Posts: 6583
84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Philip, welcome to CodeRanch!

What answers did you come up with?
 
Stephan van Hulst
Bartender
Posts: 6583
84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah sorry, I thought you had questions for us!
 
Stephan van Hulst
Bartender
Posts: 6583
84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I went through some of the slides and you had a snippet to illustrate recursive lambdas:
You talk about the Y-combinator in your slides, which I implemented in Java a while ago. It's not pretty, but it works!
 
Philip Schwarz
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Stephan

Nice!

Have you seen how Samir Talwar implements the lambda calculus in Java? He defines the Y combinator and uses it to write fizzbuzz: https://github.com/SamirTalwar/FizzBuzz/blob/master/src/main/java/com/noodlesandwich/fizzbuzz/%CE%BBs.java

Philip
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!