The Sol Programming Language!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

245 lines 4.7 KiB Raw Blame History

 --- 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 { = ... (0x1409410),  = ... (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"] = } [1, 15] {} [0, "Undefined method (call on singlet)", [[, {["bad"] = , ["x"] = {}}], [, ... (0x145db20)]]] {["c"] = } 15 --- Induced errors [0, "lp0 on fire", [[, {["raise"] = , ["x"] = ... (0x145e2c0)}], [, ... (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"] = } 3 --- Special methods Index {["__call"] = , ["__setindex"] = , ["__index"] = } 3 Index {["__call"] = , ["__setindex"] = , ["__index"] = } 5 3 5 SetIndex {["__call"] = , ["__setindex"] = , ["__index"] = } a 7 Call {["__call"] = , ["__setindex"] = , ["__index"] = } 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 [1, 2, 3] ["b", 1, 2, 3] --- Function body swapping 0 2 2 0 4 4 --- More complicated ASTs [, , ] --- Exec- and eval-by-parse Hello from parse()! 8 --- Mutating ASTs 12 12 a= 1 , b= 2 None a= 1 , b= 2 None --- AST Environments " a is and b is {["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 = ) ) 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: ...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!