Fix Tagged Lambdas info on the readme

This commit is contained in:
LunaAmora 2024-01-10 08:52:34 -04:00
parent ee2c645cba
commit 3f5372a955

View File

@ -264,19 +264,19 @@ Similarly to dups and sups, lambdas and applications can have labels too.
For example, data types can be encoded as tagged lambdas:
```rs
// data Bool = T | F
T = @#Bool t @#Bool f t
F = @#Bool t @#Bool f f
T = λ#Bool t λ#Bool f t
F = λ#Bool t λ#Bool f f
// data List = (Cons x xs) | Nil
Cons = @x @xs @#List c @#List n (#List c x xs)
Nil = @#List c @#List n n
Cons = λx λxs λ#List c λ#List n (#List.Cons.xs (#List.Cons.x c x) xs)
Nil = λ#List c λ#List n n
```
When encoding the pattern matching, the application can then use the same label:
```rs
// not = @bool match bool { T: (F) F: (T) }
not = @bool (#Bool bool F T)
// not = λbool match bool { T: (F) F: (T) }
not = λbool (#Bool bool F T)
```
This allows, in some limited* scenarios, automatic vectorization: