mirror of
https://github.com/artegoser/ONLang
synced 2024-12-22 17:13:46 +03:00
doc: import
This commit is contained in:
parent
0676d8691f
commit
4495ff9cb7
5 changed files with 51 additions and 22 deletions
|
@ -1,7 +1,7 @@
|
|||
# TODO CONCEPTS
|
||||
|
||||
- [x] Functions
|
||||
- [ ] imports
|
||||
- [x] imports
|
||||
- [x] scopes of visibility
|
||||
|
||||
- [ ] methods for arrays
|
||||
|
@ -12,7 +12,7 @@
|
|||
- [ ] command execution function
|
||||
- [ ] function for random
|
||||
- [x] delete variable
|
||||
- [ ] types conversion
|
||||
- [ ] types conversion `in process`
|
||||
- [ ] checking variable type
|
||||
- [x] checking for the existence of a variable
|
||||
- [x] create scopes without if, else, loop
|
||||
|
|
|
@ -8,6 +8,12 @@
|
|||
|
||||
`All posibilities in example.json5`
|
||||
|
||||
## How to import modules
|
||||
|
||||
```json5
|
||||
[{ import: { path: "examples/assertions.onla", as: "assertions" } }]
|
||||
```
|
||||
|
||||
## How to print
|
||||
|
||||
```json5
|
||||
|
|
11
examples/assertions.onla
Normal file
11
examples/assertions.onla
Normal file
|
@ -0,0 +1,11 @@
|
|||
//artegoser
|
||||
//assertions module for onlang
|
||||
[
|
||||
{
|
||||
fn: {
|
||||
name: "eq",
|
||||
args: ["a", "b"],
|
||||
body: [{ return: { comp: [{ var: "a" }, "==", { var: "b" }] } }],
|
||||
},
|
||||
},
|
||||
]
|
|
@ -64,42 +64,54 @@
|
|||
},
|
||||
},
|
||||
|
||||
{
|
||||
fn: {
|
||||
name: "_eq",
|
||||
args: ["a", "b"],
|
||||
body: [{ return: { comp: [{ var: "a" }, "==", { var: "b" }] } }],
|
||||
},
|
||||
},
|
||||
{ import: { path: "examples/assertions.onla", as: "assertions" } },
|
||||
|
||||
["10! == 3 628 800: ", { _eq: [{ fact: [10] }, 3628800] }],
|
||||
["11! == 39 916 800: ", { _eq: [{ fact: [11] }, 39916800] }],
|
||||
["10! == 3 628 800: ", { "assertions.eq": [{ fact: [10] }, 3628800] }],
|
||||
["11! == 39 916 800: ", { "assertions.eq": [{ fact: [11] }, 39916800] }],
|
||||
|
||||
["12! == 479 001 600: ", { _eq: [{ fact: [12] }, 479001600] }],
|
||||
["13! == 6 227 020 800: ", { _eq: [{ fact: [13] }, 6227020800] }],
|
||||
["12! == 479 001 600: ", { "assertions.eq": [{ fact: [12] }, 479001600] }],
|
||||
["13! == 6 227 020 800: ", { "assertions.eq": [{ fact: [13] }, 6227020800] }],
|
||||
|
||||
["14! == 87 178 291 200: ", { _eq: [{ fact: [14] }, 87178291200] }],
|
||||
["15! == 1 307 674 368 000: ", { _eq: [{ fact: [15] }, 1307674368000] }],
|
||||
[
|
||||
"14! == 87 178 291 200: ",
|
||||
{ "assertions.eq": [{ fact: [14] }, 87178291200] },
|
||||
],
|
||||
[
|
||||
"15! == 1 307 674 368 000: ",
|
||||
{ "assertions.eq": [{ fact: [15] }, 1307674368000] },
|
||||
],
|
||||
|
||||
["16! == 20 922 789 888 000: ", { _eq: [{ fact: [16] }, 20922789888000] }],
|
||||
["17! == 355 687 428 096 000: ", { _eq: [{ fact: [17] }, 355687428096000] }],
|
||||
[
|
||||
"16! == 20 922 789 888 000: ",
|
||||
{ "assertions.eq": [{ fact: [16] }, 20922789888000] },
|
||||
],
|
||||
[
|
||||
"17! == 355 687 428 096 000: ",
|
||||
{ "assertions.eq": [{ fact: [17] }, 355687428096000] },
|
||||
],
|
||||
|
||||
[
|
||||
"18! == 6 402 373 705 728 000: ",
|
||||
{ _eq: [{ fact: [18] }, 6402373705728000] },
|
||||
{ "assertions.eq": [{ fact: [18] }, 6402373705728000] },
|
||||
],
|
||||
[
|
||||
"19! == 121 645 100 408 832 000: ",
|
||||
{ _eq: [{ fact: [19] }, 121645100408832000] },
|
||||
{ "assertions.eq": [{ fact: [19] }, 121645100408832000] },
|
||||
],
|
||||
|
||||
[
|
||||
"20! == 2 432 902 008 176 640 000: ",
|
||||
{ _eq: [{ fact: [20] }, 2432902008176640000] },
|
||||
{ "assertions.eq": [{ fact: [20] }, 2432902008176640000] },
|
||||
],
|
||||
"",
|
||||
["(loop) 10! == 3 628 800: ", { _eq: [{ fact_loop: [10] }, 3628800] }],
|
||||
["(loop) 11! == 39 916 800: ", { _eq: [{ fact_loop: [11] }, 39916800] }],
|
||||
[
|
||||
"(loop) 10! == 3 628 800: ",
|
||||
{ "assertions.eq": [{ fact_loop: [10] }, 3628800] },
|
||||
],
|
||||
[
|
||||
"(loop) 11! == 39 916 800: ",
|
||||
{ "assertions.eq": [{ fact_loop: [11] }, 39916800] },
|
||||
],
|
||||
|
||||
// [
|
||||
// "21! == 51 090 942 171 709 440 000: ",
|
Loading…
Add table
Reference in a new issue