mirror of
https://github.com/HigherOrderCO/Bend.git
synced 2024-09-11 03:45:29 +03:00
Fix tiny grammar mistakes
This commit is contained in:
parent
66a8be1c33
commit
2676db5960
20
GUIDE.md
20
GUIDE.md
@ -6,7 +6,7 @@ feels like Python, but scales like CUDA. It runs on CPUs and GPUs, and you don't
|
||||
have to do anything to make it parallel: as long as your code isn't "helplessly
|
||||
sequential", it **will** use 1000's of threads!
|
||||
|
||||
While cool, Bend far from perfect. In absolute terms it is still not so fast.
|
||||
While cool, Bend is far from perfect. In absolute terms it is still not so fast.
|
||||
Compared to SOTA compilers like GCC or GHC, our code gen is still embarrassingly
|
||||
bad, and there is a lot to improve. That said, it does scale horizontally with
|
||||
cores - and that's really cool. So, if you'd like to be an early adopter of this
|
||||
@ -251,7 +251,7 @@ def main:
|
||||
return is_even(7)
|
||||
```
|
||||
|
||||
Which is immutable. If that's sound annoying, that's because **it is**. Don't
|
||||
Which is immutable. If that sounds annoying, that's because **it is**. Don't
|
||||
let anyone tell you otherwise. We are aware of that, and we have many ideas on
|
||||
how to improve this, making Bend feel even more Python-like. For now, we have to
|
||||
live with it. But, wait... if variables are immutable... how do we even do
|
||||
@ -267,7 +267,7 @@ def sum(x):
|
||||
|
||||
Here, the entire way the algorithm works is by mutating the `total` variable.
|
||||
Without mutability, loops don't make sense. The good news is Bend has *something
|
||||
else* that is equally as - actually, mode - powerful. And learning it is really
|
||||
else* that is equally as - actually, more - powerful. And learning it is really
|
||||
worth your time. Let's do it!
|
||||
|
||||
Folds and Bends
|
||||
@ -312,8 +312,8 @@ As usual, for now, we'll live with the longer version.
|
||||
|
||||
Now, here's a question: how do we *sum* the elements of a tree? In Python, we
|
||||
could just use a loop. In Bend, we don't have loops. Fortunately, there is
|
||||
another construct we can use: is called `fold`, and it works like a *search and
|
||||
replace* for datatypes. For example, consider the code below:
|
||||
another construct we can use: it's called `fold`, and it works like a *search
|
||||
and replace* for datatypes. For example, consider the code below:
|
||||
|
||||
|
||||
```python
|
||||
@ -490,7 +490,7 @@ for i in range(8):
|
||||
sum += i
|
||||
```
|
||||
|
||||
Is actually just a short way to write:
|
||||
Is actually just a similar way to write:
|
||||
|
||||
```python
|
||||
sum = (0 + (1 + (2 + (3 + (4 + (5 + (6 + 7)))))))
|
||||
@ -532,7 +532,7 @@ So, how do you write a parallel program in Bend?
|
||||
|
||||
**Just write algorithms that aren't helplessly sequential.**
|
||||
|
||||
That's all there is to it. As long as you write programs like that one, and
|
||||
That's all there is to it. As long as you write programs like that one, then
|
||||
unlike the former one, they will run in parallel. And that's why `bend` and
|
||||
`fold` are core features: they're, essentially, parallelizable loops. For
|
||||
example, to add numbers in parallel, we can write:
|
||||
@ -569,8 +569,8 @@ That's **18x faster**! Can we do better? Sure: let's use the **C compiler** now:
|
||||
bend gen-c main.bend >> main.c
|
||||
```
|
||||
|
||||
This command converts your `bend` file in a small, dependency-free C file that
|
||||
does the same computation much faster. You can compile it to an executable:
|
||||
This command converts your `bend` file into a small, dependency-free C file
|
||||
that does the same computation much faster. You can compile it to an executable:
|
||||
|
||||
```
|
||||
gcc main.c -o main -O2 -lm -lpthread # if you're on Linux
|
||||
@ -753,7 +753,7 @@ has an entire "secret" Haskell-like syntax that is compatible with old HVM1. For
|
||||
example,
|
||||
[here](https://gist.github.com/VictorTaelin/9cbb43e2b1f39006bae01238f99ff224) is
|
||||
an implementation of the Bitonic Sort with Haskell-like equations. We'll
|
||||
document it syntax here soon!
|
||||
document its syntax here soon!
|
||||
|
||||
Community
|
||||
---------
|
||||
|
Loading…
Reference in New Issue
Block a user