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:
|
For example, data types can be encoded as tagged lambdas:
|
||||||
```rs
|
```rs
|
||||||
// data Bool = T | F
|
// data Bool = T | F
|
||||||
T = @#Bool t @#Bool f t
|
T = λ#Bool t λ#Bool f t
|
||||||
F = @#Bool t @#Bool f f
|
F = λ#Bool t λ#Bool f f
|
||||||
|
|
||||||
// data List = (Cons x xs) | Nil
|
// data List = (Cons x xs) | Nil
|
||||||
Cons = @x @xs @#List c @#List n (#List c x xs)
|
Cons = λx λxs λ#List c λ#List n (#List.Cons.xs (#List.Cons.x c x) xs)
|
||||||
Nil = @#List c @#List n n
|
Nil = λ#List c λ#List n n
|
||||||
```
|
```
|
||||||
|
|
||||||
When encoding the pattern matching, the application can then use the same label:
|
When encoding the pattern matching, the application can then use the same label:
|
||||||
|
|
||||||
```rs
|
```rs
|
||||||
// not = @bool match bool { T: (F) F: (T) }
|
// not = λbool match bool { T: (F) F: (T) }
|
||||||
not = @bool (#Bool bool F T)
|
not = λbool (#Bool bool F T)
|
||||||
```
|
```
|
||||||
|
|
||||||
This allows, in some limited* scenarios, automatic vectorization:
|
This allows, in some limited* scenarios, automatic vectorization:
|
||||||
|
Loading…
Reference in New Issue
Block a user