all repos — min @ 59aefabd87e41e18141456e7c778a1f93d20d448

A small but practical concatenative programming language.

Updated docs.
h3rald h3rald@h3rald.com
Sat, 12 Oct 2024 15:06:57 +0200
commit

59aefabd87e41e18141456e7c778a1f93d20d448

parent

70cd9f441a13a6d9bf518cda78050ab99a37b94e

M Min_DeveloperGuide.mdMin_DeveloperGuide.md

@@ -97,54 +97,53 @@ ### `global` Module

{@ site/contents/reference-global.md || 1 @} -### `stack` Module +### `crypto` Module -{@ site/contents/reference-stack.md || 1 @} +{@ site/contents/reference-crypto.md || 1 @} -### `seq` Module +### `dict` Module -{@ site/contents/reference-seq.md || 1 @} +{@ site/contents/reference-dict.md || 1 @} -### `dict` Module +### `fs` Module -{@ site/contents/reference-dict.md || 1 @} +{@ site/contents/reference-fs.md || 1 @} -### `dstore` Module +### `http` Module -{@ site/contents/reference-dstore.md || 1 @} +{@ site/contents/reference-http.md || 1 @} ### `io` Module {@ site/contents/reference-io.md || 1 @} -### `fs` Module +### `math` Module -{@ site/contents/reference-fs.md || 1 @} +{@ site/contents/reference-math.md || 1 @} -### `sys` Module +### `net` Module -{@ site/contents/reference-sys.md || 1 @} +{@ site/contents/reference-net.md || 1 @} -### `time` Module +### `seq` Module -{@ site/contents/reference-time.md || 1 @} - -### `crypto` Module +{@ site/contents/reference-seq.md || 1 @} -{@ site/contents/reference-crypto.md || 1 @} +### `stack` Module +{@ site/contents/reference-stack.md || 1 @} -### `math` Module +### `store` Module -{@ site/contents/reference-math.md || 1 @} +{@ site/contents/reference-store.md || 1 @} -### `net` Module +### `sys` Module -{@ site/contents/reference-net.md || 1 @} +{@ site/contents/reference-sys.md || 1 @} -### `http` Module +### `time` Module -{@ site/contents/reference-http.md || 1 @} +{@ site/contents/reference-time.md || 1 @} ### `xml` Module

@@ -183,7 +182,9 @@ {# link-page => $2 #}

{# link-module => [$1 Module](#<code>$1</code>-Module) #} -{# link-operator => [$2](#min-operator-id-$2) #} +{# link-operator => [$1.$2](#min-operator-id-$2) #} + +{# link-global-operator => [$1](#min-operator-id-$1) #} {# link-learn => #}
M help.jsonhelp.json

@@ -533,7 +533,7 @@ "name": "get-raw",

"signature": "dict 'sym ==> dict:rawval" }, "dict.has?": { - "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.\n \n \n Example\n \n The following program returns true:\n \n {true :a1 \"aaa\" :a2 false :a3} 'a2 dict.has?", "kind": "symbol", "module": "dict", "name": "has?",

@@ -547,14 +547,14 @@ "name": "keys",

"signature": "dict ==> (str*)" }, "dict.pairs": { - "description": "Returns a quotation containing a quotation for each value/key pair (value first, key second) of dictionary dict. \n \n \n Example\n\n A The following program returns ((1 \"a\") (2 \"b\")):\n {1 :a 2 :b} dpairs", + "description": "Returns a quotation containing a quotation for each value/key pair (value first, key second) of dictionary dict. \n \n \n Example\n\n A The following program returns ((1 \"a\") (2 \"b\")):\n {1 :a 2 :b} dict.pairs", "kind": "symbol", "module": "dict", "name": "pairs", "signature": "dict ==> (a*)" }, "dict.pick": { - "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.\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\") dict.pick", "kind": "symbol", "module": "dict", "name": "pick",

@@ -601,62 +601,6 @@ "kind": "symbol",

"module": "global", "name": "div", "signature": "int1 int2 ==> int3" - }, - "dstore.dsdelete": { - "description": "Removes an item from the datastore dict:datastore. The item is uniquely identified by 'sym, 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.", - "kind": "symbol", - "module": "dstore", - "name": "dsdelete", - "signature": "dict:datastore 'sym ==> dict:datastore" - }, - "dstore.dsget": { - "description": "Retrieves item dict from datastore dict:datastore. dict is retrieved by specifying 'sym, which contains the collection containing the item and the item id, separated by a forward slash (/).", - "kind": "symbol", - "module": "dstore", - "name": "dsget", - "signature": "dict:datastore 'sym ==> dict" - }, - "dstore.dsinit": { - "description": "Initializes a bew datastore by creating the 'sym JSON file. Puts the datastore instance on the stack.", - "kind": "symbol", - "module": "dstore", - "name": "dsinit", - "signature": "'sym ==> dict:datastore" - }, - "dstore.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", - "module": "dstore", - "name": "dspost", - "signature": "dict:datastore 'sym dict ==> dict:datastore" - }, - "dstore.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", - "module": "dstore", - "name": "dsput", - "signature": "dict:datastore 'sym dict ==> dict:datastore" - }, - "dstore.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 dget \"h3rald\" ==) dsquery", - "kind": "symbol", - "module": "dstore", - "name": "dsquery", - "signature": "dict:datastore 'sym quot ==> (dict*)" - }, - "dstore.dsread": { - "description": "Reads the previously-created datastore from the file 'sym and puts the resulting datastore instance on the stack.", - "kind": "symbol", - "module": "dstore", - "name": "dsread", - "signature": "'sym ==> dict:datastore" - }, - "dstore.dswrite": { - "description": "Writes the contents of the datastore dict:datastore to the filesystem.", - "kind": "symbol", - "module": "dstore", - "name": "dswrite", - "signature": "dict:datastore ==> dict:datastore" }, "escape": { "description": "Returns a copy of 'sym with quotes and backslashes escaped with a backslash.",

@@ -988,14 +932,14 @@ "name": "get-content",

"signature": "str1 ==> str2" }, "http.request": { - "description": "Performs an HTTP request. Note that dict is can be a standard (untyped) dictionary but its fields will be validated like if it was a dict:http-request.\n\n \n Example\n \n The following code constructs dict and passes it to the **request** operator to perform an HTTP GET request to <http://httpbin.org/ip:\n \n {}\n \"GET\" 'method dget\n \"http://httpbin.org/ip\" 'url dset\n request", + "description": "Performs an HTTP request. Note that dict is can be a standard (untyped) dictionary but its fields will be validated like if it was a dict:http-request.\n\n \n Example\n \n The following code constructs dict and passes it to the **request** operator to perform an HTTP GET request to <http://httpbin.org/ip:\n \n {}\n \"GET\" 'method dict.get\n \"http://httpbin.org/ip\" 'url dict.set\n request", "kind": "symbol", "module": "http", "name": "request", "signature": "dict ==> dict:http-response" }, "http.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: [dict:http-request &rArr; dict:http-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 'body dset\n dup puts!\n )\n ; The request handler is ready, give it the name handler\n :handler\n \n ; Create the parameter dictionary for the server\n {}\n handler 'handler dset\n 5555 'port dset\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.\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: [dict:http-request &rArr; dict:http-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 'body dict.set\n stack.dup puts!\n )\n ; The request handler is ready, give it the name handler\n :handler\n \n ; Create the parameter dictionary for the server\n {}\n handler 'handler dict.set\n 5555 'port dict.set\n \n ; Start server\n \"Server started on port 5555.\" puts!\n \"Press Ctrl+C to stop.\" puts!\n start-server", "kind": "symbol", "module": "http", "name": "start-server",

@@ -1065,7 +1009,7 @@ "name": "integer?",

"signature": "a ==> bool" }, "interpolate": { - "description": "Substitutes the placeholders included in str with the values in quot.\n \n Notes\n \n * If quot contains symbols or quotations, they are not interpreted. To do so, call apply before interpolating or use apply-interpolate instead.\n * You can use the $# placeholder to indicate the next placeholder that has not been already referenced in the string.\n * You can use named placeholders like $pwd, but in this case quot must contain a quotation containing both the placeholder names (odd items) and the values (even items).\n \n \n Example\n \n The following code (executed in a directory called '/Users/h3rald/Development/min' containing 19 files):\n \n \"Directory '$1' includes $2 files.\" (. (. ls 'file? filter size)) apply interpolate\n \n produces:\n \n \"Directory '/Users/h3rald/Development/min' includes 19 files.\"", + "description": "Substitutes the placeholders included in str with the values in quot.\n \n Notes\n \n * If quot contains symbols or quotations, they are not interpreted. To do so, call apply before interpolating or use apply-interpolate instead.\n * You can use the $# placeholder to indicate the next placeholder that has not been already referenced in the string.\n * You can use named placeholders like $pwd, but in this case quot must contain a quotation containing both the placeholder names (odd items) and the values (even items).\n \n \n Example\n \n The following code (executed in a directory called '/Users/h3rald/Development/min' containing 19 files):\n \n \"Directory '$1' includes $2 files.\" (sys.pwd (sys.pwd sys.ls 'fs.file? seq.filter size)) apply interpolate\n \n produces:\n \n \"Directory '/Users/h3rald/Development/min' includes 19 files.\"", "kind": "symbol", "module": "global", "name": "interpolate",

@@ -1170,7 +1114,7 @@ "name": "info",

"signature": "a ==> a" }, "io.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 [minline](https://h3rald.com/minline/minline.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 mapkey \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. \n\n \n Notes\n\n * At present, only the key names and sequences defined in the [minline](https://h3rald.com/minline/minline.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 io.mapkey \n \n causes the CTRL+L key to clear the screen.", "kind": "symbol", "module": "io", "name": "mapkey",

@@ -1513,14 +1457,14 @@ "name": "close",

"signature": "dict:socket ==> " }, "net.connect": { - "description": "Connects socket dict:socket to address str 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 str 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 {} net.socket \"localhost\" 7777 net.connect :cli\n \n args 1 get :msg\n \n \"Sending message \\\"$1\\\" to localhost:7777...\" (msg) = net.send\n \n \"Done.\" puts!\n \n cli net.close", "kind": "symbol", "module": "net", "name": "connect", "signature": "dict:socket str int ==> dict:socket" }, "net.listen": { - "description": "Makes socket dict:socket1 listen to the specified address and port. dict can be empty or contain any of the following properties, used to specify the address and port to listen to respectively.\n \n address\n : The address to listen to (default: **0.0.0.0**).\n port\n : The port to listen to (default: **80**).\n \n \n Example\n \n The following code shows how to create a simple server that listens on port 7777, prints data received from clients, and exits when it receives the string exit:\n \n {} socket {\"127.0.0.1\" :address 7777 :port} listen :srv\n \n \"Server listening on localhost:7777\" puts!\n \n {} socket :cli\n \"\" :line\n (line \"exit\" !=)\n (\n srv cli accept #cli\n cli recv-line @line\n \"Received: $1\" (line) = % puts!\n ) while\n \n \"Exiting...\" puts!\n \n srv close", + "description": "Makes socket dict:socket1 listen to the specified address and port. dict can be empty or contain any of the following properties, used to specify the address and port to listen to respectively.\n \n address\n : The address to listen to (default: **0.0.0.0**).\n port\n : The port to listen to (default: **80**).\n \n \n Example\n \n The following code shows how to create a simple server that listens on port 7777, prints data received from clients, and exits when it receives the string exit:\n \n {} net.socket {\"127.0.0.1\" :address 7777 :port} net.listen :srv\n \n \"Server listening on localhost:7777\" puts!\n \n {} net.socket :cli\n \"\" :line\n (line \"exit\" !=)\n (\n srv cli net.accept #cli\n cli net.recv-line @line\n \"Received: $1\" (line) = % puts!\n ) while\n \n \"Exiting...\" puts!\n \n srv net.close", "kind": "symbol", "module": "net", "name": "listen",

@@ -1534,7 +1478,7 @@ "name": "recv",

"signature": "dict:socket int ==> str" }, "net.recv-line": { - "description": "Waits to receive a line of data from dict:socket and returns the resulting data str. \"\" 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 str. \"\" 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 {} net.socket \"httpbin.org\" 80 net.connect :cli\n \n cli \"GET /uuid HTTP/1.1\\r\\nHost: httpbin.org\\r\\n\\r\\n\" net.send\n \n cli net.recv-line puts :line\n (line \"\\}\" match not) \n (\n cli net.recv-line puts @line\n ) while", "kind": "symbol", "module": "net", "name": "recv-line",

@@ -1660,19 +1604,12 @@ "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:\n \n (\"[$1]$$ \" (sys.pwd) = sidebar%\n Example\n \n Publish symbol [my-local-symbol](class:kwd) to [global](class:kwd) scope:\n 'my-local-symbol global publish", "kind": "symbol", "module": "global", "name": "prompt", "signature": " ==> str" }, - "publish": { - "description": "Publishes symbol 'sym to the scope of dict.\n \n \n Example\n \n Publish symbol [my-local-symbol](class:kwd) to [global](class:kwd) scope:\n 'my-local-symbol global publish", - "kind": "symbol", - "module": "global", - "name": "publish", - "signature": "'sym dict ==> " - }, "put-env": { "description": "Sets environment variable 'sym2 to 'sym1.", "kind": "symbol",

@@ -1946,7 +1883,7 @@ "name": "concat",

"signature": "quot1 quot2 ==> quot3" }, "seq.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.\n\n \n Example\n \n The following program leaves (2) on the stack:\n \n (1 2 \"test\") (\"test\" \"a\" true 1) seq.difference", "kind": "symbol", "module": "seq", "name": "difference",

@@ -1960,14 +1897,14 @@ "name": "drop",

"signature": "quot1 int ==> quot2" }, "seq.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.\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 (stackdup 20 < stack.swap even? and) seq.filter", "kind": "symbol", "module": "seq", "name": "filter", "signature": "quot1 quot2 ==> quot3" }, "seq.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.\n \n \n Example\n \n The following program leaves 3 on the stack:\n \n (1 2 4 8 16) \n (5 ) seq.find", "kind": "symbol", "module": "seq", "name": "find",

@@ -1981,7 +1918,7 @@ "name": "first",

"signature": "quot ==> a" }, "seq.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.\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 seq.flatten", "kind": "symbol", "module": "seq", "name": "flatten",

@@ -1995,7 +1932,7 @@ "name": "get",

"signature": "quot int ==> a" }, "seq.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.\n \n \n Example\n \n The following program leaves (1 2 3) on the stack:\n \n (1 () () () 2 () 3) \n seq.harvest", "kind": "symbol", "module": "seq", "name": "harvest",

@@ -2016,7 +1953,7 @@ "name": "insert",

"signature": "quot1 a int ==> quot2" }, "seq.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.\n\n \n Example\n \n The following program leaves (1 \"test\") on the stack:\n \n (1 2 \"test\") (\"test\" \"a\" true 1) seq.intersection", "kind": "symbol", "module": "seq", "name": "intersection",

@@ -2037,7 +1974,7 @@ "name": "map",

"signature": "quot1 quot2 ==> quot3" }, "seq.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.\n \n \n Example\n \n The following program leaves 35 on the stack:\n \n (1 3 5) \n (stack.dup *) (+) seq.map-reduce", "kind": "symbol", "module": "seq", "name": "map-reduce",

@@ -2051,7 +1988,7 @@ "name": "one?",

"signature": "quot1 quot2 ==> bool" }, "seq.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.\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?) seq.partition", "kind": "symbol", "module": "seq", "name": "partition",

@@ -2079,7 +2016,7 @@ "name": "raw-get",

"signature": "quot int ==> dict:rawval" }, "seq.reduce": { - "description": "Combines each successive element of quot1 using quot2. On the first iteration, the first two inputs processed by quot2 are a1 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 a1 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 (*) seq.reduce", "kind": "symbol", "module": "seq", "name": "reduce",

@@ -2142,21 +2079,21 @@ "name": "size",

"signature": "quot ==> int" }, "seq.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.\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 seq.slice", "kind": "symbol", "module": "seq", "name": "slice", "signature": "quot1 int1 int2 ==> quot2" }, "seq.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. \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) ' seq.sort", "kind": "symbol", "module": "seq", "name": "sort", "signature": "quot1 quot2 ==> quot3" }, "seq.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.\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) seq.symmetric-difference", "kind": "symbol", "module": "seq", "name": "symmetric-difference",

@@ -2170,7 +2107,7 @@ "name": "take",

"signature": "quot1 int ==> quot2" }, "seq.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.\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) seq.union", "kind": "symbol", "module": "seq", "name": "union",

@@ -2219,7 +2156,7 @@ "name": "clear",

"signature": "a ==> " }, "stack.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.\n \n Example\n \n The following program leaves 2 on the stack:\n \n (1 2 3) ((sum) (size)) stack.cleave /", "kind": "symbol", "module": "stack", "name": "cleave",

@@ -2261,7 +2198,7 @@ "name": "id",

"signature": " ==> " }, "stack.keep": { - "description": "Removes the first element from the stack, dequotes it, and restores the second element.\n \n Example\n \n The following program leaves 5 3 on the stack:\n \n 2 3 '+ keep", + "description": "Removes the first element from the stack, dequotes it, and restores the second element.\n \n Example\n \n The following program leaves 5 3 on the stack:\n \n 2 3 '+ stack.keep", "kind": "symbol", "module": "stack", "name": "keep",

@@ -2324,7 +2261,7 @@ "name": "sip",

"signature": "quot1 quot2 ==> a* quot1" }, "stack.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.\n \n Example\n \n The following program leaves (1 4) on the stack:\n \n (1 2) (3 4) ((0 get) (1 get)) stack.spread", "kind": "symbol", "module": "stack", "name": "spread",

@@ -2344,6 +2281,62 @@ "module": "stack",

"name": "swons", "signature": "(a*) a1 ==> (a1 a*)" }, + "store.delete": { + "description": "Removes an item from the datastore dict:datastore. The item is uniquely identified by 'sym, 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.", + "kind": "symbol", + "module": "store", + "name": "delete", + "signature": "dict:datastore 'sym ==> dict:datastore" + }, + "store.get": { + "description": "Retrieves item dict from datastore dict:datastore. dict is retrieved by specifying 'sym, which contains the collection containing the item and the item id, separated by a forward slash (/).", + "kind": "symbol", + "module": "store", + "name": "get", + "signature": "dict:datastore 'sym ==> dict" + }, + "store.init": { + "description": "Initializes a bew datastore by creating the 'sym JSON file. Puts the datastore instance on the stack.", + "kind": "symbol", + "module": "store", + "name": "init", + "signature": "'sym ==> dict:datastore" + }, + "store.post": { + "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", + "module": "store", + "name": "post", + "signature": "dict:datastore 'sym dict ==> dict:datastore" + }, + "store.put": { + "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", + "module": "store", + "name": "put", + "signature": "dict:datastore 'sym dict ==> dict:datastore" + }, + "store.query": { + "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 dget \"h3rald\" ==) dquery", + "kind": "symbol", + "module": "store", + "name": "query", + "signature": "dict:datastore 'sym quot ==> (dict*)" + }, + "store.read": { + "description": "Reads the previously-created datastore from the file 'sym and puts the resulting datastore instance on the stack.", + "kind": "symbol", + "module": "store", + "name": "read", + "signature": "'sym ==> dict:datastore" + }, + "store.write": { + "description": "Writes the contents of the datastore dict:datastore to the filesystem.", + "kind": "symbol", + "module": "store", + "name": "write", + "signature": "dict:datastore ==> dict:datastore" + }, "string": { "description": "Converts a to its string representation.", "kind": "symbol",

@@ -2422,7 +2415,7 @@ "name": "cd",

"signature": "'sym ==> " }, "sys.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.\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 sys.chmod\"", "kind": "symbol", "module": "sys", "name": "chmod",

@@ -2569,7 +2562,7 @@ "name": "zip",

"signature": "quot 'sym ==> " }, "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 dget succ succ 'a dset)\n (dup 'b dget succ 'b dset)\n ) tap\n \n Returns {3 :a 3 :b 3 :c}.", + "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 (stack.dup 'a dict.get succ succ 'a dict.set)\n (stack.dup 'b dict.get succ 'b dict.set)\n ) tap\n \n Returns {3 :a 3 :b 3 :c}.", "kind": "symbol", "module": "global", "name": "tap",

@@ -2688,7 +2681,7 @@ "name": "tokenize",

"signature": "str ==> quot" }, "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. \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 (stack.pop)\n (format-error puts)\n (0)\n ) try", "kind": "symbol", "module": "global", "name": "try",

@@ -2777,89 +2770,89 @@ "kind": "symbol",

"module": "io", "name": "write" }, - "xml.from-html": { - "description": "Returns an xml-node representing an HTML string (wrapped in a <document tag unless a valid HTML document is provided as input).", - "kind": "symbol", - "module": "xml", - "name": "from-html", - "signature": "'sym ==> xml-node" - }, - "xml.from-xml": { - "description": "Returns an xml-node representing an XML string (element or fragment).\n \n \n Example\n \n The following program:\n\n \"<a href='https://min-lang.org'min web site</a\" from-xml \n returns the following:\n \n {\n {\"https://min-lang.org\" :href} :attributes\n ({\"min web site\" :text}) :children\n \"a\" :tag\n ;xml-element\n }", - "kind": "symbol", - "module": "xml", - "name": "from-xml", - "signature": "'sym ==> xml-node" - }, - "xml.to-xml": { - "description": "Returns a str representing an XML node.", - "kind": "symbol", - "module": "xml", - "name": "to-xml", - "signature": "xml-node ==> str" - }, - "xml.xcdata": { + "xml.cdata": { "description": "Returns a dict:xml-cdata representing an XML CDATA section.", "kind": "symbol", "module": "xml", - "name": "xcdata", + "name": "cdata", "signature": "'sym ==> dict:xml-cdata" }, - "xml.xcomment": { + "xml.comment": { "description": "Returns a dict:xml-comment representing an XML comment.", "kind": "symbol", "module": "xml", - "name": "xcomment", + "name": "comment", "signature": "'sym ==> dict:xml-comment" }, - "xml.xelement": { + "xml.element": { "description": "Returns a dict:xml-element representing an XML element (it will be an empty element with no attributes or children).", "kind": "symbol", "module": "xml", - "name": "xelement", + "name": "element", "signature": "'sym ==> dict:xml-element" }, - "xml.xentity": { + "xml.entity": { "description": "Returns a dict:xml-entity representing an XML entity.", "kind": "symbol", "module": "xml", - "name": "xentity", + "name": "entity", "signature": "'sym ==> dict:xml-entity" }, - "xml.xentity2utf8": { - "description": "Returns the UTF-8 symbol corresponding to the specified XML entity. \n \n \n Example\n \n The following program prints p to the screen:\n \n \"&gt;\" xentity xentity2utf8 puts", + "xml.entity2utf8": { + "description": "Returns the UTF-8 symbol corresponding to the specified XML entity. \n \n \n Example\n \n The following program prints p to the screen:\n \n \"&gt;\" xml.entity xml.entity2utf8 puts!", "kind": "symbol", "module": "xml", - "name": "xentity2utf8", + "name": "entity2utf8", "signature": "dict:xml-entity ==> str" }, - "xml.xescape": { + "xml.escape": { "description": "Converts any <, `, &, ', and \"` present in 'sym into the corresponding XML entities.", "kind": "symbol", "module": "xml", - "name": "xescape", + "name": "escape", "signature": "'sym ==> str" }, - "xml.xquery": { - "description": "Returns an dict:xml-element representing the first element matching CSS the selector 'sym.\n \n \n Example\n \n The following program:\n\n \"<ul\n <li class='test'first</li\n <li class='other'second</li\n <li class='test'third</li\n </ul\" \n from-xml \".test\" xquery\n Returns the following:\n\n {\n {\"test\" :class} :attributes \n ({\"first\" :text}) :children \n \"li\" :tag \n ;xml-element\n }", + "xml.from-html": { + "description": "Returns an xml-node representing an HTML string (wrapped in a <document tag unless a valid HTML document is provided as input).", + "kind": "symbol", + "module": "xml", + "name": "from-html", + "signature": "'sym ==> xml-node" + }, + "xml.from-xml": { + "description": "Returns an xml-node representing an XML string (element or fragment).\n \n \n Example\n \n The following program:\n\n \"<a href='https://min-lang.org'min web site</a\" from-xml \n returns the following:\n \n {\n {\"https://min-lang.org\" :href} :attributes\n ({\"min web site\" :text}) :children\n \"a\" :tag\n ;xml-element\n }", "kind": "symbol", "module": "xml", - "name": "xquery", + "name": "from-xml", + "signature": "'sym ==> xml-node" + }, + "xml.query": { + "description": "Returns an dict:xml-element representing the first element matching CSS the selector 'sym.\n \n \n Example\n \n The following program:\n\n \"<ul\n <li class='test'first</li\n <li class='other'second</li\n <li class='test'third</li\n </ul\" \n xml.from-xml \".test\" xml.query\n Returns the following:\n\n {\n {\"test\" :class} :attributes \n ({\"first\" :text}) :children \n \"li\" :tag \n ;xml-element\n }", + "kind": "symbol", + "module": "xml", + "name": "query", "signature": "dict:xml-element 'sym ==> dict:xml-element" }, - "xml.xqueryall": { - "description": "Returns a list of dict:xml-element dictionaries representing all the elements matching CSS the selector 'sym.\n \n \n Example\n \n The following program:\n\n \"<ul\n <li class='test'first</li\n <li class='other'second</li\n <li class='test'third</li\n </ul\" \n from-xml \".test\" xqueryall\n Returns the following:\n\n ({\n {\"test\" :class} :attributes \n ({\"first\" :text}) :children \n \"li\" :tag \n ;xml-element\n }\n {\n {\"test\" :class} :attributes \n ({\"third\" :text}) :children \n \"li\" :tag \n ;xml-element\n })", + "xml.queryall": { + "description": "Returns a list of dict:xml-element dictionaries representing all the elements matching CSS the selector 'sym.\n \n \n Example\n \n The following program:\n\n \"<ul\n <li class='test'first</li\n <li class='other'second</li\n <li class='test'third</li\n </ul\" \n xml.from-xml \".test\" xml.queryall\n Returns the following:\n\n ({\n {\"test\" :class} :attributes \n ({\"first\" :text}) :children \n \"li\" :tag \n ;xml-element\n }\n {\n {\"test\" :class} :attributes \n ({\"third\" :text}) :children \n \"li\" :tag \n ;xml-element\n })", "kind": "symbol", "module": "xml", - "name": "xqueryall", + "name": "queryall", "signature": "dict:xml-element 'sym ==> dict:xml-element" }, - "xml.xtext": { + "xml.text": { "description": "Returns a dict:xml-text representing an XML text node.", "kind": "symbol", "module": "xml", - "name": "xtext", + "name": "text", "signature": "'sym ==> dict:xml-text" + }, + "xml.to-xml": { + "description": "Returns a str representing an XML node.", + "kind": "symbol", + "module": "xml", + "name": "to-xml", + "signature": "xml-node ==> str" }, "xor": { "description": "Returns true if bool1 and bool2 are different, false otherwise.",
M next-release.mdnext-release.md

@@ -67,6 +67,7 @@ - **xml** module: renamed **xescape** to **xml.escape**

- **xml** module: renamed **xelement** to **xml.element** - **xml** module: renamed **xquery** to **xml.query** - **xml** module: renamed **xqueryall** to **xml.query-all** +- The **prompt** symbol is no longer unsealed. ### New Features
M site/contents/reference-dict.mdsite/contents/reference-dict.md

@@ -24,7 +24,7 @@ > > Example

> > > > The following program returns {{t}}: > > -> > {true :a1 "aaa" :a2 false :a3} 'a2 dhas? +> > {true :a1 "aaa" :a2 false :a3} 'a2 dict.has? #} {#op||keys||{{d}}||({{s}}{{0p}})||

@@ -38,7 +38,7 @@ > > Example

> > > > The following program returns `{4 :a 7 :d}`: > > -> > {5 :q 4 :a 6 :c 7 :d "d" :a} ("a" "d") dpick +> > {5 :q 4 :a 6 :c 7 :d "d" :a} ("a" "d") dict.pick #} {#op||pairs||{{d}}||({{a0p}})||

@@ -48,7 +48,7 @@ > > %sidebar%

> > Example > > > > A The following program returns `((1 "a") (2 "b"))`: -> > {1 :a 2 :b} dpairs +> > {1 :a 2 :b} dict.pairs #} {#op||set||{{d}} {{any}} {{sl}}||{{d}}||
M site/contents/reference-dstore.mdsite/contents/reference-store.md

@@ -1,29 +1,29 @@

----- content-type: "page" -title: "dstore Module" +title: "store Module" ----- {@ _defs_.md || 0 @} -{#op||dsdelete||{{dstore}} {{sl}}||{{dstore}}|| +{#op||delete||{{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||dsget||{{dstore}} {{sl}}||{{d}}|| +{#op||get||{{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 (/). #} -{#op||dsinit||{{sl}}||{{dstore}}|| +{#op||init||{{sl}}||{{dstore}}|| Initializes a bew datastore by creating the {{sl}} JSON file. Puts the datastore instance on the stack. #} -{#op||dspost||{{dstore}} {{sl}} {{d}}||{{dstore}}|| +{#op||post||{{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||dsput||{{dstore}} {{sl}} {{d}}||{{dstore}}|| +{#op||put||{{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||dsquery||{{dstore}} {{sl}} {{q}}||({{d0p}})|| +{#op||query||{{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. > > > %sidebar%

@@ -31,13 +31,13 @@ > > Example

> > > > Assuming that **ds** is a datastore, the following program retrieves all elements of teh collection **posts** whose author field is set to "h3rald": > > -> > ds "posts" ('author dget "h3rald" ==) dsquery +> > ds "posts" ('author dget "h3rald" ==) dquery #} -{#op||dsread||{{sl}}||{{dstore}}|| +{#op||read||{{sl}}||{{dstore}}|| Reads the previously-created datastore from the file {{sl}} and puts the resulting datastore instance on the stack. #} -{#op||dswrite||{{dstore}}||{{dstore}}|| +{#op||write||{{dstore}}||{{dstore}}|| Writes the contents of the datastore {{dstore}} to the filesystem. #}
M site/contents/reference-global.mdsite/contents/reference-global.md

@@ -396,7 +396,7 @@ > > Example

> > > > The following code (executed in a directory called '/Users/h3rald/Development/min' containing 19 files): > > -> > `"Directory '$1' includes $2 files." (. (. ls 'file? filter size)) apply interpolate` +> > `"Directory '$1' includes $2 files." (sys.pwd (sys.pwd sys.ls 'fs.file? seq.filter size)) apply interpolate` > > > > produces: > >

@@ -563,9 +563,7 @@

{#op||prompt||{{none}}||{{s}}|| > This symbol is used to configure the prompt of the min shell. By default, it is set to the following quotation: > -> ("[$1]$$ " (.) => %) -> -> Unlike other predefined symbols, this symbol is _unsealed_, which means it can be modified.#} +> ("[$1]$$ " (sys.pwd) => %) {#op||publish||{{sl}} {{d}}||{{none}}|| > Publishes symbol {{sl}} to the scope of {{d}}.

@@ -826,8 +824,8 @@ > >

> > The following program: > > > > {1 :a 2 :b 3 :c} ( -> > (dup 'a dget succ succ 'a dset) -> > (dup 'b dget succ 'b dset) +> > (stack.dup 'a dict.get succ succ 'a dict.set) +> > (stack.dup 'b dict.get succ 'b dict.set) > > ) tap > > > > Returns `{3 :a 3 :b 3 :c}`.#}

@@ -881,7 +879,7 @@ > >

> > The following program executed on an empty stack prints the message "Insufficient items on the stack" and pushes 0 on the stack: > > > > ( -> > (pop) +> > (stack.pop) > > (format-error puts) > > (0) > > ) try #}
M site/contents/reference-http.mdsite/contents/reference-http.md

@@ -19,8 +19,8 @@ > >

> > The following code constructs {{d}} and passes it to the **request** operator to perform an HTTP GET request to <http://httpbin.org/ip>: > > > > {} -> > "GET" 'method dget -> > "http://httpbin.org/ip" 'url dset +> > "GET" 'method dict.get +> > "http://httpbin.org/ip" 'url dict.set > > request #}

@@ -52,8 +52,8 @@ > > req /url :url

> > "THE URL is '$1'." url quote % puts! > > ; Constuct response body > > ( -> > (("/datetime" url ==) (timestamp datetime)) -> > (("/timestamp" url ==) (timestamp string)) +> > (("/datetime" url ==) (time.stamp time.datetime)) +> > (("/timestamp" url ==) (time.stamp string)) > > (("/shutdown" url ==) ("Stopping server..." puts! stop-server)) > > (("/" url ==) ( > > ; this is a bit short, but works with Chrome, IE, Edge, Safari

@@ -63,16 +63,16 @@ > > ((true) ("Invalid Request: $1" url quote %))

> > ) case > > :body > > ; Prepare the response -> > {} body 'body dset -> > dup puts! +> > {} body 'body dict.set +> > stack.dup puts! > > ) > > ; The request handler is ready, give it the name handler > > :handler > > > > ; Create the parameter dictionary for the server > > {} -> > handler 'handler dset -> > 5555 'port dset +> > handler 'handler dict.set +> > 5555 'port dict.set > > > > ; Start server > > "Server started on port 5555." puts!

@@ -81,4 +81,4 @@ > > start-server

#} {#op||stop-server||{{none}}||{{none}}|| -Stops the currently-running HTTP server. This operator should be used within an HTTP server handler quotation.#}+Stops the currently-running HTTP server. This operator should be used within an HTTP server handler quotation.#}
M site/contents/reference-io.mdsite/contents/reference-io.md

@@ -66,7 +66,7 @@ > > Example

> > > > The following program: > > -> > (clear) 'ctrl+l mapkey +> > (clear) 'ctrl+l io.mapkey > > > > causes the `CTRL+L` key to clear the screen. #}
M site/contents/reference-net.mdsite/contents/reference-net.md

@@ -18,17 +18,17 @@ > > Example

> > > > 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. > > -> > {} socket "localhost" 7777 connect :cli +> > {} net.socket "localhost" 7777 net.connect :cli > > > > args 1 get :msg > > > > "Sending message \"$1\" to localhost:7777..." (msg) => % puts! > > -> > cli "$1\n" (msg) => % send +> > cli "$1\n" (msg) => % net.send > > > > "Done." puts! > > -> > cli close +> > cli net.close #} {#op||listen||{{d}} {{sock1}}||{{sock2}}||

@@ -44,22 +44,22 @@ > > Example

> > > > The following code shows how to create a simple server that listens on port 7777, prints data received from clients, and exits when it receives the string `exit`: > > -> > {} socket {"127.0.0.1" :address 7777 :port} listen :srv +> > {} net.socket {"127.0.0.1" :address 7777 :port} net.listen :srv > > > > "Server listening on localhost:7777" puts! > > -> > {} socket :cli +> > {} net.socket :cli > > "" :line > > (line "exit" !=) > > ( -> > srv cli accept #cli -> > cli recv-line @line +> > srv cli net.accept #cli +> > cli net.recv-line @line > > "Received: $1" (line) => % puts! > > ) while > > > > "Exiting..." puts! > > -> > srv close +> > srv net.close #} {#op||recv||{{sock}} {{i}}||{{s}}||

@@ -74,14 +74,14 @@ > >

> > 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: > > > > -> > {} socket "httpbin.org" 80 connect :cli +> > {} net.socket "httpbin.org" 80 net.connect :cli > > -> > cli "GET /uuid HTTP/1.1\r\nHost: httpbin.org\r\n\r\n" send +> > cli "GET /uuid HTTP/1.1\r\nHost: httpbin.org\r\n\r\n" net.send > > -> > cli recv-line puts :line +> > cli net.recv-line puts :line > > (line "\}" match not) > > ( -> > cli recv-line puts @line +> > cli net.recv-line puts @line > > ) while #}
M site/contents/reference-seq.mdsite/contents/reference-seq.md

@@ -27,7 +27,7 @@ > > Example

> > > > The following program leaves `(2)` on the stack: > > -> > (1 2 "test") ("test" "a" true 1) difference #} +> > (1 2 "test") ("test" "a" true 1) seq.difference #} {#op||drop||{{q1}} {{i}}||{{q2}}|| Returns a quotation {{q2}} containing the remaining elements after the first _n_ values of the input quotation {{q1}}, or an empty quotation if {{i}} is greater than the length of {{q1}}. #}

@@ -41,7 +41,7 @@ > >

> > The following program leaves `(2 6 8 12)` on the stack: > > > > (1 37 34 2 6 8 12 21) -> > (dup 20 < swap even? and) filter #} +> > (stackdup 20 < stack.swap even? and) seq.filter #} {#op||find||{{q1}} {{q2}}||{{i}}|| > Returns the index of the first element within {{q1}} that satisfies predicate {{q2}}, or -1 if no element satisfies it.

@@ -52,7 +52,7 @@ > >

> > The following program leaves `3` on the stack: > > > > (1 2 4 8 16) -> > (5 >) find #} +> > (5 >) seq.find #} {#op||first||{{q}}||{{any}}|| Returns the first element of {{q}}. #}

@@ -66,7 +66,7 @@ > >

> > The following program leaves `(1 2 3 4 5 6 7 8)` on the stack: > > > > (1 (2 3 4) 5 (6 7) 8) -> > flatten #} +> > seq.flatten #} {#op||harvest||{{q1}}||{{q2}}|| > Creates a new quotation {{q2}} containing all elements of {{q1}} except for empty quotations.

@@ -77,7 +77,7 @@ > >

> > The following program leaves `(1 2 3)` on the stack: > > > > (1 () () () 2 () 3) -> > harvest #} +> > seq.harvest #} {#op||in?||{{q}} {{any}}||{{b}}|| Returns {{t}} if {{any}} is contained in {{q}}, {{f}} otherwise.#}

@@ -93,7 +93,7 @@ > > Example

> > > > The following program leaves `(1 "test")` on the stack: > > -> > (1 2 "test") ("test" "a" true 1) intersection #} +> > (1 2 "test") ("test" "a" true 1) seq.intersection #} {#op||last||{{q}}||{{any}}|| Returns the last element of {{q}}. #}

@@ -110,7 +110,7 @@ > >

> > The following program leaves `35` on the stack: > > > > (1 3 5) -> > (dup *) (+) map-reduce #} +> > (stack.dup *) (+) seq.map-reduce #} {#op||partition||{{q1}} {{q2}}||{{q3}} {{q4}}|| > Partitions {{q1}} into two quotations: {{q3}} contains all elements of {{q1}} that satisfy predicate {{q2}}, {{q4}} all the others.

@@ -121,7 +121,7 @@ > >

> > The following program leaves `(1 3 5) (2 4 6)` on the stack: > > > > (1 2 3 4 5 6) -> > (odd?) partition #} +> > (odd?) seq.partition #} {#op||one?||{{q1}} {{q2}}||{{b}}|| Applies predicate {{q2}} to each element of {{q1}} and returns {{t}} if only one element of {{q1}} satisfies predicate {{q2}}, {{f}} otherwise. #}

@@ -144,7 +144,7 @@ > >

> > The following program leaves `120` on the stack: > > > > (1 2 3 4 5) -> > 1 (*) reduce #} +> > 1 (*) seq.reduce #} {#op||reject||{{q1}} {{q2}}||{{q3}}|| Returns a new quotatios {{q3}} including all elements of {{q1}} that do not satisfy predicate {{q2}} (i.e. the opposite of `filter`)#}

@@ -179,7 +179,7 @@ > >

> > The following program leaves `(3 4 5)` on the stack: > > > > (1 2 3 4 5 6) -> > 2 4 slice #} +> > 2 4 seq.slice #} {#op||sort||{{q1}} {{q2}}||{{q3}}|| > Sorts all elements of {{q1}} according to predicate {{q2}}.

@@ -189,7 +189,7 @@ > > Example

> > > > The following program leaves `(1 3 5 7 9 13 16)` on the stack: > > -> > (1 9 5 13 16 3 7) '> sort #} +> > (1 9 5 13 16 3 7) '> seq.sort #} {#op||symmetric-difference||{{q1}} {{q2}}||{{q3}}|| > Calculates the symmetric difference {{q3}} of {{q1}} and {{q2}}.

@@ -199,7 +199,7 @@ > > Example

> > > > The following program leaves `(true "a" 2)` on the stack: > > -> > (1 2 "test") ("test" "a" true 1) symmetric-difference #} +> > (1 2 "test") ("test" "a" true 1) seq.symmetric-difference #} {#op||take||{{q1}} {{i}}||{{q2}}|| Returns a quotation {{q2}} containing the first _n_ values of the input quotation {{q1}}, or {{q1}} itself if {{i}} is greater than the length of {{q1}}. #}

@@ -212,4 +212,4 @@ > > Example

> > > > The following program leaves `(true 1 "test" "a" 2)` on the stack: > > -> > (1 2 "test") ("test" "a" true 1) union #} +> > (1 2 "test") ("test" "a" true 1) seq.union #}
M site/contents/reference-stack.mdsite/contents/reference-stack.md

@@ -14,7 +14,7 @@ > > Example

> > > > The following program leaves 2 on the stack: > > -> > `(1 2 3) ((sum) (size)) cleave /`#} +> > `(1 2 3) ((sum) (size)) stack.cleave /`#} {#op||cons||{{a1}} ({{a0p}})||({{a1}} {{a0p}})|| Prepends {{a1}} to the quotation on top of the stack.#}

@@ -38,7 +38,7 @@ > > Example

> > > > The following program leaves `5 3` on the stack: > > -> > `2 3 '+ keep` #} +> > `2 3 '+ stack.keep` #} {#op||nip||{{a1}} {{a2}}||{{a2}}|| Removes the second element from the stack.#}

@@ -71,7 +71,7 @@ > > Example

> > > > The following program leaves `(1 4)` on the stack: > > -> > `(1 2) (3 4) ((0 get) (1 get)) spread` #} +> > `(1 2) (3 4) ((0 get) (1 get)) stack.spread` #} {#op||swap||{{a1}} {{a2}}||{{a2}} {{a1}}|| Swaps the first two elements on the stack. #}
M site/contents/reference-sys.mdsite/contents/reference-sys.md

@@ -15,7 +15,7 @@ > > Example

> > > > 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: > > -> > `"/tmp/test.txt 755 chmod"`#} +> > `"/tmp/test.txt 755 sys.chmod"`#} {#op||cd||{{sl}}||{{none}}|| Change the current directory to {{sl}}. #}
M site/contents/reference-xml.mdsite/contents/reference-xml.md

@@ -29,22 +29,22 @@

{#op||to-xml||{{xnode}}||{{s}}|| Returns a {{s}} representing an XML node. #} -{#op||xcdata||{{sl}}||{{xcdata}}|| +{#op||cdata||{{sl}}||{{xcdata}}|| Returns a {{xcdata}} representing an XML CDATA section. #} -{#op||xcomment||{{sl}}||{{xcomment}}|| +{#op||comment||{{sl}}||{{xcomment}}|| Returns a {{xcomment}} representing an XML comment. #} -{#op||xelement||{{sl}}||{{xelement}}|| +{#op||element||{{sl}}||{{xelement}}|| Returns a {{xelement}} representing an XML element (it will be an empty element with no attributes or children). #} -{#op||xentity||{{sl}}||{{xentity}}|| +{#op||entity||{{sl}}||{{xentity}}|| Returns a {{xentity}} representing an XML entity. #} -{#op||xescape||{{sl}}||{{s}}|| +{#op||escape||{{sl}}||{{s}}|| Converts any `<`, `>`, `&`, `'`, and `"` present in {{sl}} into the corresponding XML entities. #} -{#op||xentity2utf8||{{xentity}}||{{s}}|| +{#op||entity2utf8||{{xentity}}||{{s}}|| > Returns the UTF-8 symbol corresponding to the specified XML entity. > > > %sidebar%

@@ -52,10 +52,10 @@ > > Example

> > > > The following program prints `p` to the screen: > > -> > "&gt;" xentity xentity2utf8 puts +> > "&gt;" xml.entity xml.entity2utf8 puts! #} -{#op||xquery||{{xelement}} {{sl}}||{{xelement}}|| +{#op||query||{{xelement}} {{sl}}||{{xelement}}|| > Returns an {{xelement}} representing the first element matching CSS the selector {{sl}}. > > > %sidebar%

@@ -68,7 +68,7 @@ > > <li class='test'>first</li>

> > <li class='other'>second</li> > > <li class='test'>third</li> > > </ul>" -> > from-xml ".test" xquery +> > xml.from-xml ".test" xml.query > > Returns the following: > > > > {

@@ -79,7 +79,7 @@ > > ;xml-element

> > } #} -{#op||xqueryall||{{xelement}} {{sl}}||{{xelement}}|| +{#op||queryall||{{xelement}} {{sl}}||{{xelement}}|| > Returns a list of {{xelement}} dictionaries representing all the elements matching CSS the selector {{sl}}. > > > %sidebar%

@@ -92,7 +92,7 @@ > > <li class='test'>first</li>

> > <li class='other'>second</li> > > <li class='test'>third</li> > > </ul>" -> > from-xml ".test" xqueryall +> > xml.from-xml ".test" xml.queryall > > Returns the following: > > > > ({

@@ -109,5 +109,5 @@ > > ;xml-element

> > }) #} -{#op||xtext||{{sl}}||{{xtext}}|| +{#op||text||{{sl}}||{{xtext}}|| Returns a {{xtext}} representing an XML text node. #}
M site/contents/reference.mdsite/contents/reference.md

@@ -7,31 +7,32 @@

min includes a small but powerful standard library organized into the following _modules_: {#link-module||global#} -: Defines the basic language constructs, such as control flow, type conversions, symbol definition and binding, exception handling, etc. +: Defines the basic language constructs, such as control flow, type conversions, symbol definition and binding, exception handling, etc. This module is automatically imported (no need to prepend `global.` . to reference its symbols). + +{#link-module||crypto#} +: Provides operators to compute hashes (MD4, MD5, SHA1, SHA224, SHA256, SHA384, sha512), base64 encoding/decoding, and AES encryption/decryption. +{#link-module||dict#} +: Defines operators for dictionaries, like `dict.get`, `dict.dup`, `dict.set`, etc. +{#link-module||fs#} +: Provides operators for reading and writing files, and accessing file information and properties. +{#link-module||http#} +: Provides operators to perform HTTP requests, download files and create basic HTTP servers. +{#link-module||io#} +: Provides operators for writing to STDOUT, reading from STDIN, capturing key presses, etc. +{#link-module||math#} +: Provides many mathematical operators and constants such as trigonometric functions, square root, logarithms, etc. +{#link-module||net#} +: Provides basic supports for sockets (some features are not supported on Windows systems). +{#link-module||seq#} +: Defines operators for quotations, like `seq.map`, `seq.filter`, `seq.reduce`, etc. {#link-module||stack#} -: Defines combinators and stack-shufflers like dip, dup, swap, cons, etc. -{#link-module||seq#} -: Defines operators for quotations, like map, filter, reduce, etc. -{#link-module||dict#} -: Defines operators for dictionaries, like dget, ddup, dset, etc. +: Defines combinators and stack-shufflers like `stack.pop`, `stack.dup`, `stack.swap`, `stack.cons`, etc. {#link-module||store#} : Provides support for simple, persistent, in-memory JSON stores. -{#link-module||io#} -: Provides operators for reading and writing files as well as printing to STDOUT and reading from STDIN. -{#link-module||fs#} -: Provides operators for accessing file information and properties. {#link-module||sys#} : Provides operators to use as basic shell commands, access environment variables, and execute external commands. {#link-module||time#} : Provides a few basic operators to manage dates, times, and timestamps. -{#link-module||crypto#} -: Provides operators to compute hashes (MD4, MD5, SHA1, SHA224, SHA256, SHA384, sha512), base64 encoding/decoding, and AES encryption/decryption. -{#link-module||math#} -: Provides many mathematical operators and constants such as trigonometric functions, square root, logarithms, etc. -{#link-module||net#} -: Provides basic supports for sockets (some features are not supported on Windows systems). -{#link-module||http#} -: Provides operators to perform HTTP requests, download files and create basic HTTP servers. {#link-module||xml#} : Provides operators for parsing, creating and querying XML/HTML code using CSS selectors.