123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 |
- --- Empty functions
- None
- --- While loop
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- --- Range
- [0, 1, 2, 3, 4]
- --- Iter list
- 1
- 2
- 3
- 4
- 5
- --- Index list
- 0 1
- 1 2
- 2 3
- 3 4
- 4 5
- --- mul9
- 9
- 18
- 27
- 36
- 45
- --- Iter mul9
- 0 9
- 1 18
- 2 27
- 3 36
- 4 45
- --- Mapgen
- {[10] = ... (0x1409410), [6] = ... (0x1409310), ["this time with spaces"] = 6.283185, ["sublist"] = [1, ... (0x14091d0), 2, 3, 5, 8], ["submap"] = {["health"] = 42.000000, ["stamina"] = 100}, ["string"] = "hello", ["integer"] = ... (0x14091d0)}
- --- Map iter
- 10 10
- 6 6
- this time with spaces 6.283185
- sublist [1, ... (0x14091d0), 2, 3, 5, 8]
- submap {["health"] = 42.000000, ["stamina"] = 100}
- string hello
- integer 1
- --- try
- {["c"] = <Function>}
- [1, 15]
- {}
- [0, "Undefined method (call on singlet)", [[<Stmt[LIST]>, {["bad"] = <Function bad>, ["x"] = {}}], [<Stmt[RET]>, ... (0x145db20)]]]
- {["c"] = <Function>}
- 15
- --- Induced errors
- [0, "lp0 on fire", [[<Stmt[LIST]>, {["raise"] = <Function raise>, ["x"] = ... (0x145e2c0)}], [<Stmt[EXPR]>, ... (0x145f060)]]]
- --- Indexing
- 1
- 1
- 6
- --- Function binding
- 8 9 10
- 11 12 13
- --- Iterators
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- --- Method calls
- 1 2
- {["a"] = <Function>} 3
- --- Special methods
- Index {["__call"] = <Function>, ["__setindex"] = <Function>, ["__index"] = <Function>} 3
- Index {["__call"] = <Function>, ["__setindex"] = <Function>, ["__index"] = <Function>} 5
- 3 5
- SetIndex {["__call"] = <Function>, ["__setindex"] = <Function>, ["__index"] = <Function>} a 7
- Call {["__call"] = <Function>, ["__setindex"] = <Function>, ["__index"] = <Function>} q r
- q
- {["__setindex"] = {["b"] = 2, ["a"] = 1}, ["__index"] = ... (0x1464400)} 1 2
- {["__setindex"] = {["b"] = 2, ["a"] = 1}, ["__index"] = ... (0x1464400)} {... (0x1465400), ... (0x1465140)}
- --- Data sharing
- {["b"] = [1, 2, 3, 4, 5], ["a"] = ... (0x1465980)}
- {["b"] = [1, 2, 7, "c", 5], ["a"] = ... (0x1465980)}
- {["b"] = [1, 7, "c", "f", "q"], ["a"] = ... (0x1465980)}
- --- Arithmetic structure operations
- abcd
- lolololololololololololololololololololololololololololololololol
- [1, 2, 3, 4, 5]
- [1, 2, 3, ... (0x14091d0), ... (0x1409210), ... (0x1409250), ... (0x14091d0), ... (0x1409210), ... (0x1409250), ... (0x14091d0), ... (0x1409210), ... (0x1409250), ... (0x14091d0), ... (0x1409210), ... (0x1409250)]
- {["c"] = 3, ["b"] = 2, ["a"] = 1}
- --- Map/filter
- [1, 2, 3, 4, 5]
- [3, 6, 9, 12, 15]
- [3, 9, 15]
- --- Map/filter chain
- [3, 9, 15]
- --- Exec/eval
- Hello from exec!
- 8
- Hello from subtest!
- --- Modulus
- 2
- 3
- 0
- --- Special function manipulation
- <Function foo>
- <Function bar>
- [1, 2, 3]
- ["b", 1, 2, 3]
- --- Function body swapping
- <Function a> 0
- <Function b> 2
- <Stmt[LIST]>
- <Stmt[LIST]>
- <Function a> 2
- <Function b> 0
- <Stmt[LIST]>
- <Function a> 4
- <Function b> 4
- --- More complicated ASTs
- <Function outer> <Stmt[LIST]> [<Stmt[EXPR]>, <Stmt[EXPR]>, <Stmt[RET]>]
- --- Exec- and eval-by-parse
- Hello from parse()!
- 8
- --- Mutating ASTs
- <Function f> <Stmt[LIST]> 12
- <Function f> <Stmt[LIST]> 12
- a= 1 , b= 2
- <Function g> <Stmt[LIST]> None
- a= 1 , b= 2
- <Function g> <Stmt[LIST]> None
- --- AST Environments
- "<Stmt[LIST]>
- a is <Function a> and b is <Function b>
- {["b"] = 2, ["a"] = 1}
- a is 1 and b is 2
- {["b"] = 5, ["a"] = 4}
- {["b"] = ["world"], ["a"] = "hello"}
- a is hello and b is ["world"]
- {["b"] = 5, ["a"] = 4}
- {["__index"] = {["b"] = 2, ["a"] = 1}}
- {["b"] = 2, ["a"] = 1}
- a is 1 and b is 2
- {["b"] = 5, ["a"] = 4, ["__index"] = {["b"] = 2, ["a"] = 1}}
- {["b"] = 2, ["a"] = 1}
- --- Basic buffers
- (buffer.fromstring = <CFunction> )
- <Buffer @0x1474380 size 14
- (b.get = <CFunction> )
- Hello, world!
- QeLlo, world!
- , world!
- 1816946001
- 1886545252
- derpo, world!
- derpo, world!
- Goodbye! Goodbye!
- "A string!"
-
- ...is a SOL_STRING
- (buffer.sizeof.ptr = 8 )
- (buffer.sizeof.int = 4 )
- (buffer.sizeof.int*2 = 8 )
- (buffer.sizeof.int*2 + buffer.sizeof.ptr = 16 )
- ...string buffer: <Buffer @0x14743e0>
- ...with value: A string!
- --- IO redirection
- A line!
- An object: {["c"] = "turkey", ["b"] = 2, ["a"] = 1}
- Something mysterious :o
- Writing directly to a file :D...restored stdout.
- Buffered output was:
- ""
-
- ...second time.
- Hey there!
- lolololololololololololololololololololololololololololololololol
- ...restored.
- Output was:
- ""
-
- --- Substrings
- "This is a test!"
-
- "his is a test"
-
- "s is a te"
-
- "s "
-
- "s is a t"
-
- ""
-
- --- Splitting
- "This is a test!"
-
- ["This", "is", "a", "test!"]
-
- ["Th", "s ", "s a test!"]
-
- ["This is a test!"]
-
- ["Th", "s ", "s ", " t", "st!"]
-
- "This" "string"
-
- "is" "string"
-
- "a" "string"
-
- "test!" "string"
-
- --- Continue/break
- 0
- 1
- 2
- 3
- 4
- 5
- ---
- 1
- 3
- 5
- 7
- 9
- --- Control expressions
- 1 is true
- 0 is false
- [1000, 1002, 1004, 1006, 1008, 1010, 1012, 1014, 1016, 1018]
- ( 0 )
- ( 1 )
- ( 2 )
- ( 3 )
- ( 4 )
- ( 5 )
- 5
- --- All done!
|