## Slide 1

### Slide 1 text

Y-Combinator @matyo91 25-04-2023 In PHP

## Slide 2

### Slide 2 text

⾠ I’m not an expert ⾠ I will speak with my own words @matyo91 @matyo91 25-04-2023

## Slide 3

### Slide 3 text

Objectives : Go back up to theoretical concepts that solve an issue How I discovered Y-Combinator and why I do need them ? Why Y-Combinator ? Introduction to Lambda Calculus Exemples of basic Lambda Calculus and equivalent in PHP Y-Combinator in PHP (for me and others github repositories) Plan @matyo91 25-04-2023 @matyo91

## Slide 4

### Slide 4 text

How I discovered Y-Combinator ? @matyo91 25-04-2023 Why I need them ?

## Slide 5

### Slide 5 text

In PHP https://github.com/darkwood-fr/flow In PHP https://github.com/phpflo/phpflo 25-04-2023 Flow Based Railway Flow Based MulByTwo MinusThree AddOne @matyo91

## Slide 6

### Slide 6 text

Why Y-Combinator ? @matyo91 25-04-2023 What does it solve ?

## Slide 7

### Slide 7 text

Do recursion in a language that do not have any recursion mechanism at all “ @matyo91 25-04-2023

## Slide 8

### Slide 8 text

Recursive Iterative @matyo91 @matyo91 25-04-2023

## Slide 9

### Slide 9 text

Pipe @matyo91 @matyo91 25-04-2023

## Slide 10

### Slide 10 text

A Y-combinator is a "functional" (a function that operates on other functions) that enables recursion, when you can't refer to the function from within itself. In computer-science theory, it generalises recursion, abstracting its implementation, and thereby separating it from the actual work of the function in question. This is applicable in languages that support Lambda-Calculus functions Y-Combinator @matyo91 25-04-2023 @matyo91

## Slide 11

### Slide 11 text

Lambda Calculus @matyo91 25-04-2023

## Slide 12

### Slide 12 text

Alonzo Church ( 1903 - 1995 ) Inventor of Lambda Calculus @matyo91 @matyo91 25-04-2023

## Slide 13

### Slide 13 text

Church Turing @matyo91 @matyo91 25-04-2023

## Slide 14

### Slide 14 text

λ x . x + 1 ( λ x . x + 1 ) ( 5 ) = 5 + 1 = 6 @matyo91 @matyo91 25-04-2023 X X + 1

## Slide 15

### Slide 15 text

λ x . λ y . x+y     ( λ x . λ y . x+y ) ( 5 , 6 ) = 5 + 6 = 11 @matyo91 @matyo91 25-04-2023 X X + Y Y

## Slide 16

### Slide 16 text

There are variables. We got a way to build functions. We can apply functions to each others by providing elements of the language itself. All derivatives of lambda calculus language is something defined in terms of this definition. Lambda Calculus @matyo91 25-04-2023 @matyo91

## Slide 17

### Slide 17 text

True ? False ? @matyo91 @matyo91 25-04-2023

## Slide 18

### Slide 18 text

@matyo91 @matyo91 25-04-2023

## Slide 19

### Slide 19 text

True = λ x . λ y . x False = λ x . λ y . y @matyo91 @matyo91 25-04-2023 X X Y True X Y Y False

## Slide 20

### Slide 20 text

True = λ x . λ y . x @matyo91 @matyo91 25-04-2023 False = λ x . λ y . y

## Slide 21

### Slide 21 text

Not ? @matyo91 @matyo91 25-04-2023

## Slide 22

### Slide 22 text

@matyo91 @matyo91 25-04-2023

## Slide 23

### Slide 23 text

Not = λ b . b False True @matyo91 @matyo91 25-04-2023 b False True b Not

## Slide 24

### Slide 24 text

Not = ( λ b . b False True ) ( True ) = True False True = ( λ x . λ y . x ) ( False True ) = False @matyo91 @matyo91 25-04-2023

## Slide 25

### Slide 25 text

@matyo91 @matyo91 25-04-2023 Not = λ b . b False True

## Slide 26

### Slide 26 text

Y-Combinator @matyo91 25-04-2023

## Slide 27

### Slide 27 text

Y ( f ) = f ( Y ( f ) ) = f ( f ( Y ( f ) ) ) = f ( f ( f ( f ( ... ) ) ) ) @matyo91 @matyo91 25-04-2023

## Slide 28

### Slide 28 text

Fac (n) = if n == 1 then 1 else n * Fac (n - 1)   Fac (3) = 3 * Fac (2) = 3 * 2 * Fac (1) = 3 * 2 * 1 = 6 @matyo91 @matyo91 25-04-2023 YCombinator in Lambda Calculus

## Slide 29

### Slide 29 text

Fac = Y ( ? ) @matyo91 @matyo91 25-04-2023 YCombinator in Lambda Calculus

## Slide 30

### Slide 30 text

Fac = Y ( ? ) = Y ( λ f . λ n . ? ) = Y ( λ f . λ n . max( n , 1 ) * Fac ( n - 1 ) ) @matyo91 @matyo91 25-04-2023 YCombinator in Lambda Calculus

## Slide 31

### Slide 31 text

Loop = ? @matyo91 @matyo91 25-04-2023 YCombinator in Lambda Calculus

## Slide 32

### Slide 32 text

Loop = Loop @matyo91 @matyo91 25-04-2023 YCombinator in Lambda Calculus

## Slide 33

### Slide 33 text

Loop = ( λ x . x . x ) ( λ x . x . x ) @matyo91 @matyo91 25-04-2023 YCombinator in Lambda Calculus

## Slide 34

### Slide 34 text

Loop = ( λ x . x . x ) ( λ x . x . x ) @matyo91 @matyo91 25-04-2023 YCombinator in Lambda Calculus

## Slide 35

### Slide 35 text

Loop = ( λ x . x . x ) ( λ x . x . x ) Loop = ( λ x . ( λ x . x . x ) . ( λ x . x . x ) ) @matyo91 @matyo91 25-04-2023 YCombinator in Lambda Calculus

## Slide 36

### Slide 36 text

Loop = ( λ x . x . x ) ( λ x . x . x ) Loop = ( λ x . ( λ x . x . x ) . ( λ x . x . x ) ) Loop = ( λ x . x . x ) ( λ x . x . x ) @matyo91 @matyo91 25-04-2023 YCombinator in Lambda Calculus

## Slide 37

### Slide 37 text

Loop = Y ( ? ) @matyo91 @matyo91 25-04-2023 YCombinator in Lambda Calculus

## Slide 38

### Slide 38 text

Loop = Y ( λ x . x . x ) = ( λ x . x . x ) ( Y ( λ x . x . x ) ) = ( λ x . x . x ) ( λ x . x . x ) ( Y ( λ x . x . x ) ) @matyo91 @matyo91 25-04-2023 YCombinator in Lambda Calculus

## Slide 39

### Slide 39 text

Y ( f ) = λ f ( λ x . f ( x x ) ) ( λ x . f ( x x ) ) @matyo91 @matyo91 25-04-2023 YCombinator in Lambda Calculus

## Slide 40

### Slide 40 text

https://github.com/darkwood-fr/flow @matyo91 @matyo91 25-04-2023 YCombinator in PHP

## Slide 41

### Slide 41 text

https://github.com/loophp/combinator @matyo91 @matyo91 25-04-2023

## Slide 42

### Slide 42 text

https://github.com/igorw/lambda-php @matyo91 @matyo91 25-04-2023

## Slide 43

### Slide 43 text

In Real Life @matyo91 25-04-2023 @matyo91

## Slide 44

### Slide 44 text

Hello! I Am Mathieu Ledru You can contact me at @matyo91 25-04-2023 @matyo91 Thanks! Any questions?