Merge branch 'dev'
This commit is contained in:
12
README.md
12
README.md
@@ -169,29 +169,29 @@ bool empty # => false
|
|||||||
Using these, you can build a lot of fundamental functional paradigm functions.
|
Using these, you can build a lot of fundamental functional paradigm functions.
|
||||||
|
|
||||||
```
|
```
|
||||||
:. map ?: f Any -> Any ?. x [Any] -> [Any]
|
:. map : f ?. x [] -> []
|
||||||
?? bool x
|
?? bool x
|
||||||
+ f head x map 'f tail x
|
+ f head x map 'f tail x
|
||||||
empty
|
empty
|
||||||
map ;y ** y 2 [1 2 3 4 5 6 7 8 9 10] # => [1 4 9 16 25 36 49 64 81 100]
|
map ;x ** x 2 [1 2 3 4 5 6 7 8 9 10] # => [1 4 9 16 25 36 49 64 81 100]
|
||||||
|
|
||||||
:: iterate : f i count -> [Any]
|
:: iterate : f i count -> []
|
||||||
?? > count 0
|
?? > count 0
|
||||||
+ i iterate 'f f i - count 1
|
+ i iterate 'f f i - count 1
|
||||||
empty
|
empty
|
||||||
iterate ;x + 1 x 0 10 # => [0 1 2 3 4 5 6 7 8 9]
|
iterate ;x + 1 x 0 10 # => [0 1 2 3 4 5 6 7 8 9]
|
||||||
|
|
||||||
:. take ?. n Int ?. x [Any] -> [Any]
|
:. take ?. n Int ?. x [] -> []
|
||||||
?? > n 0
|
?? > n 0
|
||||||
+ head x take - n 1 tail x
|
+ head x take - n 1 tail x
|
||||||
empty
|
empty
|
||||||
take 3 [1 2 3 4 5] # => [1 2 3]
|
take 3 [1 2 3 4 5] # => [1 2 3]
|
||||||
|
|
||||||
:. take'while : pred Any -> Bool ?. x [Any] -> [Any]
|
:. take'while ?: pred Any -> Bool ?. x [] -> []
|
||||||
?? && bool x pred head x
|
?? && bool x pred head x
|
||||||
+ head x take'while 'pred tail x
|
+ head x take'while 'pred tail x
|
||||||
empty
|
empty
|
||||||
take'while ;y < y 10 [1 3 5 7 9 11 13 15 16] # => [1 3 5 7 9]
|
take'while ;x < x 10 [1 3 5 7 9 11 13 15 16] # => [1 3 5 7 9]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Lambdas
|
## Lambdas
|
||||||
|
|||||||
22
TODO.md
Normal file
22
TODO.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
## Internal Details
|
||||||
|
|
||||||
|
- arrays as iterators instead of a vector
|
||||||
|
- a virtual machine and bytecode
|
||||||
|
|
||||||
|
## Language Features
|
||||||
|
|
||||||
|
- tuples
|
||||||
|
- `extern "C"` functions
|
||||||
|
- modules (`import` function)
|
||||||
|
- structs
|
||||||
|
- data types (need an IO object for stateful functions to return)
|
||||||
|
- unpacking type parameters (`(x:xs)` in Haskell for example)
|
||||||
|
- type variables in function parameters and data types
|
||||||
|
- automatic Int to Float casting if a parameter expects a float
|
||||||
|
- `[x..y]` array generators
|
||||||
|
- `(+)` = `;.x y + x y`
|
||||||
|
|
||||||
|
## Maybe Add
|
||||||
|
|
||||||
|
- `/` for float division and `//` for integer division
|
||||||
@@ -5,8 +5,8 @@ fn main() {
|
|||||||
|
|
||||||
for value in runtime.values() {
|
for value in runtime.values() {
|
||||||
match value {
|
match value {
|
||||||
Ok(v) => println!("{v}"),
|
Ok(v) => println!("=> {v}"),
|
||||||
Err(e) => eprintln!("{e}"),
|
Err(e) => eprintln!("error: {e}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user