mirror of
https://github.com/HigherOrderCO/Bend.git
synced 2024-09-11 11:56:54 +03:00
fix typo
This commit is contained in:
parent
c2f37ebfec
commit
3ac46e839e
8
GUIDE.md
8
GUIDE.md
@ -334,7 +334,7 @@ Here is how you create a perfect binary tree with copies of the number `7`:
|
||||
def main():
|
||||
|
||||
bend x = 0:
|
||||
while x < 3:
|
||||
when x < 3:
|
||||
tree = ![go(x + 1), go(x + 1)]
|
||||
else:
|
||||
tree = 7
|
||||
@ -403,7 +403,7 @@ It could be emulated with a `bend` in the following manner:
|
||||
|
||||
```python
|
||||
bend idx = 0:
|
||||
while idx < 10:
|
||||
when idx < 10:
|
||||
sum = idx + go(idx + 1)
|
||||
else:
|
||||
sum = 0
|
||||
@ -411,10 +411,6 @@ bend idx = 0:
|
||||
|
||||
Of course, if you do it, Bend's devs will be very disappointed with you.
|
||||
|
||||
## Example: Parallel Sum
|
||||
|
||||
TODO
|
||||
|
||||
## Example: Parallel Bitonic Sort
|
||||
|
||||
TODO
|
||||
|
@ -9,23 +9,23 @@ type Tree:
|
||||
def and(a, b):
|
||||
match a:
|
||||
case Bool/true:
|
||||
return b;
|
||||
return b
|
||||
case Bool/false:
|
||||
return Bool/false;
|
||||
return Bool/false
|
||||
|
||||
def all(tree):
|
||||
fold tree:
|
||||
case Tree/node:
|
||||
return and(tree.lft tree.rgt);
|
||||
return and(tree.lft tree.rgt)
|
||||
case Tree/leaf:
|
||||
return tree.val;
|
||||
return tree.val
|
||||
|
||||
def gen(n):
|
||||
switch n:
|
||||
case 0:
|
||||
return Tree/leaf(Bool/true);
|
||||
return Tree/leaf(Bool/true)
|
||||
case _:
|
||||
return Tree/node { lft: gen(n-1), rgt: gen(n-1) };
|
||||
return Tree/node { lft: gen(n-1), rgt: gen(n-1) }
|
||||
|
||||
def main():
|
||||
return all(gen(8));
|
||||
return all(gen(8))
|
||||
|
@ -39,9 +39,7 @@ data Tree = (Leaf val) | (Both lft rgt)
|
||||
(Sum (Tree/Leaf x)) = x
|
||||
(Sum (Tree/Both a b)) = (+ (Sum a) (Sum b))
|
||||
|
||||
(Main) =
|
||||
let n = 10
|
||||
(Sum (Sort 0 (Rev (Gen n 0))))
|
||||
(Main) = (Sum (Sort 0 (Rev (Gen 18 0))))
|
||||
|
||||
// Use an argument from cli
|
||||
// (Main n) = (Sum (Sort 0 (Rev (Gen n 0))))
|
||||
|
@ -22,4 +22,4 @@ def gen(depth):
|
||||
|
||||
// returns the sum of 0..2^16
|
||||
def main:
|
||||
return sum(gen(16))
|
||||
return sum(gen(24))
|
||||
|
Loading…
Reference in New Issue
Block a user