mirror of
https://github.com/HigherOrderCO/Bend.git
synced 2024-10-11 10:50:09 +03:00
Fix Tagged Lambdas info on the readme
This commit is contained in:
parent
ee2c645cba
commit
3f5372a955
12
README.md
12
README.md
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user