Updates 'usage' to output a list of all builtins if no argument is given

master
sloum 2 years ago
parent 1317bb22e6
commit 096a3ab852

@ -110,7 +110,7 @@ Quote and list both have some syntactic sugar to create a shorthand for their us
<li><code>(load [filepath: string...])</code>: <code>symbol</code></li>
<li><code>(load-mod [filepath: string...])</code>: <code>symbol</code></li>
<li><code>(load-mod-file [filepath: string...])</code>: <code>symbol</code></li>
<li><code>(usage [symbol|string])</code>: <code>()</code> Will display usage information for the given procedure or runtime value</li>
<li><code>(usage [[symbol|string]])</code>: <code>()</code> Will display usage information for the given procedure or runtime value. If no argument is given <code>usage</code> will list known procedures</li>
</ul>
</details>

@ -2,6 +2,8 @@ package main
import (
"fmt"
"sort"
"strings"
)
type proc struct {
@ -142,6 +144,23 @@ func eval(exp expression, en *env) (value expression) {
}
}
case "usage":
if len(e) < 2 {
fmt.Print("(usage [[procedure: symbol]])\n\n\033[1;4mKnown procedures\033[0m\n\n")
keys := make([]string, 0, len(usageStrings))
var out strings.Builder
for key, _ := range usageStrings {
keys = append(keys, key)
}
sort.Strings(keys)
for i := range keys {
out.WriteString(fmt.Sprintf("%-26s", keys[i]))
if (i+1) % 2 == 0 {
out.WriteRune('\n')
}
}
fmt.Println(out.String())
return make([]expression, 0)
}
proc, ok := e[1].(string)
if !ok {
p, ok2 := e[1].(symbol)

@ -107,7 +107,7 @@ func outputResult(txt string) {
func Repl() {
initialTerm, _ = ln.TerminalMode()
line = ln.NewLiner()
line.SetCtrlCAborts(false)
line.SetCtrlCAborts(true)
linerTerm, _ = ln.TerminalMode()
defer line.Close()

@ -13,152 +13,154 @@ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR I
const historyFilename string = "slope-repl.history"
var usageStrings = map[string]string{
"quote": "(quote [expression...]) => bool",
"if": "(if [condition: expression] [#t-branch: expression] [[#f-branch: expression]]) => value\n\nAny value other than #f is considered true for the purposes of the `condition`, any expression given to `if` as a `condition` will be evaluated and its value will be taken as truthy or falsy by the above truthiness rule",
"and": "(and [expression...]) => bool",
"or": "(or [expression...]) => bool",
"cond": "(cond [([condition: expression] [#t-branch: expression])...]) => value\n\nWill evaluate each condition in turn and evaluate to the #t-branch of the first condition that is truthy. If no condition is truthy then an empty list will be returned. The value `else` is a sepcial case allowed as the final condition expression, the #t-branch of this condition list will be returned if no other condition is found to be truthy",
"set!": "(set! [var-name: symbol] [value|expression|procedure]) => value | expression | procedure\n\nReturns the value that var-name was set to, in addition to creating the var symbol and setting it to the given value. Only an existing variable can be set with `set!`, trying to set a non-existant variable will result in an exception. `set!` will always set the value for the variable in the nearest scope",
"define": "(define [var-name] [value|expression|procedure]) => value | expression | procedure\n\nReturns the value that var-name was set to, in addition to creating the var symbol and setting it to the given value. Define is lexically scoped (using define within a lambda will create a variable that is only visible to that lambda and its child scopes, but not to any parent scopes)",
"lambda": "(lambda [([[argument: sumbol...]])] [expression...]) => procedure\n\n`lambda` creates its own scope and any define statements within the lambda will be scoped to the lambda (available to it and any child scopes)",
"begin": "(begin [expression...]) => value\n\nEvaluates a series of expressions and returns the value of the last expression that is evaluated",
"begin0": "(begin [expression...]) => value\n\nEvaluates a series of expressions and returns the value of the first expression that is evaluated",
"filter": "(filter [test: procedure] [list]) => list\n\nThe test procedure supplied to filter should take one value and will have its return value treated as a bool. Any value in the list that returns a true when fed to the test procedure will be added to the list that filter returns",
"load": "(load [filepath: string...]) => symbol\n\n`load` will open the file represented by filepath and evaluate its contents as slope . It will run any within the file. `load` can accept a relative reference, which will be treated as relative to the current working directory. Any `define` statements within the laoded file will result in the symbol getting added to the global environment",
"load-mod": "(load-mod [module-name: string...]) => symbol\n\n`load-mod` will search the module path for the given module. If found, the file 'main.slo' within the module folder will be parsed. Arbitrary will not be executed, only `define`, `load-mod`, and `load-mod-file` statements will be evaluated",
"load-mod-file": "(load-mod-file [filepath: string]) => symbol\n\n`load-mod-file` is used within modules to do a relative load of files that are a part of the module, but are not 'main.slo'. The same evaluation rules as `load-mod` apply to `load-mod-file`",
"positive?": "(positive? [number]) => bool",
"negative?": "(negative? [number]) => bool",
"zero?": "(zero? [number]) => bool",
"abs": "(abs [number]) => number",
"floor": "(floor [number]) => number",
"ceil": "(ceil [number]) => number",
"round": "(round [number] [[decimals-to-round-to: number]]) => number",
"!": "(! [exception-text: string]) => exception",
"+": "(+ [number...]) => number",
"-": "(- [number...]) => number",
"*": "(* [number...]) => number",
"/": "(/ [number...]) => number",
"min": "(min [number...]) => number",
"max": "(max [number...]) => number",
"number->string": "(number->string [number] [[base: number]]) => string\n\nThe value for `base` defaults to 10 (decimal). If a value other than 10 is provided then the number will be parsed as an integer and output in the given base. If the value for `base` is 10 or is not given, the number will be parsed as a floating point number",
"rand": "(rand [[max]] [[min]]) => number\n\nIf no arguments are given `rand` will produce a floating point number between 0 and 1. If only `max` is given, `rand` will produce a floating point number between 0 and `max`. If `max` and `min` are both given, `rand` will produce a floating point number between `min` and `max`. `max` is always exclusive (the value produced will always be less than `max`), while `min` is inclusize. To obtain integers use `floor`, `ceil`, or `round` on the result or `rand`",
">": "(> [number] [number]) => bool",
">=": "(>= [number] [number]) => bool",
"<": "(< [number] [number]) => bool",
"<=": "(<= [number] [number]) => bool",
"not": "(not [value]) => bool\n\n`not` will invert the truthiness of the value it is given",
"equal?": "(equal? [value] [value]) => bool",
"number?": "(number? [value]) => bool",
"string?": "(string? [value]) => bool",
"bool?": "(bool? [value]) => bool",
"symbol?": "(symbol? [value]) => bool",
"pair?": "(pair? [value]) => bool",
"list?": "(list? [value]) => bool",
"null?": "(null? [value]) => bool",
"procedure?": "(procedure? [value]) => bool",
"atom?": "(atom? [value]) => bool",
"assoc?": "(assoc? [value]) => bool",
"io-handle?": "(io-handle? [value]) => bool",
"string-buf?": "(string-buf? [value]) => bool",
"~bool": "(~bool [value]) => bool\n\n`~bool` will convert a given value to a boolean value using a looser set of rules than `if` would normally use: 0, 0.0, the empty list, an empty string, and a closed io-handle will be considered falsy (in addition to #f)",
"length": "(length [list|string|exception|IOHandle>string-buf]) => number",
"list": "(list [value...]) => list",
"cons": "(cons [value] [list]) => list",
"car": "(car [list]) => value|list",
"cdr": "(cdr [list]) => list",
"abs": "(abs [number]) => number",
"and": "(and [expression...]) => bool",
"append": "(append [list] [value...]) => list",
"map": "(map [procedure] [list...]) => list\n\n`map` will pass the values of each list as arguments to the given prcedure and a new list will be created from the results. If multiple lists are given, they should be the same length and their values will be given as arguments such that the first argument of each list will be provided to the given procedure (as two arguments in the case of two lists, three in the case of three etc), then the second argument, and so on",
"for-each": "(for-each [procedure] [list...]) => empty-list\n\nWorks via the same rules as `map`, but is used specifically for its side effects, rather than return values. See `map` for further details",
"list->string": "(list->string [list] [[join-on: string]]) => string",
"list-ref": "(list-ref [list] [index: number]) => value\n\nList indexing starts at 0",
"list-sort": "(list-sort [list] [[sub-list-index: number]]) => list\n\nIf `list` is a list of lists, sorting can be done by the index value of a sublist if desired. `list-sort` always sorts the list in ascending order, but can be reversed with `reverse`",
"reverse": "(reverse [list|string]) => list|string\n\n`reverse` will reverse a list or a string and return the same type of value it was given, but with the contents reversed",
"apply": "(apply [procedure] [arguments: list]) => value",
"assoc": "(assoc [association-list] [key: value] [[value]]) => value|list\n\nIf two arguments are given then `assoc` retrieves the value of the key. If a third argument is given `assoc` will set the value for the given key to the given value, returning the updated list",
"member?": "(member? [list] [value]) => bool",
"substring": "(substring [string] [start-index: number] [end-index: number]) => string\n\n`end-index` is exclusive",
"string-append": "(string-append [value...]) => string\n\n'string-append' will stringify any non-string values passed to it and append them. To have finer grain control of number conversion use 'number->string' and pass the result to 'string-append'",
"string-format": "(string-format [template: string] [value...]) => string\n\nReplaces values designated by `%v` in the template string with successive values (`value...`).\n\nWidth can be set by adding an integer between the `%` and the `v`: `%10v`, or left aligned: `%-10v`",
"string->number": "(string->number [string] [[base: number]]) => number\n\nIf a non-decimal base is given the input string will be parsed as an integer. All decimal, the default, base conversions from string will attempt a parsing as a floating point value",
"string->list": "(string->list [string] [[split-on: value]]) => list\n\nSplits the string at each instance of `split-on` value. If `split-on` is not a string it will be case to string for the purposes of splitting the string into a list",
"string->md5": "(string->md5 [string]) => string",
"string->sha256": "(string->sha256 [string]) => string",
"string-fields": "(string-fields [string]) => list\n\nSplits a string around each instance of one or more consecutive white space characters",
"string-trim-space": "(string-trim-space [string]) => string\n\nRemoves any leading or trailing white-space from `string`",
"string-index-of": "(string-index-of [string] [search-value: string]) => number\n\nReturns -1 if `search-value` does not appear in `string`",
"string-ref": "(string-ref [string] [number]) => string",
"string-upper": "(string-upper [string]) => string",
"string-lower": "(string-lower [string]) => string",
"string-make-buf": "(string-make-buf) => IOHandle: string-buf",
"string-buf-clear": "(string-buf-clear [IOHandle: string-buf]) => ()",
"regex-match?": "(regex-match? [pattern: string] [string]) => bool",
"regex-find": "(regex-find [pattern: string] [string]) => list",
"regex-replace": "(regex-replace [string (pattern)] [string]) => string",
"newline": "(newline) => ()",
"assoc?": "(assoc? [value]) => bool",
"atom?": "(atom? [value]) => bool",
"begin": "(begin [expression...]) => value\n\nEvaluates a series of expressions and returns the value of the last expression that is evaluated",
"begin0": "(begin [expression...]) => value\n\nEvaluates a series of expressions and returns the value of the first expression that is evaluated",
"bool?": "(bool? [value]) => bool",
"car": "(car [list]) => value|list",
"cdr": "(cdr [list]) => list",
"ceil": "(ceil [number]) => number",
"chdir": "(chdir [filepath: string]) => ()",
"chmod": "(chmod [filepath: string] [file-mode: number]) => ()",
"close": "(close [IOHandle]) => ()",
"cond": "(cond [([condition: expression] [#t-branch: expression])...]) => value\n\nWill evaluate each condition in turn and evaluate to the #t-branch of the first condition that is truthy. If no condition is truthy then an empty list will be returned. The value `else` is a sepcial case allowed as the final condition expression, the #t-branch of this condition list will be returned if no other condition is found to be truthy",
"cons": "(cons [value] [list]) => list",
"date": "(date): date => string",
"date-format": "(date-format [start-format: string] [date: string] [end-format: string]) => string\n\nDate format/pattern substitutions:\n\t%a - 12 hour segment, lowercase: pm\n\t%A - 12 hour segment, uppercase: PM\n\t%d - Day without leading zero: 4\n\t%D - Day with leading zero: 04\n\t%e - Day without leading zero, but with space padding: 4\n\t%f - Month name, short: Jan\n\t%F - Month name, long: January\n\t%g or %G - Hour, 24 hour format: 15\n\t%h - Hour, 12 hour format without leading zero: 2\n\t%H - Hour, 12 hour format with leading zero: 02\n\t%i - Minutes without leading zero: 4\n\t%I - Minutes with leading zero: 04\n\t%m - Month number, without leading zero: 6\n\t%M - Month number, with leading zero: 06\n\t%o - Timezone offset, without minutes: -07\n\t%O - Timezone offset, with minutes: -0700\n\t%s - Seconds, without leading zero: 5\n\t%S - Seconds, with leading zero: 05\n\t%w - Short weekeday: Wed\n\t%W - Long weekday: Wednesday\n\t%y - Two digit year: 21\n\t%Y - Four digit year: 2021\n\t%Z - Time zone, as three chars: UTC, PST, etc.\n\t%% - Will yield a literal percent sign: %\n\tanything else - A percent followed by an unrecognized char will yield a ?, as will a hanging % as the last char in the string\n\nSo the string: \"%F %e, %Y %h:%I%a\" would be equivalend to something like: \"August 8, 2021 4:03pm\"\n\nWhen a string is converted to a date and no time zone information is present, slope will assume the user's local time.",
"date->timestamp": "(date->timestamp [date: string] [format: string]) => number (timestamp)\n\nDate format/pattern substitutions:\n\t%a - 12 hour segment, lowercase: pm\n\t%A - 12 hour segment, uppercase: PM\n\t%d - Day without leading zero: 4\n\t%D - Day with leading zero: 04\n\t%e - Day without leading zero, but with space padding: 4\n\t%f - Month name, short: Jan\n\t%F - Month name, long: January\n\t%g or %G - Hour, 24 hour format: 15\n\t%h - Hour, 12 hour format without leading zero: 2\n\t%H - Hour, 12 hour format with leading zero: 02\n\t%i - Minutes without leading zero: 4\n\t%I - Minutes with leading zero: 04\n\t%m - Month number, without leading zero: 6\n\t%M - Month number, with leading zero: 06\n\t%o - Timezone offset, without minutes: -07\n\t%O - Timezone offset, with minutes: -0700\n\t%s - Seconds, without leading zero: 5\n\t%S - Seconds, with leading zero: 05\n\t%w - Short weekeday: Wed\n\t%W - Long weekday: Wednesday\n\t%y - Two digit year: 21\n\t%Y - Four digit year: 2021\n\t%Z - Time zone, as three chars: UTC, PST, etc.\n\t%% - Will yield a literal percent sign: %\n\tanything else - A percent followed by an unrecognized char will yield a ?, as will a hanging % as the last char in the string\n\nSo the string: \"%F %e, %Y %h:%I%a\" would be equivalend to something like: \"August 8, 2021 4:03pm\"\n\nWhen a string is converted to a date and no time zone information is present, slope will assume the user's local time.",
"date-default-format": "(date-default-format) => string\n\nReturns a format string for the default format produced by 'date'",
"define": "(define [var-name] [value|expression|procedure]) => value | expression | procedure\n\nReturns the value that var-name was set to, in addition to creating the var symbol and setting it to the given value. Define is lexically scoped (using define within a lambda will create a variable that is only visible to that lambda and its child scopes, but not to any parent scopes)",
"devnull": "devnull => io-handle (file: write-only)",
"display": "(display [value...]) => ()",
"display-lines": "(display-lines [value...]) => ()",
"write": "(write [string] [[IOHandle]]) => ()|IOHandle",
"write-raw": "(write-raw [string] [[IOHandle]]) => ()|IOHandle",
"read-all": "(read-all [[IOHandle]]) => string",
"read-line": "(read-line [[IOHandle]]) => string|symbol: EOF",
"read-char": "(read-char [[IOHandle]]) => string",
"read-all-lines": "(read-all-lines [[IOHandle]]) => list",
"close": "(close [IOHandle]) => ()",
"E": "E => number",
"env": "(env [[env-key: string]] [[env-value: string]]) => list|string|()",
"equal?": "(equal? [value] [value]) => bool",
"exception-mode-panic": "(exception-mode-panic) => ()",
"exception-mode-panic?": "(exception-mode-panic?) => bool",
"exception-mode-pass": "(exception-mode-pass) => ()",
"exception-mode-pass?": "(exception-mode-pass?) => bool",
"exit": "(exit [[number]]) => ()",
"file-append-to": "(file-append-to [filepath: string] [string...]) => ()",
"file-create": "(file-create [filepath: string]) => IOHandle",
"file-create-temp": "(file-create-temp [filename-pattern: string]) => IOHandle",
"file-name": "(file-name [IOHandle]) => string",
"file-open-read": "(file-open-read [filepath: string]) => IOHandle",
"file-open-write": "(file-open-write [filepath: string]) => IOHandle",
"file-append-to": "(file-append-to [filepath: string] [string...]) => ()",
"file-name": "(file-name [IOHandle]) => string",
"file-stat": "(file-stat [filepath: string]) => assoc-list|#f\n\n#f will be returned if the file does not exist; all other file access errors will raise an exception.\n\nAssociative list will have the following keys:\n\tname (string)\n\tsize (bytes: number)\n\tmode (number)\n\tmod-time (number)\n\tis-dir? (bool)\n\tis-symlink? (bool)\n\tpath (string)\n\n'mode' will default to decimal,as all numbers do in slope, but it can be cast to an octal string with 'number->string'.\n\n'path' will be an absolute path after following a symlink, if present, or the path as provided to 'stat' in the absense of a symlink",
"exit": "(exit [[number]]) => ()",
"filter": "(filter [test: procedure] [list]) => list\n\nThe test procedure supplied to filter should take one value and will have its return value treated as a bool. Any value in the list that returns a true when fed to the test procedure will be added to the list that filter returns",
"floor": "(floor [number]) => number",
"for-each": "(for-each [procedure] [list...]) => empty-list\n\nWorks via the same rules as `map`, but is used specifically for its side effects, rather than return values. See `map` for further details",
"hostname": "(hostname) => string",
"if": "(if [condition: expression] [#t-branch: expression] [[#f-branch: expression]]) => value\n\nAny value other than #f is considered true for the purposes of the `condition`, any expression given to `if` as a `condition` will be evaluated and its value will be taken as truthy or falsy by the above truthiness rule",
"io-handle?": "(io-handle? [value]) => bool",
"lambda": "(lambda [([[argument: sumbol...]])] [expression...]) => procedure\n\n`lambda` creates its own scope and any define statements within the lambda will be scoped to the lambda (available to it and any child scopes)",
"length": "(length [list|string|exception|IOHandle>string-buf]) => number",
"license": "(license) => ()",
"apply": "(apply [procedure] [arguments: list]) => value",
"!": "(! [exception-text: string]) => exception",
"exception-mode-panic": "(exception-mode-panic) => ()",
"exception-mode-pass": "(exception-mode-pass) => ()",
"exception-mode-panic?": "(exception-mode-panic?) => bool",
"exception-mode-pass?": "(exception-mode-pass?) => bool",
"term-size": "(term-size) => list",
"term-restore": "(term-restore) => ()",
"term-char-mode": "(term-char-mode) => ()",
"term-raw-mode": "(term-raw-mode) => ()",
"term-cooked-mode": "(term-cooked-mode) => ()",
"term-sane-mode": "(term-sane-mode) => ()",
"path-exists?": "(path-exists? [filepath: string]) => bool",
"path-is-dir?": "(path-is-dir? [filepath: string]) => bool",
"list": "(list [value...]) => list",
"list?": "(list? [value]) => bool",
"list-ref": "(list-ref [list] [index: number]) => value\n\nList indexing starts at 0",
"list-sort": "(list-sort [list] [[sub-list-index: number]]) => list\n\nIf `list` is a list of lists, sorting can be done by the index value of a sublist if desired. `list-sort` always sorts the list in ascending order, but can be reversed with `reverse`",
"list->string": "(list->string [list] [[join-on: string]]) => string",
"load": "(load [filepath: string...]) => symbol\n\n`load` will open the file represented by filepath and evaluate its contents as slope . It will run any within the file. `load` can accept a relative reference, which will be treated as relative to the current working directory. Any `define` statements within the laoded file will result in the symbol getting added to the global environment",
"load-mod": "(load-mod [module-name: string...]) => symbol\n\n`load-mod` will search the module path for the given module. If found, the file 'main.slo' within the module folder will be parsed. Arbitrary will not be executed, only `define`, `load-mod`, and `load-mod-file` statements will be evaluated",
"load-mod-file": "(load-mod-file [filepath: string]) => symbol\n\n`load-mod-file` is used within modules to do a relative load of files that are a part of the module, but are not 'main.slo'. The same evaluation rules as `load-mod` apply to `load-mod-file`",
"map": "(map [procedure] [list...]) => list\n\n`map` will pass the values of each list as arguments to the given prcedure and a new list will be created from the results. If multiple lists are given, they should be the same length and their values will be given as arguments such that the first argument of each list will be provided to the given procedure (as two arguments in the case of two lists, three in the case of three etc), then the second argument, and so on",
"max": "(max [number...]) => number",
"member?": "(member? [list] [value]) => bool",
"min": "(min [number...]) => number",
"mkdir": "(mkdir [path: string] [permissions: number] [[make-all: bool]]) => ()",
"mv": "(mv [from-path: string] [to-path: string]) => ()",
"negative?": "(negative? [number]) => bool",
"not": "(not [value]) => bool\n\n`not` will invert the truthiness of the value it is given",
"net-conn": "(net-conn [host: string] [port: string|number] [[use-tls: bool]] [[timeout-seconds: number]]) => IOHandle",
"newline": "(newline) => ()",
"null?": "(null? [value]) => bool",
"number?": "(number? [value]) => bool",
"number->string": "(number->string [number] [[base: number]]) => string\n\nThe value for `base` defaults to 10 (decimal). If a value other than 10 is provided then the number will be parsed as an integer and output in the given base. If the value for `base` is 10 or is not given, the number will be parsed as a floating point number",
"or": "(or [expression...]) => bool",
"pair?": "(pair? [value]) => bool",
"path-abs": "(path-abs [filepath: string]) => string",
"path-join": "(path-join [string]) => string",
"path-extension": "(path-extension [filepath: string] [[replacement-extension: string]]) => string",
"path-base": "(path-base [filepath: string]) => string",
"path-dir": "(path-dir [filepath: string]) => string",
"path-exists?": "(path-exists? [filepath: string]) => bool",
"path-extension": "(path-extension [filepath: string] [[replacement-extension: string]]) => string",
"path-glob": "(path-glob [filepath: string]) => list",
"chmod": "(chmod [filepath: string] [file-mode: number]) => ()",
"chdir": "(chdir [filepath: string]) => ()",
"env": "(env [[env-key: string]] [[env-value: string]]) => list|string|()",
"subprocess": "(subprocess [list] [[output-redirection: IOHandle|#f]] [[error-redirection: IOHandle|#f]]) => number\n\nPassing `#f` to output redirection allows you to do stdout while still redirecting stderr. The `#f` for stderr only exists for symetry, and will not redirect stderr",
"mkdir": "(mkdir [path: string] [permissions: number] [[make-all: bool]]) => ()",
"rm": "(rm [path: string] [[make-all: bool]]) => ()",
"mv": "(mv [from-path: string] [to-path: string]) => ()",
"path-is-dir?": "(path-is-dir? [filepath: string]) => bool",
"path-join": "(path-join [string]) => string",
"PHI": "PHI => number",
"PI": "PI => number",
"positive?": "(positive? [number]) => bool",
"procedure?": "(procedure? [value]) => bool",
"pwd": "(pwd): path => string",
"net-conn": "(net-conn [host: string] [port: string|number] [[use-tls: bool]] [[timeout-seconds: number]]) => IOHandle",
"url-scheme": "(url-scheme [url: string] [[new-scheme: string]]) => string",
"url-host": "(url-host [url: string] [[new-host: string]]) => string",
"url-port": "(url-port [url: string] [[new-port: string]]) => string",
"url-path": "(url-path [url: string] [[new-path: string]]) => string",
"url-query": "(url-query [url: string] [[new-query: string]]) => string",
"hostname": "(hostname) => string",
"timestamp": "(timestamp) => number (timestamp)",
"date": "(date): date => string",
"timestamp->date": "(timestamp->date [timestamp: string|number] [[format: string]]) => string\n\nDate format/pattern substitutions:\n\t%a - 12 hour segment, lowercase: pm\n\t%A - 12 hour segment, uppercase: PM\n\t%d - Day without leading zero: 4\n\t%D - Day with leading zero: 04\n\t%e - Day without leading zero, but with space padding: 4\n\t%f - Month name, short: Jan\n\t%F - Month name, long: January\n\t%g or %G - Hour, 24 hour format: 15\n\t%h - Hour, 12 hour format without leading zero: 2\n\t%H - Hour, 12 hour format with leading zero: 02\n\t%i - Minutes without leading zero: 4\n\t%I - Minutes with leading zero: 04\n\t%m - Month number, without leading zero: 6\n\t%M - Month number, with leading zero: 06\n\t%o - Timezone offset, without minutes: -07\n\t%O - Timezone offset, with minutes: -0700\n\t%s - Seconds, without leading zero: 5\n\t%S - Seconds, with leading zero: 05\n\t%w - Short weekeday: Wed\n\t%W - Long weekday: Wednesday\n\t%y - Two digit year: 21\n\t%Y - Four digit year: 2021\n\t%Z - Time zone, as three chars: UTC, PST, etc.\n\t%% - Will yield a literal percent sign: %\n\tanything else - A percent followed by an unrecognized char will yield a ?, as will a hanging % as the last char in the string\n\nSo the string: \"%F %e, %Y %h:%I%a\" would be equivalend to something like: \"August 8, 2021 4:03pm\"\n\nWhen a string is converted to a date and no time zone information is present, slope will assume the user's local time.",
"date->timestamp": "(date->timestamp [date: string] [format: string]) => number (timestamp)\n\nDate format/pattern substitutions:\n\t%a - 12 hour segment, lowercase: pm\n\t%A - 12 hour segment, uppercase: PM\n\t%d - Day without leading zero: 4\n\t%D - Day with leading zero: 04\n\t%e - Day without leading zero, but with space padding: 4\n\t%f - Month name, short: Jan\n\t%F - Month name, long: January\n\t%g or %G - Hour, 24 hour format: 15\n\t%h - Hour, 12 hour format without leading zero: 2\n\t%H - Hour, 12 hour format with leading zero: 02\n\t%i - Minutes without leading zero: 4\n\t%I - Minutes with leading zero: 04\n\t%m - Month number, without leading zero: 6\n\t%M - Month number, with leading zero: 06\n\t%o - Timezone offset, without minutes: -07\n\t%O - Timezone offset, with minutes: -0700\n\t%s - Seconds, without leading zero: 5\n\t%S - Seconds, with leading zero: 05\n\t%w - Short weekeday: Wed\n\t%W - Long weekday: Wednesday\n\t%y - Two digit year: 21\n\t%Y - Four digit year: 2021\n\t%Z - Time zone, as three chars: UTC, PST, etc.\n\t%% - Will yield a literal percent sign: %\n\tanything else - A percent followed by an unrecognized char will yield a ?, as will a hanging % as the last char in the string\n\nSo the string: \"%F %e, %Y %h:%I%a\" would be equivalend to something like: \"August 8, 2021 4:03pm\"\n\nWhen a string is converted to a date and no time zone information is present, slope will assume the user's local time.",
"date-format": "(date-format [start-format: string] [date: string] [end-format: string]) => string\n\nDate format/pattern substitutions:\n\t%a - 12 hour segment, lowercase: pm\n\t%A - 12 hour segment, uppercase: PM\n\t%d - Day without leading zero: 4\n\t%D - Day with leading zero: 04\n\t%e - Day without leading zero, but with space padding: 4\n\t%f - Month name, short: Jan\n\t%F - Month name, long: January\n\t%g or %G - Hour, 24 hour format: 15\n\t%h - Hour, 12 hour format without leading zero: 2\n\t%H - Hour, 12 hour format with leading zero: 02\n\t%i - Minutes without leading zero: 4\n\t%I - Minutes with leading zero: 04\n\t%m - Month number, without leading zero: 6\n\t%M - Month number, with leading zero: 06\n\t%o - Timezone offset, without minutes: -07\n\t%O - Timezone offset, with minutes: -0700\n\t%s - Seconds, without leading zero: 5\n\t%S - Seconds, with leading zero: 05\n\t%w - Short weekeday: Wed\n\t%W - Long weekday: Wednesday\n\t%y - Two digit year: 21\n\t%Y - Four digit year: 2021\n\t%Z - Time zone, as three chars: UTC, PST, etc.\n\t%% - Will yield a literal percent sign: %\n\tanything else - A percent followed by an unrecognized char will yield a ?, as will a hanging % as the last char in the string\n\nSo the string: \"%F %e, %Y %h:%I%a\" would be equivalend to something like: \"August 8, 2021 4:03pm\"\n\nWhen a string is converted to a date and no time zone information is present, slope will assume the user's local time.",
"quote": "(quote [expression...]) => bool",
"read-all": "(read-all [[IOHandle]]) => string",
"read-all-lines": "(read-all-lines [[IOHandle]]) => list",
"read-char": "(read-char [[IOHandle]]) => string",
"read-line": "(read-line [[IOHandle]]) => string|symbol: EOF",
"regex-find": "(regex-find [pattern: string] [string]) => list",
"regex-match?": "(regex-match? [pattern: string] [string]) => bool",
"regex-replace": "(regex-replace [string (pattern)] [string]) => string",
"rand": "(rand [[max]] [[min]]) => number\n\nIf no arguments are given `rand` will produce a floating point number between 0 and 1. If only `max` is given, `rand` will produce a floating point number between 0 and `max`. If `max` and `min` are both given, `rand` will produce a floating point number between `min` and `max`. `max` is always exclusive (the value produced will always be less than `max`), while `min` is inclusize. To obtain integers use `floor`, `ceil`, or `round` on the result or `rand`",
"reverse": "(reverse [list|string]) => list|string\n\n`reverse` will reverse a list or a string and return the same type of value it was given, but with the contents reversed",
"rm": "(rm [path: string] [[make-all: bool]]) => ()",
"round": "(round [number] [[decimals-to-round-to: number]]) => number",
"set!": "(set! [var-name: symbol] [value|expression|procedure]) => value | expression | procedure\n\nReturns the value that var-name was set to, in addition to creating the var symbol and setting it to the given value. Only an existing variable can be set with `set!`, trying to set a non-existant variable will result in an exception. `set!` will always set the value for the variable in the nearest scope",
"signal-catch-sigint": "(signal-catch-sigint [procedure]) => bool\n\nThe procedure passed to signal-catch-sigint should take no arguments and will be run upon sigint being received. This will override all default behavior: if you still want the program to exit you will need to call (exit) from within the procedure. This procedure (signal-catch-sigint) should be called at the root level of your program as it will only have access to the global environment.",
"sleep": "(sleep [[milliseconds: number]]) => ()",
"date-default-format": "(date-default-format) => string\n\nReturns a format string for the default format produced by 'date'",
"PI": "PI => number",
"PHI": "PHI => number",
"E": "E => number",
"stderr": "stdin => io-handle (file: write-only)",
"stdin": "stdin => io-handle(file: read-only)",
"stdout": "stdin => io-handle (file: write-only)",
"stderr": "stdin => io-handle (file: write-only)",
"usage": "(usage [built-in-name: string])",
"string?": "(string? [value]) => bool",
"string->list": "(string->list [string] [[split-on: value]] [[count: number]]) => list\n\nSplits the string at each instance of `split-on` value. If `split-on` is not a string it will be case to string for the purposes of splitting the string into a list\n\nIf a count is provided the string will be split into no more than _count_ list elements.",
"string->md5": "(string->md5 [string]) => string",
"string->sha256": "(string->sha256 [string]) => string",
"string->number": "(string->number [string] [[base: number]]) => number/#f\n\nIf a non-decimal base is supplied, the input string will be parsed as an integer and any flaoting point value will be floored. A valid base passed with a string that does not parse to a number will return #f",
"string-append": "(string-append [value...]) => string\n\n'string-append' will stringify any non-string values passed to it and append them. To have finer grain control of number conversion use 'number->string' and pass the result to 'string-append'",
"string-buf?": "(string-buf? [value]) => bool",
"string-buf-clear": "(string-buf-clear [IOHandle: string-buf]) => ()",
"string-fields": "(string-fields [string]) => list\n\nSplits a string around each instance of one or more consecutive white space characters",
"string-format": "(string-format [template: string] [value...]) => string\n\nReplaces values designated by `%v` in the template string with successive values (`value...`).\n\nWidth can be set by adding an integer between the `%` and the `v`: `%10v`, or left aligned: `%-10v`",
"string-index-of": "(string-index-of [string] [search-value: string]) => number\n\nReturns -1 if `search-value` does not appear in `string`",
"string-lower": "(string-lower [string]) => string",
"string-make-buf": "(string-make-buf) => IOHandle: string-buf",
"string-ref": "(string-ref [string] [number]) => string",
"string-trim-space": "(string-trim-space [string]) => string\n\nRemoves any leading or trailing white-space from `string`",
"string-upper": "(string-upper [string]) => string",
"subprocess": "(subprocess [list] [[output-redirection: IOHandle|#f]] [[error-redirection: IOHandle|#f]]) => number\n\nPassing `#f` to output redirection allows you to do stdout while still redirecting stderr. The `#f` for stderr only exists for symetry, and will not redirect stderr",
"substring": "(substring [string] [start-index: number] [end-index: number]) => string\n\n`end-index` is exclusive",
"symbol?": "(symbol? [value]) => bool",
"term-char-mode": "(term-char-mode) => ()",
"term-cooked-mode": "(term-cooked-mode) => ()",
"term-raw-mode": "(term-raw-mode) => ()",
"term-restore": "(term-restore) => ()",
"term-sane-mode": "(term-sane-mode) => ()",
"term-size": "(term-size) => list",
"timestamp": "(timestamp) => number (timestamp)",
"timestamp->date": "(timestamp->date [timestamp: string|number] [[format: string]]) => string\n\nDate format/pattern substitutions:\n\t%a - 12 hour segment, lowercase: pm\n\t%A - 12 hour segment, uppercase: PM\n\t%d - Day without leading zero: 4\n\t%D - Day with leading zero: 04\n\t%e - Day without leading zero, but with space padding: 4\n\t%f - Month name, short: Jan\n\t%F - Month name, long: January\n\t%g or %G - Hour, 24 hour format: 15\n\t%h - Hour, 12 hour format without leading zero: 2\n\t%H - Hour, 12 hour format with leading zero: 02\n\t%i - Minutes without leading zero: 4\n\t%I - Minutes with leading zero: 04\n\t%m - Month number, without leading zero: 6\n\t%M - Month number, with leading zero: 06\n\t%o - Timezone offset, without minutes: -07\n\t%O - Timezone offset, with minutes: -0700\n\t%s - Seconds, without leading zero: 5\n\t%S - Seconds, with leading zero: 05\n\t%w - Short weekeday: Wed\n\t%W - Long weekday: Wednesday\n\t%y - Two digit year: 21\n\t%Y - Four digit year: 2021\n\t%Z - Time zone, as three chars: UTC, PST, etc.\n\t%% - Will yield a literal percent sign: %\n\tanything else - A percent followed by an unrecognized char will yield a ?, as will a hanging % as the last char in the string\n\nSo the string: \"%F %e, %Y %h:%I%a\" would be equivalend to something like: \"August 8, 2021 4:03pm\"\n\nWhen a string is converted to a date and no time zone information is present, slope will assume the user's local time.",
"url-host": "(url-host [url: string] [[new-host: string]]) => string",
"url-path": "(url-path [url: string] [[new-path: string]]) => string",
"url-port": "(url-port [url: string] [[new-port: string]]) => string",
"url-query": "(url-query [url: string] [[new-query: string]]) => string",
"url-scheme": "(url-scheme [url: string] [[new-scheme: string]]) => string",
"usage": "(usage [[built-in-name: string]]) => ()\n\nIf not passed a value, usage will display a list of all known built-in procedures. When given a value a description of that value will be output to stdout.",
"write": "(write [string] [[IOHandle]]) => ()|IOHandle",
"write-raw": "(write-raw [string] [[IOHandle]]) => ()|IOHandle",
"zero?": "(zero? [number]) => bool",
}

Loading…
Cancel
Save