Implemented auto-popping; web site design improvements.
jump to
@@ -94,13 +94,13 @@ "kind": "symbol",
"name": "::" }, "<": { - "description": "Returns true if a1 is smaller than a2, false otherwise. \n \n Note\n \n Only comparisons among two numbers or two strings are supported.", + "description": "Returns true if a1 is smaller than a2, false otherwise. \r\n \r\n Note\r\n \r\n Only comparisons among two numbers or two strings are supported.", "kind": "symbol", "name": "<", "signature": "a1 a2 ==> bool" }, "<=": { - "description": "Returns true if a1 is smaller than or equal to a2, false otherwise.\n \n Note\n \n Only comparisons among two numbers or two strings are supported.", + "description": "Returns true if a1 is smaller than or equal to a2, false otherwise.\r\n \r\n Note\r\n \r\n Only comparisons among two numbers or two strings are supported.", "kind": "symbol", "name": "<=", "signature": "a1 a2 ==> bool"@@ -127,7 +127,7 @@ "name": "==",
"signature": "a1 a2 ==> bool" }, "==>": { - "description": "Symbol used to separate input and output calues in operator signatures.", + "description": "Symbol used to separate input and output values in operator signatures.", "kind": "symbol", "name": "==>", "signature": " ==> "@@ -143,7 +143,7 @@ "kind": "symbol",
"name": "=~" }, ">": { - "description": "Returns true if a1 is greater than a2, false otherwise. \n \n Note\n \n Only comparisons among two numbers or two strings are supported.", + "description": "Returns true if a1 is greater than a2, false otherwise. \r\n \r\n Note\r\n \r\n Only comparisons among two numbers or two strings are supported.", "kind": "symbol", "name": ">", "signature": "a1 a2 ==> bool"@@ -154,7 +154,7 @@ "kind": "symbol",
"name": "><" }, ">=": { - "description": "Returns true if a1 is greater than or equal to a2, false otherwise.\n \n Note\n \n Only comparisons among two numbers or two strings are supported.", + "description": "Returns true if a1 is greater than or equal to a2, false otherwise.\r\n \r\n Note\r\n \r\n Only comparisons among two numbers or two strings are supported.", "kind": "symbol", "name": ">=", "signature": "a1 a2 ==> bool"@@ -175,7 +175,7 @@ "kind": "symbol",
"name": "@" }, "ROOT": { - "description": "Returns a module holding a reference to the [ROOT](class:kwd) scope.\n\n \n Tip\n \n This symbol is very useful in conjunction with the **with** operator.", + "description": "Returns a module holding a reference to the [ROOT](class:kwd) scope.\r\n\r\n \r\n Tip\r\n \r\n This symbol is very useful in conjunction with the **with** operator.", "kind": "symbol", "name": "ROOT", "signature": " ==> dict"@@ -233,6 +233,12 @@ "kind": "symbol",
"name": "append", "signature": "a quot ==> (a* a)" }, + "apply": { + "description": "Returns a new quotation obtained by evaluating each element of quot in a separate stack.", + "kind": "symbol", + "name": "apply", + "signature": "quot ==> (a*)" + }, "apply-interpolate": { "description": "The same as pushing apply and then interpolate on the stack.", "kind": "symbol",@@ -306,7 +312,7 @@ "name": "bitxor",
"signature": "int1 int2 ==> int3" }, "bool": { - "description": "Converts a to a boolean value based on the following rules:\n \n * If a is a boolean value, no conversion is performed.\n * If a is null, it is converted to false .\n * If a is a numeric value, zero is converted to false , otherwise it is converted to true.\n * If a is a quotation or a dictionary, the empty quotation or dictionary is converted to false , otherwise it is converted to true.\n * If a is a string, the empty string, and \"false\" are converted to false , otherwise it is converted to true.", + "description": "Converts a to a boolean value based on the following rules:\r\n \r\n * If a is a boolean value, no conversion is performed.\r\n * If a is null, it is converted to false .\r\n * If a is a numeric value, zero is converted to false , otherwise it is converted to true.\r\n * If a is a quotation or a dictionary, the empty quotation or dictionary is converted to false , otherwise it is converted to true.\r\n * If a is a string, the empty string, and \"false\" are converted to false , otherwise it is converted to true.", "kind": "symbol", "name": "bool", "signature": "a ==> bool"@@ -330,7 +336,7 @@ "name": "capitalize",
"signature": "'sym ==> string" }, "case": { - "description": "This operator takes a quotation containing _n_ different conditional branches. \n \n Each branch must be a quotation containing two quotations, and it is processed as follows:\n \n * if quot1 evaluates to true, then the quot2 is executed.\n * if quot1 evaluates to false , then the following branch is processed (if any).\n \n \n Example\n \n The following program prints \"Smaller than 3\":\n \n 2 (\n (( 3) (\"Greater than 3\" put!))\n ((< 3) (\"Smaller than 3\" put!))\n ((true) (\"Exactly 3\" put!))\n ) case", + "description": "This operator takes a quotation containing _n_ different conditional branches. \r\n \r\n Each branch must be a quotation containing two quotations, and it is processed as follows:\r\n \r\n * if quot1 evaluates to true, then the quot2 is executed.\r\n * if quot1 evaluates to false , then the following branch is processed (if any).\r\n \r\n \r\n Example\r\n \r\n The following program prints \"Smaller than 3\":\r\n \r\n 2 (\r\n (( 3) (\"Greater than 3\" put!))\r\n ((< 3) (\"Smaller than 3\" put!))\r\n ((true) (\"Exactly 3\" put!))\r\n ) case", "kind": "symbol", "name": "case", "signature": "((quot1 quot2)*) ==> a*"@@ -348,13 +354,13 @@ "name": "ceil",
"signature": "num ==> int" }, "chmod": { - "description": "Sets the permissions of file or directory 'sym to int. int is a three-digit representation of user, group and other permissions. See the [Unix Permissions Calculator](http://permissions-calculator.org/) for examples and conversions.\n \n \n Example\n \n The following program makes the file **/tmp/test.txt** readable, writable and executable by its owner, and readable and executable by users of the same group and all other users:\n \n /tmp/test.txt 755 chmod", + "description": "Sets the permissions of file or directory 'sym to int. int is a three-digit representation of user, group and other permissions. See the [Unix Permissions Calculator](http://permissions-calculator.org/) for examples and conversions.\r\n \r\n \r\n Example\r\n \r\n The following program makes the file **/tmp/test.txt** readable, writable and executable by its owner, and readable and executable by users of the same group and all other users:\r\n \r\n /tmp/test.txt 755 chmod", "kind": "symbol", "name": "chmod", "signature": "'sym int ==> " }, "choose": { - "description": "Prints string2, then prints all string1 included in the quotation prepended with a number, and waits from valid input from the user.\n \n If the user enters a number that matches one of the choices, then the corresponding quotation quot1 is executed, otherwise the choice menu is displayed again until a valid choice is made.", + "description": "Prints string2, then prints all string1 included in the quotation prepended with a number, and waits from valid input from the user.\r\n \r\n If the user enters a number that matches one of the choices, then the corresponding quotation quot1 is executed, otherwise the choice menu is displayed again until a valid choice is made.", "kind": "symbol", "name": "choose", "signature": "((string1 quot1)+) string2 ==> a*"@@ -378,7 +384,7 @@ "name": "clear-stack",
"signature": "a ==> " }, "cleave": { - "description": "Applies each quotation contained in the first element to the second element a1.\n \n Example\n \n The following program leaves 2 on the stack:\n \n (1 2 3) ((sum) (size)) cleave /", + "description": "Applies each quotation contained in the first element to the second element a1.\r\n \r\n Example\r\n \r\n The following program leaves 2 on the stack:\r\n \r\n (1 2 3) ((sum) (size)) cleave /", "kind": "symbol", "name": "cleave", "signature": "a1 (quot*) ==> a*"@@ -408,13 +414,13 @@ "name": "concat",
"signature": "quot1 quot2 ==> quot3" }, "confirm": { - "description": "Prints string (prompt) appending \" [yes/no]: \", reads a line from STDIN and:\n \n * if it matches /^y(es)?$/i, puts true on the stack.\n * if it matches /^no?$/i, puts false on the stack. \n * Otherwise, it prints Invalid answer. Please enter 'yes' or 'no': and waits for a new answer.", + "description": "Prints string (prompt) appending \" [yes/no]: \", reads a line from STDIN and:\r\n \r\n * if it matches /^y(es)?$/i, puts true on the stack.\r\n * if it matches /^no?$/i, puts false on the stack. \r\n * Otherwise, it prints Invalid answer. Please enter 'yes' or 'no': and waits for a new answer.", "kind": "symbol", "name": "confirm", "signature": "string ==> bool" }, "connect": { - "description": "Connects socket dict:socket to address string and port int.\n \n \n Example\n \n The following code shows how to send a message to a server running on localhost:7777. The message is passed as the first argument to the program.\n \n {} socket \"localhost\" 7777 connect =cli\n \n args 1 get :msg\n \n \"Sending message \\\"$1\\\" to localhost:7777...\" (msg) = send\n \n \"Done.\" puts!\n \n cli close", + "description": "Connects socket dict:socket to address string and port int.\r\n \r\n \r\n Example\r\n \r\n The following code shows how to send a message to a server running on localhost:7777. The message is passed as the first argument to the program.\r\n \r\n {} socket \"localhost\" 7777 connect =cli\r\n \r\n args 1 get :msg\r\n \r\n \"Sending message \\\"$1\\\" to localhost:7777...\" (msg) = send\r\n \r\n \"Done.\" puts!\r\n \r\n cli close", "kind": "symbol", "name": "connect", "signature": "dict:socket string int ==> dict:socket"@@ -485,12 +491,6 @@ "kind": "symbol",
"name": "debug", "signature": "a ==> a" }, - "debug!": { - "description": "Prints a (removing it from the stack) and a new line to STDOUT, if logging level is set to [debug](class:kwd) or lower.", - "kind": "symbol", - "name": "debug!", - "signature": "a ==> " - }, "decode": { "description": "Decodes the Base64-encoded string 'sym.", "kind": "symbol",@@ -534,7 +534,7 @@ "name": "delete-sigil",
"signature": "'sym ==> " }, "dequote": { - "description": "Pushes the contents of quotation quot on the stack.\n\n Each element is pushed on the stack one by one. If any error occurs, quot is restored on the stack.", + "description": "Pushes the contents of quotation quot on the stack.\r\n\r\n Each element is pushed on the stack one by one. If any error occurs, quot is restored on the stack.", "kind": "symbol", "name": "dequote", "signature": "quot ==> a*"@@ -546,7 +546,7 @@ "name": "dget",
"signature": "dict 'sym ==> a" }, "dhas?": { - "description": "Returns true if dictionary dict contains the key 'sym, false otherwise.\n \n \n Example\n \n The following program returns true:\n \n {true :a1 \"aaa\" :a2 false :a3} 'a2 dhas?", + "description": "Returns true if dictionary dict contains the key 'sym, false otherwise.\r\n \r\n \r\n Example\r\n \r\n The following program returns true:\r\n \r\n {true :a1 \"aaa\" :a2 false :a3} 'a2 dhas?", "kind": "symbol", "name": "dhas?", "signature": "dict 'sym ==> bool"@@ -558,7 +558,7 @@ "name": "dictionary?",
"signature": "a ==> bool" }, "difference": { - "description": "Calculates the difference quot3 of quot1 and quot2.\n\n \n Example\n \n The following program leaves (2) on the stack:\n \n (1 2 \"test\") (\"test\" \"a\" true 1) difference", + "description": "Calculates the difference quot3 of quot1 and quot2.\r\n\r\n \r\n Example\r\n \r\n The following program leaves (2) on the stack:\r\n \r\n (1 2 \"test\") (\"test\" \"a\" true 1) difference", "kind": "symbol", "name": "difference", "signature": "quot1 quot2 ==> quot3"@@ -606,7 +606,7 @@ "name": "dpairs",
"signature": "dict ==> (a*)" }, "dpick": { - "description": "Returns a new dictionary dict2 containing the elements of dict1 whose keys are included in quot.\n \n \n Example\n \n The following program returns {4 :a 7 :d}:\n \n {5 :q 4 :a 6 :c 7 :d \"d\" :a} (\"a\" \"d\") dpick", + "description": "Returns a new dictionary dict2 containing the elements of dict1 whose keys are included in quot.\r\n \r\n \r\n Example\r\n \r\n The following program returns {4 :a 7 :d}:\r\n \r\n {5 :q 4 :a 6 :c 7 :d \"d\" :a} (\"a\" \"d\") dpick", "kind": "symbol", "name": "dpick", "signature": "dict1 quot ==> dict2"@@ -623,12 +623,6 @@ "kind": "symbol",
"name": "dsdelete", "signature": "dict:datastore 'sym ==> dict:datastore" }, - "dsdelete!": { - "description": "Same as dsdelete, but doesn't leave anything on the stack.", - "kind": "symbol", - "name": "dsdelete!", - "signature": "dict:datastore 'sym ==> " - }, "dset": { "description": "Sets the value of the 'sym of dict1 to a, and returns the modified dictionary dict.", "kind": "symbol",@@ -647,38 +641,20 @@ "kind": "symbol",
"name": "dsinit", "signature": "'sym ==> dict:datastore" }, - "dsinit!": { - "description": "Same as dsinit, but doesn't leave anything on the stack.", - "kind": "symbol", - "name": "dsinit!", - "signature": "'sym dict ==> " - }, "dspost": { "description": "Adds the dictionary dict to the datastore dict:datastore inside collection 'sym, generating and adding a unique **id** field to dict. If the collection 'sym does not exist it is created. Puts the reference to the modified datastore back on tbe stack.", "kind": "symbol", "name": "dspost", "signature": "dict:datastore 'sym dict ==> dict:datastore" }, - "dspost!": { - "description": "Same as dspost, but doesn't leave anything on the stack.", - "kind": "symbol", - "name": "dspost!", - "signature": "dict:datastore 'sym dict ==> " - }, "dsput": { "description": "Adds the dictionary dict to the datastore dict:datastore. 'sym contains the collection where dict will be placed and the id of dict, separated by a forward slash (/). If the collection 'sym does not exist it is created. Puts the reference to the modified datastore back on tbe stack.", "kind": "symbol", "name": "dsput", "signature": "dict:datastore 'sym dict ==> dict:datastore" }, - "dsput!": { - "description": "Same as dsput, but doesn't leave anything on the stack.", - "kind": "symbol", - "name": "dsput!", - "signature": "dict:datastore 'sym ==> " - }, "dsquery": { - "description": "Retrieves a quotation of dictionaries from the collection 'sym of datastore dict:datastore obtained by applying quot as a filter to each item of the collection, picking only the elements that match the filter.\n\n \n Example\n\n Assuming that **ds** is a datastore, the following program retrieves all elements of teh collection **posts** whose author field is set to \"h3rald\":\n\n ds \"posts\" (/author \"h3rald\" ==) dsquery", + "description": "Retrieves a quotation of dictionaries from the collection 'sym of datastore dict:datastore obtained by applying quot as a filter to each item of the collection, picking only the elements that match the filter.\r\n\r\n \r\n Example\r\n\r\n Assuming that **ds** is a datastore, the following program retrieves all elements of teh collection **posts** whose author field is set to \"h3rald\":\r\n\r\n ds \"posts\" (/author \"h3rald\" ==) dsquery", "kind": "symbol", "name": "dsquery", "signature": "dict:datastore 'sym quot ==> (dict*)"@@ -695,12 +671,6 @@ "kind": "symbol",
"name": "dswrite", "signature": "dict:datastore ==> dict:datastore" }, - "dswrite!": { - "description": "Same as dswrite, but doesn't leave anything on the stack.", - "kind": "symbol", - "name": "dswrite!", - "signature": "dict:datastore ==> " - }, "dtype": { "description": "Returns a string set to the type of dict (empty if the dictionary has no type).", "kind": "symbol",@@ -743,12 +713,6 @@ "kind": "symbol",
"name": "error", "signature": "a ==> a" }, - "error!": { - "description": "Prints a (removing it from the stack) and a new line to STDERR, if logging level is set to [error](class:kwd) or lower.", - "kind": "symbol", - "name": "error!", - "signature": "a ==> " - }, "escape": { "description": "Returns a copy of 'sym with quotes and backslashes escaped with a backslash.", "kind": "symbol",@@ -780,7 +744,7 @@ "name": "exit",
"signature": "int ==> " }, "expect": { - "description": "Validates the first _n_ elements of the stack against the type descriptions specified in quot1 (_n_ is quot1's length) and if all the elements are valid returns them wrapped in quot2 (in reverse order). \n\n \n Tips\n \n * You can specify a typed dictionary by prepending the type name with dict:. Example: dict:socket\n * You can specify two or more matching types by separating the type names with a pipe: string|quot\n\n \n Example\n \n Assuming that the following elements are on the stack (from top to bottom): \n \n 1 \"test\" 3.4\n \n the following program evaluates to true:\n \n (int string num) expect (3.4 \"test\" 1) ==", + "description": "Validates the first _n_ elements of the stack against the type descriptions specified in quot1 (_n_ is quot1's length) and if all the elements are valid returns them wrapped in quot2 (in reverse order). \r\n\r\n \r\n Tips\r\n \r\n * You can specify a typed dictionary by prepending the type name with dict:. Example: dict:socket\r\n * You can specify two or more matching types by separating the type names with a pipe: string|quot\r\n\r\n \r\n Example\r\n \r\n Assuming that the following elements are on the stack (from top to bottom): \r\n \r\n 1 \"test\" 3.4\r\n \r\n the following program evaluates to true:\r\n \r\n (int string num) expect (3.4 \"test\" 1) ==", "kind": "symbol", "name": "expect", "signature": "quot1 ==> quot2"@@ -828,13 +792,13 @@ "name": "filename",
"signature": "'sym ==> string" }, "filter": { - "description": "Returns a new quotation quot3 containing all elements of quot1 that satisfy predicate quot2.\n \n \n Example\n \n The following program leaves (2 6 8 12) on the stack:\n \n (1 37 34 2 6 8 12 21) \n (dup 20 < swap even? and) filter", + "description": "Returns a new quotation quot3 containing all elements of quot1 that satisfy predicate quot2.\r\n \r\n \r\n Example\r\n \r\n The following program leaves (2 6 8 12) on the stack:\r\n \r\n (1 37 34 2 6 8 12 21) \r\n (dup 20 < swap even? and) filter", "kind": "symbol", "name": "filter", "signature": "quot1 quot2 ==> quot3" }, "find": { - "description": "Returns the index of the first element within quot1 that satisfies predicate quot2, or -1 if no element satisfies it.\n \n \n Example\n \n The following program leaves 3 on the stack:\n \n (1 2 4 8 16) \n (5 ) find", + "description": "Returns the index of the first element within quot1 that satisfies predicate quot2, or -1 if no element satisfies it.\r\n \r\n \r\n Example\r\n \r\n The following program leaves 3 on the stack:\r\n \r\n (1 2 4 8 16) \r\n (5 ) find", "kind": "symbol", "name": "find", "signature": "quot1 quot2 ==> int"@@ -846,13 +810,13 @@ "name": "first",
"signature": "quot ==> a" }, "flatten": { - "description": "Flattens all quotations within quot1 and returns the resulting sequence quot2.\n \n \n Example\n \n The following program leaves (1 2 3 4 5 6 7 8) on the stack:\n \n (1 (2 3 4) 5 (6 7) 8) \n flatten", + "description": "Flattens all quotations within quot1 and returns the resulting sequence quot2.\r\n \r\n \r\n Example\r\n \r\n The following program leaves (1 2 3 4 5 6 7 8) on the stack:\r\n \r\n (1 (2 3 4) 5 (6 7) 8) \r\n flatten", "kind": "symbol", "name": "flatten", "signature": "quot1 ==> quot2" }, "float": { - "description": "Converts a to an integer value based on the following rules:\n \n * If a is true, it is converted to 1.0.\n * If a is false , it is converted to 0.0.\n * If a is null, it is converted to 0.0\n. * If a is a integer, it is converted to float value.\n * If a is a float, no conversion is performed.\n * If a is a string, it is parsed as a float value.", + "description": "Converts a to an integer value based on the following rules:\r\n \r\n * If a is true, it is converted to 1.0.\r\n * If a is false , it is converted to 0.0.\r\n * If a is null, it is converted to 0.0\r\n. * If a is a integer, it is converted to float value.\r\n * If a is a float, no conversion is performed.\r\n * If a is a string, it is parsed as a float value.", "kind": "symbol", "name": "float", "signature": "a ==> float"@@ -876,7 +840,7 @@ "name": "foreach",
"signature": "quot1 quot2 ==> a*" }, "format-error": { - "description": "Formats the error dict:error as a string. \n \n Example\n \n The following: \n \n {\"MyError\" :error \"This is a test error\" :message} 'error set-type format-error\n \n produces: \"This is a test error\"", + "description": "Formats the error dict:error as a string. \r\n \r\n Example\r\n \r\n The following: \r\n \r\n {\"MyError\" :error \"This is a test error\" :message} 'error set-type format-error\r\n \r\n produces: \"This is a test error\"", "kind": "symbol", "name": "format-error", "signature": "dict:error ==> string"@@ -900,13 +864,13 @@ "name": "from-json",
"signature": "string ==> a" }, "from-semver": { - "description": "Given a basic [SemVer](https://semver.org)-compliant string (with no additional labels) string, \nit pushes a dictionary dict on the stack containing a **major**, **minor**, and **patch** key/value pairs.", + "description": "Given a basic [SemVer](https://semver.org)-compliant string (with no additional labels) string, \r\nit pushes a dictionary dict on the stack containing a **major**, **minor**, and **patch** key/value pairs.", "kind": "symbol", "name": "from-semver", "signature": "string ==> dict" }, "from-yaml": { - "description": "Converts a YAML string into min data.\n \n Note\n \n At present, only YAML objects containing string values are supported.", + "description": "Converts a YAML string into min data.\r\n \r\n Note\r\n \r\n At present, only YAML objects containing string values are supported.", "kind": "symbol", "name": "from-yaml", "signature": "string ==> a"@@ -918,7 +882,7 @@ "name": "fsize",
"signature": "'sym ==> int" }, "fstats": { - "description": "Returns a dictionary dict containing information on file/directory 'sym.\n \n Example\n \n Assuming that min is a file, the following:\n \n \"min\" fstats\n \n produces:\n \n {\n \"min\" :name\n 16777220 :device\n 50112479 :file\n \"file\" :type\n 617068 :size\n 755 :permissions\n 1 :nlinks\n 1496583112.0 :ctime\n 1496584370.0 :atime\n 1496583112.0 :mtime\n }", + "description": "Returns a dictionary dict containing information on file/directory 'sym.\r\n \r\n Example\r\n \r\n Assuming that min is a file, the following:\r\n \r\n \"min\" fstats\r\n \r\n produces:\r\n \r\n {\r\n \"min\" :name\r\n 16777220 :device\r\n 50112479 :file\r\n \"file\" :type\r\n 617068 :size\r\n 755 :permissions\r\n 1 :nlinks\r\n 1496583112.0 :ctime\r\n 1496584370.0 :atime\r\n 1496583112.0 :mtime\r\n }", "kind": "symbol", "name": "fstats", "signature": "'sym ==> dict"@@ -978,7 +942,7 @@ "name": "hardlink",
"signature": "'sym1 'sym2 ==> " }, "harvest": { - "description": "Creates a new quotation quot2 containing all elements of quot1 except for empty quotations.\n \n \n Example\n \n The following program leaves (1 2 3) on the stack:\n \n (1 () () () 2 () 3) \n harvest", + "description": "Creates a new quotation quot2 containing all elements of quot1 except for empty quotations.\r\n \r\n \r\n Example\r\n \r\n The following program leaves (1 2 3) on the stack:\r\n \r\n (1 () () () 2 () 3) \r\n harvest", "kind": "symbol", "name": "harvest", "signature": "quot1 ==> quot2"@@ -1038,7 +1002,7 @@ "name": "inf",
"signature": " ==> num" }, "infix-dequote": { - "description": "Dequotes quot using infix notation. \n \n Note that no special operator preference is defined, symbols precedence is always left-to-right. However, you can use parentheses (quotes) to evaluate expressions before others.\n \n \n Example\n \n The following program leaves 17 on the stack:\n\n (2 + (3 * 5)) infix-dequote\n\n while this program leaves 25 on the stack:\n \n (2 + 3 * 5) infix-dequote", + "description": "Dequotes quot using infix notation. \r\n \r\n Note that no special operator preference is defined, symbols precedence is always left-to-right. However, you can use parentheses (quotes) to evaluate expressions before others.\r\n \r\n \r\n Example\r\n \r\n The following program leaves 17 on the stack:\r\n\r\n (2 + (3 * 5)) infix-dequote\r\n\r\n while this program leaves 25 on the stack:\r\n \r\n (2 + 3 * 5) infix-dequote", "kind": "symbol", "name": "infix-dequote", "signature": "quot ==> a"@@ -1049,12 +1013,6 @@ "kind": "symbol",
"name": "info", "signature": "a ==> a" }, - "info!": { - "description": "Prints a (removing it from the stack) and a new line to STDOUT, if logging level is set to [info](class:kwd) or lower.", - "kind": "symbol", - "name": "info!", - "signature": "a ==> " - }, "insert": { "description": "Inserts a as the value of the _n^th_ element quot1 (zero-based), and returns the modified copy of the quotation quot2.", "kind": "symbol",@@ -1062,7 +1020,7 @@ "name": "insert",
"signature": "quot1 a int ==> quot2" }, "int": { - "description": "Converts a to an integer value based on the following rules:\n \n * If a is true, it is converted to 1.\n * If a is false , it is converted to 0.\n * If a is null, it is converted to 0.\n * If a is an integer, no conversion is performed.\n * If a is a float, it is converted to an integer value by truncating its decimal part.\n * If a is a string, it is parsed as an integer value.", + "description": "Converts a to an integer value based on the following rules:\r\n \r\n * If a is true, it is converted to 1.\r\n * If a is false , it is converted to 0.\r\n * If a is null, it is converted to 0.\r\n * If a is an integer, no conversion is performed.\r\n * If a is a float, it is converted to an integer value by truncating its decimal part.\r\n * If a is a string, it is parsed as an integer value.", "kind": "symbol", "name": "int", "signature": "a ==> int"@@ -1074,13 +1032,13 @@ "name": "integer?",
"signature": "a ==> bool" }, "intersection": { - "description": "Calculates the intersection quot3 of quot1 and quot2.\n\n \n Example\n \n The following program leaves (1 \"test\") on the stack:\n \n (1 2 \"test\") (\"test\" \"a\" true 1) intersection", + "description": "Calculates the intersection quot3 of quot1 and quot2.\r\n\r\n \r\n Example\r\n \r\n The following program leaves (1 \"test\") on the stack:\r\n \r\n (1 2 \"test\") (\"test\" \"a\" true 1) intersection", "kind": "symbol", "name": "intersection", "signature": "quot1 quot2 ==> quot3" }, "invoke": { - "description": "Assming that 'sym is a formatted like *dictionary*/*symbol*, calls *symbol* defined in *dictionary* (note that this also works for nested dictionaries. \n \n \n Example\n \n The following program leaves 100 on the stack:\n \n {{100 :b} :a} :test *test/a/b", + "description": "Assming that 'sym is a formatted like *dictionary*/*symbol*, calls *symbol* defined in *dictionary* (note that this also works for nested dictionaries. \r\n \r\n \r\n Example\r\n \r\n The following program leaves 100 on the stack:\r\n \r\n {{100 :b} :a} :test *test/a/b", "kind": "symbol", "name": "invoke", "signature": "'sym ==> a*"@@ -1092,7 +1050,7 @@ "name": "join",
"signature": "quot 'sym ==> string" }, "keep": { - "description": "Applies each quotation contained in the first element to each subsequent corresponding element.\n \n Example\n \n The following program leaves 5 3 on the stack:\n \n 2 3 '+ keep", + "description": "Applies each quotation contained in the first element to each subsequent corresponding element.\r\n \r\n Example\r\n \r\n The following program leaves 5 3 on the stack:\r\n \r\n 2 3 '+ keep", "kind": "symbol", "name": "keep", "signature": "a1 quot ==> a* a1"@@ -1116,7 +1074,7 @@ "name": "line-info",
"signature": " ==> dict" }, "linrec": { - "description": "Implements linear recursions as follows:\n \n 1. Evaluates quot1.\n * If quot1 evaluates to true, then it evaluates quot2.\n * Otherwises it executes quot3 and recurses using the same four quotations.\n 2. Finally, it executes quot4.\n \n \n Example\n \n The following program leaves 120 on the stack, the factorial of 5:\n \n 5 (dup 0 ==) 'succ (dup pred) '* linrec", + "description": "Implements linear recursions as follows:\r\n \r\n 1. Evaluates quot1.\r\n * If quot1 evaluates to true, then it evaluates quot2.\r\n * Otherwises it executes quot3 and recurses using the same four quotations.\r\n 2. Finally, it executes quot4.\r\n \r\n \r\n Example\r\n \r\n The following program leaves 120 on the stack, the factorial of 5:\r\n \r\n 5 (dup 0 ==) 'succ (dup pred) '* linrec", "kind": "symbol", "name": "linrec", "signature": "quot1 quot2 quot3 quot4 ==> a*"@@ -1158,7 +1116,7 @@ "name": "log2",
"signature": "num1 ==> num2" }, "loglevel": { - "description": "Sets the current logging level to 'sym. 'sym must be one of the following strings or quoted symbols:\n \n * debug\n * info\n * notice\n * warn\n * error\n * fatal\n \n \n Note\n \n The default logging level is _notice_.", + "description": "Sets the current logging level to 'sym. 'sym must be one of the following strings or quoted symbols:\r\n \r\n * debug\r\n * info\r\n * notice\r\n * warn\r\n * error\r\n * fatal\r\n \r\n \r\n Note\r\n \r\n The default logging level is _notice_.", "kind": "symbol", "name": "loglevel", "signature": "'sym ==> "@@ -1194,19 +1152,19 @@ "name": "map",
"signature": "quot1 quot2 ==> quot3" }, "map-reduce": { - "description": "Applies quot2 (map) to each element of quot1 and then applies quot3 (reduce) to each successive element of quot1. quot1 must have at least one element.\n \n \n Example\n \n The following program leaves 35 on the stack:\n \n (1 3 5) \n (dup *) (+) map-reduce", + "description": "Applies quot2 (map) to each element of quot1 and then applies quot3 (reduce) to each successive element of quot1. quot1 must have at least one element.\r\n \r\n \r\n Example\r\n \r\n The following program leaves 35 on the stack:\r\n \r\n (1 3 5) \r\n (dup *) (+) map-reduce", "kind": "symbol", "name": "map-reduce", "signature": "quot1 quot2 quot3 ==> int" }, "mapkey": { - "description": "Maps the named key/key combination 'sym to the quotation quot, so that quot is executed when key 'sym is pressed. \n\n \n Notes\n\n * At present, only the key names and sequences defined in the [nimline](https://h3rald.com/nimline/nimline.html) library are supported.\n * The quotation will be executed by a copy of the min interpreter created when the mapping was defined. In other words, quotations executed by key bindings will not affect the current stack.\n \n \n Example\n \n The following program:\n \n (clear) 'ctrl+l keymap\n \n causes the CTRL+L key to clear the screen.", + "description": "Maps the named key/key combination 'sym to the quotation quot, so that quot is executed when key 'sym is pressed. \r\n\r\n \r\n Notes\r\n\r\n * At present, only the key names and sequences defined in the [nimline](https://h3rald.com/nimline/nimline.html) library are supported.\r\n * The quotation will be executed by a copy of the min interpreter created when the mapping was defined. In other words, quotations executed by key bindings will not affect the current stack.\r\n \r\n \r\n Example\r\n \r\n The following program:\r\n \r\n (clear) 'ctrl+l keymap\r\n \r\n causes the CTRL+L key to clear the screen.", "kind": "symbol", "name": "mapkey", "signature": "quot 'sym ==> " }, "match": { - "description": "Returns true if string2 matches string1, false otherwise.\n \n Tip\n \n string2 can be a sgregex-compatible regular expression.", + "description": "Returns true if string2 matches string1, false otherwise.\r\n \r\n Tip\r\n \r\n string2 can be a sgregex-compatible regular expression.", "kind": "symbol", "name": "match", "signature": "string1 string2 ==> bool"@@ -1288,12 +1246,6 @@ "description": "Prints a and a new line to STDOUT, if logging level is set to [notice](class:kwd) (default) or lower.",
"kind": "symbol", "name": "notice", "signature": "a ==> a" - }, - "notice!": { - "description": "Prints a (removing it from the stack) and a new line to STDOUT, if logging level is set to [notice](class:kwd) (default) or lower.", - "kind": "symbol", - "name": "notice!", - "signature": "a ==> " }, "now": { "description": "Returns the current time as Unix timestamp with microseconds.",@@ -1326,7 +1278,7 @@ "name": "one?",
"signature": "quot1 quot2 ==> bool" }, "operator": { - "description": "Provides a way to define a new operator (symbol or sigil) on the current scope performing additional checks (compared to define and define-sigil), and automatically mapping inputs and outputs.\n \n quot is a quotation containing:\n \n * A symbol identifying the type of operator to define (symbol or sigil).\n * A symbol identifying the name of the operator.\n * A quotation defining the signature of the operatorm containing input and output values identified by their type and a capturing symbol, separated by the == symbol.\n * A quotation identifying the body of the operator.\n\n The main additional features offered by this way of defining operators are the following:\n\n * Both input and output values are checked against a type (like when using the expect operator *and* automatically captured in a symbol that can be referenced in the operator body quotation.\n * The full signature of the operator is declared, making the resulting code easier to understand at quick glance.\n * An exception is automatically raised if the operator body pollutes the stack by adding or removing elementa from the stack (besides adding the declared output values).\n * It is possible to use the return symbol within the body quotation to immediately stop the evaluation of the body quotation and automatically push the output values on the stack.\n \n \n Example\n \n The following program defines a pow operator that calculates the power of a number providing its base and exponent, and handling some NaN results using the return symbol:\n\n (\n symbol pow\n (num :base int :exp == num :result)\n ( \n (base 0 == exp 0 == and)\n (nan @result return)\n when\n (base 1 == exp inf == and)\n (nan @result return)\n when\n (base inf == exp 0 == and)\n (nan @result return)\n when\n exp 1 - :n\n base (dup) n times (*) n times @result\n )\n ) ::", + "description": "Provides a way to define a new operator (symbol or sigil) on the current scope performing additional checks (compared to define and define-sigil), and automatically mapping inputs and outputs.\r\n \r\n quot is a quotation containing:\r\n \r\n * A symbol identifying the type of operator to define (symbol or sigil).\r\n * A symbol identifying the name of the operator.\r\n * A quotation defining the signature of the operatorm containing input and output values identified by their type and a capturing symbol, separated by the == symbol.\r\n * A quotation identifying the body of the operator.\r\n\r\n The main additional features offered by this way of defining operators are the following:\r\n\r\n * Both input and output values are checked against a type (like when using the expect operator *and* automatically captured in a symbol that can be referenced in the operator body quotation.\r\n * The full signature of the operator is declared, making the resulting code easier to understand at quick glance.\r\n * An exception is automatically raised if the operator body pollutes the stack by adding or removing elementa from the stack (besides adding the declared output values).\r\n * It is possible to use the return symbol within the body quotation to immediately stop the evaluation of the body quotation and automatically push the output values on the stack.\r\n \r\n \r\n Example\r\n \r\n The following program defines a pow operator that calculates the power of a number providing its base and exponent, and handling some NaN results using the return symbol:\r\n\r\n (\r\n symbol pow\r\n (num :base int :exp == num :result)\r\n ( \r\n (base 0 == exp 0 == and)\r\n (nan @result return)\r\n when\r\n (base 1 == exp inf == and)\r\n (nan @result return)\r\n when\r\n (base inf == exp 0 == and)\r\n (nan @result return)\r\n when\r\n exp 1 - :n\r\n base (dup) n times (*) n times @result\r\n )\r\n ) ::", "kind": "symbol", "name": "operator", "signature": "quot ==> a*"@@ -1374,7 +1326,7 @@ "name": "parse-url",
"signature": "string ==> url" }, "partition": { - "description": "Partitions quot1 into two quotations: quot3 contains all elements of quot1 that satisfy predicate quot2, quot4 all the others.\n \n \n Example\n \n The following program leaves (1 3 5) (2 4 6) on the stack:\n \n (1 2 3 4 5 6) \n (odd?) partition", + "description": "Partitions quot1 into two quotations: quot3 contains all elements of quot1 that satisfy predicate quot2, quot4 all the others.\r\n \r\n \r\n Example\r\n \r\n The following program leaves (1 3 5) (2 4 6) on the stack:\r\n \r\n (1 2 3 4 5 6) \r\n (odd?) partition", "kind": "symbol", "name": "partition", "signature": "quot1 quot2 ==> quot3 quot4"@@ -1422,7 +1374,7 @@ "name": "prefix",
"signature": "'sym1 'sym2 ==> string" }, "prefix-dequote": { - "description": "Dequotes quot using prefix notation (essentially it reverses quot and dequotes it).\n \n \n Example\n \n The following program leaves 4 on the stack:\n\n (* 8 4) prefix-dequote", + "description": "Dequotes quot using prefix notation (essentially it reverses quot and dequotes it).\r\n \r\n \r\n Example\r\n \r\n The following program leaves 4 on the stack:\r\n\r\n (* 8 4) prefix-dequote", "kind": "symbol", "name": "prefix-dequote", "signature": "quot ==> a"@@ -1439,12 +1391,6 @@ "kind": "symbol",
"name": "print", "signature": "a ==> a" }, - "print!": { - "description": "Prints a to STDOUT and removes a from the stack.", - "kind": "symbol", - "name": "print!", - "signature": "a ==> " - }, "product": { "description": "Returns the product of all items of quot. quot is a quotation of integers.", "kind": "symbol",@@ -1452,13 +1398,13 @@ "name": "product",
"signature": "quot ==> int" }, "prompt": { - "description": "This symbol is used to configure the prompt of the min shell. By default, it is set to the following quotation:\n \n (\"[$1]$$ \" (.) = %)\n \n Unlike other predefined symbols, this symbol is _unsealed_, which means it can be modified.", + "description": "This symbol is used to configure the prompt of the min shell. By default, it is set to the following quotation:\r\n \r\n (\"[$1]$$ \" (.) = %)\r\n \r\n Unlike other predefined symbols, this symbol is _unsealed_, which means it can be modified.", "kind": "symbol", "name": "prompt", "signature": " ==> string" }, "publish": { - "description": "Publishes symbol 'sym to the scope of dict.\n \n \n Example\n \n Publish symbol [my-local-symbol](class:kwd) to [ROOT](class:kwd) scope:\n 'my-local-symbol ROOT publish", + "description": "Publishes symbol 'sym to the scope of dict.\r\n \r\n \r\n Example\r\n \r\n Publish symbol [my-local-symbol](class:kwd) to [ROOT](class:kwd) scope:\r\n 'my-local-symbol ROOT publish", "kind": "symbol", "name": "publish", "signature": "'sym dict ==> "@@ -1481,12 +1427,6 @@ "kind": "symbol",
"name": "puts", "signature": "a ==> a" }, - "puts!": { - "description": "Prints a and a new line to STDOUT, removing a from the stack.", - "kind": "symbol", - "name": "puts!", - "signature": "a ==> " - }, "quit": { "description": "Exits the program or shell with 0 as return code.", "kind": "symbol",@@ -1536,7 +1476,7 @@ "name": "raise",
"signature": "dict:error ==> " }, "random": { - "description": "Returns a random number int2 between 0 and int1-1. \n \n \n Note\n \n You must call randomize to initialize the random number generator, otherwise the same sequence of numbers will be returned.", + "description": "Returns a random number int2 between 0 and int1-1. \r\n \r\n \r\n Note\r\n \r\n You must call randomize to initialize the random number generator, otherwise the same sequence of numbers will be returned.", "kind": "symbol", "name": "random", "signature": "int1 ==> int2"@@ -1566,19 +1506,19 @@ "name": "recv",
"signature": "dict:socket int ==> string" }, "recv-line": { - "description": "Waits to receive a line of data from dict:socket and returns the resulting data string. \"\" is returned if dict:socket is disconnected.\n \n \n Example\n \n The following code shows how to make a simple GET request to <http://httpbin.org/uuid to receive a random UUID and display its response:\n \n \n {} socket \"httpbin.org\" 80 connect =cli\n \n cli \"GET /uuid HTTP/1.1\\r\\nHost: httpbin.org\\r\\n\\r\\n\" send\n \n cli recv-line puts :line\n (line \"\\}\" match not) \n (\n cli recv-line puts @line\n ) while", + "description": "Waits to receive a line of data from dict:socket and returns the resulting data string. \"\" is returned if dict:socket is disconnected.\r\n \r\n \r\n Example\r\n \r\n The following code shows how to make a simple GET request to <http://httpbin.org/uuid to receive a random UUID and display its response:\r\n \r\n \r\n {} socket \"httpbin.org\" 80 connect =cli\r\n \r\n cli \"GET /uuid HTTP/1.1\\r\\nHost: httpbin.org\\r\\n\\r\\n\" send\r\n \r\n cli recv-line puts :line\r\n (line \"\\}\" match not) \r\n (\r\n cli recv-line puts @line\r\n ) while", "kind": "symbol", "name": "recv-line", "signature": "dict:socket ==> string" }, "reduce": { - "description": "Combines each successive element of quot1 using quot2. On the first iteration, the first two inputs processed by quot2 are a and the first element of quot1.\n \n \n Example\n \n The following program leaves 120 on the stack:\n \n (1 2 3 4 5) \n 1 (*) reduce", + "description": "Combines each successive element of quot1 using quot2. On the first iteration, the first two inputs processed by quot2 are a and the first element of quot1.\r\n \r\n \r\n Example\r\n \r\n The following program leaves 120 on the stack:\r\n \r\n (1 2 3 4 5) \r\n 1 (*) reduce", "kind": "symbol", "name": "reduce", "signature": "quot1 a quot2 ==> int" }, "regex": { - "description": "Performs a search and/or a search-and-replace operation using pattern string2.\n \n string2 can be one of the following patterns:\n \n * **/**_search-regex_**/**_modifiers_\n * **s/**_search-regex_**/**_replacemenet_**/**_modifiers_\n \n quot is always a quotation containing:\n \n * One or more strings containing the first match and captures (if any), like for the search operator.\n * A string containing the resuling string after the search-and-replace operation.\n \n \n Tip\n \n * _search-regex_ can be a sgregex-compatible regular expression.\n * _modifiers_ are optionals can contain one or more of the following characters, in any order:\n * **i**: case-insensitive match.\n * **m**: multi-line match.\n * **s**: dot character includes newlines.\n \n \n Example: Search\n \n The following:\n \n \"This is a GOOD idea.\" \"/(good) idea/i\" regex\n \n produces: (\"GOOD idea\", \"GOOD\")\n \n \n Example: Search and Replace\n \n The following:\n \n \"This is a GOOD idea.\" \"s/good/bad/i\" regex\n \n produces: (\"This is a bad idea\")", + "description": "Performs a search and/or a search-and-replace operation using pattern string2.\r\n \r\n string2 can be one of the following patterns:\r\n \r\n * **/**_search-regex_**/**_modifiers_\r\n * **s/**_search-regex_**/**_replacemenet_**/**_modifiers_\r\n \r\n quot is always a quotation containing:\r\n \r\n * One or more strings containing the first match and captures (if any), like for the search operator.\r\n * A string containing the resuling string after the search-and-replace operation.\r\n \r\n \r\n Tip\r\n \r\n * _search-regex_ can be a sgregex-compatible regular expression.\r\n * _modifiers_ are optionals can contain one or more of the following characters, in any order:\r\n * **i**: case-insensitive match.\r\n * **m**: multi-line match.\r\n * **s**: dot character includes newlines.\r\n \r\n \r\n Example: Search\r\n \r\n The following:\r\n \r\n \"This is a GOOD idea.\" \"/(good) idea/i\" regex\r\n \r\n produces: (\"GOOD idea\", \"GOOD\")\r\n \r\n \r\n Example: Search and Replace\r\n \r\n The following:\r\n \r\n \"This is a GOOD idea.\" \"s/good/bad/i\" regex\r\n \r\n produces: (\"This is a bad idea\")", "kind": "symbol", "name": "regex", "signature": "string1 string2 ==> quot"@@ -1608,13 +1548,13 @@ "name": "repeat",
"signature": "'sym int ==> string" }, "replace": { - "description": "Returns a copy of string1 containing all occurrences of string2 replaced by string3\n \n Tip\n \n string2 can be a sgregex-compatible regular expression.\n \n \n Example\n \n The following:\n \n \"This is a stupid test. Is it really a stupid test?\" \" s[a-z]+\" \" simple\" replace\n \n produces:\n \n \"This is a simple test. Is it really a simple test?\"", + "description": "Returns a copy of string1 containing all occurrences of string2 replaced by string3\r\n \r\n Tip\r\n \r\n string2 can be a sgregex-compatible regular expression.\r\n \r\n \r\n Example\r\n \r\n The following:\r\n \r\n \"This is a stupid test. Is it really a stupid test?\" \" s[a-z]+\" \" simple\" replace\r\n \r\n produces:\r\n \r\n \"This is a simple test. Is it really a simple test?\"", "kind": "symbol", "name": "replace", "signature": "string1 string2 string3 ==> string4" }, "request": { - "description": "Performs an HTTP request.\n \n \n Example\n \n The following code constructs a request dictionary and passes it to the **request** operator to perform an HTTP GET request to <http://httpbin.org/ip:\n \n {}\n \"GET\" url\n request", + "description": "Performs an HTTP request.\r\n \r\n \r\n Example\r\n \r\n The following code constructs a request dictionary and passes it to the **request** operator to perform an HTTP GET request to <http://httpbin.org/ip:\r\n \r\n {}\r\n \"GET\" url\r\n request", "kind": "symbol", "name": "request", "signature": "request ==> response"@@ -1632,7 +1572,7 @@ "name": "rest",
"signature": "quot1 ==> quot2" }, "return": { - "description": "If used within the body quotation of an operator definition, causes the interpreter to stop pushing further body elements on the stack and start pushing tbe operator output values on the stack. \n\nIf used outside of the body quotation of an operator definition, it raises an exception.", + "description": "If used within the body quotation of an operator definition, causes the interpreter to stop pushing further body elements on the stack and start pushing tbe operator output values on the stack. \r\n\r\nIf used outside of the body quotation of an operator definition, it raises an exception.", "kind": "symbol", "name": "return", "signature": " ==> "@@ -1692,7 +1632,7 @@ "name": "saved-symbols",
"signature": " ==> (string*)" }, "scope": { - "description": "Returns a dictionary dict holding a reference to the current scope.\n \n This can be useful to save a reference to a given execution scope to access later on.\n\n \n Example\n \n The following program leaves {(2) :two ;module} on the stack:\n \n {} :myscope (2 :two scope @myscope) -", + "description": "Returns a dictionary dict holding a reference to the current scope.\r\n \r\n This can be useful to save a reference to a given execution scope to access later on.\r\n\r\n \r\n Example\r\n \r\n The following program leaves {(2) :two ;module} on the stack:\r\n \r\n {} :myscope (2 :two scope @myscope) -", "kind": "symbol", "name": "scope", "signature": " ==> dict"@@ -1734,9 +1674,15 @@ "name": "sealed?",
"signature": "'sym ==> bool" }, "search": { - "description": "Returns a quotation of quotations (like the one returned by the search operator) containing all occurrences of string2 within string1.", + "description": "Returns a quotation containing the first occurrence of string2 within string1. Note that:\r\n \r\n * The first element of quot is the matching substring.\r\n * Other elements (if any) contain captured substrings.\r\n \r\n \r\n Tip\r\n \r\n string2 can be a sgregex-compatible regular expression.\r\n \r\n \r\n Example\r\n \r\n The following:\r\n \r\n \"192.168.1.1, 127.0.0.1\" \"[0-9]+\\.[0-9]+\\.([0-9]+)\\.([0-9]+)\" search\r\n \r\n produces: (\"192.168.1.1\", \"1\", \"1\")", "kind": "symbol", "name": "search", + "signature": "string1 string2 ==> quot" + }, + "search-all": { + "description": "Returns a quotation of quotations (like the one returned by the search operator) containing all occurrences of string2 within string1.", + "kind": "symbol", + "name": "search-all", "signature": "string1 string2 ==> quot" }, "semver-inc-major": {@@ -1872,19 +1818,19 @@ "name": "sleep",
"signature": "int ==> " }, "slice": { - "description": "Creates a new quotation quot2 obtaining by selecting all elements of quot1 between indexes int1 and int2.\n \n \n Example\n \n The following program leaves (3 4 5) on the stack:\n \n (1 2 3 4 5 6) \n 2 4 slice", + "description": "Creates a new quotation quot2 obtaining by selecting all elements of quot1 between indexes int1 and int2.\r\n \r\n \r\n Example\r\n \r\n The following program leaves (3 4 5) on the stack:\r\n \r\n (1 2 3 4 5 6) \r\n 2 4 slice", "kind": "symbol", "name": "slice", "signature": "quot1 int1 int2 ==> quot2" }, "socket": { - "description": "Opens a new socket.\n \n dict can be empty or contain any of the following properties, used to specify the domain, type and protocol of the socket respectively.\n \n domain\n : The socket domain. It can be set to one of the following values:\n \n * **ipv4** (default): Internet Protocol version 4.\n * **ipv6**: Internet Protocol version 6.\n * **unix**: local Unix file (not supported on Windows systems).\n type\n : The socket type. It can be set to one of the following values:\n \n * **stream** (default): Reliable stream-oriented service or Stream Socket.\n * **dgram**: Datagram service or Datagram Socket.\n * **raw**: Raw protocols atop the network layer.\n * **seqpacket**: Reliable sequenced packet service.\n protocol\n : The socket protocol. It can be set to one of the following values:\n \n * **tcp** (default): Transmission Control Protocol.\n * **udp**: User Datagram Protocol.\n * **ipv4**: Internet Protocol version 4 (not supported on Windows systems).\n * **ipv6**: Internet Protocol version 6 (not supported on Windows systems).\n * **raw**: Raw IP Packets protocol (not supported on Windows systems).\n * **icmp**: Internet Control Message Protocol (not supported on Windows systems).", + "description": "Opens a new socket.\r\n \r\n dict can be empty or contain any of the following properties, used to specify the domain, type and protocol of the socket respectively.\r\n \r\n domain\r\n : The socket domain. It can be set to one of the following values:\r\n \r\n * **ipv4** (default): Internet Protocol version 4.\r\n * **ipv6**: Internet Protocol version 6.\r\n * **unix**: local Unix file (not supported on Windows systems).\r\n type\r\n : The socket type. It can be set to one of the following values:\r\n \r\n * **stream** (default): Reliable stream-oriented service or Stream Socket.\r\n * **dgram**: Datagram service or Datagram Socket.\r\n * **raw**: Raw protocols atop the network layer.\r\n * **seqpacket**: Reliable sequenced packet service.\r\n protocol\r\n : The socket protocol. It can be set to one of the following values:\r\n \r\n * **tcp** (default): Transmission Control Protocol.\r\n * **udp**: User Datagram Protocol.\r\n * **ipv4**: Internet Protocol version 4 (not supported on Windows systems).\r\n * **ipv6**: Internet Protocol version 6 (not supported on Windows systems).\r\n * **raw**: Raw IP Packets protocol (not supported on Windows systems).\r\n * **icmp**: Internet Control Message Protocol (not supported on Windows systems).", "kind": "symbol", "name": "socket", "signature": "dict ==> dict:socket" }, "sort": { - "description": "Sorts all elements of quot1 according to predicate quot2. \n \n \n Example\n \n The following program leaves (1 3 5 7 9 13 16) on the stack:\n \n (1 9 5 13 16 3 7) ' sort", + "description": "Sorts all elements of quot1 according to predicate quot2. \r\n \r\n \r\n Example\r\n \r\n The following program leaves (1 3 5 7 9 13 16) on the stack:\r\n \r\n (1 9 5 13 16 3 7) ' sort", "kind": "symbol", "name": "sort", "signature": "quot1 quot2 ==> quot3"@@ -1902,7 +1848,7 @@ "name": "split",
"signature": "'sym1 'sym2 ==> quot" }, "spread": { - "description": "Applies each quotation contained in the first element to each subsequent corresponding element.\n \n Example\n \n The following program leaves (1 4) on the stack:\n \n (1 2) (3 4) ((0 get) (1 get)) spread", + "description": "Applies each quotation contained in the first element to each subsequent corresponding element.\r\n \r\n Example\r\n \r\n The following program leaves (1 4) on the stack:\r\n \r\n (1 2) (3 4) ((0 get) (1 get)) spread", "kind": "symbol", "name": "spread", "signature": "a* (quot*) ==> a*"@@ -1914,7 +1860,7 @@ "name": "sqrt",
"signature": "num1 ==> num2" }, "start-server": { - "description": "Starts an HTTP server based on the configuration provided in dict.\n \n dict is a dictionary containing the following keys:\n \n address\n : The address to bind the server to (default: **127.0.0.1**).\n port\n : The port to bind the server to.\n handler\n : A quotation with the following signature, used to handle all incoming requests: [request ⇒ response](class:kwd)\n \n \n Example\n \n The following program starts a very simple HTTP server that can display the current timestamp or date and time in ISO 8601 format:\n \n ; Define the request handler\n (\n ; Assume there is a request on the stack, take it off and give it the name req\n :req\n ; Let's see what we got (print req to standard out)\n \"THE REQUEST:\" puts! req puts!\n ; The request is a dictionary, we retrieve the value for the key url, and give it the name url\n req /url :url\n \"THE URL is '$1'.\" url quote ))\n ) case\n :body\n ; Prepare the response\n {} body handler\n 5555 %port\n \n ; Start server\n \"Server started on port 5555.\" puts!\n \"Press Ctrl+C to stop.\" puts!\n start-server", + "description": "Starts an HTTP server based on the configuration provided in dict.\r\n \r\n dict is a dictionary containing the following keys:\r\n \r\n address\r\n : The address to bind the server to (default: **127.0.0.1**).\r\n port\r\n : The port to bind the server to.\r\n handler\r\n : A quotation with the following signature, used to handle all incoming requests: [request ⇒ response](class:kwd)\r\n \r\n \r\n Example\r\n \r\n The following program starts a very simple HTTP server that can display the current timestamp or date and time in ISO 8601 format:\r\n \r\n ; Define the request handler\r\n (\r\n ; Assume there is a request on the stack, take it off and give it the name req\r\n :req\r\n ; Let's see what we got (print req to standard out)\r\n \"THE REQUEST:\" puts! req puts!\r\n ; The request is a dictionary, we retrieve the value for the key url, and give it the name url\r\n req /url :url\r\n \"THE URL is '$1'.\" url quote ))\r\n ) case\r\n :body\r\n ; Prepare the response\r\n {} body handler\r\n 5555 %port\r\n \r\n ; Start server\r\n \"Server started on port 5555.\" puts!\r\n \"Press Ctrl+C to stop.\" puts!\r\n start-server", "kind": "symbol", "name": "start-server", "signature": "dict ==> "@@ -2004,7 +1950,7 @@ "name": "symlink?",
"signature": "'sym ==> bool" }, "symmetric-difference": { - "description": "Calculates the symmetric difference quot3 of quot1 and quot2.\n\n \n Example\n \n The following program leaves (true \"a\" 2) on the stack:\n \n (1 2 \"test\") (\"test\" \"a\" true 1) symmetric-difference", + "description": "Calculates the symmetric difference quot3 of quot1 and quot2.\r\n\r\n \r\n Example\r\n \r\n The following program leaves (true \"a\" 2) on the stack:\r\n \r\n (1 2 \"test\") (\"test\" \"a\" true 1) symmetric-difference", "kind": "symbol", "name": "symmetric-difference", "signature": "quot1 quot2 ==> quot3"@@ -2014,12 +1960,6 @@ "description": "Executes the external command 'sym in the current directory and pushes its return code on the stack.",
"kind": "symbol", "name": "system", "signature": "'sym ==> int" - }, - "system!": { - "description": "Executes the external command 'sym in the current directory without pushing its return code on the stack.", - "kind": "symbol", - "name": "system!", - "signature": "'sym ==> " }, "take": { "description": "Returns a quotation quot2 containing the first _n_ values of the input quotation quot1, or quot1 itself if int is greater than the length of quot1.",@@ -2040,15 +1980,9 @@ "name": "tanh",
"signature": "num1 ==> num2" }, "tap": { - "description": "Performs the following operations:\n \n 1. Removes a from the stack.\n 2. For each quotation defined in quot (which is a quotation of quotations each requiring one argument and returning one argument):\n 1. Pushes a back to the stack.\n 2. Dequotes the quotation and saves the result as a.\n 3. Push the resulting a back on the stack.\n \n \n Example\n \n The following program:\n \n {1 :a 2 :b 3 :c} (\n (dup /a succ succ b)\n ) tap\n \n Returns {3 :a 3 :b 3 :c}.", + "description": "Performs the following operations:\r\n \r\n 1. Removes a from the stack.\r\n 2. For each quotation defined in quot (which is a quotation of quotations each requiring one argument and returning one argument):\r\n 1. Pushes a back to the stack.\r\n 2. Dequotes the quotation and saves the result as a.\r\n 3. Push the resulting a back on the stack.\r\n \r\n \r\n Example\r\n \r\n The following program:\r\n \r\n {1 :a 2 :b 3 :c} (\r\n (dup /a succ succ b)\r\n ) tap\r\n \r\n Returns {3 :a 3 :b 3 :c}.", "kind": "symbol", "name": "tap", - "signature": "a quot ==> a" - }, - "tap!": { - "description": "Performs the following operations:\n \n 1. Removes a from the stack.\n 2. For each quotation defined in quot (which is a quotation of quotations each requiring one argument and returning one argument):\n 1. Pushes a back to the stack.\n 2. Dequotes the quotation and saves the result as a.\n \n \n Example\n \n The following program:\n \n \"\" :s1\n \"test\" (\n (' \"1\" swap append \"\" join)\n (' \"2\" swap append \"\" join)\n (' \"3\" swap append \"\" join @s1 s1)\n ) tap!\n \n Sets s1 to \"test123\".", - "kind": "symbol", - "name": "tap!", "signature": "a quot ==> a" }, "tau": {@@ -2100,7 +2034,7 @@ "name": "to-timestamp",
"signature": "dict:timeinfo ==> int" }, "to-yaml": { - "description": "Converts a into a YAML string.\n\n \n Note\n \n At present, only min dictionaries containing string values are supported.", + "description": "Converts a into a YAML string.\r\n\r\n \r\n Note\r\n \r\n At present, only min dictionaries containing string values are supported.", "kind": "symbol", "name": "to-yaml", "signature": "a ==> string"@@ -2112,7 +2046,7 @@ "name": "trunc",
"signature": "num1 ==> num2" }, "try": { - "description": "Evaluates a quotation as a try/catch/finally block. \n \n The must contain the following elements:\n \n 1. A quotation quot1 containing the code to be evaluated (_try_ block).\n 1. _(optional)_ A quotation quot2 containing the code to execute in case of error (_catch_ block).\n 1. _(optional)_ A quotation quot3 containing the code to execute after the code has been evaluated, whether an error occurred or not (_finally_ block).\n \n \n Example\n \n The following program executed on an empty stack prints the message \"Insufficient items on the stack\" and pushes 0 on the stack:\n \n (\n (pop)\n (format-error puts)\n (0)\n ) try", + "description": "Evaluates a quotation as a try/catch/finally block. \r\n \r\n The must contain the following elements:\r\n \r\n 1. A quotation quot1 containing the code to be evaluated (_try_ block).\r\n 1. _(optional)_ A quotation quot2 containing the code to execute in case of error (_catch_ block).\r\n 1. _(optional)_ A quotation quot3 containing the code to execute after the code has been evaluated, whether an error occurred or not (_finally_ block).\r\n \r\n \r\n Example\r\n \r\n The following program executed on an empty stack prints the message \"Insufficient items on the stack\" and pushes 0 on the stack:\r\n \r\n (\r\n (pop)\r\n (format-error puts)\r\n (0)\r\n ) try", "kind": "symbol", "name": "try", "signature": "(quot1 quot2? quot3?) ==> a*"@@ -2130,13 +2064,13 @@ "name": "type?",
"signature": "a 'sym ==> bool" }, "typeclass": { - "description": "Defines a new type class 'sym set to quotation quot, which can be used in operator signatures.\n \n \n Example\n \n Consider the following type class which defines a natural number: \n\n (:n ((n integer?) (n 0 )) &&) 'natural typeclass\n \n It can now be used in operator signatures, like this:\n \n (\n symbol natural-sum\n (natural :n natural :m == natural :result)\n (n m + @result)\n ) ::", + "description": "Defines a new type class 'sym set to quotation quot, which can be used in operator signatures.\r\n \r\n \r\n Example\r\n \r\n Consider the following type class which defines a natural number: \r\n\r\n (:n ((n integer?) (n 0 )) &&) 'natural typeclass\r\n \r\n It can now be used in operator signatures, like this:\r\n \r\n (\r\n symbol natural-sum\r\n (natural :n natural :m == natural :result)\r\n (n m + @result)\r\n ) ::", "kind": "symbol", "name": "typeclass", "signature": "quot 'sym ==> " }, "union": { - "description": "Calculates the union quot3 of quot1 and quot2.\n\n \n Example\n \n The following program leaves (true 1 \"test\" \"a\" 2) on the stack:\n \n (1 2 \"test\") (\"test\" \"a\" true 1) union", + "description": "Calculates the union quot3 of quot1 and quot2.\r\n\r\n \r\n Example\r\n \r\n The following program leaves (true 1 \"test\" \"a\" 2) on the stack:\r\n \r\n (1 2 \"test\") (\"test\" \"a\" true 1) union", "kind": "symbol", "name": "union", "signature": "quot1 quot2 ==> quot3"@@ -2148,7 +2082,7 @@ "name": "unless",
"signature": "quot1 quot2 ==> a*" }, "unmapkey": { - "description": "Unmaps a previously-mapped key or key-combination 'sym, restoring the default mapping if available.\n\n \n Notes\n\n * At present, only the key names and sequences defined in the [nimline](https://h3rald.com/nimline/nimline.html) library are supported.\n * At present, all the default mappings of min are those provided by the [nimline](https://h3rald.com/nimline/nimline.html) library.", + "description": "Unmaps a previously-mapped key or key-combination 'sym, restoring the default mapping if available.\r\n\r\n \r\n Notes\r\n\r\n * At present, only the key names and sequences defined in the [nimline](https://h3rald.com/nimline/nimline.html) library are supported.\r\n * At present, all the default mappings of min are those provided by the [nimline](https://h3rald.com/nimline/nimline.html) library.", "kind": "symbol", "name": "unmapkey", "signature": "'sym ==> "@@ -2189,12 +2123,6 @@ "kind": "symbol",
"name": "warning", "signature": "a ==> a" }, - "warning!": { - "description": "Prints a (removing it from the stack) and a new line to STDERR, if logging level is set to [warning](class:kwd) or lower.", - "kind": "symbol", - "name": "warning!", - "signature": "a ==> " - }, "when": { "description": "If quot1 evaluates to true then evaluates quot2.", "kind": "symbol",@@ -2208,13 +2136,13 @@ "name": "which",
"signature": "'sym ==> string" }, "while": { - "description": "Executes quot2 while quot1 evaluates to true.\n \n \n Example\n \n The following program prints all natural numbers from 0 to 10:\n \n 0 :count \n (count 10 <=) \n (count puts succ @count) while", + "description": "Executes quot2 while quot1 evaluates to true.\r\n \r\n \r\n Example\r\n \r\n The following program prints all natural numbers from 0 to 10:\r\n \r\n 0 :count \r\n (count 10 <=) \r\n (count puts succ @count) while", "kind": "symbol", "name": "while", "signature": "quot1 quot2 ==> a*" }, "with": { - "description": "Pushes each item of quot1 on the stack using the scope of quot2 as scope. \n\n \n Example\n \n This operator is useful to define symbols on the [ROOT](class:kwd) scope or another scope. For example min's prelude includes the following code used to import certain modules only if min was not compiled in lite mode:\n \n 'lite? (\n (\n 'crypto import\n 'math import\n 'net import\n 'http import\n ) ROOT with\n ) unless", + "description": "Pushes each item of quot1 on the stack using the scope of quot2 as scope. \r\n\r\n \r\n Example\r\n \r\n This operator is useful to define symbols on the [ROOT](class:kwd) scope or another scope. For example min's prelude includes the following code used to import certain modules only if min was not compiled in lite mode:\r\n \r\n 'lite? (\r\n (\r\n 'crypto import\r\n 'math import\r\n 'net import\r\n 'http import\r\n ) ROOT with\r\n ) unless", "kind": "symbol", "name": "with", "signature": "quot1 quot2 ==> a*"
@@ -234,6 +234,17 @@ i.trace = i2.trace
raise i.push i2.stack.newVal +# Inherit file/line/column from current symbol +proc pushSym*(i: In, s: string) = + i.push MinValue( + kind: minSymbol, + symVal: s, + filename: i.currSym.filename, + line: i.currSym.line, + column: i.currSym.column, + outerSym: i.currSym.symVal, + docComment: i.currSym.docComment) + proc push*(i: In, val: MinValue) {.gcsafe, extern:"min_exported_symbol_$1".}= if val.kind == minSymbol: i.debug(val)@@ -249,20 +260,27 @@ raise MinReturnException(msg: "return symbol found")
if i.scope.hasSymbol(symbol): i.apply i.scope.getSymbol(symbol) else: - var qIndex = symbol.find('"') - if qIndex > 0: - let sigil = symbol[0..qIndex-1] - if not i.scope.hasSigil(sigil): - raiseUndefined("Undefined sigil '$1'"%sigil) - i.stack.add(MinValue(kind: minString, strVal: symbol[qIndex+1..symbol.len-2])) - i.apply(i.scope.getSigil(sigil)) + # Check if symbol ends with ! (auto-popping) + if symbol.len > 1 and symbol[symbol.len-1] == '!': + let apSymbol = symbol[0..symbol.len-1] + if i.scope.hasSymbol(apSymbol): + i.apply i.scope.getSymbol(apSymbol) + i.pushSym "pop" else: - let sigil = "" & symbol[0] - if symbol.len > 1 and i.scope.hasSigil(sigil): - i.stack.add(MinValue(kind: minString, strVal: symbol[1..symbol.len-1])) + var qIndex = symbol.find('"') + if qIndex > 0: + let sigil = symbol[0..qIndex-1] + if not i.scope.hasSigil(sigil): + raiseUndefined("Undefined sigil '$1'"%sigil) + i.stack.add(MinValue(kind: minString, strVal: symbol[qIndex+1..symbol.len-2])) i.apply(i.scope.getSigil(sigil)) else: - raiseUndefined("Undefined symbol '$1'" % [val.symVal]) + let sigil = "" & symbol[0] + if symbol.len > 1 and i.scope.hasSigil(sigil): + i.stack.add(MinValue(kind: minString, strVal: symbol[1..symbol.len-1])) + i.apply(i.scope.getSigil(sigil)) + else: + raiseUndefined("Undefined symbol '$1'" % [val.symVal]) discard i.trace.pop elif val.kind == minDictionary and val.objType != "module": # Dictionary must be copied every time they are interpreted, otherwise when they are used in cycles they reference each other.@@ -421,14 +439,3 @@ return i.eval(s, name, true)
proc read*(i: In, s: string): MinValue = return i.load(s, true) - -# Inherit file/line/column from current symbol -proc pushSym*(i: In, s: string) = - i.push MinValue( - kind: minSymbol, - symVal: s, - filename: i.currSym.filename, - line: i.currSym.line, - column: i.currSym.column, - outerSym: i.currSym.symVal, - docComment: i.currSym.docComment)
@@ -21,10 +21,6 @@ i.dset(d, "path", p.newVal)
d.objType = "datastore" i.push d - def.symbol("dsinit!") do (i: In): - i.pushSym "dsinit" - i.pushSym "pop" - def.symbol("dsread") do (i: In): let vals = i.expect("'sym") let p = vals[0].getString@@ -43,10 +39,6 @@ let data = i%(i.dget(ds, "data".newVal))
p.writeFile(data.pretty) i.push ds - def.symbol("dswrite!") do (i: In): - i.pushSym "dswrite" - i.pushSym "pop" - def.symbol("dshas?") do (i: In): let vals = i.expect("'sym", "dict:datastore") let s = vals[0].getString@@ -113,10 +105,6 @@ var cll = i.dget(data, collection)
i.dset(cll, id, d) i.push ds - def.symbol("dspost!") do (i: In): - i.pushSym "dspost" - i.pushSym "pop" - def.symbol("dsput") do (i: In): let vals = i.expect("dict", "'sym", "dict:datastore") var d = vals[0]@@ -134,10 +122,6 @@ var cll = i.dget(data, collection)
i.dset(cll, id, d) i.push ds - def.symbol("dsput!") do (i: In): - i.pushSym "dsput" - i.pushSym "pop" - def.symbol("dsdelete") do (i: In): let vals = i.expect("'sym", "dict:datastore") let s = vals[0].getString@@ -153,9 +137,5 @@ raiseInvalid("Collection '$#' does not exist" % collection)
var cll = i.dget(data, collection) i.ddel(cll, id) i.push ds - - def.symbol("dsdelete!") do (i: In): - i.pushSym "dsdelete" - i.pushSym "pop" def.finalize("dstore")
@@ -72,31 +72,6 @@ let a = i.peek
fatal $$a quit(100) - def.symbol("notice!") do (i: In): - let a = i.pop - notice $$a - - def.symbol("info!") do (i: In): - let a = i.pop - info $$a - - def.symbol("error!") do (i: In): - let a = i.pop - error $$a - - def.symbol("warn!") do (i: In): - let a = i.pop - warn $$a - - def.symbol("debug!") do (i: In): - let a = i.pop - debug $$a - - def.symbol("fatal!") do (i: In): - let a = i.pop - fatal $$a - quit(100) - def.symbol("column-print") do (i: In): let vals = i.expect("int", "quot") let n = vals[0]@@ -176,9 +151,6 @@ def.symbol("print") do (i: In):
let a = i.peek a.print - def.symbol("print!") do (i: In): - i.pop.print - def.symbol("fread") do (i: In): let vals = i.expect("string") let file = vals[0].strVal
@@ -325,9 +325,6 @@ def.symbol("puts") do (i: In):
let a = i.peek echo $$a - def.symbol("puts!") do (i: In): - echo $$i.pop - def.symbol("gets") do (i: In) {.gcsafe.}: when defined(mini): i.push readLineFromStdin("").newVal@@ -794,16 +791,6 @@ i.dequote(p)
a = i.pop i.push(a) - def.symbol("tap!") do (i: In): - let vals = i.expect("quot", "a") - let programs = vals[0] - var a = vals[1] - for program in programs.qVal: - var p = program - i.push(a) - i.dequote(p) - a = i.pop - # Conditionals def.symbol("if") do (i: In):
@@ -57,11 +57,6 @@ let vals = i.expect("'sym")
let a = vals[0] i.push execShellCmd(a.getString).newVal - def.symbol("system!") do (i: In): - let vals = i.expect("'sym") - let a = vals[0] - discard execShellCmd(a.getString) - def.symbol("run") do (i: In): let vals = i.expect("'sym") let cmd = vals[0]@@ -217,9 +212,6 @@ i.pushSym("get-env")
def.symbol("!") do (i: In): i.pushSym("system") - - def.symbol("!!") do (i: In): - i.pushSym("system!") def.symbol("&") do (i: In): i.pushSym("run")
@@ -1,16 +1,18 @@
:root { - --primary-foreground:#89968B; + --primary-foreground:#d1e5d4; --primary-background:#262625; --secondary-background: #474745; - --primary-accent:#4BAA76; + --primary-accent:#57c589; --secondary-accent:#2B4737; --secondary-foreground:#D4CC90; + --normal-text-weight: 300; + --bold-text-weight: 400; } body { background-color: var(--primary-background); color: var(--primary-foreground); - font-weight: 300; + font-weight: var(--normal-text-weight); font-feature-settings: "kern"; font-kerning: normal; font-variant-ligatures: common-ligatures;@@ -113,7 +115,11 @@ margin: auto;
} b, strong, dt { - font-weight: 400; + font-weight: var(--bold-text-weight); +} + +dt { + margin-top: 1em; } code, pre, .kwd, .cmd, .file, .dir, kbd, .kbd, .ext, .min-terminal {@@ -121,11 +127,11 @@ font-family: 'Inconsolata', monospace;
} .kwd, .kwd, .cmd, .file, .dir, .ext, kbd, .kbd { - font-weight: bold; + font-weight: var(--bold-text-weight); } h1, h2, h3, h4, h5, h6 { - font-weight: 300; + font-weight: var(--normal-text-weight); color: var(--secondary-foreground); }@@ -166,21 +172,21 @@
.note p:first-child:before { font-family: "themify"; font-style: normal; - font-weight: normal; + font-weight: var(--normal-text-weight); font-size: 100%; content: "\e717" " "; } .tip p:first-child:before { font-family: "themify"; font-style: normal; - font-weight: normal; + font-weight: var(--normal-text-weight); font-size: 100%; content: "\e64d" " "; } .warning p:first-child:before { font-family: "themify"; font-style: normal; - font-weight: normal; + font-weight: var(--normal-text-weight); font-size: 100%; content: "\e6c5" " "; }@@ -206,12 +212,12 @@ .sidebar p:first-child,
.note p:first-child, .tip p:first-child, .warning p:first-child { - font-weight: bold; + font-weight: var(--bold-text-weight); } .sidebar p:first-child:before { font-family: "themify"; font-style: normal; - font-weight: normal; + font-weight: var(--normal-text-weight); font-size: 100%; content: "\e717" " "; }@@ -248,7 +254,7 @@ margin-right: 3px;
box-shadow: none; font-size: 90%; font-variant: small-caps; - font-weight: bold; + font-weight: var(--bold-text-weight); content: "sigil"; }
@@ -105,6 +105,13 @@ ) operator
Also, symbols defined with the {#link-operator||lang||operator#} symbol can be annotated with documentation comments (starting with `;;` or wrapped in `#|| ... ||#`)`) so that a help text can be displayed using the {#link-operator||lang||help#} symbol. +## Auto-popping + +Typically, but not always, operators push one or more value to the stack. While this is typically the desired behavior, in some cases you may want to keep the stack clear so in these cases you can append a `!` character to any symbol to cause the symbol {#link-operator||lang||pop#} to be pushed on the stack immediately afterwards. + + "test" puts ;Prints "test" and pushes "test" on the stack. + "test" puts! ;Prints "test" without pushing anything on the stack. + ## Operator signatures When defining symbols and sigils witb the {#link-operator||lang||operator#} operator, you must specify a *signature* that will be used to validate and captuee input and output values:
@@ -8,9 +8,6 @@ {#op||dsdelete||{{dstore}} {{sl}}||{{dstore}}||
Removes an item from the datastore {{dstore}}. The item is uniquely identified by {{sl}}, which contains the collection containing the item and the item id, separated by a forward slash (/). Puts the reference to the modified datastore back on tbe stack. #} -{#op||dsdelete!||{{dstore}} {{sl}}||{{none}}|| -Same as `dsdelete`, but doesn't leave anything on the stack. #} - {#op||dsget||{{dstore}} {{sl}}||{{d}}|| Retrieves item {{d}} from datastore {{dstore}}. {{d}} is retrieved by specifying {{sl}}, which contains the collection containing the item and the item id, separated by a forward slash (/). #}@@ -18,23 +15,14 @@
{#op||dsinit||{{sl}}||{{dstore}}|| Initializes a bew datastore by creating the {{sl}} JSON file. Puts the datastore instance on the stack. #} -{#op||dsinit!||{{sl}} {{d}}||{{none}}|| -Same as `dsinit`, but doesn't leave anything on the stack. #} - {#op||dspost||{{dstore}} {{sl}} {{d}}||{{dstore}}|| Adds the dictionary {{d}} to the datastore {{dstore}} inside collection {{sl}}, generating and adding a unique **id** field to {{d}}. If the collection {{sl}} does not exist it is created. Puts the reference to the modified datastore back on tbe stack. #} -{#op||dspost!||{{dstore}} {{sl}} {{d}}||{{none}}|| -Same as `dspost`, but doesn't leave anything on the stack. #} - {#op||dsput||{{dstore}} {{sl}} {{d}}||{{dstore}}|| Adds the dictionary {{d}} to the datastore {{dstore}}. {{sl}} contains the collection where {{d}} will be placed and the id of {{d}}, separated by a forward slash (/). If the collection {{sl}} does not exist it is created. Puts the reference to the modified datastore back on tbe stack. #} -{#op||dsput!||{{dstore}} {{sl}}||{{none}}|| -Same as `dsput`, but doesn't leave anything on the stack. #} - {#op||dsquery||{{dstore}} {{sl}} {{q}}||({{d0p}})|| > Retrieves a quotation of dictionaries from the collection {{sl}} of datastore {{dstore}} obtained by applying {{q}} as a filter to each item of the collection, picking only the elements that match the filter. >@@ -53,7 +41,3 @@
{#op||dswrite||{{dstore}}||{{dstore}}|| Writes the contents of the datastore {{dstore}} to the filesystem. #} - -{#op||dswrite!||{{dstore}}||{{none}}|| -Same as `dswrite`, but doesn't leave anything on the stack. #} -
@@ -28,15 +28,9 @@
{#op||debug||{{any}}||{{any}}|| Prints {{any}} and a new line to STDOUT, if logging level is set to [debug](class:kwd) or lower.#} -{#op||debug!||{{any}}||{{none}}|| -Prints {{any}} (removing it from the stack) and a new line to STDOUT, if logging level is set to [debug](class:kwd) or lower.#} - {#op||error||{{any}}||{{any}}|| Prints {{any}} and a new line to STDERR, if logging level is set to [error](class:kwd) or lower.#} -{#op||error!||{{any}}||{{none}}|| -Prints {{any}} (removing it from the stack) and a new line to STDERR, if logging level is set to [error](class:kwd) or lower.#} - {#op||fappend||{{s1}} {{s2}}||{{none}}|| Appends {{s1}} to the end of file {{s2}}. #}@@ -54,9 +48,6 @@ Reads single character from STDIN without waiting for ENTER key and places its ASCII code on top of the stack.#}
{#op||info||{{any}}||{{any}}|| Prints {{any}} and a new line to STDOUT, if logging level is set to [info](class:kwd) or lower.#} - -{#op||info!||{{any}}||{{none}}|| -Prints {{any}} (removing it from the stack) and a new line to STDOUT, if logging level is set to [info](class:kwd) or lower.#} {#op||mapkey||{{q}} {{sl}}||{{none}}|| > Maps the named key/key combination {{sl}} to the quotation {{q}}, so that {{q}} is executed when key {{sl}} is pressed.@@ -82,17 +73,11 @@
{#op||notice||{{any}}||{{any}}|| Prints {{any}} and a new line to STDOUT, if logging level is set to [notice](class:kwd) (default) or lower.#} -{#op||notice!||{{any}}||{{none}}|| -Prints {{any}} (removing it from the stack) and a new line to STDOUT, if logging level is set to [notice](class:kwd) (default) or lower.#} - {#op||password||{{none}}||{{s}}|| Reads a line from STDIN displaying \* for each typed character, and places it on top of the stack as a string.#} {#op||print||{{any}}||{{any}}|| Prints {{any}} to STDOUT.#} - -{#op||print!||{{any}}||{{none}}|| -Prints {{any}} to STDOUT and removes {{any}} from the stack.#} {#op||putchr||{{s}}||{{any}}|| Prints {{s}} to STDOUT without printing a new line ({{s}} must contain only one character).#}@@ -111,7 +96,4 @@ > > * At present, all the default mappings of min are those provided by the [nimline](https://h3rald.com/nimline/nimline.html) library.
#} {#op||warning||{{any}}||{{any}}|| -Prints {{any}} and a new line to STDERR, if logging level is set to [warning](class:kwd) or lower.#} - -{#op||warning!||{{any}}||{{none}}|| -Prints {{any}} (removing it from the stack) and a new line to STDERR, if logging level is set to [warning](class:kwd) or lower.#} +Prints {{any}} and a new line to STDERR, if logging level is set to [warning](class:kwd) or lower.#}
@@ -362,9 +362,6 @@
{#op||puts||{{any}}||{{any}}|| Prints {{any}} and a new line to STDOUT.#} -{#op||puts!||{{any}}||{{none}}|| -Prints {{any}} and a new line to STDOUT, removing {{any}} from the stack.#} - {#op||quit||{{none}}||{{none}}|| Exits the program or shell with 0 as return code. #}@@ -481,28 +478,6 @@ > > (dup /b succ %b)
> > ) tap > > > > Returns `{3 :a 3 :b 3 :c}`.#} - -{#op||tap!||{{any}} {{q}}||{{any}}|| -> Performs the following operations: -> -> 1. Removes {{any}} from the stack. -> 2. For each quotation defined in {{q}} (which is a quotation of quotations each requiring one argument and returning one argument): -> 1. Pushes {{any}} back to the stack. -> 2. Dequotes the quotation and saves the result as {{any}}. -> -> > %sidebar% -> > Example -> > -> > The following program: -> > -> > "" :s1 -> > "test" ( -> > (' "1" swap append "" join) -> > (' "2" swap append "" join) -> > (' "3" swap append "" join @s1 s1) -> > ) tap! -> > -> > Sets `s1` to `"test123"`. #} {#op||times||{{q}} {{i}}||{{a0p}}|| Applies the quotation {{q}} {{i}} times.#}
@@ -106,9 +106,6 @@
{#op||system||{{sl}}||{{i}}|| Executes the external command {{sl}} in the current directory and pushes its return code on the stack. #} -{#op||system!||{{sl}}||{{none}}|| -Executes the external command {{sl}} in the current directory without pushing its return code on the stack. #} - {#op||unzip||{{sl1}} {{sl2}}||{{none}}|| Decompresses zip file {{sl1}} to directory {{sl2}} (created if not present).#}
@@ -19,7 +19,6 @@
{#op||datetime||{{i}}||{{s}}|| Returns an ISO 8601 string representing the combined date and time in UTC of timestamp {{i}}. #} - {#op||tformat||{{i}} {{s}}||{{s}}|| > Formats timestamp {{i}} using string {{s}}. >
@@ -6,7 +6,8 @@ <link rel="icon" type="image/png" href="/images/logo.png" />
<title>{{site}} - {{title}}</title> <link rel="stylesheet" href="//cdn.jsdelivr.net/g/pure@0.6.2(base-min.css+grids-min.css+grids-responsive-min.css+buttons-min.css)"> <link rel="stylesheet" href="https://cdn.rawgit.com/balzss/luxbar/ae5835e2/build/luxbar.min.css"> - <link href="https://fonts.googleapis.com/css?family=Inconsolata|Lato:300,300i,400,400i" rel="stylesheet"> + <link rel="preconnect" href="https://fonts.gstatic.com"> + <link href="https://fonts.googleapis.com/css2?family=Inconsolata:wght@300;400&family=Lato:ital,wght@0,300;0,400;1,300;1,400&display=swap" rel="stylesheet"> <link rel="stylesheet" href="/styles/themify-icons.css"> <link rel="stylesheet" href="/styles/min-lang.css"> </head>