text stringlengths 19 585k | label stringclasses 2
values | category stringclasses 2
values | language stringclasses 14
values | repo stringclasses 932
values | sha stringlengths 40 40 |
|---|---|---|---|---|---|
@@ -3,48 +3,64 @@
It is possible to easily define complex data types using the `type` keyword.
```py
-# A Boolean is either True or False
-type Bool = True | False
+#{
+ A Boolean is either True or False | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/defining-data-types.md b/docs/defining-data-types.md
index c2bce26f..2fb0109f 100644
--- a/docs/defining-data-types.md
+++ b/docs/defining-data-types.md
@@ -3,31 +3,41 @@
It is possible to easily define complex data types using the `type` keyword.
```py
-# A Boolean is either True or False
-type B... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -3,48 +3,64 @@
It is possible to easily define complex data types using the `type` keyword.
```py
-# A Boolean is either True or False
-type Bool = True | False
+#{
+ A Boolean is either True or False
+}#
+type Bool:
+ True
+ False
```
If a constructor has any arguments, parentheses are necessary around ... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/defining-data-types.md b/docs/defining-data-types.md
index c2bce26f..2fb0109f 100644
--- a/docs/defining-data-types.md
+++ b/docs/defining-data-types.md
@@ -3,31 +3,41 @@
It is possible to easily define complex data types using the `type` keyword.
```py
-# A Boolean is either True or False
-type B... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -3,48 +3,64 @@
It is possible to easily define complex data types using the `type` keyword.
```py
-# A Boolean is either True or False
-type Bool = True | False
+#{
+ A Boolean is either True or False
+}#
+type Bool:
+ True
+ False
```
If a constructor has any arguments, parentheses are necessary around ... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/defining-data-types.md b/docs/defining-data-types.md
index c2bce26f..2fb0109f 100644
--- a/docs/defining-data-types.md
+++ b/docs/defining-data-types.md
@@ -3,31 +3,41 @@
It is possible to easily define complex data types using the `type` keyword.
```py
-# A Boolean is either True or False
-type B... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -3,48 +3,64 @@
It is possible to easily define complex data types using the `type` keyword.
```py
-# A Boolean is either True or False
-type Bool = True | False
+#{
+ A Boolean is either True or False
+}#
+type Bool:
+ True
+ False
```
If a constructor has any arguments, parentheses are necessary around ... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/defining-data-types.md b/docs/defining-data-types.md
index c2bce26f..2fb0109f 100644
--- a/docs/defining-data-types.md
+++ b/docs/defining-data-types.md
@@ -3,31 +3,41 @@
It is possible to easily define complex data types using the `type` keyword.
```py
-# A Boolean is either True or False
-type B... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -13,7 +13,7 @@ def main():
# The second argument is '0' if we want to load all functions immediately.
# Otherwise it should be '1' when we want to load functions as we use them.
# 'dl' is the unique id of the dynamic library.
- dl <- IO/DyLib/open("./libbend_dirs.so", 0)
+ dl <- IO/DyLib/open(".... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/ffi.md b/docs/ffi.md
index 0c770b6a..e69e4b14 100644
--- a/docs/ffi.md
+++ b/docs/ffi.md
@@ -27,8 +27,9 @@ def main():
# In our example, 'ls' receives a path as a String and
# returns a String with the result of the 'ls' command.
- files_bytes <- IO/DyLib/call(dl, "ls", "./")
- files... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -27,8 +27,8 @@ def main():
# In our example, 'ls' receives a path as a String and
# returns a String with the result of the 'ls' command.
- files_bytes <- IO/DyLib/call(dl, "ls", "./")
- files_str = String/decode_utf8(files_bytes)
+ files_bytes <- IO/DyLib/call(Result/unwrap(dl), "ls", "./") #IO... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/ffi.md b/docs/ffi.md
index 0c770b6a..e69e4b14 100644
--- a/docs/ffi.md
+++ b/docs/ffi.md
@@ -27,8 +27,9 @@ def main():
# In our example, 'ls' receives a path as a String and
# returns a String with the result of the 'ls' command.
- files_bytes <- IO/DyLib/call(dl, "ls", "./")
- files... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -11,6 +11,8 @@ from path import name
# or
import path/name
```
+## Placement
+Imports should be placed at the top of a file. | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/imports.md b/docs/imports.md
index ada25cd6..d3a849bb 100644
--- a/docs/imports.md
+++ b/docs/imports.md
@@ -10,6 +10,7 @@ Imports can be declared two ways:
from path import name
# or
import path/name
+# We recommend always placing the imports at the top of the file.
```
## Project Structure
| good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -2,7 +2,7 @@
In strict-mode, some types of recursive terms will unroll indefinitely.
-This is a simple piece of code that works on many other functional programming languages, including hvm's lazy-mode, but hangs on strict-mode:
+This is a simple piece of code that works on many other functional programming lan... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/lazy-definitions.md b/docs/lazy-definitions.md
index 1a9a8383..db491d14 100644
--- a/docs/lazy-definitions.md
+++ b/docs/lazy-definitions.md
@@ -2,7 +2,7 @@
In strict-mode, some types of recursive terms will unroll indefinitely.
-This is a simple piece of code that works on many other functional ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -16,20 +16,7 @@ Map = λf λlist
Main = (Map λx (+ x 1) (Cons 1 Nil))
```
-The recursive `Map` definition never gets reduced.
-Using the debug mode `-d` we can see the steps:
-
-```
-(Map λa (+ a 1) (Cons 1 Nil))
----------------------------------------
-(Map λa (+ a 1) λb λ* (b 1 Nil))
---------------------------... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/lazy-definitions.md b/docs/lazy-definitions.md
index 1a9a8383..db491d14 100644
--- a/docs/lazy-definitions.md
+++ b/docs/lazy-definitions.md
@@ -2,7 +2,7 @@
In strict-mode, some types of recursive terms will unroll indefinitely.
-This is a simple piece of code that works on many other functional ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -53,7 +40,7 @@ Map = λf λlist
This code will work as expected, since `cons` and `nil` are lambdas without free variables, they will be automatically floated to new definitions if the [float-combinators](compiler-options.md#float-combinators) option is active, allowing them to be unrolled lazily by hvm.
-It's re... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/lazy-definitions.md b/docs/lazy-definitions.md
index 1a9a8383..db491d14 100644
--- a/docs/lazy-definitions.md
+++ b/docs/lazy-definitions.md
@@ -2,7 +2,7 @@
In strict-mode, some types of recursive terms will unroll indefinitely.
-This is a simple piece of code that works on many other functional ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -50,13 +50,22 @@ minus_zero = -0.0
### Mixing number types
The three number types are fundamentally different.
-If you mix two numbers of different types, HVM will interpret the binary representation of one of them incorrectly, leading to incorrect results. Which number is interpreted incorrectly depends on the ... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/native-numbers.md b/docs/native-numbers.md
index 8bdc95e2..7838816b 100644
--- a/docs/native-numbers.md
+++ b/docs/native-numbers.md
@@ -49,14 +49,24 @@ minus_zero = -0.0
### Mixing number types
-The three number types are fundamentally different.
-If you mix two numbers of different types, HVM w... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -88,28 +88,37 @@ To ensure that recursive pattern matching functions don't loop in strict mode, i
```py
# This is what the Foo function actually compiles to.
# With -Olinearize-matches and -Ofloat-combinators (default on strict mode)
-(Foo) = λa λb λc (switch a { 0: Foo$C5; _: Foo$C8 } b c)
-
-(Foo$C5) = λd λe (d... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/pattern-matching.md b/docs/pattern-matching.md
index 69068e17..148ed206 100644
--- a/docs/pattern-matching.md
+++ b/docs/pattern-matching.md
@@ -27,21 +27,21 @@ Matches on ADT constructors are compiled to different expressions depending on t
type Maybe = (Some val) | None
UnwrapOrZero x = match x ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -88,28 +88,37 @@ To ensure that recursive pattern matching functions don't loop in strict mode, i
```py
# This is what the Foo function actually compiles to.
# With -Olinearize-matches and -Ofloat-combinators (default on strict mode)
-(Foo) = λa λb λc (switch a { 0: Foo$C5; _: Foo$C8 } b c)
-
-(Foo$C5) = λd λe (d... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/pattern-matching.md b/docs/pattern-matching.md
index 69068e17..148ed206 100644
--- a/docs/pattern-matching.md
+++ b/docs/pattern-matching.md
@@ -27,21 +27,21 @@ Matches on ADT constructors are compiled to different expressions depending on t
type Maybe = (Some val) | None
UnwrapOrZero x = match x ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -88,28 +88,37 @@ To ensure that recursive pattern matching functions don't loop in strict mode, i
```py
# This is what the Foo function actually compiles to.
# With -Olinearize-matches and -Ofloat-combinators (default on strict mode)
-(Foo) = λa λb λc (switch a { 0: Foo$C5; _: Foo$C8 } b c)
-
-(Foo$C5) = λd λe (d... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/pattern-matching.md b/docs/pattern-matching.md
index 69068e17..148ed206 100644
--- a/docs/pattern-matching.md
+++ b/docs/pattern-matching.md
@@ -27,21 +27,21 @@ Matches on ADT constructors are compiled to different expressions depending on t
type Maybe = (Some val) | None
UnwrapOrZero x = match x ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -123,18 +132,19 @@ Parse = λarg0 switch matched = (- arg0 '(') {
}
}
```
-Unlike with `switch`, with pattern matching equations you can't access the value of the predecessor of the matched value directly, but instead you can match on a variable.
+A key difference from direct switch expressions is how variable b... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/pattern-matching.md b/docs/pattern-matching.md
index 69068e17..148ed206 100644
--- a/docs/pattern-matching.md
+++ b/docs/pattern-matching.md
@@ -27,21 +27,21 @@ Matches on ADT constructors are compiled to different expressions depending on t
type Maybe = (Some val) | None
UnwrapOrZero x = match x ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -123,18 +132,19 @@ Parse = λarg0 switch matched = (- arg0 '(') {
}
}
```
-Unlike with `switch`, with pattern matching equations you can't access the value of the predecessor of the matched value directly, but instead you can match on a variable.
+A key difference from direct switch expressions is how variable b... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/pattern-matching.md b/docs/pattern-matching.md
index 69068e17..148ed206 100644
--- a/docs/pattern-matching.md
+++ b/docs/pattern-matching.md
@@ -27,21 +27,21 @@ Matches on ADT constructors are compiled to different expressions depending on t
type Maybe = (Some val) | None
UnwrapOrZero x = match x ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -123,18 +132,19 @@ Parse = λarg0 switch matched = (- arg0 '(') {
}
}
```
-Unlike with `switch`, with pattern matching equations you can't access the value of the predecessor of the matched value directly, but instead you can match on a variable.
+A key difference from direct switch expressions is how variable b... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/pattern-matching.md b/docs/pattern-matching.md
index 69068e17..148ed206 100644
--- a/docs/pattern-matching.md
+++ b/docs/pattern-matching.md
@@ -27,21 +27,21 @@ Matches on ADT constructors are compiled to different expressions depending on t
type Maybe = (Some val) | None
UnwrapOrZero x = match x ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -187,7 +187,7 @@ Returns the expression that follows. The last statement of each branch of a func
```py
# Allowed, all branches return
-def max(a, b):
+def max(a: T, b: T) -> T: | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/syntax.md b/docs/syntax.md
index 76e80c8e..299741f6 100644
--- a/docs/syntax.md
+++ b/docs/syntax.md
@@ -55,7 +55,7 @@ def add(x: u24, y: u24) -> u24:
def unchecked two() -> u24:
return 2
-def main:
+def main() -> u24:
return add(40, two)
```
@@ -307,7 +307,7 @@ For fields notated with `~`... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -207,7 +207,7 @@ def Foo(x):
```py
# Not allowed, one of the branches doesn't return
-def Foo(a, b):
+def Foo(a: T, b: T) -> T: | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/syntax.md b/docs/syntax.md
index 76e80c8e..299741f6 100644
--- a/docs/syntax.md
+++ b/docs/syntax.md
@@ -55,7 +55,7 @@ def add(x: u24, y: u24) -> u24:
def unchecked two() -> u24:
return 2
-def main:
+def main() -> u24:
return add(40, two)
```
@@ -307,7 +307,7 @@ For fields notated with `~`... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -307,7 +307,7 @@ For fields notated with `~` in the type definition, the fold function is called
It is equivalent to the inline recursive function:
```python
-def fold(x):
+def fold(x: Tree) -> u24: | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/syntax.md b/docs/syntax.md
index 76e80c8e..299741f6 100644
--- a/docs/syntax.md
+++ b/docs/syntax.md
@@ -55,7 +55,7 @@ def add(x: u24, y: u24) -> u24:
def unchecked two() -> u24:
return 2
-def main:
+def main() -> u24:
return add(40, two)
```
@@ -307,7 +307,7 @@ For fields notated with `~`... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -581,7 +581,7 @@ i24 = -42
u24 = 42
```
-Currently, the 3 number types cannot be mixed.
+Currently, the 3 number types cannot be mixed, but can be converted in order to correspond to each other. | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/syntax.md b/docs/syntax.md
index 76e80c8e..299741f6 100644
--- a/docs/syntax.md
+++ b/docs/syntax.md
@@ -55,7 +55,7 @@ def add(x: u24, y: u24) -> u24:
def unchecked two() -> u24:
return 2
-def main:
+def main() -> u24:
return add(40, two)
```
@@ -307,7 +307,7 @@ For fields notated with `~`... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -1350,14 +1350,14 @@ def main():
Use `#{ ... #}` to indicate a multi-line comment.
Multi-line commenting should also be used to document code.
-
+Documentation for functions is meant to be written as a multiline comment right above the function.
```py
#{
Expects two arguments to be passed.
This functio... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/syntax.md b/docs/syntax.md
index 76e80c8e..299741f6 100644
--- a/docs/syntax.md
+++ b/docs/syntax.md
@@ -55,7 +55,7 @@ def add(x: u24, y: u24) -> u24:
def unchecked two() -> u24:
return 2
-def main:
+def main() -> u24:
return add(40, two)
```
@@ -307,7 +307,7 @@ For fields notated with `~`... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -6,11 +6,10 @@ You can read the full reference for both of them [here](docs/syntax.md), but the
To see some more complex examples programs, check out the [examples](examples/) folder.
### Basic features
-
-We can start with a basic program that adds the numbers 3 and 2.
+Types in Bend are completely optional - y... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/FEATURES.md b/FEATURES.md
index 8f72a2bd..ce60841f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -8,9 +8,8 @@ To see some more complex examples programs, check out the [examples](examples/)
### Basic features
We can start with a basic program that adds the numbers 3 and 2.
-
```py
-def main:
+def main... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -130,24 +131,26 @@ def main:
return MyTree.sum(x)
```
+It should be noted that in this case, since MyTree has no type annotations, its fields will be considered of type Any, which partially disables the type checker for these values. Thus the fact that `x` is holding a tree of u24 and not a tree of anything el... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/FEATURES.md b/FEATURES.md
index 8f72a2bd..ce60841f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -8,9 +8,8 @@ To see some more complex examples programs, check out the [examples](examples/)
### Basic features
We can start with a basic program that adds the numbers 3 and 2.
-
```py
-def main:
+def main... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -266,28 +267,35 @@ Floating point numbers must have the decimal point `.` and can optionally take a
The three number types are fundamentally different.
If you mix two numbers of different types HVM will interpret the binary representation of one of them incorrectly, leading to incorrect results. Which number is in... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/FEATURES.md b/FEATURES.md
index 8f72a2bd..ce60841f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -8,9 +8,8 @@ To see some more complex examples programs, check out the [examples](examples/)
### Basic features
We can start with a basic program that adds the numbers 3 and 2.
-
```py
-def main:
+def main... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -266,28 +267,35 @@ Floating point numbers must have the decimal point `.` and can optionally take a
The three number types are fundamentally different.
If you mix two numbers of different types HVM will interpret the binary representation of one of them incorrectly, leading to incorrect results. Which number is in... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/FEATURES.md b/FEATURES.md
index 8f72a2bd..ce60841f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -8,9 +8,8 @@ To see some more complex examples programs, check out the [examples](examples/)
### Basic features
We can start with a basic program that adds the numbers 3 and 2.
-
```py
-def main:
+def main... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -266,28 +267,35 @@ Floating point numbers must have the decimal point `.` and can optionally take a
The three number types are fundamentally different.
If you mix two numbers of different types HVM will interpret the binary representation of one of them incorrectly, leading to incorrect results. Which number is in... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/FEATURES.md b/FEATURES.md
index 8f72a2bd..ce60841f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -8,9 +8,8 @@ To see some more complex examples programs, check out the [examples](examples/)
### Basic features
We can start with a basic program that adds the numbers 3 and 2.
-
```py
-def main:
+def main... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -339,38 +339,37 @@ A Map is desugared to a Map data type containing two constructors `Map/Leaf` and
```py
# When you write this
-def empty_map:
+def empty_map() -> Map(T):
return {}
-def init_map:
- return { 1: "one", 2: "two", `blue`: 0x0000FF }
+def init_map() -> Map(String):
+ return { 1: "one", 2: "tw... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/FEATURES.md b/FEATURES.md
index 8f72a2bd..ce60841f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -8,9 +8,8 @@ To see some more complex examples programs, check out the [examples](examples/)
### Basic features
We can start with a basic program that adds the numbers 3 and 2.
-
```py
-def main:
+def main... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -352,9 +367,9 @@ _recursive_. For example, the tree:
Could be represented as:
```
-tree = Tree/Node {
- lft: Tree/Node { left: Tree/Leaf { val: 1 }, right: Tree/Leaf { val: 2 } },
- rgt: Tree/Node { left: Tree/Leaf { val: 3 }, right: Tree/Leaf { val: 4 } }
+tree = Tree/Node{
+ left: Tree/Node{left: Tree/Leaf ... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/GUIDE.md b/GUIDE.md
index ea89b25c..f048b9b4 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -78,19 +78,28 @@ and recursion play an important role. This is how its `"Hello, world!"` looks:
def main():
return "Hello, world!"
```
-
+To run the program above, type:
+```
+bend run-rs main.bend
+```
Wait - there ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -33,13 +33,14 @@ def main(x, y):
# Calling with two argument
> bend run <path> +5 +3
-{+2 -2}
-
-# Calling with three argument
+{+2 -2}# | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/cli-arguments.md b/docs/cli-arguments.md
index c72f64e2..a6a58798 100644
--- a/docs/cli-arguments.md
+++ b/docs/cli-arguments.md
@@ -34,8 +34,7 @@ def main(x, y):
# Calling with two argument
> bend run <path> +5 +3
{+2 -2}
-
-# Calling with three argument
+# Calling with three arguments
# In this ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -50,13 +50,26 @@ minus_zero = -0.0
### Mixing number types
The three number types are fundamentally different.
-If you mix two numbers of different types, HVM will interpret the binary representation of one of them incorrectly, leading to incorrect results. Which number is interpreted incorrectly depends on the ... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/native-numbers.md b/docs/native-numbers.md
index 8bdc95e2..7838816b 100644
--- a/docs/native-numbers.md
+++ b/docs/native-numbers.md
@@ -49,14 +49,24 @@ minus_zero = -0.0
### Mixing number types
-The three number types are fundamentally different.
-If you mix two numbers of different types, HVM w... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -88,18 +88,19 @@ To ensure that recursive pattern matching functions don't loop in strict mode, i
```py
# This is what the Foo function actually compiles to.
# With -Olinearize-matches and -Ofloat-combinators (default on strict mode)
-(Foo) = λa λb λc (switch a { 0: Foo$C5; _: Foo$C8 } b c)
-
-(Foo$C5) = λd λe (d... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/pattern-matching.md b/docs/pattern-matching.md
index 69068e17..148ed206 100644
--- a/docs/pattern-matching.md
+++ b/docs/pattern-matching.md
@@ -27,21 +27,21 @@ Matches on ADT constructors are compiled to different expressions depending on t
type Maybe = (Some val) | None
UnwrapOrZero x = match x ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -88,18 +88,19 @@ To ensure that recursive pattern matching functions don't loop in strict mode, i
```py
# This is what the Foo function actually compiles to.
# With -Olinearize-matches and -Ofloat-combinators (default on strict mode)
-(Foo) = λa λb λc (switch a { 0: Foo$C5; _: Foo$C8 } b c)
-
-(Foo$C5) = λd λe (d... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/pattern-matching.md b/docs/pattern-matching.md
index 69068e17..148ed206 100644
--- a/docs/pattern-matching.md
+++ b/docs/pattern-matching.md
@@ -27,21 +27,21 @@ Matches on ADT constructors are compiled to different expressions depending on t
type Maybe = (Some val) | None
UnwrapOrZero x = match x ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -229,31 +254,22 @@ Here, `map` must be the name of the `Map` variable, and the keys inside `[]` can
### Map/empty
-Initializes an empty map.
-
```python
+#{
+ Initializes an empty map.
+#}
Map/empty = Map/Leaf
```
### Map/get
-Retrieves a `value` from the `map` based on the `key`.
-Returns a tuple wit... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/builtins.md b/docs/builtins.md
index ee6f4c17..4ab66dcc 100644
--- a/docs/builtins.md
+++ b/docs/builtins.md
@@ -7,7 +7,9 @@
## String
```python
-type String = (Cons head ~tail) | (Nil)
+type String:
+ Nil
+ Cons { head: u24, ~tail: String }
```
- **Nil**: Represents an empty string.
@@ -25,... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -229,31 +254,22 @@ Here, `map` must be the name of the `Map` variable, and the keys inside `[]` can
### Map/empty
-Initializes an empty map.
-
```python
+#{
+ Initializes an empty map.
+#}
Map/empty = Map/Leaf | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/builtins.md b/docs/builtins.md
index ee6f4c17..4ab66dcc 100644
--- a/docs/builtins.md
+++ b/docs/builtins.md
@@ -7,7 +7,9 @@
## String
```python
-type String = (Cons head ~tail) | (Nil)
+type String:
+ Nil
+ Cons { head: u24, ~tail: String }
```
- **Nil**: Represents an empty string.
@@ -25,... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -12,6 +12,7 @@
| `-Oinline` `-Ono-inline` | Disabled | [inline](#inline) |
| `-Ocheck-net-size` `-Ono-check-net-size` | Disabled | [check-net-size](#check-net-size) |
| `-Oadt-scott` `-Oadt-nu... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/compiler-options.md b/docs/compiler-options.md
index 71d817b6..2c4b42c7 100644
--- a/docs/compiler-options.md
+++ b/docs/compiler-options.md
@@ -12,7 +12,7 @@
| `-Oinline` `-Ono-inline` | Disabled | [inline](#inline) |
| `-... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -13,7 +13,7 @@ def main():
# The second argument is '0' if we want to load all functions immediately.
# Otherwise it should be '1' when we want to load functions as we use them.
# 'dl' is the unique id of the dynamic library.
- dl <- IO/DyLib/open("./libbend_dirs.so", 0)
+ dl <- Result/unwrap(IO... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/ffi.md b/docs/ffi.md
index 0c770b6a..e69e4b14 100644
--- a/docs/ffi.md
+++ b/docs/ffi.md
@@ -27,8 +27,9 @@ def main():
# In our example, 'ls' receives a path as a String and
# returns a String with the result of the 'ls' command.
- files_bytes <- IO/DyLib/call(dl, "ls", "./")
- files... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -50,13 +50,26 @@ minus_zero = -0.0
### Mixing number types
The three number types are fundamentally different.
-If you mix two numbers of different types, HVM will interpret the binary representation of one of them incorrectly, leading to incorrect results. Which number is interpreted incorrectly depends on the ... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/native-numbers.md b/docs/native-numbers.md
index 8bdc95e2..7838816b 100644
--- a/docs/native-numbers.md
+++ b/docs/native-numbers.md
@@ -49,14 +49,24 @@ minus_zero = -0.0
### Mixing number types
-The three number types are fundamentally different.
-If you mix two numbers of different types, HVM w... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -88,18 +88,20 @@ To ensure that recursive pattern matching functions don't loop in strict mode, i
```py
# This is what the Foo function actually compiles to.
# With -Olinearize-matches and -Ofloat-combinators (default on strict mode)
-(Foo) = λa λb λc (switch a { 0: Foo$C5; _: Foo$C8 } b c)
-
-(Foo$C5) = λd λe (d... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/pattern-matching.md b/docs/pattern-matching.md
index 69068e17..148ed206 100644
--- a/docs/pattern-matching.md
+++ b/docs/pattern-matching.md
@@ -27,21 +27,21 @@ Matches on ADT constructors are compiled to different expressions depending on t
type Maybe = (Some val) | None
UnwrapOrZero x = match x ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -717,103 +774,115 @@ String/encode_utf8 (String/Cons x xs) =
}
}
-# Decodes a sequence of bytes to a String using ascii encoding.
+#{ Decodes a sequence of bytes to a String using ascii encoding. #}
String/decode_ascii (bytes: (List u24)) : String
String/decode_ascii (List/Cons x xs) = (String/Cons x (St... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/src/fun/builtins.bend b/src/fun/builtins.bend
index 8b188bef..2d708f30 100644
--- a/src/fun/builtins.bend
+++ b/src/fun/builtins.bend
@@ -6,7 +6,7 @@ type List(T):
Nil
Cons { head: T, ~tail: List(T) }
-# Returns the length of a list and the list itself.
+#{ Returns a tuple containing the length and... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -88,18 +88,19 @@ To ensure that recursive pattern matching functions don't loop in strict mode, i
```py
# This is what the Foo function actually compiles to.
# With -Olinearize-matches and -Ofloat-combinators (default on strict mode)
-
-(Foo__C5) = λa switch a { 0: λ* B; _: Foo__C4; } # Foo.case_0
-(Foo__C4) = ... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/pattern-matching.md b/docs/pattern-matching.md
index 69068e17..148ed206 100644
--- a/docs/pattern-matching.md
+++ b/docs/pattern-matching.md
@@ -27,21 +27,21 @@ Matches on ADT constructors are compiled to different expressions depending on t
type Maybe = (Some val) | None
UnwrapOrZero x = match x ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -75,73 +76,80 @@ String/equals (String/Cons x xs) (String/Cons y ys) =
}
String/equals * * = 0
-# Splits a list into two lists at the first occurrence of a value.
+#{ Splits a string into a list of strings based on the given delimiter. #}
String/split (s: String) (delimiter: u24) : (List String)
String/split... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/src/fun/builtins.bend b/src/fun/builtins.bend
index 8b188bef..2d708f30 100644
--- a/src/fun/builtins.bend
+++ b/src/fun/builtins.bend
@@ -6,7 +6,7 @@ type List(T):
Nil
Cons { head: T, ~tail: List(T) }
-# Returns the length of a list and the list itself.
+#{ Returns a tuple containing the length and... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -366,21 +384,37 @@ def IO/sleep(seconds: f24) -> IO(None):
## File IO
### File IO primitives
+
+#{ Opens a file with with `path` being given as a string and `mode` being a string with the mode to open the file in. The mode should be one of the following: #} | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/src/fun/builtins.bend b/src/fun/builtins.bend
index 8b188bef..2d708f30 100644
--- a/src/fun/builtins.bend
+++ b/src/fun/builtins.bend
@@ -6,7 +6,7 @@ type List(T):
Nil
Cons { head: T, ~tail: List(T) }
-# Returns the length of a list and the list itself.
+#{ Returns a tuple containing the length and... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -717,103 +774,115 @@ String/encode_utf8 (String/Cons x xs) =
}
}
-# Decodes a sequence of bytes to a String using ascii encoding.
+#{ Decodes a sequence of bytes to a String using ascii encoding. #}
String/decode_ascii (bytes: (List u24)) : String
String/decode_ascii (List/Cons x xs) = (String/Cons x (St... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/src/fun/builtins.bend b/src/fun/builtins.bend
index 8b188bef..2d708f30 100644
--- a/src/fun/builtins.bend
+++ b/src/fun/builtins.bend
@@ -6,7 +6,7 @@ type List(T):
Nil
Cons { head: T, ~tail: List(T) }
-# Returns the length of a list and the list itself.
+#{ Returns a tuple containing the length and... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -88,19 +88,23 @@ To ensure that recursive pattern matching functions don't loop in strict mode, i
```py
# This is what the Foo function actually compiles to.
# With -Olinearize-matches and -Ofloat-combinators (default on strict mode)
+# Main function
(Foo) = λa λb λc (switch a { 0: Foo__C8; _: Foo__C9; } b c)
... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/pattern-matching.md b/docs/pattern-matching.md
index 69068e17..148ed206 100644
--- a/docs/pattern-matching.md
+++ b/docs/pattern-matching.md
@@ -27,21 +27,21 @@ Matches on ADT constructors are compiled to different expressions depending on t
type Maybe = (Some val) | None
UnwrapOrZero x = match x ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -60,20 +60,20 @@ They offer more advanced pattern matching capabilities and also take care linear
Pattern matching equations are transformed into a tree of `match` and `switch` terms from left to right.
```py
# These two are equivalent
-(Foo 0 false (Cons h1 (Cons h2 t))) = (A h1 h2 t)
-(Foo 0 * *) = B
+(Foo 0 fa... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/pattern-matching.md b/docs/pattern-matching.md
index 69068e17..148ed206 100644
--- a/docs/pattern-matching.md
+++ b/docs/pattern-matching.md
@@ -27,21 +27,21 @@ Matches on ADT constructors are compiled to different expressions depending on t
type Maybe = (Some val) | None
UnwrapOrZero x = match x ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -27,21 +27,21 @@ Matches on ADT constructors are compiled to different expressions depending on t
type Maybe = (Some val) | None
UnwrapOrZero x = match x {
- Some: x.val
- None: 0
+ Maybe/Some: x.val
+ Maybe/None: 0
}
# If the current encoding is 'adt-num-scott' it becomes:
-Some = λval λx (x 0 val)
-Non... | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/pattern-matching.md b/docs/pattern-matching.md
index 69068e17..148ed206 100644
--- a/docs/pattern-matching.md
+++ b/docs/pattern-matching.md
@@ -27,21 +27,21 @@ Matches on ADT constructors are compiled to different expressions depending on t
type Maybe = (Some val) | None
UnwrapOrZero x = match x ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -153,7 +153,7 @@ Foo _ = 3
Hi (String/Cons 'h' (String/Cons 'i' String/Nil)) = 2
Hi _ = 0
-Foo List.nil = 0
-Foo (List.cons x List.nil) = x
+Foo List/nil = 0
+Foo (List/cons x List/nil) = x | bad | review | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
diff --git a/docs/pattern-matching.md b/docs/pattern-matching.md
index 69068e17..148ed206 100644
--- a/docs/pattern-matching.md
+++ b/docs/pattern-matching.md
@@ -27,21 +27,21 @@ Matches on ADT constructors are compiled to different expressions depending on t
type Maybe = (Some val) | None
UnwrapOrZero x = match x ... | good | review_fixed | HigherOrderCO/Bend | 4979b1413f3f7afcafe62c2d8a8203c351d5611a | |
@@ -170,62 +170,111 @@ def Tree/reverse(tree: Tree(T)) -> Tree(T):
case Tree/Node:
return ![tree.right, tree.left]
-# MAP Impl
+# BOOL Impl
+type Bool:
+ True
+ False
-type Map T = (Node (value: T) ~(left: (Map T)) ~(right: (Map T))) | (Leaf)
-
-Map/empty : (Map T) = Map/Leaf
-
-Map/get (map: (Map T))... | bad | review | HigherOrderCO/Bend | 88db4e4589c55ac1a530084b325067cc12b87c98 | |
diff --git a/src/fun/builtins.bend b/src/fun/builtins.bend
index 29d94f0e7..8b188bef2 100644
--- a/src/fun/builtins.bend
+++ b/src/fun/builtins.bend
@@ -170,62 +170,111 @@ def Tree/reverse(tree: Tree(T)) -> Tree(T):
case Tree/Node:
return ![tree.right, tree.left]
-# MAP Impl
-
-type Map T = (Node (value: ... | good | review_fixed | HigherOrderCO/Bend | 88db4e4589c55ac1a530084b325067cc12b87c98 | |
@@ -170,62 +170,111 @@ def Tree/reverse(tree: Tree(T)) -> Tree(T):
case Tree/Node:
return ![tree.right, tree.left]
-# MAP Impl
+# BOOL Impl
+type Bool:
+ True
+ False
-type Map T = (Node (value: T) ~(left: (Map T)) ~(right: (Map T))) | (Leaf)
-
-Map/empty : (Map T) = Map/Leaf
-
-Map/get (map: (Map T))... | bad | review | HigherOrderCO/Bend | 88db4e4589c55ac1a530084b325067cc12b87c98 | |
diff --git a/src/fun/builtins.bend b/src/fun/builtins.bend
index 29d94f0e7..8b188bef2 100644
--- a/src/fun/builtins.bend
+++ b/src/fun/builtins.bend
@@ -170,62 +170,111 @@ def Tree/reverse(tree: Tree(T)) -> Tree(T):
case Tree/Node:
return ![tree.right, tree.left]
-# MAP Impl
-
-type Map T = (Node (value: ... | good | review_fixed | HigherOrderCO/Bend | 88db4e4589c55ac1a530084b325067cc12b87c98 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.