diff --git a/static/1.25.1/api/jpm/cc.html b/static/1.25.1/api/jpm/cc.html index e03530bb..8160d2f1 100644 --- a/static/1.25.1/api/jpm/cc.html +++ b/static/1.25.1/api/jpm/cc.html @@ -109,35 +109,35 @@
cc/archive-c cc/compile-c cc/create-buffer-c cc/create-buffer-c-impl cc/create-executable cc/embed-name cc/entry-name cc/entry-replace cc/link-c cc/make-bin-source cc/make-define cc/make-defines cc/modpath-to-meta cc/modpath-to-static cc/out-path
(archive-c opts target & objects) -Link object files together to make a static library.Community Examples
(compile-c compiler opts src dest &opt static?) +Link object files together to make a static library.
(compile-c compiler opts src dest &opt static?) -Compile a C file into an object file.Community Examples
(create-buffer-c source dest name) +Compile a C file into an object file.
(create-buffer-c source dest name) -Inline raw byte file as a c file.Community Examples
(create-buffer-c-impl bytes dest name) +Inline raw byte file as a c file.
(create-executable opts source dest no-core) -Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.Community Examples
(embed-name path) +Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.
(embed-name path) -Rename a janet symbol for embedding.Community Examples
(entry-name name) -Name of symbol that enters static compilation of a module.Community Examples
(entry-replace name) +Name of symbol that enters static compilation of a module.
(entry-replace name) -Escape special characters in the entry-nameCommunity Examples
(link-c has-cpp opts target & objects) +Escape special characters in the entry-name
(link-c has-cpp opts target & objects) -Link C or C++ object files together to make a native module.Community Examples
(make-bin-source declarations lookup-into-invocations no-core) +Link C or C++ object files together to make a native module.
(make-bin-source declarations lookup-into-invocations no-core) -Community Examples
(make-define define value) -Generate strings for adding custom defines to the compiler.Community Examples
(make-defines defines) +Generate strings for adding custom defines to the compiler.
(make-defines defines) -Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.Community Examples
(modpath-to-meta path) +Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.
(modpath-to-meta path) -Get the meta file path (.meta.janet) corresponding to a native module path (.so).Community Examples
(modpath-to-static path) +Get the meta file path (.meta.janet) corresponding to a native module path (.so).
(modpath-to-static path) -Get the static library (.a) path corresponding to a native module path (.so).Community Examples
(out-path path from-ext to-ext) +Get the static library (.a) path corresponding to a native module path (.so).
(out-path path from-ext to-ext) -Take a source file path and convert it to an output path.Community Examples
cgen/add-loader cgen/ir cgen/mangle cgen/print-ir
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(ir & body) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(ir & body) -Macro that automatically quotes the body provided and calls (print-ir ...) on the body.Community Examples
(mangle token) +Macro that automatically quotes the body provided and calls (print-ir ...) on the body.
(mangle token) -Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.Community Examples
(print-ir ir) +Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.
(print-ir ir) -Compile the CGEN IR to C and print it to (dyn :out).Community Examples
cli/jpm cli/main cli/run cli/setup
(jpm & argv) -A Macro User Interface for jpm to be used from a repl in a way similar to the command line.Community Examples
(main & argv) +A Macro User Interface for jpm to be used from a repl in a way similar to the command line.
(setup args) Load configuration from the command line, environment variables, and configuration files. Returns array of non-configuration arguments as well. @@ -121,7 +121,7 @@Community ExamplesIndex 1. Commmand line settings 2. The value of `(dyn :jpm-config)` 3. Environment variables - 4. Config file settings (default-config if non specified)
commands/build commands/clean commands/configure commands/deps commands/enable-local-mode commands/help commands/install commands/jpm-debug-repl commands/list-installed commands/list-pkgs commands/list-rules commands/new-c-project commands/new-project commands/quickbin commands/set-tree commands/show-paths commands/show-rule-tree commands/test commands/update-pkgs
(configure &opt path) -Setup an out-of-tree build with certain configuration options.Community Examples
(deps) +Setup an out-of-tree build with certain configuration options.
(enable-local-mode) -Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/Community Examples
(help) +Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/
(new-c-project name) -Create a new C projectCommunity Examples
(set-tree tree) -Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.Community Examples
(show-paths) +Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.
config/builtin-configs config/config-checkers config/config-docs config/config-options config/config-parsers config/config-set config/defconf config/dyn:ar config/dyn:auto-shebang config/dyn:binpath config/dyn:build-type config/dyn:buildpath config/dyn:c++ config/dyn:c++-link config/dyn:cc config/dyn:cc-link config/dyn:cflags config/dyn:cflags-verbose config/dyn:config-file config/dyn:cppflags config/dyn:curlpath config/dyn:dest-dir config/dyn:dynamic-cflags config/dyn:dynamic-lflags config/dyn:gitpath config/dyn:headerpath config/dyn:is-msvc config/dyn:janet config/dyn:janet-cflags config/dyn:janet-lflags config/dyn:ldflags config/dyn:lflags config/dyn:libpath config/dyn:local config/dyn:manpath config/dyn:modext config/dyn:modpath config/dyn:nocolor config/dyn:offline config/dyn:optimize config/dyn:pkglist config/dyn:silent config/dyn:statext config/dyn:tarpath config/dyn:test config/dyn:tree config/dyn:update-pkgs config/dyn:use-batch-shell config/dyn:verbose config/dyn:workers config/load-config config/load-config-file config/load-default config/load-options config/opt config/read-env-variables config/save-config config/shorthand-mapping
Table of all built-in options, as opposed to project deifned options.Community Examples
A table of all of the dynamic config bindings to checkers (validators).Community Examples
Table of all of the help text for each config option.Community Examples
A table of possible options for enum option types.Community Examples
A table of all of the dynamic config bindings to parsers.Community Examples
(defconf kw &opt parser docs options) +config/builtin-configs config/config-checkers config/config-docs config/config-options config/config-parsers config/config-set config/defconf config/dyn:ar config/dyn:auto-shebang config/dyn:binpath config/dyn:build-type config/dyn:buildpath config/dyn:c++ config/dyn:c++-link config/dyn:cc config/dyn:cc-link config/dyn:cflags config/dyn:cflags-verbose config/dyn:config-file config/dyn:cppflags config/dyn:curlpath config/dyn:dest-dir config/dyn:dynamic-cflags config/dyn:dynamic-lflags config/dyn:gitpath config/dyn:headerpath config/dyn:is-msvc config/dyn:janet config/dyn:janet-cflags config/dyn:janet-lflags config/dyn:ldflags config/dyn:lflags config/dyn:libpath config/dyn:local config/dyn:manpath config/dyn:modext config/dyn:modpath config/dyn:nocolor config/dyn:offline config/dyn:optimize config/dyn:pkglist config/dyn:silent config/dyn:statext config/dyn:tarpath config/dyn:test config/dyn:tree config/dyn:update-pkgs config/dyn:use-batch-shell config/dyn:verbose config/dyn:workers config/load-config config/load-config-file config/load-default config/load-options config/opt config/read-env-variables config/save-config config/shorthand-mapping
config/builtin-configs table sourceTable of all built-in options, as opposed to project deifned options.config/config-checkers table sourceA table of all of the dynamic config bindings to checkers (validators).config/defconf macro source(defconf kw &opt parser docs options) -Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.Community Examplesconfig/dyn:ar function source(dyn:ar &opt dflt) +Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.config/load-config function source(load-config settings &opt override) -Load a configuration from a table or struct.Community Examplesconfig/load-config-file function source(load-config-file path &opt override) +Load a configuration from a table or struct.config/load-config-file function source(load-config-file path &opt override) -Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.Community Examplesconfig/load-default function source(load-default &opt override) +Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.config/load-default function source(load-default &opt override) -Load the default configuration.Community Examplesconfig/load-options function source(load-options &opt path) -Load a file that contains config options that can be set. If no such file exists, then do nothing.Community Examplesconfig/opt function source(opt opts key &opt dflt) +Load a file that contains config options that can be set. If no such file exists, then do nothing.config/opt function source(opt opts key &opt dflt) -Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.Community Examplesconfig/read-env-variables function source(read-env-variables) +Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.config/read-env-variables function source(read-env-variables) -Read environment variables that correspond to config variables into dyns.Community Examplesconfig/save-config function source(save-config path) +Read environment variables that correspond to config variables into dyns.config/save-config function source(save-config path) -Write the current configuration information to a file.Community Examplesconfig/shorthand-mapping struct source+Write the current configuration information to a file.Map some single characters to long options.Community Examples
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.
(pmap f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.Community Examples
jpm/cc/archive-c jpm/cc/compile-c jpm/cc/create-buffer-c jpm/cc/create-buffer-c-impl jpm/cc/create-executable jpm/cc/embed-name jpm/cc/entry-name jpm/cc/entry-replace jpm/cc/link-c jpm/cc/make-bin-source jpm/cc/make-define jpm/cc/make-defines jpm/cc/modpath-to-meta jpm/cc/modpath-to-static jpm/cc/out-path jpm/cgen/add-loader jpm/cgen/ir jpm/cgen/mangle jpm/cgen/print-ir jpm/commands/build jpm/commands/clean jpm/commands/configure jpm/commands/deps jpm/commands/enable-local-mode jpm/commands/help jpm/commands/install jpm/commands/jpm-debug-repl jpm/commands/list-installed jpm/commands/list-pkgs jpm/commands/list-rules jpm/commands/new-c-project jpm/commands/new-project jpm/commands/quickbin jpm/commands/set-tree jpm/commands/show-paths jpm/commands/show-rule-tree jpm/commands/test jpm/commands/update-pkgs jpm/config/builtin-configs jpm/config/config-checkers jpm/config/config-docs jpm/config/config-options jpm/config/config-parsers jpm/config/config-set jpm/config/defconf jpm/config/dyn:ar jpm/config/dyn:auto-shebang jpm/config/dyn:binpath jpm/config/dyn:build-type jpm/config/dyn:buildpath jpm/config/dyn:c++ jpm/config/dyn:c++-link jpm/config/dyn:cc jpm/config/dyn:cc-link jpm/config/dyn:cflags jpm/config/dyn:cflags-verbose jpm/config/dyn:config-file jpm/config/dyn:cppflags jpm/config/dyn:curlpath jpm/config/dyn:dest-dir jpm/config/dyn:dynamic-cflags jpm/config/dyn:dynamic-lflags jpm/config/dyn:gitpath jpm/config/dyn:headerpath jpm/config/dyn:is-msvc jpm/config/dyn:janet jpm/config/dyn:janet-cflags jpm/config/dyn:janet-lflags jpm/config/dyn:ldflags jpm/config/dyn:lflags jpm/config/dyn:libpath jpm/config/dyn:local jpm/config/dyn:manpath jpm/config/dyn:modext jpm/config/dyn:modpath jpm/config/dyn:nocolor jpm/config/dyn:offline jpm/config/dyn:optimize jpm/config/dyn:pkglist jpm/config/dyn:silent jpm/config/dyn:statext jpm/config/dyn:tarpath jpm/config/dyn:test jpm/config/dyn:tree jpm/config/dyn:update-pkgs jpm/config/dyn:use-batch-shell jpm/config/dyn:verbose jpm/config/dyn:workers jpm/config/load-config jpm/config/load-config-file jpm/config/load-default jpm/config/load-options jpm/config/opt jpm/config/read-env-variables jpm/config/save-config jpm/config/shorthand-mapping jpm/dagbuild/pdag jpm/dagbuild/pmap jpm/make-config/auto jpm/make-config/generate-config jpm/pm/bundle-install jpm/pm/curl jpm/pm/do-rule jpm/pm/download-bundle jpm/pm/download-git-bundle jpm/pm/download-tar-bundle jpm/pm/git jpm/pm/import-rules jpm/pm/load-lockfile jpm/pm/load-project-meta jpm/pm/make-jpm-env jpm/pm/make-lockfile jpm/pm/out-of-tree-config jpm/pm/post-deps jpm/pm/require-jpm jpm/pm/resolve-bundle jpm/pm/tar jpm/pm/update-git-bundle jpm/pm/update-installed jpm/rules/add-body jpm/rules/add-dep jpm/rules/add-input jpm/rules/add-output jpm/rules/add-thunk jpm/rules/build-rules jpm/rules/getrules jpm/rules/phony jpm/rules/rule jpm/rules/sh-phony jpm/rules/sh-rule jpm/rules/sh-task jpm/rules/task jpm/scaffold/scaffold-project jpm/shutil/abspath jpm/shutil/basename jpm/shutil/clear-cache jpm/shutil/clear-manifest jpm/shutil/clexe-shell jpm/shutil/copy jpm/shutil/copyfile jpm/shutil/create-dirs jpm/shutil/devnull jpm/shutil/dirname jpm/shutil/drop1-shell jpm/shutil/exec-slurp jpm/shutil/filepath-replace jpm/shutil/find-build-dir jpm/shutil/find-cache jpm/shutil/find-manifest jpm/shutil/find-manifest-dir jpm/shutil/is-win jpm/shutil/path-splitter jpm/shutil/rimraf jpm/shutil/rm jpm/shutil/shell
(archive-c opts target & objects) -Link object files together to make a static library.Community Examples
(compile-c compiler opts src dest &opt static?) +Link object files together to make a static library.
(compile-c compiler opts src dest &opt static?) -Compile a C file into an object file.Community Examples
(create-buffer-c source dest name) +Compile a C file into an object file.
(create-buffer-c source dest name) -Inline raw byte file as a c file.Community Examples
(create-buffer-c-impl bytes dest name) +Inline raw byte file as a c file.
(create-buffer-c-impl bytes dest name) -Community Examples
(create-executable opts source dest no-core) -Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.Community Examples
(embed-name path) +Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.
(embed-name path) -Rename a janet symbol for embedding.Community Examples
(entry-name name) -Name of symbol that enters static compilation of a module.Community Examples
(entry-replace name) +Name of symbol that enters static compilation of a module.
(entry-replace name) -Escape special characters in the entry-nameCommunity Examples
(link-c has-cpp opts target & objects) +Escape special characters in the entry-name
(link-c has-cpp opts target & objects) -Link C or C++ object files together to make a native module.Community Examples
(make-bin-source declarations lookup-into-invocations no-core) +Link C or C++ object files together to make a native module.
(make-bin-source declarations lookup-into-invocations no-core) -Community Examples
(make-define define value) -Generate strings for adding custom defines to the compiler.Community Examples
(make-defines defines) +Generate strings for adding custom defines to the compiler.
(make-defines defines) -Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.Community Examples
(modpath-to-meta path) +Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.
(modpath-to-meta path) -Get the meta file path (.meta.janet) corresponding to a native module path (.so).Community Examples
(modpath-to-static path) +Get the meta file path (.meta.janet) corresponding to a native module path (.so).
(modpath-to-static path) -Get the static library (.a) path corresponding to a native module path (.so).Community Examples
(out-path path from-ext to-ext) +Get the static library (.a) path corresponding to a native module path (.so).
(out-path path from-ext to-ext) -Take a source file path and convert it to an output path.Community Examples
(add-loader) +Take a source file path and convert it to an output path.
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(ir & body) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(ir & body) -Macro that automatically quotes the body provided and calls (print-ir ...) on the body.Community Examples
(mangle token) +Macro that automatically quotes the body provided and calls (print-ir ...) on the body.
(mangle token) -Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.Community Examples
(print-ir ir) +Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.
(print-ir ir) -Compile the CGEN IR to C and print it to (dyn :out).Community Examples
(configure &opt path) -Setup an out-of-tree build with certain configuration options.Community Examples
(deps) +Setup an out-of-tree build with certain configuration options.
(enable-local-mode) -Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/Community Examples
(help) +Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/
(new-c-project name) -Create a new C projectCommunity Examples
(set-tree tree) -Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.Community Examples
(show-paths) +Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.
Table of all built-in options, as opposed to project deifned options.Community Examples
A table of all of the dynamic config bindings to checkers (validators).Community Examples
Table of all of the help text for each config option.Community Examples
A table of possible options for enum option types.Community Examples
A table of all of the dynamic config bindings to parsers.Community Examples
Table of all built-in options, as opposed to project deifned options.
A table of all of the dynamic config bindings to checkers (validators).
(defconf kw &opt parser docs options) -Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.Community Examples
(dyn:ar &opt dflt) +Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.
(load-config settings &opt override) -Load a configuration from a table or struct.Community Examples
(load-config-file path &opt override) +Load a configuration from a table or struct.
(load-config-file path &opt override) -Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.Community Examples
(load-default &opt override) +Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.
(load-default &opt override) -Load the default configuration.Community Examples
(load-options &opt path) -Load a file that contains config options that can be set. If no such file exists, then do nothing.Community Examples
(opt opts key &opt dflt) +Load a file that contains config options that can be set. If no such file exists, then do nothing.
(opt opts key &opt dflt) -Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.Community Examples
(read-env-variables) +Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.
(read-env-variables) -Read environment variables that correspond to config variables into dyns.Community Examples
(save-config path) +Read environment variables that correspond to config variables into dyns.
(save-config path) -Write the current configuration information to a file.Community Examples
Map some single characters to long options.Community Examples
(pdag f dag &opt n-workers) +Write the current configuration information to a file.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.
(pmap f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.Community Examples
(auto) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.
(generate-config &opt destdir silent as-data) +Get an autodetected config.
(generate-config &opt destdir silent as-data) -Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.Community Examples
(bundle-install bundle &opt no-deps) +Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.
(bundle-install bundle &opt no-deps) -Install a bundle from a git repository.Community Examples
(do-rule target) -Evaluate a given rule in a one-off manner.Community Examples
(download-bundle url bundle-type &opt tag shallow) +Evaluate a given rule in a one-off manner.
(download-bundle url bundle-type &opt tag shallow) -Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.Community Examples
(download-git-bundle bundle-dir url tag shallow) +Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.
(download-git-bundle bundle-dir url tag shallow) -Download a git bundle from a remote respositoryCommunity Examples
(download-tar-bundle bundle-dir url &opt force-gz) +Download a git bundle from a remote respository
(download-tar-bundle bundle-dir url &opt force-gz) -Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.Community Examples
(git & args) +Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.
(import-rules path &opt base-env) -Import another file that defines more rules. This ruleset is merged into the current ruleset.Community Examples
(load-lockfile &opt filename) +Import another file that defines more rules. This ruleset is merged into the current ruleset.
(load-lockfile &opt filename) -Load packages from a lockfile.Community Examples
(load-project-meta &opt path) +Load packages from a lockfile.
(load-project-meta &opt path) -Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.Community Examples
(make-jpm-env &opt base-env) +Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.
(make-jpm-env &opt base-env) -Create an environment that is preloaded with jpm symbols.Community Examples
(make-lockfile &opt filename) +Create an environment that is preloaded with jpm symbols.
(out-of-tree-config path &opt options) -Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.Community Examples
(post-deps & body) +Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.
(post-deps & body) -Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.Community Examples
(require-jpm path &opt base-env) +Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.
(require-jpm path &opt base-env) -Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.Community Examples
(resolve-bundle bundle) +Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.
(resolve-bundle bundle) -Convert any bundle string/table to the normalized table form.Community Examples
(tar & args) +Convert any bundle string/table to the normalized table form.
(update-git-bundle bundle-dir tag shallow) +Make a call to tar.
(update-git-bundle bundle-dir tag shallow) -Fetch latest tag version from remote repositoryCommunity Examples
(update-installed) +Fetch latest tag version from remote repository
(update-installed) -Update all previously installed packages to their latest versions.Community Examples
(add-body target & body) +Update all previously installed packages to their latest versions.
(add-body target & body) -Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.Community Examples
(add-dep target dep) +Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.
(add-input target input) -Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.Community Examples
(add-output target output) +Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.
(add-output target output) -Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.Community Examples
(add-thunk target thunk) +Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.
(add-thunk target thunk) -Append a thunk to a target's recipe.Community Examples
(build-rules rules targets &opt n-workers) +Append a thunk to a target's recipe.
(build-rules rules targets &opt n-workers) -Given a graph of all rules, extract a work graph that will build out-of-date files.Community Examples
(getrules) +Given a graph of all rules, extract a work graph that will build out-of-date files.
(rule target deps & body) -Add a rule to the rule graph.Community Examples
(sh-phony target deps & body) -Alias for `sh-task`.Community Examples
(sh-rule target deps & body) -Add a rule that invokes a shell command, and fails if the command returns non-zero.Community Examples
(sh-task target deps & body) +Add a rule that invokes a shell command, and fails if the command returns non-zero.
(sh-task target deps & body) -Add a task that invokes a shell command, and fails if the command returns non-zero.Community Examples
(task target deps & body) +Add a task that invokes a shell command, and fails if the command returns non-zero.
(task target deps & body) -Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).Community Examples
(scaffold-project name &opt options) +Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).
(scaffold-project name &opt options) -Generate a standardized project scaffold.Community Examples
(abspath path) -Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).Community Examples
(basename path) +Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).
(basename path) -Get the filename of a path without any leading directory components.Community Examples
(clear-cache) +Get the filename of a path without any leading directory components.
(clear-manifest) -Clear the global installation manifest.Community Examples
(clexe-shell & args) +Clear the global installation manifest.
(copy src dest) -Copy a file or directory recursively from one location to another.Community Examples
(copyfile src dest) +Copy a file or directory recursively from one location to another.
(copyfile src dest) -Copy a file one location to another.Community Examples
(create-dirs dest) -Create all directories needed for a file (mkdir -p).Community Examples
(dirname path) -Get the directory of a file without the filename.Community Examples
(drop1-shell std args) +Get the directory of a file without the filename.
(drop1-shell std args) -Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.Community Examples
(exec-slurp & args) +Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.
(exec-slurp & args) -Read stdout of subprocess and return it trimmed in a string.Community Examples
(filepath-replace repo) +Read stdout of subprocess and return it trimmed in a string.
(filepath-replace repo) -Remove special characters from a string or path to make it into a path segment.Community Examples
(find-build-dir) +Remove special characters from a string or path to make it into a path segment.
(find-build-dir) -Gets the build directory to output files to.Community Examples
(find-cache) -Return the path to the global cache.Community Examples
(find-manifest name) -Get the full path of a manifest file given a package name.Community Examples
(find-manifest-dir) +Get the full path of a manifest file given a package name.
(find-manifest-dir) -Get the path to the directory containing manifests for installed packages.Community Examples
(is-win) +Get the path to the directory containing manifests for installed packages.
(is-win) -Check if we should assume a DOS-like shell or default to posix shell.Community Examples
(rimraf path) +Check if we should assume a DOS-like shell or default to posix shell.
(rm path) -Remove a directory and all sub directories.Community Examples
make-config/auto make-config/generate-config
(generate-config &opt destdir silent as-data) +Get an autodetected config.
(generate-config &opt destdir silent as-data) -Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.Community Examples
pm/bundle-install pm/curl pm/do-rule pm/download-bundle pm/download-git-bundle pm/download-tar-bundle pm/git pm/import-rules pm/load-lockfile pm/load-project-meta pm/make-jpm-env pm/make-lockfile pm/out-of-tree-config pm/post-deps pm/require-jpm pm/resolve-bundle pm/tar pm/update-git-bundle pm/update-installed
(bundle-install bundle &opt no-deps) -Install a bundle from a git repository.Community Examples
(do-rule target) -Evaluate a given rule in a one-off manner.Community Examples
(download-bundle url bundle-type &opt tag shallow) +Evaluate a given rule in a one-off manner.
(download-bundle url bundle-type &opt tag shallow) -Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.Community Examples
(download-git-bundle bundle-dir url tag shallow) +Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.
(download-git-bundle bundle-dir url tag shallow) -Download a git bundle from a remote respositoryCommunity Examples
(download-tar-bundle bundle-dir url &opt force-gz) +Download a git bundle from a remote respository
(download-tar-bundle bundle-dir url &opt force-gz) -Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.Community Examples
(git & args) +Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.
(import-rules path &opt base-env) -Import another file that defines more rules. This ruleset is merged into the current ruleset.Community Examples
(load-lockfile &opt filename) +Import another file that defines more rules. This ruleset is merged into the current ruleset.
(load-lockfile &opt filename) -Load packages from a lockfile.Community Examples
(load-project-meta &opt path) -Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.Community Examples
(make-jpm-env &opt base-env) +Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.
(make-jpm-env &opt base-env) -Create an environment that is preloaded with jpm symbols.Community Examples
(make-lockfile &opt filename) +Create an environment that is preloaded with jpm symbols.
(out-of-tree-config path &opt options) -Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.Community Examples
(post-deps & body) +Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.
(post-deps & body) -Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.Community Examples
(require-jpm path &opt base-env) +Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.
(require-jpm path &opt base-env) -Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.Community Examples
(resolve-bundle bundle) +Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.
(resolve-bundle bundle) -Convert any bundle string/table to the normalized table form.Community Examples
(update-git-bundle bundle-dir tag shallow) +Make a call to tar.
(update-git-bundle bundle-dir tag shallow) -Fetch latest tag version from remote repositoryCommunity Examples
(update-installed) +Fetch latest tag version from remote repository
(update-installed) -Update all previously installed packages to their latest versions.Community Examples
rules/add-body rules/add-dep rules/add-input rules/add-output rules/add-thunk rules/build-rules rules/getrules rules/phony rules/rule rules/sh-phony rules/sh-rule rules/sh-task rules/task
(add-body target & body) -Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.Community Examples
(add-dep target dep) +Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.
(add-input target input) -Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.Community Examples
(add-output target output) +Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.
(add-output target output) -Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.Community Examples
(add-thunk target thunk) +Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.
(add-thunk target thunk) -Append a thunk to a target's recipe.Community Examples
(build-rules rules targets &opt n-workers) +Append a thunk to a target's recipe.
(build-rules rules targets &opt n-workers) -Given a graph of all rules, extract a work graph that will build out-of-date files.Community Examples
(getrules) +Given a graph of all rules, extract a work graph that will build out-of-date files.
(sh-rule target deps & body) -Add a rule that invokes a shell command, and fails if the command returns non-zero.Community Examples
(sh-task target deps & body) +Add a rule that invokes a shell command, and fails if the command returns non-zero.
(sh-task target deps & body) -Add a task that invokes a shell command, and fails if the command returns non-zero.Community Examples
(task target deps & body) +Add a task that invokes a shell command, and fails if the command returns non-zero.
(task target deps & body) -Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).Community Examples
(scaffold-project name &opt options) -Generate a standardized project scaffold.Community Examples
shutil/abspath shutil/basename shutil/clear-cache shutil/clear-manifest shutil/clexe-shell shutil/copy shutil/copyfile shutil/create-dirs shutil/devnull shutil/dirname shutil/drop1-shell shutil/exec-slurp shutil/filepath-replace shutil/find-build-dir shutil/find-cache shutil/find-manifest shutil/find-manifest-dir shutil/is-win shutil/path-splitter shutil/rimraf shutil/rm shutil/shell
(abspath path) -Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).Community Examples
(basename path) +Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).
(basename path) -Get the filename of a path without any leading directory components.Community Examples
(clear-cache) +Get the filename of a path without any leading directory components.
(clear-manifest) -Clear the global installation manifest.Community Examples
(copy src dest) -Copy a file or directory recursively from one location to another.Community Examples
(copyfile src dest) +Copy a file or directory recursively from one location to another.
(copyfile src dest) -Copy a file one location to another.Community Examples
(create-dirs dest) -Create all directories needed for a file (mkdir -p).Community Examples
(dirname path) -Get the directory of a file without the filename.Community Examples
(drop1-shell std args) +Get the directory of a file without the filename.
(drop1-shell std args) -Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.Community Examples
(exec-slurp & args) +Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.
(exec-slurp & args) -Read stdout of subprocess and return it trimmed in a string.Community Examples
(filepath-replace repo) +Read stdout of subprocess and return it trimmed in a string.
(filepath-replace repo) -Remove special characters from a string or path to make it into a path segment.Community Examples
(find-build-dir) +Remove special characters from a string or path to make it into a path segment.
(find-build-dir) -Gets the build directory to output files to.Community Examples
(find-cache) -Return the path to the global cache.Community Examples
(find-manifest name) -Get the full path of a manifest file given a package name.Community Examples
(find-manifest-dir) +Get the full path of a manifest file given a package name.
(find-manifest-dir) -Get the path to the directory containing manifests for installed packages.Community Examples
(is-win) +Get the path to the directory containing manifests for installed packages.
(is-win) -Check if we should assume a DOS-like shell or default to posix shell.Community Examples
(rimraf path) +Check if we should assume a DOS-like shell or default to posix shell.
(decode s) Converts a base64 encoded string to its binary representation of any format -(UTF-8, binary, ..).Community Examples
(encode s) -Converts a string of any format (UTF-8, binary, ..) to base64 encoding.Community Examples
cron/check cron/next-timestamp cron/parse-cron
(check cron &opt time local) -Check if a given time matches a cron specifier.Community Examples
(next-timestamp cron &opt time local) +Check if a given time matches a cron specifier.
(next-timestamp cron &opt time local) -Given a cron schedule, get the next instance on the cron tab after timeCommunity Examples
(parse-cron str) +Given a cron schedule, get the next instance on the cron tab after time
(parse-cron str) -Parse a cron string into a valid cron schedule objectCommunity Examples
ev-utils/go-nursery ev-utils/join-nursery ev-utils/multithread-service ev-utils/nursery ev-utils/pcall ev-utils/pdag ev-utils/pmap ev-utils/pmap-full ev-utils/pmap-limited ev-utils/spawn-nursery
(go-nursery nurse f &opt value) -Spawn a fiber into a nursery, similar to ev/go.Community Examples
(join-nursery nurse) +Spawn a fiber into a nursery, similar to ev/go.
(join-nursery nurse) -Suspend the current fiber until the nursery is emptied.Community Examples
(multithread-service thread-main n-threads) +Suspend the current fiber until the nursery is emptied.
(multithread-service thread-main n-threads) -Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.Community Examples
(nursery) +Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.
(nursery) -Group a number of fibers into a single object for structured concurrencyCommunity Examples
(pcall f n) +Group a number of fibers into a single object for structured concurrency
(pcall f n) -Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.Community Examples
(pdag f dag &opt n-workers) +Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data &opt n-workers) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.
(pmap f data &opt n-workers) -Map `f` over data in parallel, optionally limiting parallelism to `n` workers.Community Examples
(pmap-full f data) +Map `f` over data in parallel, optionally limiting parallelism to `n` workers.
(pmap-full f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.Community Examples
(pmap-limited f data n-workers) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.
(pmap-limited f data n-workers) -Similar to pmap-full, but only runs work n-ways parallel.Community Examples
(spawn-nursery nurse & body) +Similar to pmap-full, but only runs work n-ways parallel.
(spawn-nursery nurse & body) -Similar to ev/spawn but associate spawned fibers with a nurseryCommunity Examples
fmt/format fmt/format-file fmt/format-print
(format source) -Format a string of source code to a buffer.Community Examples
(format-print source) -Format a string of source code and print the result.Community Examples
generators/concat generators/cycle generators/drop generators/drop-until generators/drop-while generators/filter generators/from-iterable generators/map generators/mapcat generators/range generators/run generators/take generators/take-until generators/take-while generators/to-array
(concat & xs) -Concatenate one or more generators or iterables into a single generator.Community Examples
(cycle ds) +Concatenate one or more generators or iterables into a single generator.
(cycle ds) -Repeatedly yield the elements of `ds`, looping back to the beginning when finished.Community Examples
(drop n ds) +Repeatedly yield the elements of `ds`, looping back to the beginning when finished.
(drop-until p ds) -Drop elements from `ds` until `p` is true.Community Examples
(drop-while p ds) -Drop elements from `ds` while `p` is true.Community Examples
(filter p ds) -Create a generator that filters `ds` with `p`.Community Examples
(from-iterable ds) +Create a generator that filters `ds` with `p`.
(from-iterable ds) -Create a new generator around any iterable data structure.Community Examples
(map f ds) +Create a new generator around any iterable data structure.
(map f ds) -Create a generator that maps `f` over `ds`.Community Examples
(mapcat f ds) -Map `f` over `ds`, concatenating the results into a new generator.Community Examples
(range from to) +Map `f` over `ds`, concatenating the results into a new generator.
(take n ds) -Take `n` elements from iterable `ds`.Community Examples
(take-until p ds) -Return elements from `ds` until `p` is true.Community Examples
(take-while p ds) +Return elements from `ds` until `p` is true.
(take-while p ds) -Return elements from `ds` while `p` is true.Community Examples
getline/default-autocomplete-context getline/default-autocomplete-options getline/default-doc-fetch getline/make-getline getline/max-history
(default-autocomplete-context buf pos) -Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.Community Examples
(default-autocomplete-options prefix &) +Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.
(default-autocomplete-options prefix &) -Default handler to get available autocomplete options for a given substring.Community Examples
(default-doc-fetch sym w &) +Default handler to get available autocomplete options for a given substring.
(default-doc-fetch sym w &) -Default handler for Ctrl-G to lookup docstrings in the current environment.Community Examples
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) +Default handler for Ctrl-G to lookup docstrings in the current environment.
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) -Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.Community Examples
http/cookie-grammar http/cookies http/logger http/middleware http/query-string-grammar http/read-body http/read-request http/read-response http/request http/request-peg http/response-peg http/router http/send-response http/server http/server-handler http/status-messages http/url-grammar
Grammar to parse a cookie header to a series of keys and values.Community Examples
(cookies nextmw) +http/cookie-grammar http/cookies http/logger http/middleware http/query-string-grammar http/read-body http/read-request http/read-response http/request http/request-peg http/response-peg http/router http/send-response http/server http/server-handler http/status-messages http/url-grammar
http/cookie-grammar core/peg sourceGrammar to parse a cookie header to a series of keys and values.http/cookies function source(cookies nextmw) -Parses cookies into the table under :cookies keyCommunity Exampleshttp/logger function source(logger nextmw) -Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.Community Exampleshttp/middleware function source(middleware x) +Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.http/middleware function source(middleware x) -Coerce any type to http middlewareCommunity Exampleshttp/query-string-grammar core/peg sourceGrammar that parses a query string (sans url path and ? character) and returns a table.Community Exampleshttp/query-string-grammar core/peg sourceGrammar that parses a query string (sans url path and ? character) and returns a table.http/read-body function source(read-body req) -Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.Community Exampleshttp/read-request function source(read-request conn buf &opt no-query) +Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.http/read-request function source(read-request conn buf &opt no-query) -Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Exampleshttp/read-response function source(read-response conn buf) +Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`http/read-response function source(read-response conn buf) -Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Exampleshttp/request function source(request method url &keys {:headers headers :body body}) +Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`http/request function source(request method url &keys {:headers headers :body body}) -Make an HTTP request to a server. Returns a table contain response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.Community Exampleshttp/router function source(router routes) +Make an HTTP request to a server. Returns a table contain response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.http/router function source(router routes) -Creates a router middleware. A router will dispatch to different routes based on the URL path.Community Exampleshttp/send-response function source(send-response conn response &opt buf) +Creates a router middleware. A router will dispatch to different routes based on the URL path.http/send-response function source(send-response conn response &opt buf) -Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.Community Exampleshttp/server function source(server handler &opt host port) +Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.http/server function source(server handler &opt host port) -Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.Community Exampleshttp/server-handler function source(server-handler conn handler) +Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.http/server-handler function source(server-handler conn handler) -A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Community Exampleshttp/status-messages struct sourceMapping of HTTP status codes to their status message.Community Exampleshttp/url-grammar core/peg source+A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.Community Examples
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.
httpf/add-bindings-as-routes httpf/add-route httpf/default-payload-wrapper httpf/listen httpf/server
(add-bindings-as-routes server &opt env) -Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.Community Examples
(add-route server path docstring schema handler &opt read-mime render-mime) +Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.
(add-route server path docstring schema handler &opt read-mime render-mime) -Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.Community Examples
(default-payload-wrapper payload) +Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.
(default-payload-wrapper payload) -Add some metadata to all responsesCommunity Examples
(listen server &opt host port n-workers) +Add some metadata to all responses
(listen server &opt host port n-workers) -Start server. Will run on multiple-threads if n-workers > 1.Community Examples
(server &opt parent) +Start server. Will run on multiple-threads if n-workers > 1.
(decode s) Converts a base64 encoded string to its binary representation of any format -(UTF-8, binary, ..).Community Examples
(encode s) -Converts a string of any format (UTF-8, binary, ..) to base64 encoding.Community Examples
(check cron &opt time local) +Converts a string of any format (UTF-8, binary, ..) to base64 encoding.
(check cron &opt time local) -Check if a given time matches a cron specifier.Community Examples
(next-timestamp cron &opt time local) +Check if a given time matches a cron specifier.
(next-timestamp cron &opt time local) -Given a cron schedule, get the next instance on the cron tab after timeCommunity Examples
(parse-cron str) +Given a cron schedule, get the next instance on the cron tab after time
(parse-cron str) -Parse a cron string into a valid cron schedule objectCommunity Examples
(go-nursery nurse f &opt value) +Parse a cron string into a valid cron schedule object
(go-nursery nurse f &opt value) -Spawn a fiber into a nursery, similar to ev/go.Community Examples
(join-nursery nurse) +Spawn a fiber into a nursery, similar to ev/go.
(join-nursery nurse) -Suspend the current fiber until the nursery is emptied.Community Examples
(multithread-service thread-main n-threads) +Suspend the current fiber until the nursery is emptied.
(multithread-service thread-main n-threads) -Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.Community Examples
(nursery) +Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.
(nursery) -Group a number of fibers into a single object for structured concurrencyCommunity Examples
(pcall f n) +Group a number of fibers into a single object for structured concurrency
(pcall f n) -Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.Community Examples
(pdag f dag &opt n-workers) +Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data &opt n-workers) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.
(pmap f data &opt n-workers) -Map `f` over data in parallel, optionally limiting parallelism to `n` workers.Community Examples
(pmap-full f data) +Map `f` over data in parallel, optionally limiting parallelism to `n` workers.
(pmap-full f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.Community Examples
(pmap-limited f data n-workers) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.
(pmap-limited f data n-workers) -Similar to pmap-full, but only runs work n-ways parallel.Community Examples
(spawn-nursery nurse & body) +Similar to pmap-full, but only runs work n-ways parallel.
(spawn-nursery nurse & body) -Similar to ev/spawn but associate spawned fibers with a nurseryCommunity Examples
(format source) +Similar to ev/spawn but associate spawned fibers with a nursery
(format source) -Format a string of source code to a buffer.Community Examples
(format-file file) +Format a string of source code to a buffer.
(format-print source) -Format a string of source code and print the result.Community Examples
(concat & xs) +Format a string of source code and print the result.
(concat & xs) -Concatenate one or more generators or iterables into a single generator.Community Examples
(cycle ds) +Concatenate one or more generators or iterables into a single generator.
(cycle ds) -Repeatedly yield the elements of `ds`, looping back to the beginning when finished.Community Examples
(drop n ds) +Repeatedly yield the elements of `ds`, looping back to the beginning when finished.
(drop-until p ds) -Drop elements from `ds` until `p` is true.Community Examples
(drop-while p ds) +Drop elements from `ds` until `p` is true.
(drop-while p ds) -Drop elements from `ds` while `p` is true.Community Examples
(filter p ds) -Create a generator that filters `ds` with `p`.Community Examples
(from-iterable ds) +Create a generator that filters `ds` with `p`.
(from-iterable ds) -Create a new generator around any iterable data structure.Community Examples
(map f ds) +Create a new generator around any iterable data structure.
(map f ds) -Create a generator that maps `f` over `ds`.Community Examples
(mapcat f ds) -Map `f` over `ds`, concatenating the results into a new generator.Community Examples
(range from to) +Map `f` over `ds`, concatenating the results into a new generator.
(take n ds) -Take `n` elements from iterable `ds`.Community Examples
(take-until p ds) +Take `n` elements from iterable `ds`.
(take-until p ds) -Return elements from `ds` until `p` is true.Community Examples
(take-while p ds) +Return elements from `ds` until `p` is true.
(take-while p ds) -Return elements from `ds` while `p` is true.Community Examples
(to-array s) +Return elements from `ds` while `p` is true.
(to-array s) -Consume `s` into a new array.Community Examples
(default-autocomplete-context buf pos) +Consume `s` into a new array.
(default-autocomplete-context buf pos) -Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.Community Examples
(default-autocomplete-options prefix &) +Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.
(default-autocomplete-options prefix &) -Default handler to get available autocomplete options for a given substring.Community Examples
(default-doc-fetch sym w &) +Default handler to get available autocomplete options for a given substring.
(default-doc-fetch sym w &) -Default handler for Ctrl-G to lookup docstrings in the current environment.Community Examples
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) +Default handler for Ctrl-G to lookup docstrings in the current environment.
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) -Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.Community Examples
(escape x) +Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.
(escape x) -Escape characters in a string for HTMLCommunity Examples
(html data &opt buf) -Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.Community Examples
(raw text) +Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.
(raw text) -Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.Community Examples
Grammar to parse a cookie header to a series of keys and values.Community Examples
(cookies nextmw) +Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.
Grammar to parse a cookie header to a series of keys and values.
(cookies nextmw) -Parses cookies into the table under :cookies keyCommunity Examples
(logger nextmw) -Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.Community Examples
(middleware x) +Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.
(middleware x) -Coerce any type to http middlewareCommunity Examples
Grammar that parses a query string (sans url path and ? character) and returns a table.Community Examples
Grammar that parses a query string (sans url path and ? character) and returns a table.
(read-body req) -Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.Community Examples
(read-request conn buf &opt no-query) +Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.
(read-request conn buf &opt no-query) -Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Examples
(read-response conn buf) +Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`
(read-response conn buf) -Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Examples
(request method url &keys {:headers headers :body body}) +Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`
(request method url &keys {:headers headers :body body}) -Make an HTTP request to a server. Returns a table contain response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.Community Examples
(router routes) +Make an HTTP request to a server. Returns a table contain response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.
(router routes) -Creates a router middleware. A router will dispatch to different routes based on the URL path.Community Examples
(send-response conn response &opt buf) +Creates a router middleware. A router will dispatch to different routes based on the URL path.
(send-response conn response &opt buf) -Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.Community Examples
(server handler &opt host port) +Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.
(server handler &opt host port) -Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.Community Examples
(server-handler conn handler) +Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.
(server-handler conn handler) -A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Community Examples
Mapping of HTTP status codes to their status message.Community Examples
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.Community Examples
(add-bindings-as-routes server &opt env) +A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.
(add-bindings-as-routes server &opt env) -Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.Community Examples
(add-route server path docstring schema handler &opt read-mime render-mime) +Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.
(add-route server path docstring schema handler &opt read-mime render-mime) -Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.Community Examples
(default-payload-wrapper payload) +Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.
(default-payload-wrapper payload) -Add some metadata to all responsesCommunity Examples
(listen server &opt host port n-workers) +Add some metadata to all responses
(listen server &opt host port n-workers) -Start server. Will run on multiple-threads if n-workers > 1.Community Examples
(server &opt parent) +Start server. Will run on multiple-threads if n-workers > 1.
(json/decode json-source &opt keywords nils) +Create a new server.
(json/decode json-source &opt keywords nils) -Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.Community Examples
(json/encode x &opt tab newline buf) +Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.
(json/encode x &opt tab newline buf) -Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.Community Examples
(always x) +Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.
(always x) -Return a function that discards any arguments and always returns `x`.Community Examples
(antepenultimate xs) +Return a function that discards any arguments and always returns `x`.
(antepenultimate xs) -Get the third-to-last element from an indexed data structure.Community Examples
(caperr & body) +Get the third-to-last element from an indexed data structure.
(caperr & body) Captures the standart error output of the variadic `body` and returns it -as a buffer.Community Examples
(capout & body) Captures the standart output of the variadic `body` and returns it as -a buffer.Community Examples
(cond-> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs with condition and operation to which the `val`, is put as first argument. All conditions are tried and for truthy conditions the operation is executed. -Returns the value mutated if any condition is truthy.Community Examples
(cond->> val & clauses) +Returns the value mutated if any condition is truthy.
(cond->> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs of condition and operation to which the `val`, is put as last argument. All conditions are tried and for truthy the operation is ran. -Returns mutated value if any condition is truthy.Community Examples
(dedent & xs) Remove indentation after concatenating the arguments. Works by removing leading whitespace, and then removing that same pattern of whitepsace after -new lines.Community Examples
(defs & bindings) -Defines many constants as in let `bindings`, but without creating new scope.Community Examples
(dfs data visit-leaf &opt node-before node-after get-children seen) +Defines many constants as in let `bindings`, but without creating new scope.
(dfs data visit-leaf &opt node-before node-after get-children seen) Do a depth first, pre-order traversal over a data structure. Also allow for callbacks before and after visiting the children of a node. Also allow for a custom `get-children` function to change traversal as needed. Will detect cycles if an empty table is passed as the `seen` parameter, which is used to cached values -that have been visited.Community Examples
(do-def c d & body) Convenience macro for defining constant named `c` with value `d` before `body` and returning it after evaluating `body`, that presumably modifies -the `c` refered content. For example buffer, table or array.Community Examples
(do-var v d & body) +the `c` refered content. For example buffer, table or array.
(do-var v d & body) Convenience macro for defining varible named `v` with value `d` before `body` -and returning it after evaluating `body`, that presumably modifies `v`.Community Examples
(gett ds & keys) +and returning it after evaluating `body`, that presumably modifies `v`.
(gett ds & keys) -Recursive macro (get). Similar to get-in, but keys are variadic argument.Community Examples
(insert-sorted arr <? & xs) +Recursive macro (get). Similar to get-in, but keys are variadic argument.
(insert-sorted arr <? & xs) Insert elements in `arr` such that it remains sorted by the comparator. If -`arr` is not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(insert-sorted-by arr f & xs) +`arr` is not sorted beforehand, the results are undefined. Returns `arr`.
(insert-sorted-by arr f & xs) Insert elements in `arr` such that it remains sorted by the value returned when `f` is called with the element, comparing the values with <. If `arr` is -not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(int->string int &opt base) +not sorted beforehand, the results are undefined. Returns `arr`.
(int->string int &opt base) -Stringify an integer in a particular base. Defaults to decimal (base 10).Community Examples
(int/ & xs) +Stringify an integer in a particular base. Defaults to decimal (base 10).
(log level & args) Print to a dynamic binding stream if that stream is set, otherwise do nothing. Evaluate to nil. For example, `(log :err "value error: %V" my-value)` will print -to `(dyn :err)` only if `(dyn :err)` has been set.Community Examples
(make prototype & pairs) +to `(dyn :err)` only if `(dyn :err)` has been set.
(make prototype & pairs) Convenience macro for creating new table from even number of kvs pairs in a variadic `table-or-pairs` arguments and setting its prototype to `prototype`. -Factory function for creating new objects from prototypes.Community Examples
(make-id &opt prefix) +Factory function for creating new objects from prototypes.
(make-id &opt prefix) Create a random, printable keyword id with 10 bytes of entropy -with an optional prefix.Community Examples
(map-keys f data) Returns new table with function `f` applied to `data`'s -keys recursively.Community Examples
(map-vals f data) -Returns new table with function `f` applied to `data`'s values.Community Examples
(penultimate xs) +Returns new table with function `f` applied to `data`'s values.
(penultimate xs) -Get the second-to-last element from an indexed data structure.Community Examples
(print-table data &opt columns header-mapping) +Get the second-to-last element from an indexed data structure.
(print-table data &opt columns header-mapping) Iterate through the rows of a data structure and print a table in a human readable way, with padding and heading information. Can optionally provide @@ -343,244 +343,244 @@Community ExamplesSpork
for each row. Lastly, a `header-mapping` dictionary can be provided that changes the printed header names my mapping column keys to the desired header name. If no mapping is found, then the column key will be used as -the header name. Returns nil.
(randomize-array arr &opt rng) +the header name. Returns nil.
(randomize-array arr &opt rng) Randomizes array using the fisher-yates shuffle, takes an optional random -number generator.Community Examples
(second xs) -Get the second element from an indexed data structure.Community Examples
(select-keys data keyz) +Get the second element from an indexed data structure.
(select-keys data keyz) -Returns new table with selected `keyz` from dictionary `data`.Community Examples
(set* tgts exprs) +Returns new table with selected `keyz` from dictionary `data`.
(set* tgts exprs) Parallel `set` function. Takes a list of targets and expressions, evaluates all the expressions, and then assigns them to the targets. Each target can be a variable -or a 2-tuple, just like in the normal `set` special form.Community Examples
(string->int str &opt base) +or a 2-tuple, just like in the normal `set` special form.
(string->int str &opt base) Parse an integer in the given base. Defaults to decimal (base 10). Differs -from scan-number in that this does not recognize floating point notation.Community Examples
(table-filter pred dict) +from scan-number in that this does not recognize floating point notation.
(table-filter pred dict) Filter a key-value structure info a table. Semantics are the same as for built-in `filter`, except that `pred` takes two arguments (key and value.) -Does not consider prototypes.Community Examples
(third xs) -Get the third element from an indexed data structure.Community Examples
(trim-prefix prefix str) +Get the third element from an indexed data structure.
(trim-prefix prefix str) -Trim the specified prefix of a string if it has oneCommunity Examples
(trim-suffix suffix str) +Trim the specified prefix of a string if it has one
(trim-suffix suffix str) -Trim the specified suffix of a string if it has oneCommunity Examples
(until cnd & body) +Trim the specified suffix of a string if it has one
(until cnd & body) Repeat `body` while the `cnd` is false. -Equivalent to (while (not cnd) ;body).Community Examples
(vars & bindings) -Defines many variables as in let `bindings`, but without creating new scope.Community Examples
(make-proto stream &opt pack unpack) +Defines many variables as in let `bindings`, but without creating new scope.
(make-proto stream &opt pack unpack) -Create both a send an recv function from a stream, as with `make-send` and `make-recv`.Community Examples
(make-recv stream &opt unpack) +Create both a send an recv function from a stream, as with `make-send` and `make-recv`.
(make-recv stream &opt unpack) -Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.Community Examples
(make-send stream &opt pack) +Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.
(make-send stream &opt pack) -Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.Community Examples
(client &opt host port name) +Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.
(client &opt host port name) -Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".Community Examples
Default host to run server on and connect to.Community Examples
(server &opt host port env cleanup welcome-msg) +Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".
(server &opt host port env cleanup welcome-msg) -Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.Community Examples
(server-single &opt host port env cleanup welcome-msg) +Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.
(server-single &opt host port env cleanup welcome-msg) -Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.Community Examples
(posix/abspath path) +Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(ext path) -Get the file extension for a path.Community Examples
(posix/join & els) -Join path elements together.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/parts path) -Split a path into its parts.Community Examples
(posix/relpath source target) +Split a path into its parts.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(posix/relpath source target) +Get the relative path between two subpaths.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(win32/abspath path) +Get the relative path between two subpaths.
(win32/abspath path) -Coerce a path to be absolute.Community Examples
(win32/abspath? path) -Check if a path is absolute.Community Examples
(win32/basename path) -Gets the base file name of a path.Community Examples
(win32/dirname path) -Gets the directory name of a path.Community Examples
(ext path) -Get the file extension for a path.Community Examples
(win32/join & els) -Join path elements together.Community Examples
(win32/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(win32/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(win32/parts path) -Split a path into its parts.Community Examples
(win32/relpath source target) +Split a path into its parts.
(win32/relpath source target) -Get the relative path between two subpaths.Community Examples
(rawterm/begin &opt on-winch) +Get the relative path between two subpaths.
(rawterm/begin &opt on-winch) -Begin raw terminal functionality. Return a stream that can be read from to get input.Community Examples
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) +Begin raw terminal functionality. Return a stream that can be read from to get input.
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) -Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.Community Examples
(rawterm/ctrl-z) +Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.
(rawterm/ctrl-z) -A handler that a user can use to handle ctrl-z from input to suspend the current process.Community Examples
(rawterm/end) +A handler that a user can use to handle ctrl-z from input to suspend the current process.
(rawterm/getch &opt into) -Get a byte of input from stdin, without blocking if possible. Returns a buffer.Community Examples
(rawterm/isatty) +Get a byte of input from stdin, without blocking if possible. Returns a buffer.
(rawterm/isatty) -Check if the current stdin is a tty.Community Examples
(rawterm/monowidth bytes &opt start-index end-index) +Check if the current stdin is a tty.
(rawterm/monowidth bytes &opt start-index end-index) -Measure the monospace width of a string.Community Examples
(rawterm/rune-monowidth rune) +Measure the monospace width of a string.
(rawterm/rune-monowidth rune) -Get the monospace width of a rune. Returns either 0, 1, or 2.Community Examples
(rawterm/size) +Get the monospace width of a rune. Returns either 0, 1, or 2.
(rawterm/size) -Get the number of rows and columns visible in the terminal as tuple [rows cols]Community Examples
(rawterm/slice-monowidth bytes columns &opt start-index into) +Get the number of rows and columns visible in the terminal as tuple [rows cols]
(rawterm/slice-monowidth bytes columns &opt start-index into) -Get a byte slice that will fit into a number of columns.Community Examples
(compile pattern) +Get a byte slice that will fit into a number of columns.
(compile pattern) -Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.Community Examples
(find reg text &opt start) +Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.
(find reg text &opt start) -Similar to peg/find, but for regexes.Community Examples
(find-all reg text &opt start) +Similar to peg/find, but for regexes.
(find-all reg text &opt start) -Similar to peg/find-all, but for regexes.Community Examples
(match reg text &opt start) +Similar to peg/find-all, but for regexes.
(match reg text &opt start) -Similar to peg/match, but for regexes.Community Examples
Peg used to generate peg source code from a regular expression string.Community Examples
(replace reg rep text &opt start) +Similar to peg/match, but for regexes.
Peg used to generate peg source code from a regular expression string.
(replace reg rep text &opt start) -Similar to peg/replace, but for regexes.Community Examples
(replace-all reg rep text &opt start) +Similar to peg/replace, but for regexes.
(replace-all reg rep text &opt start) -Similar to peg/replace-all, but for regexes.Community Examples
(source pattern) -Compile a subset of regex to PEG source code.Community Examples
(client &opt host port name) +Compile a subset of regex to PEG source code.
(client &opt host port name) -Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.Community Examples
Default host to run server on and connect to.Community Examples
(server functions &opt host port workers-per-connection) +Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.
(server functions &opt host port workers-per-connection) -Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.Community Examples
(make-predicate schema) +Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.
(make-predicate schema) -Generate a function that can be used to validate a data structure. This is the function form of `predicate`.Community Examples
(make-validator schema) +Generate a function that can be used to validate a data structure. This is the function form of `predicate`.
(make-validator schema) -Generate a function that can be used to validate a data structure. This is the function form of `validator`.Community Examples
(predicate pattern) +Generate a function that can be used to validate a data structure. This is the function form of `validator`.
(predicate pattern) -Make a validation predicate given a certain schema.Community Examples
(validator pattern) +Make a validation predicate given a certain schema.
(validator pattern) -Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.Community Examples
(copy-file src-path dst-path) +Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.
(copy-file src-path dst-path) -Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.Community Examples
(create-dirs dir-path) +Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.
(create-dirs dir-path) -Create all directories in path specified as string including itself.Community Examples
(exec-slurp & args) +Create all directories in path specified as string including itself.
(exec-slurp & args) -Read stdout of subprocess and return it trimmed in a string.Community Examples
(exists? path) +Read stdout of subprocess and return it trimmed in a string.
(exists? path) -Check if the given file or directory exists. (Follows symlinks)Community Examples
(list-all-files dir &opt into) +Check if the given file or directory exists. (Follows symlinks)
(list-all-files dir &opt into) -List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.Community Examples
(make-new-file file-path &opt mode) +List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.
(make-new-file file-path &opt mode) -Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).Community Examples
(rm path) +Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).
(rm path) -Remove a directory and all sub directories recursively.Community Examples
(scan-directory dir func) +Remove a directory and all sub directories recursively.
(scan-directory dir func) -Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.Community Examples
(tarray/buffer array|size) +Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.
(tarray/buffer array|size) -Return typed array buffer or create a new buffer.Community Examples
(tarray/copy-bytes src sindex dst dindex &opt count) +Return typed array buffer or create a new buffer.
(tarray/copy-bytes src sindex dst dindex &opt count) -Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.Community Examples
(tarray/length array|buffer) +Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.
(tarray/length array|buffer) -Return typed array or buffer size.Community Examples
(tarray/new type size &opt stride offset tarray|buffer) +Return typed array or buffer size.
(tarray/new type size &opt stride offset tarray|buffer) -Create new typed array.Community Examples
(tarray/properties array) +Create new typed array.
(tarray/properties array) -Return typed array properties as a struct.Community Examples
(tarray/slice tarr &opt start end) +Return typed array properties as a struct.
(tarray/slice tarr &opt start end) -Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.Community Examples
(tarray/swap-bytes src sindex dst dindex &opt count) +Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.
(tarray/swap-bytes src sindex dst dindex &opt count) -Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.Community Examples
(all-tasks tasker &opt detailed) +Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.
(all-tasks tasker &opt detailed) -Get an array of all task ids for which there is still data on disk. If `detailed` is truthy, return full task metadata instead of ids.Community Examples
(cancel-task tasker task-id) +Get an array of all task ids for which there is still data on disk. If `detailed` is truthy, return full task metadata instead of ids.
(cancel-task tasker task-id) -Cancel a queued or running task.Community Examples
(close-queues tasker) -Prevent any tasks from being added to queues. When an executor finishes it's current job, if there are any, it will terminate. When all executors complete, the call to `run-executors` will complete.Community Examples
Default location of task recordsCommunity Examples
Maximum allowed priority (lower priority tasks will execute first)Community Examples
Minimum allowed priority (lower priority tasks will execute first)Community Examples
(new-tasker &opt task-directory queues queue-size) +Prevent any tasks from being added to queues. When an executor finishes it's current job, if there are any, it will terminate. When all executors complete, the call to `run-executors` will complete.
Maximum allowed priority (lower priority tasks will execute first)
Minimum allowed priority (lower priority tasks will execute first)
(new-tasker &opt task-directory queues queue-size) -Create queues and various settings to run tasks. Create a new tasker table.Community Examples
(queue-task tasker argv &opt note priority qname timeout expiration input) +Create queues and various settings to run tasks. Create a new tasker table.
(queue-task tasker argv &opt note priority qname timeout expiration input) -Add a task specification to a queue. Supply an argv string array that will be used to invoke s a subprocess. The optional `note` parameter is just a textual note for task trackingv. The `priority` parameter should be an integer between 0 and 9 inclusive, default is 4. Lower priority jobs in the same queue will be executed by higher priority. Use input to pass in generic, unstructured input to a task.Community Examples
(run-cleanup tasker) +Add a task specification to a queue. Supply an argv string array that will be used to invoke s a subprocess. The optional `note` parameter is just a textual note for task trackingv. The `priority` parameter should be an integer between 0 and 9 inclusive, default is 4. Lower priority jobs in the same queue will be executed by higher priority. Use input to pass in generic, unstructured input to a task.
(run-cleanup tasker) -Delete old expired jobs saved on diskCommunity Examples
(run-executors tasker &opt workers-per-queue pre-task post-task) +Delete old expired jobs saved on disk
(run-executors tasker &opt workers-per-queue pre-task post-task) -Start a number of executors to run tasks as with `tasker/spawn-executors`, and then wait for all executors to complete.Community Examples
(spawn-executors tasker &opt qnames workers-per-queue pre-task post-task) +Start a number of executors to run tasks as with `tasker/spawn-executors`, and then wait for all executors to complete.
(spawn-executors tasker &opt qnames workers-per-queue pre-task post-task) -Start a number of executors to run tasks. Tasks can be added to a queue by calling queue-task. A single tasker object can make multiple calls to spawn-executors.Community Examples
A tuple of all possible statuses that a task can have.Community Examples
(task-file tasker task-id &opt file-name) +Start a number of executors to run tasks. Tasks can be added to a queue by calling queue-task. A single tasker object can make multiple calls to spawn-executors.
(task-file tasker task-id &opt file-name) -Get a log file for a path. By default, will get a path to out.log.Community Examples
(task-status tasker task-id) +Get a log file for a path. By default, will get a path to out.log.
(task-status tasker task-id) -Look up the status of a given task by id.Community Examples
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(compile str) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(compile str) Compile a Temple template into a function which will return a rendered buffer. The resulting function should receive the template arguments in the -&keys format.Community Examples
(create source &opt where) -Compile a template string into a function. Optionally provide a location where the source is from to improve debugging. Returns the template function.Community Examples
(assert x &opt e) +Compile a template string into a function. Optionally provide a location where the source is from to improve debugging. Returns the template function.
(assert x &opt e) -Override's the default assert with some nice error handling.Community Examples
(assert-docs path) +Override's the default assert with some nice error handling.
(assert-docs path) Assert that all symbols, when module on the path is required, -have proper doc stringCommunity Examples
(assert-error msg & forms) -Test passes if forms error.Community Examples
(assert-no-error msg & forms) -Test passes if forms do not error.Community Examples
(capture-stderr & body) Runs the form and captures stderr. Returns tuple with result of the form -and a string with captured stderr.Community Examples
(capture-stdout & body) Runs the form and captures stdout. Returns tuple with result of the form -and a string with captured stdout.Community Examples
(start-suite &opt name) -Starts test suite.Community Examples
(suppress-stderr & body) -Suppreses stdout from the bodyCommunity Examples
(suppress-stdout & body) -Suppreses stdout from the bodyCommunity Examples
(timeit form &opt tag) Time the execution of `form` using `os/clock` before and after, and print the result to stdout. returns: result of executing `form`. -Uses `tag` (default "Elapsed time:") to tag the printout.Community Examples
(utf8/decode-rune buf &opt start) +Uses `tag` (default "Elapsed time:") to tag the printout.
(utf8/decode-rune buf &opt start) -Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].Community Examples
(utf8/encode-rune rune &opt buf) +Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].
(utf8/encode-rune rune &opt buf) -Encode a Unicode codepoint into the end of a buffer.Community Examples
(utf8/prefix->width c) +Encode a Unicode codepoint into the end of a buffer.
(utf8/prefix->width c) -Given the first byte in an UTF-8 sequence, get the number of bytes that the codepoint sequence takes up, including the prefix byte.Community Examples
(json/decode json-source &opt keywords nils) -Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.Community Examples
(json/encode x &opt tab newline buf) +Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.
(json/encode x &opt tab newline buf) -Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.Community Examples
math/add math/add-to-mean math/approx-eq math/bernoulli-distribution math/binominal-coeficient math/binominal-distribution math/check-propability math/chi-squared-distribution-table math/cols math/cumulative-std-normal-probability math/det math/dot math/epsilon math/extent math/factorial math/geometric-mean math/get-only-el math/harmonic-mean math/ident math/interquartile-range math/linear-regression math/linear-regression-line math/median math/median-absolute-deviation math/minor math/mode math/mop math/mul math/perm math/permutation-test math/permutations math/poisson-distribution math/quantile math/quantile-rank math/quantile-rank-sorted math/quantile-sorted math/quickselect math/relative-err math/root-mean-square math/rows math/sample-correlation math/sample-covariance math/sample-skewness math/sample-standard-deviation math/sample-variance math/scalar math/shuffle-in-place math/size math/sop math/standard-deviation math/standard-normal-table math/sum-compensated math/sum-nth-power-deviations math/swap math/t-test math/t-test-2 math/trans math/variance math/z-score math/zero
(add m a) Add `a` to matrix `m` where it can be matrix or scalar. -Matrix `m` is mutated.Community Examples
(add-to-mean m n v) -Adds new value `v` to mean `m` from `n` values.Community Examples
(approx-eq a e &opt t) +Adds new value `v` to mean `m` from `n` values.
(approx-eq a e &opt t) Approximate equality between actual number `a` and expected number `e`. Default tolerance `t` -is `epsilon`.Community Examples
(bernoulli-distribution p) -Creates Bernoulli distribution from popability `p` in the tuple.Community Examples
(binominal-coeficient n k) +Creates Bernoulli distribution from popability `p` in the tuple.
(binominal-coeficient n k) Computes binominal coeficient from set of size `n` -and sample size `k`.Community Examples
(binominal-distribution t p) Creates binominal distribution from trials `t` -and propability `p` in the tuple.Community Examples
(check-propability p) -Asserts that probability in in the [0 1] range.Community Examples
(cumulative-std-normal-probability z) +Returns numbers of columns of matrix `m`.
(cumulative-std-normal-probability z) -Computes standard normal probability for `y`.Community Examples
(dot mx my) -Computes dot product of matrices or vectors `x` and `y`.Community Examples
(extent xs) -Returns the minimum & maximum number in an `xs` as tuple.Community Examples
(factorial n) +Returns the minimum & maximum number in an `xs` as tuple.
(geometric-mean xs) -Gets the geometric mean from `xs`.Community Examples
(get-only-el m) Convenience macro for geting first element -from first row of the two dimensional array `m`.Community Examples
(harmonic-mean xs) +from first row of the two dimensional array `m`.
(harmonic-mean xs) -Gets the harmonic mean from `xs`.Community Examples
(ident c) -Creates identity matrix with `c` x `c` size.Community Examples
(interquartile-range xs) +Creates identity matrix with `c` x `c` size.
(interquartile-range xs) -Gets the interquartile range from `xs`.Community Examples
(linear-regression coords) +Gets the interquartile range from `xs`.
(linear-regression coords) Computes the slope `:m` and y-intercept `:b` -of the function in the struct from set of coordinates.Community Examples
(linear-regression-line {:m m :b b}) +of the function in the struct from set of coordinates.
(linear-regression-line {:m m :b b}) -Constructs function from struct returned by linear regression.Community Examples
(median xs) +Constructs function from struct returned by linear regression.
(median-absolute-deviation xs) +Gets the median value from `xs`
(median-absolute-deviation xs) -Gets median absolute deviation from `xs`.Community Examples
(minor m x y) -Computes minor matrix of matrix `m` and `x`, `y`.Community Examples
(mop m op a) Mutates every cell of the matrix `m` with `op` -and corresponding cell from matrix arg `a`.Community Examples
(mul m a) Multiply matrix `m` with `a` which can be matrix or vector. -Matrix `m` is mutated.Community Examples
(permutation-test xs ys &opt a k) +Computes permanent of the matrix `m`.
(permutation-test xs ys &opt a k) Conducts a permutation test to determine if two data sets `xs` and `ys` are *significantly* different from each other. You can use alternative hypotesis `a`, which defaults to `:two-side`, with `:greater` and `:lesser` being the other two options. The last optional argument is `k` number of values -in permutation distributionCommunity Examples
(permutations s &opt k) -Returns permutations of length `k` from members of `s`Community Examples
(poisson-distribution lambda) +Returns permutations of length `k` from members of `s`
(poisson-distribution lambda) -Creates Poisson distribution from `lambda` in tuple.Community Examples
(quantile xs p) -Gets the quantile value from `xs` at `p` from unsorted population.Community Examples
(quantile-rank xs p) +Gets the quantile value from `xs` at `p` from unsorted population.
(quantile-rank xs p) -Gets the quantile rank of value `v` from unsorted `xs`.Community Examples
(quantile-rank-sorted xs v) +Gets the quantile rank of value `v` from unsorted `xs`.
(quantile-rank-sorted xs v) -Gets the quantile rank of value `v` from sorted `xs`.Community Examples
(quantile-sorted xs p) +Gets the quantile rank of value `v` from sorted `xs`.
(quantile-sorted xs p) -Gets the quantile value from `xs` at `p` from sorted population.Community Examples
(quickselect arr k &opt left right) +Gets the quantile value from `xs` at `p` from sorted population.
(quickselect arr k &opt left right) Rearrange items in `arr` so that all items in `[left, k]` range are the smallest. The `k`-th element will have the `(k - left + 1)`-th smallest value in `[left, right]`. -Mutates `arr`.Community Examples
(relative-err a e) Gets the relative err between actual number `a` -and expected number `e`.Community Examples
(root-mean-square xs) -Gets the root mean square from `xs`.Community Examples
(sample-correlation xs ys) +Returns numbers of rows of matrix `m`.
(sample-correlation xs ys) -Gets the sample correlation between `xs` and `ys`.Community Examples
(sample-covariance xs ys) +Gets the sample correlation between `xs` and `ys`.
(sample-covariance xs ys) -Gets the sample covariance between `xs` and `ys`.Community Examples
(sample-skewness xs) +Gets the sample covariance between `xs` and `ys`.
(sample-skewness xs) -Gets the sample skeweness from the `xs`.Community Examples
(sample-standard-deviation xs) +Gets the sample skeweness from the `xs`.
(sample-standard-deviation xs) -Gets sample standard deviation from `xs`.Community Examples
(sample-variance xs) +Gets sample standard deviation from `xs`.
(sample-variance xs) -Get the sample variance from `xs`.Community Examples
(scalar c s) -Creates scalar `s` matrix with `c` x `c` size.Community Examples
(shuffle-in-place xs) +Creates scalar `s` matrix with `c` x `c` size.
(shuffle-in-place xs) Generate random permutation of the array `xs` -which is shuffled in place.Community Examples
(size m) -Returns tuple with the matrix `m` size [rows cols].Community Examples
(sop m op & a) Mutates every cell of the matrix `m` with `op` -and variadic args `a`.Community Examples
(standard-deviation xs) -Gets the standard deviation from `ds`.Community Examples
(sum-compensated xs) -Returns sum of the members of `xs` with Kahan-Babushka algorithm.Community Examples
(sum-nth-power-deviations xs n) +Returns sum of the members of `xs` with Kahan-Babushka algorithm.
(sum-nth-power-deviations xs n) -Get the sum of deviations to the n power.Community Examples
(swap arr i j) Swaps members with indices `i` and `j` of arr. -Noop when `i` equals `j`.Community Examples
(t-test xs expv) Computes one sample t-test comparing the mean of `xs` -to known value `expv`.Community Examples
(t-test-2 xs ys &opt d) Computes two sample t-test of two samples `xs` and `ys` -with difference optional `d` which defaults to 0.Community Examples
(z-score x m d) Gets the standard score for number `x` from mean `m` -and standard deviation `d`.Community Examples
(zero c &opt r) Creates vector of length `c`, or matrix if `r` -is provided, and fills it with zeros.Community Examples
misc/always misc/antepenultimate misc/caperr misc/capout misc/cond-> misc/cond->> misc/dedent misc/defs misc/dfs misc/do-def misc/do-var misc/gett misc/insert-sorted misc/insert-sorted-by misc/int->string misc/int/ misc/log misc/make misc/make-id misc/map-keys misc/map-vals misc/penultimate misc/print-table misc/randomize-array misc/second misc/select-keys misc/set* misc/string->int misc/table-filter misc/third misc/trim-prefix misc/trim-suffix misc/until misc/vars
(always x) -Return a function that discards any arguments and always returns `x`.Community Examples
(antepenultimate xs) +Return a function that discards any arguments and always returns `x`.
(antepenultimate xs) -Get the third-to-last element from an indexed data structure.Community Examples
(caperr & body) +Get the third-to-last element from an indexed data structure.
(caperr & body) Captures the standart error output of the variadic `body` and returns it -as a buffer.Community Examples
(capout & body) Captures the standart output of the variadic `body` and returns it as -a buffer.Community Examples
(cond-> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs with condition and operation to which the `val`, is put as first argument. All conditions are tried and for truthy conditions the operation is executed. -Returns the value mutated if any condition is truthy.Community Examples
(cond->> val & clauses) +Returns the value mutated if any condition is truthy.
(cond->> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs of condition and operation to which the `val`, is put as last argument. All conditions are tried and for truthy the operation is ran. -Returns mutated value if any condition is truthy.Community Examples
(dedent & xs) Remove indentation after concatenating the arguments. Works by removing leading whitespace, and then removing that same pattern of whitepsace after -new lines.Community Examples
(defs & bindings) -Defines many constants as in let `bindings`, but without creating new scope.Community Examples
(dfs data visit-leaf &opt node-before node-after get-children seen) +Defines many constants as in let `bindings`, but without creating new scope.
(dfs data visit-leaf &opt node-before node-after get-children seen) Do a depth first, pre-order traversal over a data structure. Also allow for callbacks before and after visiting the children of a node. Also allow for a custom `get-children` function to change traversal as needed. Will detect cycles if an empty table is passed as the `seen` parameter, which is used to cached values -that have been visited.Community Examples
(do-def c d & body) Convenience macro for defining constant named `c` with value `d` before `body` and returning it after evaluating `body`, that presumably modifies -the `c` refered content. For example buffer, table or array.Community Examples
(do-var v d & body) +the `c` refered content. For example buffer, table or array.
(do-var v d & body) Convenience macro for defining varible named `v` with value `d` before `body` -and returning it after evaluating `body`, that presumably modifies `v`.Community Examples
(gett ds & keys) +and returning it after evaluating `body`, that presumably modifies `v`.
(gett ds & keys) -Recursive macro (get). Similar to get-in, but keys are variadic argument.Community Examples
(insert-sorted arr <? & xs) +Recursive macro (get). Similar to get-in, but keys are variadic argument.
(insert-sorted arr <? & xs) Insert elements in `arr` such that it remains sorted by the comparator. If -`arr` is not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(insert-sorted-by arr f & xs) +`arr` is not sorted beforehand, the results are undefined. Returns `arr`.
(insert-sorted-by arr f & xs) Insert elements in `arr` such that it remains sorted by the value returned when `f` is called with the element, comparing the values with <. If `arr` is -not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(int->string int &opt base) +not sorted beforehand, the results are undefined. Returns `arr`.
(int->string int &opt base) -Stringify an integer in a particular base. Defaults to decimal (base 10).Community Examples
(int/ & xs) +Stringify an integer in a particular base. Defaults to decimal (base 10).
(log level & args) Print to a dynamic binding stream if that stream is set, otherwise do nothing. Evaluate to nil. For example, `(log :err "value error: %V" my-value)` will print -to `(dyn :err)` only if `(dyn :err)` has been set.Community Examples
(make prototype & pairs) Convenience macro for creating new table from even number of kvs pairs in a variadic `table-or-pairs` arguments and setting its prototype to `prototype`. -Factory function for creating new objects from prototypes.Community Examples
(make-id &opt prefix) +Factory function for creating new objects from prototypes.
(make-id &opt prefix) Create a random, printable keyword id with 10 bytes of entropy -with an optional prefix.Community Examples
(map-keys f data) Returns new table with function `f` applied to `data`'s -keys recursively.Community Examples
(map-vals f data) -Returns new table with function `f` applied to `data`'s values.Community Examples
(penultimate xs) +Returns new table with function `f` applied to `data`'s values.
(penultimate xs) -Get the second-to-last element from an indexed data structure.Community Examples
(print-table data &opt columns header-mapping) +Get the second-to-last element from an indexed data structure.
(print-table data &opt columns header-mapping) Iterate through the rows of a data structure and print a table in a human readable way, with padding and heading information. Can optionally provide @@ -189,37 +189,37 @@Community ExamplesIndex for each row. Lastly, a `header-mapping` dictionary can be provided that changes the printed header names my mapping column keys to the desired header name. If no mapping is found, then the column key will be used as -the header name. Returns nil.
(randomize-array arr &opt rng) Randomizes array using the fisher-yates shuffle, takes an optional random -number generator.Community Examples
(second xs) -Get the second element from an indexed data structure.Community Examples
(select-keys data keyz) +Get the second element from an indexed data structure.
(select-keys data keyz) -Returns new table with selected `keyz` from dictionary `data`.Community Examples
(set* tgts exprs) +Returns new table with selected `keyz` from dictionary `data`.
(set* tgts exprs) Parallel `set` function. Takes a list of targets and expressions, evaluates all the expressions, and then assigns them to the targets. Each target can be a variable -or a 2-tuple, just like in the normal `set` special form.Community Examples
(string->int str &opt base) +or a 2-tuple, just like in the normal `set` special form.
(string->int str &opt base) Parse an integer in the given base. Defaults to decimal (base 10). Differs -from scan-number in that this does not recognize floating point notation.Community Examples
(table-filter pred dict) +from scan-number in that this does not recognize floating point notation.
(table-filter pred dict) Filter a key-value structure info a table. Semantics are the same as for built-in `filter`, except that `pred` takes two arguments (key and value.) -Does not consider prototypes.Community Examples
(third xs) -Get the third element from an indexed data structure.Community Examples
(trim-prefix prefix str) +Get the third element from an indexed data structure.
(trim-prefix prefix str) -Trim the specified prefix of a string if it has oneCommunity Examples
(trim-suffix suffix str) +Trim the specified prefix of a string if it has one
(trim-suffix suffix str) -Trim the specified suffix of a string if it has oneCommunity Examples
(until cnd & body) Repeat `body` while the `cnd` is false. -Equivalent to (while (not cnd) ;body).Community Examples
(vars & bindings) -Defines many variables as in let `bindings`, but without creating new scope.Community Examples
msg/make-proto msg/make-recv msg/make-send
(make-proto stream &opt pack unpack) -Create both a send an recv function from a stream, as with `make-send` and `make-recv`.Community Examples
(make-recv stream &opt unpack) +Create both a send an recv function from a stream, as with `make-send` and `make-recv`.
(make-recv stream &opt unpack) -Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.Community Examples
(make-send stream &opt pack) +Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.
(make-send stream &opt pack) -Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.Community Examples
netrepl/client netrepl/default-host netrepl/default-port netrepl/server netrepl/server-single
(client &opt host port name) -Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".Community Examples
(server &opt host port env cleanup welcome-msg) +Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".
(server &opt host port env cleanup welcome-msg) -Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.Community Examples
(server-single &opt host port env cleanup welcome-msg) +Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.
(server-single &opt host port env cleanup welcome-msg) -Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.Community Examples
path/abspath path/abspath? path/basename path/delim path/dirname path/ext path/join path/normalize path/parts path/posix/abspath path/posix/abspath? path/posix/basename path/posix/delim path/posix/dirname path/posix/ext path/posix/join path/posix/normalize path/posix/parts path/posix/relpath path/posix/sep path/relpath path/sep path/win32/abspath path/win32/abspath? path/win32/basename path/win32/delim path/win32/dirname path/win32/ext path/win32/join path/win32/normalize path/win32/parts path/win32/relpath path/win32/sep
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(posix/relpath source target) +Get the relative path between two subpaths.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(win32/abspath path) +Get the relative path between two subpaths.
(win32/abspath path) -Coerce a path to be absolute.Community Examples
(win32/abspath? path) -Check if a path is absolute.Community Examples
(win32/basename path) -Gets the base file name of a path.Community Examples
(win32/dirname path) -Gets the directory name of a path.Community Examples
(win32/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(win32/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(win32/relpath source target) -Get the relative path between two subpaths.Community Examples
rawterm/begin rawterm/buffer-traverse rawterm/ctrl-z rawterm/end rawterm/getch rawterm/isatty rawterm/monowidth rawterm/rune-monowidth rawterm/size rawterm/slice-monowidth
(rawterm/begin &opt on-winch) -Begin raw terminal functionality. Return a stream that can be read from to get input.Community Examples
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) +Begin raw terminal functionality. Return a stream that can be read from to get input.
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) -Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.Community Examples
(rawterm/ctrl-z) +Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.
(rawterm/ctrl-z) -A handler that a user can use to handle ctrl-z from input to suspend the current process.Community Examples
(rawterm/end) +A handler that a user can use to handle ctrl-z from input to suspend the current process.
(rawterm/getch &opt into) -Get a byte of input from stdin, without blocking if possible. Returns a buffer.Community Examples
(rawterm/isatty) +Get a byte of input from stdin, without blocking if possible. Returns a buffer.
(rawterm/isatty) -Check if the current stdin is a tty.Community Examples
(rawterm/monowidth bytes &opt start-index end-index) +Check if the current stdin is a tty.
(rawterm/monowidth bytes &opt start-index end-index) -Measure the monospace width of a string.Community Examples
(rawterm/rune-monowidth rune) +Measure the monospace width of a string.
(rawterm/rune-monowidth rune) -Get the monospace width of a rune. Returns either 0, 1, or 2.Community Examples
(rawterm/size) +Get the monospace width of a rune. Returns either 0, 1, or 2.
(rawterm/size) -Get the number of rows and columns visible in the terminal as tuple [rows cols]Community Examples
(rawterm/slice-monowidth bytes columns &opt start-index into) +Get the number of rows and columns visible in the terminal as tuple [rows cols]
(rawterm/slice-monowidth bytes columns &opt start-index into) -Get a byte slice that will fit into a number of columns.Community Examples
regex/compile regex/find regex/find-all regex/match regex/peg regex/replace regex/replace-all regex/source
(compile pattern) -Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.Community Examples
(find reg text &opt start) +Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.
(find reg text &opt start) -Similar to peg/find, but for regexes.Community Examples
(find-all reg text &opt start) +Similar to peg/find, but for regexes.
(find-all reg text &opt start) -Similar to peg/find-all, but for regexes.Community Examples
(match reg text &opt start) -Similar to peg/match, but for regexes.Community Examples
Peg used to generate peg source code from a regular expression string.Community Examples
(replace reg rep text &opt start) +Similar to peg/match, but for regexes.
(replace reg rep text &opt start) -Similar to peg/replace, but for regexes.Community Examples
(replace-all reg rep text &opt start) +Similar to peg/replace, but for regexes.
(replace-all reg rep text &opt start) -Similar to peg/replace-all, but for regexes.Community Examples
(source pattern) -Compile a subset of regex to PEG source code.Community Examples
rpc/client rpc/default-host rpc/default-port rpc/server
(client &opt host port name) -Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.Community Examples
(server functions &opt host port workers-per-connection) +Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.
(server functions &opt host port workers-per-connection) -Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.Community Examples
schema/make-predicate schema/make-validator schema/predicate schema/validator
(make-predicate schema) -Generate a function that can be used to validate a data structure. This is the function form of `predicate`.Community Examples
(make-validator schema) +Generate a function that can be used to validate a data structure. This is the function form of `predicate`.
(make-validator schema) -Generate a function that can be used to validate a data structure. This is the function form of `validator`.Community Examples
(predicate pattern) +Generate a function that can be used to validate a data structure. This is the function form of `validator`.
(predicate pattern) -Make a validation predicate given a certain schema.Community Examples
(validator pattern) +Make a validation predicate given a certain schema.
(validator pattern) -Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.Community Examples
tarray/buffer tarray/copy-bytes tarray/length tarray/new tarray/properties tarray/slice tarray/swap-bytes
(tarray/buffer array|size) -Return typed array buffer or create a new buffer.Community Examples
(tarray/copy-bytes src sindex dst dindex &opt count) +Return typed array buffer or create a new buffer.
(tarray/copy-bytes src sindex dst dindex &opt count) -Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.Community Examples
(tarray/length array|buffer) +Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.
(tarray/length array|buffer) -Return typed array or buffer size.Community Examples
(tarray/new type size &opt stride offset tarray|buffer) +Return typed array or buffer size.
(tarray/new type size &opt stride offset tarray|buffer) -Create new typed array.Community Examples
(tarray/properties array) +Create new typed array.
(tarray/properties array) -Return typed array properties as a struct.Community Examples
(tarray/slice tarr &opt start end) +Return typed array properties as a struct.
(tarray/slice tarr &opt start end) -Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.Community Examples
(tarray/swap-bytes src sindex dst dindex &opt count) +Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.
(tarray/swap-bytes src sindex dst dindex &opt count) -Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.Community Examples
test/assert test/assert-docs test/assert-error test/assert-no-error test/assert-not test/capture-stderr test/capture-stdout test/end-suite test/start-suite test/suppress-stderr test/suppress-stdout test/timeit
(assert x &opt e) -Override's the default assert with some nice error handling.Community Examples
(assert-docs path) +Override's the default assert with some nice error handling.
(assert-docs path) Assert that all symbols, when module on the path is required, -have proper doc stringCommunity Examples
(assert-error msg & forms) -Test passes if forms error.Community Examples
(assert-no-error msg & forms) -Test passes if forms do not error.Community Examples
(capture-stderr & body) Runs the form and captures stderr. Returns tuple with result of the form -and a string with captured stderr.Community Examples
(capture-stdout & body) Runs the form and captures stdout. Returns tuple with result of the form -and a string with captured stdout.Community Examples
(suppress-stderr & body) -Suppreses stdout from the bodyCommunity Examples
(suppress-stdout & body) -Suppreses stdout from the bodyCommunity Examples
(timeit form &opt tag) Time the execution of `form` using `os/clock` before and after, and print the result to stdout. returns: result of executing `form`. -Uses `tag` (default "Elapsed time:") to tag the printout.Community Examples
cc/archive-c cc/compile-c cc/create-buffer-c cc/create-buffer-c-impl cc/create-executable cc/embed-name cc/entry-name cc/entry-replace cc/link-c cc/make-bin-source cc/make-define cc/make-defines cc/modpath-to-meta cc/modpath-to-static cc/out-path
(archive-c opts target & objects) -Link object files together to make a static library.Community Examples
(compile-c compiler opts src dest &opt static?) +Link object files together to make a static library.
(compile-c compiler opts src dest &opt static?) -Compile a C file into an object file.Community Examples
(create-buffer-c source dest name) +Compile a C file into an object file.
(create-buffer-c source dest name) -Inline raw byte file as a c file.Community Examples
(create-buffer-c-impl bytes dest name) +Inline raw byte file as a c file.
(create-executable opts source dest no-core) -Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.Community Examples
(embed-name path) +Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.
(embed-name path) -Rename a janet symbol for embedding.Community Examples
(entry-name name) -Name of symbol that enters static compilation of a module.Community Examples
(entry-replace name) +Name of symbol that enters static compilation of a module.
(entry-replace name) -Escape special characters in the entry-nameCommunity Examples
(link-c has-cpp opts target & objects) +Escape special characters in the entry-name
(link-c has-cpp opts target & objects) -Link C or C++ object files together to make a native module.Community Examples
(make-bin-source declarations lookup-into-invocations no-core) +Link C or C++ object files together to make a native module.
(make-bin-source declarations lookup-into-invocations no-core) -Community Examples
(make-define define value) -Generate strings for adding custom defines to the compiler.Community Examples
(make-defines defines) +Generate strings for adding custom defines to the compiler.
(make-defines defines) -Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.Community Examples
(modpath-to-meta path) +Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.
(modpath-to-meta path) -Get the meta file path (.meta.janet) corresponding to a native module path (.so).Community Examples
(modpath-to-static path) +Get the meta file path (.meta.janet) corresponding to a native module path (.so).
(modpath-to-static path) -Get the static library (.a) path corresponding to a native module path (.so).Community Examples
(out-path path from-ext to-ext) +Get the static library (.a) path corresponding to a native module path (.so).
(out-path path from-ext to-ext) -Take a source file path and convert it to an output path.Community Examples
cgen/add-loader cgen/ir cgen/mangle cgen/print-ir
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(ir & body) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(ir & body) -Macro that automatically quotes the body provided and calls (print-ir ...) on the body.Community Examples
(mangle token) +Macro that automatically quotes the body provided and calls (print-ir ...) on the body.
(mangle token) -Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.Community Examples
(print-ir ir) +Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.
(print-ir ir) -Compile the CGEN IR to C and print it to (dyn :out).Community Examples
cli/jpm cli/main cli/run cli/setup
(jpm & argv) -A Macro User Interface for jpm to be used from a repl in a way similar to the command line.Community Examples
(main & argv) +A Macro User Interface for jpm to be used from a repl in a way similar to the command line.
(setup args) Load configuration from the command line, environment variables, and configuration files. Returns array of non-configuration arguments as well. @@ -124,7 +124,7 @@Community ExamplesIndex 1. Commmand line settings 2. The value of `(dyn :jpm-config)` 3. Environment variables - 4. Config file settings (default-config if non specified)
commands/build commands/clean commands/configure commands/deps commands/enable-local-mode commands/help commands/install commands/jpm-debug-repl commands/list-installed commands/list-pkgs commands/list-rules commands/new-c-project commands/new-project commands/quickbin commands/set-tree commands/show-paths commands/show-rule-tree commands/test commands/update-pkgs
(configure &opt path) -Setup an out-of-tree build with certain configuration options.Community Examples
(deps) +Setup an out-of-tree build with certain configuration options.
(enable-local-mode) -Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/Community Examples
(help) +Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/
(new-c-project name) -Create a new C projectCommunity Examples
(set-tree tree) -Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.Community Examples
(show-paths) +Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.
config/builtin-configs config/config-checkers config/config-docs config/config-options config/config-parsers config/config-set config/defconf config/dyn:ar config/dyn:auto-shebang config/dyn:binpath config/dyn:build-type config/dyn:buildpath config/dyn:c++ config/dyn:c++-link config/dyn:cc config/dyn:cc-link config/dyn:cflags config/dyn:cflags-verbose config/dyn:config-file config/dyn:cppflags config/dyn:curlpath config/dyn:dest-dir config/dyn:dynamic-cflags config/dyn:dynamic-lflags config/dyn:gitpath config/dyn:headerpath config/dyn:is-msvc config/dyn:janet config/dyn:janet-cflags config/dyn:janet-lflags config/dyn:ldflags config/dyn:lflags config/dyn:libpath config/dyn:local config/dyn:manpath config/dyn:modext config/dyn:modpath config/dyn:nocolor config/dyn:offline config/dyn:optimize config/dyn:pkglist config/dyn:silent config/dyn:statext config/dyn:tarpath config/dyn:test config/dyn:tree config/dyn:update-pkgs config/dyn:use-batch-shell config/dyn:verbose config/dyn:workers config/load-config config/load-config-file config/load-default config/load-options config/opt config/read-env-variables config/save-config config/shorthand-mapping
Table of all built-in options, as opposed to project deifned options.Community Examples
A table of all of the dynamic config bindings to checkers (validators).Community Examples
Table of all of the help text for each config option.Community Examples
A table of possible options for enum option types.Community Examples
A table of all of the dynamic config bindings to parsers.Community Examples
(defconf kw &opt parser docs options) +config/builtin-configs config/config-checkers config/config-docs config/config-options config/config-parsers config/config-set config/defconf config/dyn:ar config/dyn:auto-shebang config/dyn:binpath config/dyn:build-type config/dyn:buildpath config/dyn:c++ config/dyn:c++-link config/dyn:cc config/dyn:cc-link config/dyn:cflags config/dyn:cflags-verbose config/dyn:config-file config/dyn:cppflags config/dyn:curlpath config/dyn:dest-dir config/dyn:dynamic-cflags config/dyn:dynamic-lflags config/dyn:gitpath config/dyn:headerpath config/dyn:is-msvc config/dyn:janet config/dyn:janet-cflags config/dyn:janet-lflags config/dyn:ldflags config/dyn:lflags config/dyn:libpath config/dyn:local config/dyn:manpath config/dyn:modext config/dyn:modpath config/dyn:nocolor config/dyn:offline config/dyn:optimize config/dyn:pkglist config/dyn:silent config/dyn:statext config/dyn:tarpath config/dyn:test config/dyn:tree config/dyn:update-pkgs config/dyn:use-batch-shell config/dyn:verbose config/dyn:workers config/load-config config/load-config-file config/load-default config/load-options config/opt config/read-env-variables config/save-config config/shorthand-mapping
config/builtin-configs table sourceTable of all built-in options, as opposed to project deifned options.config/config-checkers table sourceA table of all of the dynamic config bindings to checkers (validators).config/defconf macro source(defconf kw &opt parser docs options) -Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.Community Examplesconfig/dyn:ar function source(dyn:ar &opt dflt) +Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.config/load-config function source(load-config settings &opt override) -Load a configuration from a table or struct.Community Examplesconfig/load-config-file function source(load-config-file path &opt override) +Load a configuration from a table or struct.config/load-config-file function source(load-config-file path &opt override) -Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.Community Examplesconfig/load-default function source(load-default &opt override) +Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.config/load-default function source(load-default &opt override) -Load the default configuration.Community Examplesconfig/load-options function source(load-options &opt path) -Load a file that contains config options that can be set. If no such file exists, then do nothing.Community Examplesconfig/opt function source(opt opts key &opt dflt) +Load a file that contains config options that can be set. If no such file exists, then do nothing.config/opt function source(opt opts key &opt dflt) -Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.Community Examplesconfig/read-env-variables function source(read-env-variables) +Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.config/read-env-variables function source(read-env-variables) -Read environment variables that correspond to config variables into dyns.Community Examplesconfig/save-config function source(save-config path) +Read environment variables that correspond to config variables into dyns.config/save-config function source(save-config path) -Write the current configuration information to a file.Community Examplesconfig/shorthand-mapping struct source+Write the current configuration information to a file.Map some single characters to long options.Community Examples
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.
(pmap f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.Community Examples
jpm/cc/archive-c jpm/cc/compile-c jpm/cc/create-buffer-c jpm/cc/create-buffer-c-impl jpm/cc/create-executable jpm/cc/embed-name jpm/cc/entry-name jpm/cc/entry-replace jpm/cc/link-c jpm/cc/make-bin-source jpm/cc/make-define jpm/cc/make-defines jpm/cc/modpath-to-meta jpm/cc/modpath-to-static jpm/cc/out-path jpm/cgen/add-loader jpm/cgen/ir jpm/cgen/mangle jpm/cgen/print-ir jpm/commands/build jpm/commands/clean jpm/commands/configure jpm/commands/deps jpm/commands/enable-local-mode jpm/commands/help jpm/commands/install jpm/commands/jpm-debug-repl jpm/commands/list-installed jpm/commands/list-pkgs jpm/commands/list-rules jpm/commands/new-c-project jpm/commands/new-project jpm/commands/quickbin jpm/commands/set-tree jpm/commands/show-paths jpm/commands/show-rule-tree jpm/commands/test jpm/commands/update-pkgs jpm/config/builtin-configs jpm/config/config-checkers jpm/config/config-docs jpm/config/config-options jpm/config/config-parsers jpm/config/config-set jpm/config/defconf jpm/config/dyn:ar jpm/config/dyn:auto-shebang jpm/config/dyn:binpath jpm/config/dyn:build-type jpm/config/dyn:buildpath jpm/config/dyn:c++ jpm/config/dyn:c++-link jpm/config/dyn:cc jpm/config/dyn:cc-link jpm/config/dyn:cflags jpm/config/dyn:cflags-verbose jpm/config/dyn:config-file jpm/config/dyn:cppflags jpm/config/dyn:curlpath jpm/config/dyn:dest-dir jpm/config/dyn:dynamic-cflags jpm/config/dyn:dynamic-lflags jpm/config/dyn:gitpath jpm/config/dyn:headerpath jpm/config/dyn:is-msvc jpm/config/dyn:janet jpm/config/dyn:janet-cflags jpm/config/dyn:janet-lflags jpm/config/dyn:ldflags jpm/config/dyn:lflags jpm/config/dyn:libpath jpm/config/dyn:local jpm/config/dyn:manpath jpm/config/dyn:modext jpm/config/dyn:modpath jpm/config/dyn:nocolor jpm/config/dyn:offline jpm/config/dyn:optimize jpm/config/dyn:pkglist jpm/config/dyn:silent jpm/config/dyn:statext jpm/config/dyn:tarpath jpm/config/dyn:test jpm/config/dyn:tree jpm/config/dyn:update-pkgs jpm/config/dyn:use-batch-shell jpm/config/dyn:verbose jpm/config/dyn:workers jpm/config/load-config jpm/config/load-config-file jpm/config/load-default jpm/config/load-options jpm/config/opt jpm/config/read-env-variables jpm/config/save-config jpm/config/shorthand-mapping jpm/dagbuild/pdag jpm/dagbuild/pmap jpm/make-config/auto jpm/make-config/generate-config jpm/pm/bundle-install jpm/pm/curl jpm/pm/do-rule jpm/pm/download-bundle jpm/pm/download-git-bundle jpm/pm/download-tar-bundle jpm/pm/git jpm/pm/import-rules jpm/pm/load-lockfile jpm/pm/load-project-meta jpm/pm/make-jpm-env jpm/pm/make-lockfile jpm/pm/out-of-tree-config jpm/pm/post-deps jpm/pm/require-jpm jpm/pm/resolve-bundle jpm/pm/tar jpm/pm/update-git-bundle jpm/pm/update-installed jpm/rules/add-body jpm/rules/add-dep jpm/rules/add-input jpm/rules/add-output jpm/rules/add-thunk jpm/rules/build-rules jpm/rules/getrules jpm/rules/phony jpm/rules/rule jpm/rules/sh-phony jpm/rules/sh-rule jpm/rules/sh-task jpm/rules/task jpm/scaffold/scaffold-project jpm/shutil/abspath jpm/shutil/basename jpm/shutil/clear-cache jpm/shutil/clear-manifest jpm/shutil/clexe-shell jpm/shutil/copy jpm/shutil/copyfile jpm/shutil/create-dirs jpm/shutil/devnull jpm/shutil/dirname jpm/shutil/drop1-shell jpm/shutil/exec-slurp jpm/shutil/filepath-replace jpm/shutil/find-build-dir jpm/shutil/find-cache jpm/shutil/find-manifest jpm/shutil/find-manifest-dir jpm/shutil/is-win jpm/shutil/path-splitter jpm/shutil/rimraf jpm/shutil/rm jpm/shutil/shell
(archive-c opts target & objects) -Link object files together to make a static library.Community Examples
(compile-c compiler opts src dest &opt static?) +Link object files together to make a static library.
(compile-c compiler opts src dest &opt static?) -Compile a C file into an object file.Community Examples
(create-buffer-c source dest name) +Compile a C file into an object file.
(create-buffer-c source dest name) -Inline raw byte file as a c file.Community Examples
(create-buffer-c-impl bytes dest name) +Inline raw byte file as a c file.
(create-buffer-c-impl bytes dest name) -Community Examples
(create-executable opts source dest no-core) -Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.Community Examples
(embed-name path) +Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.
(embed-name path) -Rename a janet symbol for embedding.Community Examples
(entry-name name) -Name of symbol that enters static compilation of a module.Community Examples
(entry-replace name) +Name of symbol that enters static compilation of a module.
(entry-replace name) -Escape special characters in the entry-nameCommunity Examples
(link-c has-cpp opts target & objects) +Escape special characters in the entry-name
(link-c has-cpp opts target & objects) -Link C or C++ object files together to make a native module.Community Examples
(make-bin-source declarations lookup-into-invocations no-core) +Link C or C++ object files together to make a native module.
(make-bin-source declarations lookup-into-invocations no-core) -Community Examples
(make-define define value) -Generate strings for adding custom defines to the compiler.Community Examples
(make-defines defines) +Generate strings for adding custom defines to the compiler.
(make-defines defines) -Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.Community Examples
(modpath-to-meta path) +Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.
(modpath-to-meta path) -Get the meta file path (.meta.janet) corresponding to a native module path (.so).Community Examples
(modpath-to-static path) +Get the meta file path (.meta.janet) corresponding to a native module path (.so).
(modpath-to-static path) -Get the static library (.a) path corresponding to a native module path (.so).Community Examples
(out-path path from-ext to-ext) +Get the static library (.a) path corresponding to a native module path (.so).
(out-path path from-ext to-ext) -Take a source file path and convert it to an output path.Community Examples
(add-loader) +Take a source file path and convert it to an output path.
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(ir & body) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(ir & body) -Macro that automatically quotes the body provided and calls (print-ir ...) on the body.Community Examples
(mangle token) +Macro that automatically quotes the body provided and calls (print-ir ...) on the body.
(mangle token) -Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.Community Examples
(print-ir ir) +Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.
(print-ir ir) -Compile the CGEN IR to C and print it to (dyn :out).Community Examples
(configure &opt path) -Setup an out-of-tree build with certain configuration options.Community Examples
(deps) +Setup an out-of-tree build with certain configuration options.
(enable-local-mode) -Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/Community Examples
(help) +Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/
(new-c-project name) -Create a new C projectCommunity Examples
(set-tree tree) -Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.Community Examples
(show-paths) +Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.
Table of all built-in options, as opposed to project deifned options.Community Examples
A table of all of the dynamic config bindings to checkers (validators).Community Examples
Table of all of the help text for each config option.Community Examples
A table of possible options for enum option types.Community Examples
A table of all of the dynamic config bindings to parsers.Community Examples
Table of all built-in options, as opposed to project deifned options.
A table of all of the dynamic config bindings to checkers (validators).
(defconf kw &opt parser docs options) -Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.Community Examples
(dyn:ar &opt dflt) +Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.
(load-config settings &opt override) -Load a configuration from a table or struct.Community Examples
(load-config-file path &opt override) +Load a configuration from a table or struct.
(load-config-file path &opt override) -Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.Community Examples
(load-default &opt override) +Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.
(load-default &opt override) -Load the default configuration.Community Examples
(load-options &opt path) -Load a file that contains config options that can be set. If no such file exists, then do nothing.Community Examples
(opt opts key &opt dflt) +Load a file that contains config options that can be set. If no such file exists, then do nothing.
(opt opts key &opt dflt) -Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.Community Examples
(read-env-variables) +Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.
(read-env-variables) -Read environment variables that correspond to config variables into dyns.Community Examples
(save-config path) +Read environment variables that correspond to config variables into dyns.
(save-config path) -Write the current configuration information to a file.Community Examples
Map some single characters to long options.Community Examples
(pdag f dag &opt n-workers) +Write the current configuration information to a file.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.
(pmap f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.Community Examples
(auto) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.
(generate-config &opt destdir silent as-data) +Get an autodetected config.
(generate-config &opt destdir silent as-data) -Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.Community Examples
(bundle-install bundle &opt no-deps) +Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.
(bundle-install bundle &opt no-deps) -Install a bundle from a git repository.Community Examples
(do-rule target) -Evaluate a given rule in a one-off manner.Community Examples
(download-bundle url bundle-type &opt tag shallow) +Evaluate a given rule in a one-off manner.
(download-bundle url bundle-type &opt tag shallow) -Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.Community Examples
(download-git-bundle bundle-dir url tag shallow) +Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.
(download-git-bundle bundle-dir url tag shallow) -Download a git bundle from a remote respositoryCommunity Examples
(download-tar-bundle bundle-dir url &opt force-gz) +Download a git bundle from a remote respository
(download-tar-bundle bundle-dir url &opt force-gz) -Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.Community Examples
(git & args) +Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.
(import-rules path &opt base-env) -Import another file that defines more rules. This ruleset is merged into the current ruleset.Community Examples
(load-lockfile &opt filename) +Import another file that defines more rules. This ruleset is merged into the current ruleset.
(load-lockfile &opt filename) -Load packages from a lockfile.Community Examples
(load-project-meta &opt path) +Load packages from a lockfile.
(load-project-meta &opt path) -Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.Community Examples
(make-jpm-env &opt base-env) +Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.
(make-jpm-env &opt base-env) -Create an environment that is preloaded with jpm symbols.Community Examples
(make-lockfile &opt filename) +Create an environment that is preloaded with jpm symbols.
(out-of-tree-config path &opt options) -Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.Community Examples
(post-deps & body) +Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.
(post-deps & body) -Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.Community Examples
(require-jpm path &opt base-env) +Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.
(require-jpm path &opt base-env) -Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.Community Examples
(resolve-bundle bundle) +Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.
(resolve-bundle bundle) -Convert any bundle string/table to the normalized table form.Community Examples
(tar & args) +Convert any bundle string/table to the normalized table form.
(update-git-bundle bundle-dir tag shallow) +Make a call to tar.
(update-git-bundle bundle-dir tag shallow) -Fetch latest tag version from remote repositoryCommunity Examples
(update-installed) +Fetch latest tag version from remote repository
(update-installed) -Update all previously installed packages to their latest versions.Community Examples
(add-body target & body) +Update all previously installed packages to their latest versions.
(add-body target & body) -Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.Community Examples
(add-dep target dep) +Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.
(add-input target input) -Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.Community Examples
(add-output target output) +Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.
(add-output target output) -Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.Community Examples
(add-thunk target thunk) +Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.
(add-thunk target thunk) -Append a thunk to a target's recipe.Community Examples
(build-rules rules targets &opt n-workers) +Append a thunk to a target's recipe.
(build-rules rules targets &opt n-workers) -Given a graph of all rules, extract a work graph that will build out-of-date files.Community Examples
(getrules) +Given a graph of all rules, extract a work graph that will build out-of-date files.
(rule target deps & body) -Add a rule to the rule graph.Community Examples
(sh-phony target deps & body) -Alias for `sh-task`.Community Examples
(sh-rule target deps & body) -Add a rule that invokes a shell command, and fails if the command returns non-zero.Community Examples
(sh-task target deps & body) +Add a rule that invokes a shell command, and fails if the command returns non-zero.
(sh-task target deps & body) -Add a task that invokes a shell command, and fails if the command returns non-zero.Community Examples
(task target deps & body) +Add a task that invokes a shell command, and fails if the command returns non-zero.
(task target deps & body) -Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).Community Examples
(scaffold-project name &opt options) +Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).
(scaffold-project name &opt options) -Generate a standardized project scaffold.Community Examples
(abspath path) -Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).Community Examples
(basename path) +Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).
(basename path) -Get the filename of a path without any leading directory components.Community Examples
(clear-cache) +Get the filename of a path without any leading directory components.
(clear-manifest) -Clear the global installation manifest.Community Examples
(clexe-shell & args) +Clear the global installation manifest.
(copy src dest) -Copy a file or directory recursively from one location to another.Community Examples
(copyfile src dest) +Copy a file or directory recursively from one location to another.
(copyfile src dest) -Copy a file one location to another.Community Examples
(create-dirs dest) -Create all directories needed for a file (mkdir -p).Community Examples
(dirname path) -Get the directory of a file without the filename.Community Examples
(drop1-shell std args) +Get the directory of a file without the filename.
(drop1-shell std args) -Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.Community Examples
(exec-slurp & args) +Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.
(exec-slurp & args) -Read stdout of subprocess and return it trimmed in a string.Community Examples
(filepath-replace repo) +Read stdout of subprocess and return it trimmed in a string.
(filepath-replace repo) -Remove special characters from a string or path to make it into a path segment.Community Examples
(find-build-dir) +Remove special characters from a string or path to make it into a path segment.
(find-build-dir) -Gets the build directory to output files to.Community Examples
(find-cache) -Return the path to the global cache.Community Examples
(find-manifest name) -Get the full path of a manifest file given a package name.Community Examples
(find-manifest-dir) +Get the full path of a manifest file given a package name.
(find-manifest-dir) -Get the path to the directory containing manifests for installed packages.Community Examples
(is-win) +Get the path to the directory containing manifests for installed packages.
(is-win) -Check if we should assume a DOS-like shell or default to posix shell.Community Examples
(rimraf path) +Check if we should assume a DOS-like shell or default to posix shell.
(rm path) -Remove a directory and all sub directories.Community Examples
make-config/auto make-config/generate-config
(generate-config &opt destdir silent as-data) +Get an autodetected config.
(generate-config &opt destdir silent as-data) -Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.Community Examples
pm/bundle-install pm/curl pm/do-rule pm/download-bundle pm/download-git-bundle pm/download-tar-bundle pm/git pm/import-rules pm/load-lockfile pm/load-project-meta pm/make-jpm-env pm/make-lockfile pm/out-of-tree-config pm/post-deps pm/require-jpm pm/resolve-bundle pm/tar pm/update-git-bundle pm/update-installed
(bundle-install bundle &opt no-deps) -Install a bundle from a git repository.Community Examples
(do-rule target) -Evaluate a given rule in a one-off manner.Community Examples
(download-bundle url bundle-type &opt tag shallow) +Evaluate a given rule in a one-off manner.
(download-bundle url bundle-type &opt tag shallow) -Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.Community Examples
(download-git-bundle bundle-dir url tag shallow) +Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.
(download-git-bundle bundle-dir url tag shallow) -Download a git bundle from a remote respositoryCommunity Examples
(download-tar-bundle bundle-dir url &opt force-gz) +Download a git bundle from a remote respository
(download-tar-bundle bundle-dir url &opt force-gz) -Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.Community Examples
(git & args) +Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.
(import-rules path &opt base-env) -Import another file that defines more rules. This ruleset is merged into the current ruleset.Community Examples
(load-lockfile &opt filename) +Import another file that defines more rules. This ruleset is merged into the current ruleset.
(load-lockfile &opt filename) -Load packages from a lockfile.Community Examples
(load-project-meta &opt path) -Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.Community Examples
(make-jpm-env &opt base-env) +Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.
(make-jpm-env &opt base-env) -Create an environment that is preloaded with jpm symbols.Community Examples
(make-lockfile &opt filename) +Create an environment that is preloaded with jpm symbols.
(out-of-tree-config path &opt options) -Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.Community Examples
(post-deps & body) +Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.
(post-deps & body) -Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.Community Examples
(require-jpm path &opt base-env) +Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.
(require-jpm path &opt base-env) -Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.Community Examples
(resolve-bundle bundle) +Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.
(resolve-bundle bundle) -Convert any bundle string/table to the normalized table form.Community Examples
(update-git-bundle bundle-dir tag shallow) +Make a call to tar.
(update-git-bundle bundle-dir tag shallow) -Fetch latest tag version from remote repositoryCommunity Examples
(update-installed) +Fetch latest tag version from remote repository
(update-installed) -Update all previously installed packages to their latest versions.Community Examples
rules/add-body rules/add-dep rules/add-input rules/add-output rules/add-thunk rules/build-rules rules/getrules rules/phony rules/rule rules/sh-phony rules/sh-rule rules/sh-task rules/task
(add-body target & body) -Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.Community Examples
(add-dep target dep) +Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.
(add-input target input) -Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.Community Examples
(add-output target output) +Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.
(add-output target output) -Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.Community Examples
(add-thunk target thunk) +Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.
(add-thunk target thunk) -Append a thunk to a target's recipe.Community Examples
(build-rules rules targets &opt n-workers) +Append a thunk to a target's recipe.
(build-rules rules targets &opt n-workers) -Given a graph of all rules, extract a work graph that will build out-of-date files.Community Examples
(getrules) +Given a graph of all rules, extract a work graph that will build out-of-date files.
(sh-rule target deps & body) -Add a rule that invokes a shell command, and fails if the command returns non-zero.Community Examples
(sh-task target deps & body) +Add a rule that invokes a shell command, and fails if the command returns non-zero.
(sh-task target deps & body) -Add a task that invokes a shell command, and fails if the command returns non-zero.Community Examples
(task target deps & body) +Add a task that invokes a shell command, and fails if the command returns non-zero.
(task target deps & body) -Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).Community Examples
(scaffold-project name &opt options) -Generate a standardized project scaffold.Community Examples
shutil/abspath shutil/basename shutil/clear-cache shutil/clear-manifest shutil/clexe-shell shutil/copy shutil/copyfile shutil/create-dirs shutil/devnull shutil/dirname shutil/drop1-shell shutil/exec-slurp shutil/filepath-replace shutil/find-build-dir shutil/find-cache shutil/find-manifest shutil/find-manifest-dir shutil/is-win shutil/path-splitter shutil/rimraf shutil/rm shutil/shell
(abspath path) -Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).Community Examples
(basename path) +Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).
(basename path) -Get the filename of a path without any leading directory components.Community Examples
(clear-cache) +Get the filename of a path without any leading directory components.
(clear-manifest) -Clear the global installation manifest.Community Examples
(copy src dest) -Copy a file or directory recursively from one location to another.Community Examples
(copyfile src dest) +Copy a file or directory recursively from one location to another.
(copyfile src dest) -Copy a file one location to another.Community Examples
(create-dirs dest) -Create all directories needed for a file (mkdir -p).Community Examples
(dirname path) -Get the directory of a file without the filename.Community Examples
(drop1-shell std args) +Get the directory of a file without the filename.
(drop1-shell std args) -Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.Community Examples
(exec-slurp & args) +Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.
(exec-slurp & args) -Read stdout of subprocess and return it trimmed in a string.Community Examples
(filepath-replace repo) +Read stdout of subprocess and return it trimmed in a string.
(filepath-replace repo) -Remove special characters from a string or path to make it into a path segment.Community Examples
(find-build-dir) +Remove special characters from a string or path to make it into a path segment.
(find-build-dir) -Gets the build directory to output files to.Community Examples
(find-cache) -Return the path to the global cache.Community Examples
(find-manifest name) -Get the full path of a manifest file given a package name.Community Examples
(find-manifest-dir) +Get the full path of a manifest file given a package name.
(find-manifest-dir) -Get the path to the directory containing manifests for installed packages.Community Examples
(is-win) +Get the path to the directory containing manifests for installed packages.
(is-win) -Check if we should assume a DOS-like shell or default to posix shell.Community Examples
(rimraf path) +Check if we should assume a DOS-like shell or default to posix shell.
(decode s) Converts a base64 encoded string to its binary representation of any format -(UTF-8, binary, ..).Community Examples
(encode s) -Converts a string of any format (UTF-8, binary, ..) to base64 encoding.Community Examples
crc/make-variant crc/named-variant
(crc/make-variant size polynomial &opt init byte-flip xorout) -Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.Community Examples
(crc/named-variant name) +Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.
(crc/named-variant name) -Get a named CRC variant.Community Examples
cron/check cron/next-timestamp cron/parse-cron
(check cron &opt time local) -Check if a given time matches a cron specifier.Community Examples
(next-timestamp cron &opt time local) +Check if a given time matches a cron specifier.
(next-timestamp cron &opt time local) -Given a cron schedule, get the next instance on the cron tab after timeCommunity Examples
(parse-cron str) +Given a cron schedule, get the next instance on the cron tab after time
(parse-cron str) -Parse a cron string into a valid cron schedule objectCommunity Examples
ev-utils/go-nursery ev-utils/join-nursery ev-utils/multithread-service ev-utils/nursery ev-utils/pcall ev-utils/pdag ev-utils/pmap ev-utils/pmap-full ev-utils/pmap-limited ev-utils/spawn-nursery
(go-nursery nurse f &opt value) -Spawn a fiber into a nursery, similar to ev/go.Community Examples
(join-nursery nurse) +Spawn a fiber into a nursery, similar to ev/go.
(join-nursery nurse) -Suspend the current fiber until the nursery is emptied.Community Examples
(multithread-service thread-main n-threads) +Suspend the current fiber until the nursery is emptied.
(multithread-service thread-main n-threads) -Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.Community Examples
(nursery) +Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.
(nursery) -Group a number of fibers into a single object for structured concurrencyCommunity Examples
(pcall f n) +Group a number of fibers into a single object for structured concurrency
(pcall f n) -Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.Community Examples
(pdag f dag &opt n-workers) +Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data &opt n-workers) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.
(pmap f data &opt n-workers) -Map `f` over data in parallel, optionally limiting parallelism to `n` workers.Community Examples
(pmap-full f data) +Map `f` over data in parallel, optionally limiting parallelism to `n` workers.
(pmap-full f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.Community Examples
(pmap-limited f data n-workers) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.
(pmap-limited f data n-workers) -Similar to pmap-full, but only runs work n-ways parallel.Community Examples
(spawn-nursery nurse & body) +Similar to pmap-full, but only runs work n-ways parallel.
(spawn-nursery nurse & body) -Similar to ev/spawn but associate spawned fibers with a nurseryCommunity Examples
fmt/format fmt/format-file fmt/format-print
(format source) -Format a string of source code to a buffer.Community Examples
(format-print source) -Format a string of source code and print the result.Community Examples
generators/concat generators/cycle generators/drop generators/drop-until generators/drop-while generators/filter generators/from-iterable generators/map generators/mapcat generators/range generators/run generators/take generators/take-until generators/take-while generators/to-array
(concat & xs) -Concatenate one or more generators or iterables into a single generator.Community Examples
(cycle ds) +Concatenate one or more generators or iterables into a single generator.
(cycle ds) -Repeatedly yield the elements of `ds`, looping back to the beginning when finished.Community Examples
(drop n ds) +Repeatedly yield the elements of `ds`, looping back to the beginning when finished.
(drop-until p ds) -Drop elements from `ds` until `p` is true.Community Examples
(drop-while p ds) -Drop elements from `ds` while `p` is true.Community Examples
(filter p ds) -Create a generator that filters `ds` with `p`.Community Examples
(from-iterable ds) +Create a generator that filters `ds` with `p`.
(from-iterable ds) -Create a new generator around any iterable data structure.Community Examples
(map f ds) +Create a new generator around any iterable data structure.
(map f ds) -Create a generator that maps `f` over `ds`.Community Examples
(mapcat f ds) -Map `f` over `ds`, concatenating the results into a new generator.Community Examples
(range from to) +Map `f` over `ds`, concatenating the results into a new generator.
(take n ds) -Take `n` elements from iterable `ds`.Community Examples
(take-until p ds) -Return elements from `ds` until `p` is true.Community Examples
(take-while p ds) +Return elements from `ds` until `p` is true.
(take-while p ds) -Return elements from `ds` while `p` is true.Community Examples
getline/default-autocomplete-context getline/default-autocomplete-options getline/default-doc-fetch getline/make-getline getline/max-history
(default-autocomplete-context buf pos) -Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.Community Examples
(default-autocomplete-options prefix &) +Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.
(default-autocomplete-options prefix &) -Default handler to get available autocomplete options for a given substring.Community Examples
(default-doc-fetch sym w &) +Default handler to get available autocomplete options for a given substring.
(default-doc-fetch sym w &) -Default handler for Ctrl-G to lookup docstrings in the current environment.Community Examples
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) +Default handler for Ctrl-G to lookup docstrings in the current environment.
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) -Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.Community Examples
htmlgen/doctype-html htmlgen/escape htmlgen/html htmlgen/raw
(escape x) +htmlgen/doctype-html htmlgen/escape htmlgen/html htmlgen/raw
htmlgen/html function source(html data &opt buf) -Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.Community Exampleshtmlgen/raw function source(raw text) +Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.htmlgen/raw function source+Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.(raw text) -Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.Community Examples
http/cookie-grammar http/cookies http/logger http/middleware http/query-string-grammar http/read-body http/read-request http/read-response http/request http/request-peg http/response-peg http/router http/send-response http/server http/server-handler http/status-messages http/url-grammar
Grammar to parse a cookie header to a series of keys and values.Community Examples
(cookies nextmw) +http/cookie-grammar http/cookies http/logger http/middleware http/query-string-grammar http/read-body http/read-request http/read-response http/request http/request-peg http/response-peg http/router http/send-response http/server http/server-handler http/status-messages http/url-grammar
http/cookie-grammar core/peg sourceGrammar to parse a cookie header to a series of keys and values.http/cookies function source(cookies nextmw) -Parses cookies into the table under :cookies keyCommunity Exampleshttp/logger function source(logger nextmw) -Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.Community Exampleshttp/middleware function source(middleware x) +Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.http/middleware function source(middleware x) -Coerce any type to http middlewareCommunity Exampleshttp/query-string-grammar core/peg sourceGrammar that parses a query string (sans url path and ? character) and returns a table.Community Exampleshttp/query-string-grammar core/peg sourceGrammar that parses a query string (sans url path and ? character) and returns a table.http/read-body function source(read-body req) -Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.Community Exampleshttp/read-request function source(read-request conn buf &opt no-query) +Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.http/read-request function source(read-request conn buf &opt no-query) -Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Exampleshttp/read-response function source(read-response conn buf) +Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`http/read-response function source(read-response conn buf) -Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Exampleshttp/request function source(request method url &keys {:headers headers :body body}) +Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`http/request function source(request method url &keys {:headers headers :body body}) -Make an HTTP request to a server. Returns a table contain response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.Community Exampleshttp/router function source(router routes) +Make an HTTP request to a server. Returns a table contain response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.http/router function source(router routes) -Creates a router middleware. A router will dispatch to different routes based on the URL path.Community Exampleshttp/send-response function source(send-response conn response &opt buf) +Creates a router middleware. A router will dispatch to different routes based on the URL path.http/send-response function source(send-response conn response &opt buf) -Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.Community Exampleshttp/server function source(server handler &opt host port) +Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.http/server function source(server handler &opt host port) -Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.Community Exampleshttp/server-handler function source(server-handler conn handler) +Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.http/server-handler function source(server-handler conn handler) -A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Community Exampleshttp/status-messages struct sourceMapping of HTTP status codes to their status message.Community Exampleshttp/url-grammar core/peg source+A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.Community Examples
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.
httpf/add-bindings-as-routes httpf/add-route httpf/default-payload-wrapper httpf/listen httpf/server
(add-bindings-as-routes server &opt env) -Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.Community Examples
(add-route server path docstring schema handler &opt read-mime render-mime) +Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.
(add-route server path docstring schema handler &opt read-mime render-mime) -Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.Community Examples
(default-payload-wrapper payload) +Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.
(default-payload-wrapper payload) -Add some metadata to all responsesCommunity Examples
(listen server &opt host port n-workers) +Add some metadata to all responses
(listen server &opt host port n-workers) -Start server. Will run on multiple-threads if n-workers > 1.Community Examples
(server &opt parent) +Start server. Will run on multiple-threads if n-workers > 1.
(decode s) Converts a base64 encoded string to its binary representation of any format -(UTF-8, binary, ..).Community Examples
(encode s) -Converts a string of any format (UTF-8, binary, ..) to base64 encoding.Community Examples
(crc/make-variant size polynomial &opt init byte-flip xorout) +Converts a string of any format (UTF-8, binary, ..) to base64 encoding.
(crc/make-variant size polynomial &opt init byte-flip xorout) -Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.Community Examples
(crc/named-variant name) +Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.
(crc/named-variant name) -Get a named CRC variant.Community Examples
(check cron &opt time local) -Check if a given time matches a cron specifier.Community Examples
(next-timestamp cron &opt time local) +Check if a given time matches a cron specifier.
(next-timestamp cron &opt time local) -Given a cron schedule, get the next instance on the cron tab after timeCommunity Examples
(parse-cron str) +Given a cron schedule, get the next instance on the cron tab after time
(parse-cron str) -Parse a cron string into a valid cron schedule objectCommunity Examples
(go-nursery nurse f &opt value) +Parse a cron string into a valid cron schedule object
(go-nursery nurse f &opt value) -Spawn a fiber into a nursery, similar to ev/go.Community Examples
(join-nursery nurse) +Spawn a fiber into a nursery, similar to ev/go.
(join-nursery nurse) -Suspend the current fiber until the nursery is emptied.Community Examples
(multithread-service thread-main n-threads) +Suspend the current fiber until the nursery is emptied.
(multithread-service thread-main n-threads) -Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.Community Examples
(nursery) +Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.
(nursery) -Group a number of fibers into a single object for structured concurrencyCommunity Examples
(pcall f n) +Group a number of fibers into a single object for structured concurrency
(pcall f n) -Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.Community Examples
(pdag f dag &opt n-workers) +Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data &opt n-workers) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.
(pmap f data &opt n-workers) -Map `f` over data in parallel, optionally limiting parallelism to `n` workers.Community Examples
(pmap-full f data) +Map `f` over data in parallel, optionally limiting parallelism to `n` workers.
(pmap-full f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.Community Examples
(pmap-limited f data n-workers) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.
(pmap-limited f data n-workers) -Similar to pmap-full, but only runs work n-ways parallel.Community Examples
(spawn-nursery nurse & body) +Similar to pmap-full, but only runs work n-ways parallel.
(spawn-nursery nurse & body) -Similar to ev/spawn but associate spawned fibers with a nurseryCommunity Examples
(format source) +Similar to ev/spawn but associate spawned fibers with a nursery
(format source) -Format a string of source code to a buffer.Community Examples
(format-file file) +Format a string of source code to a buffer.
(format-print source) -Format a string of source code and print the result.Community Examples
(concat & xs) +Format a string of source code and print the result.
(concat & xs) -Concatenate one or more generators or iterables into a single generator.Community Examples
(cycle ds) +Concatenate one or more generators or iterables into a single generator.
(cycle ds) -Repeatedly yield the elements of `ds`, looping back to the beginning when finished.Community Examples
(drop n ds) +Repeatedly yield the elements of `ds`, looping back to the beginning when finished.
(drop-until p ds) -Drop elements from `ds` until `p` is true.Community Examples
(drop-while p ds) +Drop elements from `ds` until `p` is true.
(drop-while p ds) -Drop elements from `ds` while `p` is true.Community Examples
(filter p ds) -Create a generator that filters `ds` with `p`.Community Examples
(from-iterable ds) +Create a generator that filters `ds` with `p`.
(from-iterable ds) -Create a new generator around any iterable data structure.Community Examples
(map f ds) +Create a new generator around any iterable data structure.
(map f ds) -Create a generator that maps `f` over `ds`.Community Examples
(mapcat f ds) -Map `f` over `ds`, concatenating the results into a new generator.Community Examples
(range from to) +Map `f` over `ds`, concatenating the results into a new generator.
(take n ds) -Take `n` elements from iterable `ds`.Community Examples
(take-until p ds) +Take `n` elements from iterable `ds`.
(take-until p ds) -Return elements from `ds` until `p` is true.Community Examples
(take-while p ds) +Return elements from `ds` until `p` is true.
(take-while p ds) -Return elements from `ds` while `p` is true.Community Examples
(to-array s) +Return elements from `ds` while `p` is true.
(to-array s) -Consume `s` into a new array.Community Examples
(default-autocomplete-context buf pos) +Consume `s` into a new array.
(default-autocomplete-context buf pos) -Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.Community Examples
(default-autocomplete-options prefix &) +Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.
(default-autocomplete-options prefix &) -Default handler to get available autocomplete options for a given substring.Community Examples
(default-doc-fetch sym w &) +Default handler to get available autocomplete options for a given substring.
(default-doc-fetch sym w &) -Default handler for Ctrl-G to lookup docstrings in the current environment.Community Examples
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) +Default handler for Ctrl-G to lookup docstrings in the current environment.
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) -Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.Community Examples
(escape x) +Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.
(escape x) -Escape characters in a string for HTMLCommunity Examples
(html data &opt buf) -Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.Community Examples
(raw text) +Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.
(raw text) -Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.Community Examples
Grammar to parse a cookie header to a series of keys and values.Community Examples
(cookies nextmw) +Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.
Grammar to parse a cookie header to a series of keys and values.
(cookies nextmw) -Parses cookies into the table under :cookies keyCommunity Examples
(logger nextmw) -Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.Community Examples
(middleware x) +Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.
(middleware x) -Coerce any type to http middlewareCommunity Examples
Grammar that parses a query string (sans url path and ? character) and returns a table.Community Examples
Grammar that parses a query string (sans url path and ? character) and returns a table.
(read-body req) -Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.Community Examples
(read-request conn buf &opt no-query) +Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.
(read-request conn buf &opt no-query) -Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Examples
(read-response conn buf) +Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`
(read-response conn buf) -Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Examples
(request method url &keys {:headers headers :body body}) +Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`
(request method url &keys {:headers headers :body body}) -Make an HTTP request to a server. Returns a table contain response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.Community Examples
(router routes) +Make an HTTP request to a server. Returns a table contain response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.
(router routes) -Creates a router middleware. A router will dispatch to different routes based on the URL path.Community Examples
(send-response conn response &opt buf) +Creates a router middleware. A router will dispatch to different routes based on the URL path.
(send-response conn response &opt buf) -Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.Community Examples
(server handler &opt host port) +Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.
(server handler &opt host port) -Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.Community Examples
(server-handler conn handler) +Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.
(server-handler conn handler) -A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Community Examples
Mapping of HTTP status codes to their status message.Community Examples
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.Community Examples
(add-bindings-as-routes server &opt env) +A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.
(add-bindings-as-routes server &opt env) -Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.Community Examples
(add-route server path docstring schema handler &opt read-mime render-mime) +Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.
(add-route server path docstring schema handler &opt read-mime render-mime) -Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.Community Examples
(default-payload-wrapper payload) +Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.
(default-payload-wrapper payload) -Add some metadata to all responsesCommunity Examples
(listen server &opt host port n-workers) +Add some metadata to all responses
(listen server &opt host port n-workers) -Start server. Will run on multiple-threads if n-workers > 1.Community Examples
(server &opt parent) +Start server. Will run on multiple-threads if n-workers > 1.
(json/decode json-source &opt keywords nils) +Create a new server.
(json/decode json-source &opt keywords nils) -Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.Community Examples
(json/encode x &opt tab newline buf) +Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.
(json/encode x &opt tab newline buf) -Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.Community Examples
Dynamic binding to front matter after parsing, compilation, and evaluation, of markup completes.Community Examples
The htmlgen source that can be used to generate a document with htmlgen/html.Community Examples
(add-loader) +Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.
Dynamic binding to front matter after parsing, compilation, and evaluation, of markup completes.
The htmlgen source that can be used to generate a document with htmlgen/html.
(add-loader) -Allow importing and requiring markup as a moduleCommunity Examples
(anchor name & content) +Allow importing and requiring markup as a module
(anchor name & content) -Create an in-page anchor for a local link.Community Examples
(codeblock lang &opt source) -Inline code or codeblockCommunity Examples
(markup source &opt env where) -Parse mendoza markup and evaluate it returning an htmlgen document tree.Community Examples
(mdz-loader path &) +Parse mendoza markup and evaluate it returning an htmlgen document tree.
(section name content) -Create a section. Usually used to embed different parts of the content document into different parts of the main page.Community Examples
(smaller content) +Create a section. Usually used to embed different parts of the content document into different parts of the main page.
(tag name content) -Wrap some content in an html tag. If you need attributes or other properties, you may want to use raw HTML via the html function.Community Examples
(always x) +Wrap some content in an html tag. If you need attributes or other properties, you may want to use raw HTML via the html function.
(always x) -Return a function that discards any arguments and always returns `x`.Community Examples
(antepenultimate xs) +Return a function that discards any arguments and always returns `x`.
(antepenultimate xs) -Get the third-to-last element from an indexed data structure.Community Examples
(caperr & body) +Get the third-to-last element from an indexed data structure.
(caperr & body) Captures the standart error output of the variadic `body` and returns it -as a buffer.Community Examples
(capout & body) Captures the standart output of the variadic `body` and returns it as -a buffer.Community Examples
(cond-> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs with condition and operation to which the `val`, is put as first argument. All conditions are tried and for truthy conditions the operation is executed. -Returns the value mutated if any condition is truthy.Community Examples
(cond->> val & clauses) +Returns the value mutated if any condition is truthy.
(cond->> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs of condition and operation to which the `val`, is put as last argument. All conditions are tried and for truthy the operation is ran. -Returns mutated value if any condition is truthy.Community Examples
(dedent & xs) Remove indentation after concatenating the arguments. Works by removing leading whitespace, and then removing that same pattern of whitepsace after -new lines.Community Examples
(defs & bindings) -Defines many constants as in let `bindings`, but without creating new scope.Community Examples
(dfs data visit-leaf &opt node-before node-after get-children seen) +Defines many constants as in let `bindings`, but without creating new scope.
(dfs data visit-leaf &opt node-before node-after get-children seen) Do a depth first, pre-order traversal over a data structure. Also allow for callbacks before and after visiting the children of a node. Also allow for a custom `get-children` function to change traversal as needed. Will detect cycles if an empty table is passed as the `seen` parameter, which is used to cached values -that have been visited.Community Examples
(do-def c d & body) Convenience macro for defining constant named `c` with value `d` before `body` and returning it after evaluating `body`, that presumably modifies -the `c` refered content. For example buffer, table or array.Community Examples
(do-var v d & body) +the `c` refered content. For example buffer, table or array.
(do-var v d & body) Convenience macro for defining varible named `v` with value `d` before `body` -and returning it after evaluating `body`, that presumably modifies `v`.Community Examples
(gett ds & keys) +and returning it after evaluating `body`, that presumably modifies `v`.
(gett ds & keys) -Recursive macro (get). Similar to get-in, but keys are variadic argument.Community Examples
(insert-sorted arr <? & xs) +Recursive macro (get). Similar to get-in, but keys are variadic argument.
(insert-sorted arr <? & xs) Insert elements in `arr` such that it remains sorted by the comparator. If -`arr` is not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(insert-sorted-by arr f & xs) +`arr` is not sorted beforehand, the results are undefined. Returns `arr`.
(insert-sorted-by arr f & xs) Insert elements in `arr` such that it remains sorted by the value returned when `f` is called with the element, comparing the values with <. If `arr` is -not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(int->string int &opt base) +not sorted beforehand, the results are undefined. Returns `arr`.
(int->string int &opt base) -Stringify an integer in a particular base. Defaults to decimal (base 10).Community Examples
(int/ & xs) +Stringify an integer in a particular base. Defaults to decimal (base 10).
(log level & args) Print to a dynamic binding stream if that stream is set, otherwise do nothing. Evaluate to nil. For example, `(log :err "value error: %V" my-value)` will print -to `(dyn :err)` only if `(dyn :err)` has been set.Community Examples
(make prototype & pairs) +to `(dyn :err)` only if `(dyn :err)` has been set.
(make prototype & pairs) Convenience macro for creating new table from even number of kvs pairs in a variadic `table-or-pairs` arguments and setting its prototype to `prototype`. -Factory function for creating new objects from prototypes.Community Examples
(make-id &opt prefix) +Factory function for creating new objects from prototypes.
(make-id &opt prefix) Create a random, printable keyword id with 10 bytes of entropy -with an optional prefix.Community Examples
(map-keys f data) Returns new table with function `f` applied to `data`'s -keys recursively.Community Examples
(map-vals f data) -Returns new table with function `f` applied to `data`'s values.Community Examples
(penultimate xs) +Returns new table with function `f` applied to `data`'s values.
(penultimate xs) -Get the second-to-last element from an indexed data structure.Community Examples
(print-table data &opt columns header-mapping) +Get the second-to-last element from an indexed data structure.
(print-table data &opt columns header-mapping) Iterate through the rows of a data structure and print a table in a human readable way, with padding and heading information. Can optionally provide @@ -382,280 +382,280 @@Community ExamplesSpork
for each row. Lastly, a `header-mapping` dictionary can be provided that changes the printed header names my mapping column keys to the desired header name. If no mapping is found, then the column key will be used as -the header name. Returns nil.
(randomize-array arr &opt rng) +the header name. Returns nil.
(randomize-array arr &opt rng) Randomizes array using the fisher-yates shuffle, takes an optional random -number generator.Community Examples
(second xs) -Get the second element from an indexed data structure.Community Examples
(select-keys data keyz) +Get the second element from an indexed data structure.
(select-keys data keyz) -Returns new table with selected `keyz` from dictionary `data`.Community Examples
(set* tgts exprs) +Returns new table with selected `keyz` from dictionary `data`.
(set* tgts exprs) Parallel `set` function. Takes a list of targets and expressions, evaluates all the expressions, and then assigns them to the targets. Each target can be a variable -or a 2-tuple, just like in the normal `set` special form.Community Examples
(string->int str &opt base) +or a 2-tuple, just like in the normal `set` special form.
(string->int str &opt base) Parse an integer in the given base. Defaults to decimal (base 10). Differs -from scan-number in that this does not recognize floating point notation.Community Examples
(table-filter pred dict) +from scan-number in that this does not recognize floating point notation.
(table-filter pred dict) Filter a key-value structure info a table. Semantics are the same as for built-in `filter`, except that `pred` takes two arguments (key and value.) -Does not consider prototypes.Community Examples
(third xs) -Get the third element from an indexed data structure.Community Examples
(trim-prefix prefix str) +Get the third element from an indexed data structure.
(trim-prefix prefix str) -Trim the specified prefix of a string if it has oneCommunity Examples
(trim-suffix suffix str) +Trim the specified prefix of a string if it has one
(trim-suffix suffix str) -Trim the specified suffix of a string if it has oneCommunity Examples
(until cnd & body) +Trim the specified suffix of a string if it has one
(until cnd & body) Repeat `body` while the `cnd` is false. -Equivalent to (while (not cnd) ;body).Community Examples
(vars & bindings) -Defines many variables as in let `bindings`, but without creating new scope.Community Examples
(make-proto stream &opt pack unpack) +Defines many variables as in let `bindings`, but without creating new scope.
(make-proto stream &opt pack unpack) -Create both a send an recv function from a stream, as with `make-send` and `make-recv`.Community Examples
(make-recv stream &opt unpack) +Create both a send an recv function from a stream, as with `make-send` and `make-recv`.
(make-recv stream &opt unpack) -Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.Community Examples
(make-send stream &opt pack) +Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.
(make-send stream &opt pack) -Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.Community Examples
(client &opt host port name) +Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.
(client &opt host port name) -Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".Community Examples
Default host to run server on and connect to.Community Examples
(server &opt host port env cleanup welcome-msg) +Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".
(server &opt host port env cleanup welcome-msg) -Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.Community Examples
(server-single &opt host port env cleanup welcome-msg) +Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.
(server-single &opt host port env cleanup welcome-msg) -Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.Community Examples
(posix/abspath path) +Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(ext path) -Get the file extension for a path.Community Examples
(posix/join & els) -Join path elements together.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/parts path) -Split a path into its parts.Community Examples
(posix/relpath source target) +Split a path into its parts.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(posix/relpath source target) +Get the relative path between two subpaths.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(win32/abspath path) +Get the relative path between two subpaths.
(win32/abspath path) -Coerce a path to be absolute.Community Examples
(win32/abspath? path) -Check if a path is absolute.Community Examples
(win32/basename path) -Gets the base file name of a path.Community Examples
(win32/dirname path) -Gets the directory name of a path.Community Examples
(ext path) -Get the file extension for a path.Community Examples
(win32/join & els) -Join path elements together.Community Examples
(win32/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(win32/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(win32/parts path) -Split a path into its parts.Community Examples
(win32/relpath source target) +Split a path into its parts.
(win32/relpath source target) -Get the relative path between two subpaths.Community Examples
(rawterm/begin &opt on-winch) +Get the relative path between two subpaths.
(rawterm/begin &opt on-winch) -Begin raw terminal functionality. Return a stream that can be read from to get input.Community Examples
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) +Begin raw terminal functionality. Return a stream that can be read from to get input.
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) -Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.Community Examples
(rawterm/ctrl-z) +Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.
(rawterm/ctrl-z) -A handler that a user can use to handle ctrl-z from input to suspend the current process.Community Examples
(rawterm/end) +A handler that a user can use to handle ctrl-z from input to suspend the current process.
(rawterm/getch &opt into) -Get a byte of input from stdin, without blocking if possible. Returns a buffer.Community Examples
(rawterm/isatty) +Get a byte of input from stdin, without blocking if possible. Returns a buffer.
(rawterm/isatty) -Check if the current stdin is a tty.Community Examples
(rawterm/monowidth bytes &opt start-index end-index) +Check if the current stdin is a tty.
(rawterm/monowidth bytes &opt start-index end-index) -Measure the monospace width of a string.Community Examples
(rawterm/rune-monowidth rune) +Measure the monospace width of a string.
(rawterm/rune-monowidth rune) -Get the monospace width of a rune. Returns either 0, 1, or 2.Community Examples
(rawterm/size) +Get the monospace width of a rune. Returns either 0, 1, or 2.
(rawterm/size) -Get the number of rows and columns visible in the terminal as tuple [rows cols]Community Examples
(rawterm/slice-monowidth bytes columns &opt start-index into) +Get the number of rows and columns visible in the terminal as tuple [rows cols]
(rawterm/slice-monowidth bytes columns &opt start-index into) -Get a byte slice that will fit into a number of columns.Community Examples
(compile pattern) +Get a byte slice that will fit into a number of columns.
(compile pattern) -Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.Community Examples
(find reg text &opt start) +Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.
(find reg text &opt start) -Similar to peg/find, but for regexes.Community Examples
(find-all reg text &opt start) +Similar to peg/find, but for regexes.
(find-all reg text &opt start) -Similar to peg/find-all, but for regexes.Community Examples
(match reg text &opt start) +Similar to peg/find-all, but for regexes.
(match reg text &opt start) -Similar to peg/match, but for regexes.Community Examples
Peg used to generate peg source code from a regular expression string.Community Examples
(replace reg rep text &opt start) +Similar to peg/match, but for regexes.
Peg used to generate peg source code from a regular expression string.
(replace reg rep text &opt start) -Similar to peg/replace, but for regexes.Community Examples
(replace-all reg rep text &opt start) +Similar to peg/replace, but for regexes.
(replace-all reg rep text &opt start) -Similar to peg/replace-all, but for regexes.Community Examples
(source pattern) -Compile a subset of regex to PEG source code.Community Examples
(client &opt host port name) +Compile a subset of regex to PEG source code.
(client &opt host port name) -Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.Community Examples
Default host to run server on and connect to.Community Examples
(server functions &opt host port workers-per-connection) +Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.
(server functions &opt host port workers-per-connection) -Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.Community Examples
(make-predicate schema) +Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.
(make-predicate schema) -Generate a function that can be used to validate a data structure. This is the function form of `predicate`.Community Examples
(make-validator schema) +Generate a function that can be used to validate a data structure. This is the function form of `predicate`.
(make-validator schema) -Generate a function that can be used to validate a data structure. This is the function form of `validator`.Community Examples
(predicate pattern) +Generate a function that can be used to validate a data structure. This is the function form of `validator`.
(predicate pattern) -Make a validation predicate given a certain schema.Community Examples
(validator pattern) +Make a validation predicate given a certain schema.
(validator pattern) -Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.Community Examples
(copy src dest) +Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.
(copy src dest) Copy a file or directory recursively from one location to another. -Expects input to be unix style pathsCommunity Examples
(copy-file src-path dst-path) +Expects input to be unix style paths
(copy-file src-path dst-path) -Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.Community Examples
(create-dirs dir-path) +Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.
(create-dirs dir-path) -Create all directories in path specified as string including itself.Community Examples
(devnull) +Create all directories in path specified as string including itself.
(devnull) -get the /dev/null equivalent of the current platform as an open fileCommunity Examples
(exec-slurp & args) +get the /dev/null equivalent of the current platform as an open file
(exec-slurp & args) -Read stdout of subprocess and return it trimmed in a string.Community Examples
(exec-slurp-all & args) +Read stdout of subprocess and return it trimmed in a string.
(exec-slurp-all & args) Read stdout and stderr of subprocess and return it trimmed in a struct with :err and :out containing the output as string. -This will also return the exit code under the :status key.Community Examples
(exists? path) +This will also return the exit code under the :status key.
(exists? path) -Check if the given file or directory exists. (Follows symlinks)Community Examples
(list-all-files dir &opt into) +Check if the given file or directory exists. (Follows symlinks)
(list-all-files dir &opt into) -List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.Community Examples
(make-new-file file-path &opt mode) +List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.
(make-new-file file-path &opt mode) -Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).Community Examples
(rm path) +Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).
(rm path) -Remove a directory and all sub directories recursively.Community Examples
(scan-directory dir func) +Remove a directory and all sub directories recursively.
(scan-directory dir func) -Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.Community Examples
(tarray/buffer array|size) +Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.
(tarray/buffer array|size) -Return typed array buffer or create a new buffer.Community Examples
(tarray/copy-bytes src sindex dst dindex &opt count) +Return typed array buffer or create a new buffer.
(tarray/copy-bytes src sindex dst dindex &opt count) -Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.Community Examples
(tarray/length array|buffer) +Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.
(tarray/length array|buffer) -Return typed array or buffer size.Community Examples
(tarray/new type size &opt stride offset tarray|buffer) +Return typed array or buffer size.
(tarray/new type size &opt stride offset tarray|buffer) -Create new typed array.Community Examples
(tarray/properties array) +Create new typed array.
(tarray/properties array) -Return typed array properties as a struct.Community Examples
(tarray/slice tarr &opt start end) +Return typed array properties as a struct.
(tarray/slice tarr &opt start end) -Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.Community Examples
(tarray/swap-bytes src sindex dst dindex &opt count) +Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.
(tarray/swap-bytes src sindex dst dindex &opt count) -Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.Community Examples
(all-tasks tasker &opt detailed) +Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.
(all-tasks tasker &opt detailed) -Get an array of all task ids for which there is still data on disk. If `detailed` is truthy, return full task metadata instead of ids.Community Examples
(cancel-task tasker task-id) +Get an array of all task ids for which there is still data on disk. If `detailed` is truthy, return full task metadata instead of ids.
(cancel-task tasker task-id) -Cancel a queued or running task.Community Examples
(close-queues tasker) -Prevent any tasks from being added to queues. When an executor finishes it's current job, if there are any, it will terminate. When all executors complete, the call to `run-executors` will complete.Community Examples
Default location of task recordsCommunity Examples
Maximum allowed priority (lower priority tasks will execute first)Community Examples
Minimum allowed priority (lower priority tasks will execute first)Community Examples
(new-tasker &opt task-directory queues queue-size) +Prevent any tasks from being added to queues. When an executor finishes it's current job, if there are any, it will terminate. When all executors complete, the call to `run-executors` will complete.
Maximum allowed priority (lower priority tasks will execute first)
Minimum allowed priority (lower priority tasks will execute first)
(new-tasker &opt task-directory queues queue-size) -Create queues and various settings to run tasks. Create a new tasker table.Community Examples
(queue-task tasker argv &opt note priority qname timeout expiration input) +Create queues and various settings to run tasks. Create a new tasker table.
(queue-task tasker argv &opt note priority qname timeout expiration input) -Add a task specification to a queue. Supply an argv string array that will be used to invoke s a subprocess. The optional `note` parameter is just a textual note for task trackingv. The `priority` parameter should be an integer between 0 and 9 inclusive, default is 4. Lower priority jobs in the same queue will be executed by higher priority. Use input to pass in generic, unstructured input to a task.Community Examples
(run-cleanup tasker) +Add a task specification to a queue. Supply an argv string array that will be used to invoke s a subprocess. The optional `note` parameter is just a textual note for task trackingv. The `priority` parameter should be an integer between 0 and 9 inclusive, default is 4. Lower priority jobs in the same queue will be executed by higher priority. Use input to pass in generic, unstructured input to a task.
(run-cleanup tasker) -Delete old expired jobs saved on diskCommunity Examples
(run-executors tasker &opt workers-per-queue pre-task post-task) +Delete old expired jobs saved on disk
(run-executors tasker &opt workers-per-queue pre-task post-task) -Start a number of executors to run tasks as with `tasker/spawn-executors`, and then wait for all executors to complete.Community Examples
(spawn-executors tasker &opt qnames workers-per-queue pre-task post-task) +Start a number of executors to run tasks as with `tasker/spawn-executors`, and then wait for all executors to complete.
(spawn-executors tasker &opt qnames workers-per-queue pre-task post-task) -Start a number of executors to run tasks. Tasks can be added to a queue by calling queue-task. A single tasker object can make multiple calls to spawn-executors.Community Examples
A tuple of all possible statuses that a task can have.Community Examples
(task-file tasker task-id &opt file-name) +Start a number of executors to run tasks. Tasks can be added to a queue by calling queue-task. A single tasker object can make multiple calls to spawn-executors.
(task-file tasker task-id &opt file-name) -Get a log file for a path. By default, will get a path to out.log.Community Examples
(task-status tasker task-id) +Get a log file for a path. By default, will get a path to out.log.
(task-status tasker task-id) -Look up the status of a given task by id.Community Examples
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(compile str) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(compile str) Compile a Temple template into a function which will return a rendered buffer. The resulting function should receive the template arguments in the -&keys format.Community Examples
(create source &opt where) -Compile a template string into a function. Optionally provide a location where the source is from to improve debugging. Returns the template function.Community Examples
(assert x &opt e) +Compile a template string into a function. Optionally provide a location where the source is from to improve debugging. Returns the template function.
(assert x &opt e) -Override's the default assert with some nice error handling.Community Examples
(assert-docs path) +Override's the default assert with some nice error handling.
(assert-docs path) Assert that all symbols, when module on the path is required, -have proper doc stringCommunity Examples
(assert-error msg & forms) -Test passes if forms error.Community Examples
(assert-no-error msg & forms) -Test passes if forms do not error.Community Examples
(capture-stderr & body) Runs the form and captures stderr. Returns tuple with result of the form -and a string with captured stderr.Community Examples
(capture-stdout & body) Runs the form and captures stdout. Returns tuple with result of the form -and a string with captured stdout.Community Examples
(end-suite) -Ends test suite, prints summary and exits if any have failed.Community Examples
(start-suite &opt name) +Ends test suite, prints summary and exits if any have failed.
(start-suite &opt name) -Starts test suite.Community Examples
(suppress-stderr & body) -Suppreses stdout from the bodyCommunity Examples
(suppress-stdout & body) -Suppreses stdout from the bodyCommunity Examples
(timeit form &opt tag) Time the execution of `form` using `os/clock` before and after, and print the result to stdout. returns: result of executing `form`. -Uses `tag` (default "Elapsed time:") to tag the printout.Community Examples
(utf8/decode-rune buf &opt start) +Uses `tag` (default "Elapsed time:") to tag the printout.
(utf8/decode-rune buf &opt start) -Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].Community Examples
(utf8/encode-rune rune &opt buf) +Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].
(utf8/encode-rune rune &opt buf) -Encode a Unicode codepoint into the end of a buffer.Community Examples
(utf8/prefix->width c) +Encode a Unicode codepoint into the end of a buffer.
(utf8/prefix->width c) -Given the first byte in an UTF-8 sequence, get the number of bytes that the codepoint sequence takes up, including the prefix byte.Community Examples
(zip/add-bytes writer path data &opt comment flags) +Given the first byte in an UTF-8 sequence, get the number of bytes that the codepoint sequence takes up, including the prefix byte.
(zip/add-bytes writer path data &opt comment flags) -Add a byte sequence to the zip writer.Community Examples
(zip/add-file writer path filename &opt comment flags) +Add a byte sequence to the zip writer.
(zip/add-file writer path filename &opt comment flags) -Add a file to the zip writer.Community Examples
(zip/compress bytes &opt level into) +Add a file to the zip writer.
(zip/compress bytes &opt level into) -Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.Community Examples
(zip/decompress bytes &opt into) +Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.
(zip/decompress bytes &opt into) -Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.Community Examples
(zip/extract reader idx-or-filename &opt into flags) +Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.
(zip/extract reader idx-or-filename &opt into flags) -Extract a file from the zip archive, either to memory or to a file on disk.Community Examples
(zip/file-directory? reader idx) +Extract a file from the zip archive, either to memory or to a file on disk.
(zip/file-directory? reader idx) -Check if a file index is a directory.Community Examples
(zip/file-encrypted? reader idx) +Check if a file index is a directory.
(zip/file-encrypted? reader idx) -Check if a file is encrypted inside an archive.Community Examples
(zip/file-supported? reader idx) +Check if a file is encrypted inside an archive.
(zip/file-supported? reader idx) -Check if a file is supported with this verstion of miniz.Community Examples
(zip/get-filename reader idx) +Check if a file is supported with this verstion of miniz.
(zip/get-filename reader idx) -Convert a file index index in the archive to a filename.Community Examples
(zip/locate-file reader path &opt comment flags) +Convert a file index index in the archive to a filename.
(zip/locate-file reader path &opt comment flags) -Get the index of a particular filename in the archive.Community Examples
(zip/read-bytes bytes &opt flags) +Get the index of a particular filename in the archive.
(zip/read-bytes bytes &opt flags) -Read a byte sequence as a zip archive. Returns a new zip reader.Community Examples
(zip/read-file filename &opt flags) +Read a byte sequence as a zip archive. Returns a new zip reader.
(zip/read-file filename &opt flags) -Read a file as a zip archive. Returns a new zip reader.Community Examples
(zip/reader-close reader) +Read a file as a zip archive. Returns a new zip reader.
(zip/reader-close reader) -Close a reader and free related memory.Community Examples
(zip/reader-count reader) +Close a reader and free related memory.
(zip/reader-count reader) -Get the number of files inside the zip archive. The files can be indexedCommunity Examples
(zip/stat reader idx) +Get the number of files inside the zip archive. The files can be indexed
(zip/stat reader idx) Get stat information of file. Returns a new struct with the following fields: @@ -672,17 +672,17 @@Community ExamplesSpork
* :comment * :internal-attr * :external-attr -
(zip/version) -Get the version string of the underlying miniz library.Community Examples
(zip/write-buffer) +Get the version string of the underlying miniz library.
(zip/write-buffer) -Create a new zip archive writer that write to memory.Community Examples
(zip/write-file dest-path) +Create a new zip archive writer that write to memory.
(zip/write-file dest-path) -Create a new zip archive writer that will write into an archive file.Community Examples
(zip/writer-close writer) +Create a new zip archive writer that will write into an archive file.
(zip/writer-close writer) -Close a ZipWriter.Community Examples
(zip/writer-finalizer writer) -Finalize a writer, writing any zip files to disk. Return the writer.Community Examples
(json/decode json-source &opt keywords nils) -Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.Community Examples
(json/encode x &opt tab newline buf) +Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.
(json/encode x &opt tab newline buf) -Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.Community Examples
math/add math/add-to-mean math/approx-eq math/bernoulli-distribution math/binominal-coeficient math/binominal-distribution math/check-propability math/chi-squared-distribution-table math/cols math/cumulative-std-normal-probability math/det math/dot math/epsilon math/extent math/factorial math/geometric-mean math/get-only-el math/harmonic-mean math/ident math/interquartile-range math/linear-regression math/linear-regression-line math/median math/median-absolute-deviation math/minor math/mode math/mop math/mul math/perm math/permutation-test math/permutations math/poisson-distribution math/quantile math/quantile-rank math/quantile-rank-sorted math/quantile-sorted math/quickselect math/relative-err math/root-mean-square math/rows math/sample-correlation math/sample-covariance math/sample-skewness math/sample-standard-deviation math/sample-variance math/scalar math/shuffle-in-place math/size math/sop math/standard-deviation math/standard-normal-table math/sum-compensated math/sum-nth-power-deviations math/swap math/t-test math/t-test-2 math/trans math/variance math/z-score math/zero
(add m a) Add `a` to matrix `m` where it can be matrix or scalar. -Matrix `m` is mutated.Community Examples
(add-to-mean m n v) -Adds new value `v` to mean `m` from `n` values.Community Examples
(approx-eq a e &opt t) +Adds new value `v` to mean `m` from `n` values.
(approx-eq a e &opt t) Approximate equality between actual number `a` and expected number `e`. Default tolerance `t` -is `epsilon`.Community Examples
(bernoulli-distribution p) -Creates Bernoulli distribution from popability `p` in the tuple.Community Examples
(binominal-coeficient n k) +Creates Bernoulli distribution from popability `p` in the tuple.
(binominal-coeficient n k) Computes binominal coeficient from set of size `n` -and sample size `k`.Community Examples
(binominal-distribution t p) Creates binominal distribution from trials `t` -and propability `p` in the tuple.Community Examples
(check-propability p) -Asserts that probability in in the [0 1] range.Community Examples
(cumulative-std-normal-probability z) +Returns numbers of columns of matrix `m`.
(cumulative-std-normal-probability z) -Computes standard normal probability for `y`.Community Examples
(dot mx my) -Computes dot product of matrices or vectors `x` and `y`.Community Examples
(extent xs) -Returns the minimum & maximum number in an `xs` as tuple.Community Examples
(factorial n) +Returns the minimum & maximum number in an `xs` as tuple.
(geometric-mean xs) -Gets the geometric mean from `xs`.Community Examples
(get-only-el m) Convenience macro for geting first element -from first row of the two dimensional array `m`.Community Examples
(harmonic-mean xs) +from first row of the two dimensional array `m`.
(harmonic-mean xs) -Gets the harmonic mean from `xs`.Community Examples
(ident c) -Creates identity matrix with `c` x `c` size.Community Examples
(interquartile-range xs) +Creates identity matrix with `c` x `c` size.
(interquartile-range xs) -Gets the interquartile range from `xs`.Community Examples
(linear-regression coords) +Gets the interquartile range from `xs`.
(linear-regression coords) Computes the slope `:m` and y-intercept `:b` -of the function in the struct from set of coordinates.Community Examples
(linear-regression-line {:m m :b b}) +of the function in the struct from set of coordinates.
(linear-regression-line {:m m :b b}) -Constructs function from struct returned by linear regression.Community Examples
(median xs) +Constructs function from struct returned by linear regression.
(median-absolute-deviation xs) +Gets the median value from `xs`
(median-absolute-deviation xs) -Gets median absolute deviation from `xs`.Community Examples
(minor m x y) -Computes minor matrix of matrix `m` and `x`, `y`.Community Examples
(mop m op a) Mutates every cell of the matrix `m` with `op` -and corresponding cell from matrix arg `a`.Community Examples
(mul m a) Multiply matrix `m` with `a` which can be matrix or vector. -Matrix `m` is mutated.Community Examples
(permutation-test xs ys &opt a k) +Computes permanent of the matrix `m`.
(permutation-test xs ys &opt a k) Conducts a permutation test to determine if two data sets `xs` and `ys` are *significantly* different from each other. You can use alternative hypotesis `a`, which defaults to `:two-side`, with `:greater` and `:lesser` being the other two options. The last optional argument is `k` number of values -in permutation distributionCommunity Examples
(permutations s &opt k) -Returns permutations of length `k` from members of `s`Community Examples
(poisson-distribution lambda) +Returns permutations of length `k` from members of `s`
(poisson-distribution lambda) -Creates Poisson distribution from `lambda` in tuple.Community Examples
(quantile xs p) -Gets the quantile value from `xs` at `p` from unsorted population.Community Examples
(quantile-rank xs p) +Gets the quantile value from `xs` at `p` from unsorted population.
(quantile-rank xs p) -Gets the quantile rank of value `v` from unsorted `xs`.Community Examples
(quantile-rank-sorted xs v) +Gets the quantile rank of value `v` from unsorted `xs`.
(quantile-rank-sorted xs v) -Gets the quantile rank of value `v` from sorted `xs`.Community Examples
(quantile-sorted xs p) +Gets the quantile rank of value `v` from sorted `xs`.
(quantile-sorted xs p) -Gets the quantile value from `xs` at `p` from sorted population.Community Examples
(quickselect arr k &opt left right) +Gets the quantile value from `xs` at `p` from sorted population.
(quickselect arr k &opt left right) Rearrange items in `arr` so that all items in `[left, k]` range are the smallest. The `k`-th element will have the `(k - left + 1)`-th smallest value in `[left, right]`. -Mutates `arr`.Community Examples
(relative-err a e) Gets the relative err between actual number `a` -and expected number `e`.Community Examples
(root-mean-square xs) -Gets the root mean square from `xs`.Community Examples
(sample-correlation xs ys) +Returns numbers of rows of matrix `m`.
(sample-correlation xs ys) -Gets the sample correlation between `xs` and `ys`.Community Examples
(sample-covariance xs ys) +Gets the sample correlation between `xs` and `ys`.
(sample-covariance xs ys) -Gets the sample covariance between `xs` and `ys`.Community Examples
(sample-skewness xs) +Gets the sample covariance between `xs` and `ys`.
(sample-skewness xs) -Gets the sample skeweness from the `xs`.Community Examples
(sample-standard-deviation xs) +Gets the sample skeweness from the `xs`.
(sample-standard-deviation xs) -Gets sample standard deviation from `xs`.Community Examples
(sample-variance xs) +Gets sample standard deviation from `xs`.
(sample-variance xs) -Get the sample variance from `xs`.Community Examples
(scalar c s) -Creates scalar `s` matrix with `c` x `c` size.Community Examples
(shuffle-in-place xs) +Creates scalar `s` matrix with `c` x `c` size.
(shuffle-in-place xs) Generate random permutation of the array `xs` -which is shuffled in place.Community Examples
(size m) -Returns tuple with the matrix `m` size [rows cols].Community Examples
(sop m op & a) Mutates every cell of the matrix `m` with `op` -and variadic args `a`.Community Examples
(standard-deviation xs) -Gets the standard deviation from `ds`.Community Examples
(sum-compensated xs) -Returns sum of the members of `xs` with Kahan-Babushka algorithm.Community Examples
(sum-nth-power-deviations xs n) +Returns sum of the members of `xs` with Kahan-Babushka algorithm.
(sum-nth-power-deviations xs n) -Get the sum of deviations to the n power.Community Examples
(swap arr i j) Swaps members with indices `i` and `j` of arr. -Noop when `i` equals `j`.Community Examples
(t-test xs expv) Computes one sample t-test comparing the mean of `xs` -to known value `expv`.Community Examples
(t-test-2 xs ys &opt d) Computes two sample t-test of two samples `xs` and `ys` -with difference optional `d` which defaults to 0.Community Examples
(z-score x m d) Gets the standard score for number `x` from mean `m` -and standard deviation `d`.Community Examples
(zero c &opt r) Creates vector of length `c`, or matrix if `r` -is provided, and fills it with zeros.Community Examples
misc/always misc/antepenultimate misc/caperr misc/capout misc/cond-> misc/cond->> misc/dedent misc/defs misc/dfs misc/do-def misc/do-var misc/gett misc/insert-sorted misc/insert-sorted-by misc/int->string misc/int/ misc/log misc/make misc/make-id misc/map-keys misc/map-vals misc/penultimate misc/print-table misc/randomize-array misc/second misc/select-keys misc/set* misc/string->int misc/table-filter misc/third misc/trim-prefix misc/trim-suffix misc/until misc/vars
(always x) -Return a function that discards any arguments and always returns `x`.Community Examples
(antepenultimate xs) +Return a function that discards any arguments and always returns `x`.
(antepenultimate xs) -Get the third-to-last element from an indexed data structure.Community Examples
(caperr & body) +Get the third-to-last element from an indexed data structure.
(caperr & body) Captures the standart error output of the variadic `body` and returns it -as a buffer.Community Examples
(capout & body) Captures the standart output of the variadic `body` and returns it as -a buffer.Community Examples
(cond-> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs with condition and operation to which the `val`, is put as first argument. All conditions are tried and for truthy conditions the operation is executed. -Returns the value mutated if any condition is truthy.Community Examples
(cond->> val & clauses) +Returns the value mutated if any condition is truthy.
(cond->> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs of condition and operation to which the `val`, is put as last argument. All conditions are tried and for truthy the operation is ran. -Returns mutated value if any condition is truthy.Community Examples
(dedent & xs) Remove indentation after concatenating the arguments. Works by removing leading whitespace, and then removing that same pattern of whitepsace after -new lines.Community Examples
(defs & bindings) -Defines many constants as in let `bindings`, but without creating new scope.Community Examples
(dfs data visit-leaf &opt node-before node-after get-children seen) +Defines many constants as in let `bindings`, but without creating new scope.
(dfs data visit-leaf &opt node-before node-after get-children seen) Do a depth first, pre-order traversal over a data structure. Also allow for callbacks before and after visiting the children of a node. Also allow for a custom `get-children` function to change traversal as needed. Will detect cycles if an empty table is passed as the `seen` parameter, which is used to cached values -that have been visited.Community Examples
(do-def c d & body) Convenience macro for defining constant named `c` with value `d` before `body` and returning it after evaluating `body`, that presumably modifies -the `c` refered content. For example buffer, table or array.Community Examples
(do-var v d & body) +the `c` refered content. For example buffer, table or array.
(do-var v d & body) Convenience macro for defining varible named `v` with value `d` before `body` -and returning it after evaluating `body`, that presumably modifies `v`.Community Examples
(gett ds & keys) +and returning it after evaluating `body`, that presumably modifies `v`.
(gett ds & keys) -Recursive macro (get). Similar to get-in, but keys are variadic argument.Community Examples
(insert-sorted arr <? & xs) +Recursive macro (get). Similar to get-in, but keys are variadic argument.
(insert-sorted arr <? & xs) Insert elements in `arr` such that it remains sorted by the comparator. If -`arr` is not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(insert-sorted-by arr f & xs) +`arr` is not sorted beforehand, the results are undefined. Returns `arr`.
(insert-sorted-by arr f & xs) Insert elements in `arr` such that it remains sorted by the value returned when `f` is called with the element, comparing the values with <. If `arr` is -not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(int->string int &opt base) +not sorted beforehand, the results are undefined. Returns `arr`.
(int->string int &opt base) -Stringify an integer in a particular base. Defaults to decimal (base 10).Community Examples
(int/ & xs) +Stringify an integer in a particular base. Defaults to decimal (base 10).
(log level & args) Print to a dynamic binding stream if that stream is set, otherwise do nothing. Evaluate to nil. For example, `(log :err "value error: %V" my-value)` will print -to `(dyn :err)` only if `(dyn :err)` has been set.Community Examples
(make prototype & pairs) Convenience macro for creating new table from even number of kvs pairs in a variadic `table-or-pairs` arguments and setting its prototype to `prototype`. -Factory function for creating new objects from prototypes.Community Examples
(make-id &opt prefix) +Factory function for creating new objects from prototypes.
(make-id &opt prefix) Create a random, printable keyword id with 10 bytes of entropy -with an optional prefix.Community Examples
(map-keys f data) Returns new table with function `f` applied to `data`'s -keys recursively.Community Examples
(map-vals f data) -Returns new table with function `f` applied to `data`'s values.Community Examples
(penultimate xs) +Returns new table with function `f` applied to `data`'s values.
(penultimate xs) -Get the second-to-last element from an indexed data structure.Community Examples
(print-table data &opt columns header-mapping) +Get the second-to-last element from an indexed data structure.
(print-table data &opt columns header-mapping) Iterate through the rows of a data structure and print a table in a human readable way, with padding and heading information. Can optionally provide @@ -192,37 +192,37 @@Community ExamplesIndex for each row. Lastly, a `header-mapping` dictionary can be provided that changes the printed header names my mapping column keys to the desired header name. If no mapping is found, then the column key will be used as -the header name. Returns nil.
(randomize-array arr &opt rng) Randomizes array using the fisher-yates shuffle, takes an optional random -number generator.Community Examples
(second xs) -Get the second element from an indexed data structure.Community Examples
(select-keys data keyz) +Get the second element from an indexed data structure.
(select-keys data keyz) -Returns new table with selected `keyz` from dictionary `data`.Community Examples
(set* tgts exprs) +Returns new table with selected `keyz` from dictionary `data`.
(set* tgts exprs) Parallel `set` function. Takes a list of targets and expressions, evaluates all the expressions, and then assigns them to the targets. Each target can be a variable -or a 2-tuple, just like in the normal `set` special form.Community Examples
(string->int str &opt base) +or a 2-tuple, just like in the normal `set` special form.
(string->int str &opt base) Parse an integer in the given base. Defaults to decimal (base 10). Differs -from scan-number in that this does not recognize floating point notation.Community Examples
(table-filter pred dict) +from scan-number in that this does not recognize floating point notation.
(table-filter pred dict) Filter a key-value structure info a table. Semantics are the same as for built-in `filter`, except that `pred` takes two arguments (key and value.) -Does not consider prototypes.Community Examples
(third xs) -Get the third element from an indexed data structure.Community Examples
(trim-prefix prefix str) +Get the third element from an indexed data structure.
(trim-prefix prefix str) -Trim the specified prefix of a string if it has oneCommunity Examples
(trim-suffix suffix str) +Trim the specified prefix of a string if it has one
(trim-suffix suffix str) -Trim the specified suffix of a string if it has oneCommunity Examples
(until cnd & body) Repeat `body` while the `cnd` is false. -Equivalent to (while (not cnd) ;body).Community Examples
(vars & bindings) -Defines many variables as in let `bindings`, but without creating new scope.Community Examples
msg/make-proto msg/make-recv msg/make-send
(make-proto stream &opt pack unpack) -Create both a send an recv function from a stream, as with `make-send` and `make-recv`.Community Examples
(make-recv stream &opt unpack) +Create both a send an recv function from a stream, as with `make-send` and `make-recv`.
(make-recv stream &opt unpack) -Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.Community Examples
(make-send stream &opt pack) +Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.
(make-send stream &opt pack) -Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.Community Examples
netrepl/client netrepl/default-host netrepl/default-port netrepl/server netrepl/server-single
(client &opt host port name) -Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".Community Examples
(server &opt host port env cleanup welcome-msg) +Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".
(server &opt host port env cleanup welcome-msg) -Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.Community Examples
(server-single &opt host port env cleanup welcome-msg) +Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.
(server-single &opt host port env cleanup welcome-msg) -Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.Community Examples
path/abspath path/abspath? path/basename path/delim path/dirname path/ext path/join path/normalize path/parts path/posix/abspath path/posix/abspath? path/posix/basename path/posix/delim path/posix/dirname path/posix/ext path/posix/join path/posix/normalize path/posix/parts path/posix/relpath path/posix/sep path/relpath path/sep path/win32/abspath path/win32/abspath? path/win32/basename path/win32/delim path/win32/dirname path/win32/ext path/win32/join path/win32/normalize path/win32/parts path/win32/relpath path/win32/sep
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(posix/relpath source target) +Get the relative path between two subpaths.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(win32/abspath path) +Get the relative path between two subpaths.
(win32/abspath path) -Coerce a path to be absolute.Community Examples
(win32/abspath? path) -Check if a path is absolute.Community Examples
(win32/basename path) -Gets the base file name of a path.Community Examples
(win32/dirname path) -Gets the directory name of a path.Community Examples
(win32/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(win32/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(win32/relpath source target) -Get the relative path between two subpaths.Community Examples
rawterm/begin rawterm/buffer-traverse rawterm/ctrl-z rawterm/end rawterm/getch rawterm/isatty rawterm/monowidth rawterm/rune-monowidth rawterm/size rawterm/slice-monowidth
(rawterm/begin &opt on-winch) -Begin raw terminal functionality. Return a stream that can be read from to get input.Community Examples
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) +Begin raw terminal functionality. Return a stream that can be read from to get input.
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) -Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.Community Examples
(rawterm/ctrl-z) +Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.
(rawterm/ctrl-z) -A handler that a user can use to handle ctrl-z from input to suspend the current process.Community Examples
(rawterm/end) +A handler that a user can use to handle ctrl-z from input to suspend the current process.
(rawterm/getch &opt into) -Get a byte of input from stdin, without blocking if possible. Returns a buffer.Community Examples
(rawterm/isatty) +Get a byte of input from stdin, without blocking if possible. Returns a buffer.
(rawterm/isatty) -Check if the current stdin is a tty.Community Examples
(rawterm/monowidth bytes &opt start-index end-index) +Check if the current stdin is a tty.
(rawterm/monowidth bytes &opt start-index end-index) -Measure the monospace width of a string.Community Examples
(rawterm/rune-monowidth rune) +Measure the monospace width of a string.
(rawterm/rune-monowidth rune) -Get the monospace width of a rune. Returns either 0, 1, or 2.Community Examples
(rawterm/size) +Get the monospace width of a rune. Returns either 0, 1, or 2.
(rawterm/size) -Get the number of rows and columns visible in the terminal as tuple [rows cols]Community Examples
(rawterm/slice-monowidth bytes columns &opt start-index into) +Get the number of rows and columns visible in the terminal as tuple [rows cols]
(rawterm/slice-monowidth bytes columns &opt start-index into) -Get a byte slice that will fit into a number of columns.Community Examples
regex/compile regex/find regex/find-all regex/match regex/peg regex/replace regex/replace-all regex/source
(compile pattern) -Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.Community Examples
(find reg text &opt start) +Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.
(find reg text &opt start) -Similar to peg/find, but for regexes.Community Examples
(find-all reg text &opt start) +Similar to peg/find, but for regexes.
(find-all reg text &opt start) -Similar to peg/find-all, but for regexes.Community Examples
(match reg text &opt start) -Similar to peg/match, but for regexes.Community Examples
Peg used to generate peg source code from a regular expression string.Community Examples
(replace reg rep text &opt start) +Similar to peg/match, but for regexes.
(replace reg rep text &opt start) -Similar to peg/replace, but for regexes.Community Examples
(replace-all reg rep text &opt start) +Similar to peg/replace, but for regexes.
(replace-all reg rep text &opt start) -Similar to peg/replace-all, but for regexes.Community Examples
(source pattern) -Compile a subset of regex to PEG source code.Community Examples
rpc/client rpc/default-host rpc/default-port rpc/server
(client &opt host port name) -Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.Community Examples
(server functions &opt host port workers-per-connection) +Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.
(server functions &opt host port workers-per-connection) -Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.Community Examples
schema/make-predicate schema/make-validator schema/predicate schema/validator
(make-predicate schema) -Generate a function that can be used to validate a data structure. This is the function form of `predicate`.Community Examples
(make-validator schema) +Generate a function that can be used to validate a data structure. This is the function form of `predicate`.
(make-validator schema) -Generate a function that can be used to validate a data structure. This is the function form of `validator`.Community Examples
(predicate pattern) +Generate a function that can be used to validate a data structure. This is the function form of `validator`.
(predicate pattern) -Make a validation predicate given a certain schema.Community Examples
(validator pattern) +Make a validation predicate given a certain schema.
(validator pattern) -Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.Community Examples
sh/copy sh/copy-file sh/create-dirs sh/devnull sh/exec-slurp sh/exec-slurp-all sh/exists? sh/list-all-files sh/make-new-file sh/rm sh/scan-directory
(copy src dest) Copy a file or directory recursively from one location to another. -Expects input to be unix style pathsCommunity Examples
(copy-file src-path dst-path) -Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.Community Examples
(create-dirs dir-path) +Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.
(create-dirs dir-path) -Create all directories in path specified as string including itself.Community Examples
(devnull) +Create all directories in path specified as string including itself.
(devnull) -get the /dev/null equivalent of the current platform as an open fileCommunity Examples
(exec-slurp & args) +get the /dev/null equivalent of the current platform as an open file
(exec-slurp & args) -Read stdout of subprocess and return it trimmed in a string.Community Examples
(exec-slurp-all & args) +Read stdout of subprocess and return it trimmed in a string.
(exec-slurp-all & args) Read stdout and stderr of subprocess and return it trimmed in a struct with :err and :out containing the output as string. -This will also return the exit code under the :status key.Community Examples
(exists? path) +This will also return the exit code under the :status key.
(exists? path) -Check if the given file or directory exists. (Follows symlinks)Community Examples
(list-all-files dir &opt into) +Check if the given file or directory exists. (Follows symlinks)
(list-all-files dir &opt into) -List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.Community Examples
(make-new-file file-path &opt mode) +List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.
(make-new-file file-path &opt mode) -Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).Community Examples
(rm path) +Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).
(rm path) -Remove a directory and all sub directories recursively.Community Examples
(scan-directory dir func) +Remove a directory and all sub directories recursively.
(scan-directory dir func) -Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.Community Examples
tarray/buffer tarray/copy-bytes tarray/length tarray/new tarray/properties tarray/slice tarray/swap-bytes
(tarray/buffer array|size) -Return typed array buffer or create a new buffer.Community Examples
(tarray/copy-bytes src sindex dst dindex &opt count) +Return typed array buffer or create a new buffer.
(tarray/copy-bytes src sindex dst dindex &opt count) -Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.Community Examples
(tarray/length array|buffer) +Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.
(tarray/length array|buffer) -Return typed array or buffer size.Community Examples
(tarray/new type size &opt stride offset tarray|buffer) +Return typed array or buffer size.
(tarray/new type size &opt stride offset tarray|buffer) -Create new typed array.Community Examples
(tarray/properties array) +Create new typed array.
(tarray/properties array) -Return typed array properties as a struct.Community Examples
(tarray/slice tarr &opt start end) +Return typed array properties as a struct.
(tarray/slice tarr &opt start end) -Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.Community Examples
(tarray/swap-bytes src sindex dst dindex &opt count) +Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.
(tarray/swap-bytes src sindex dst dindex &opt count) -Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.Community Examples
test/assert test/assert-docs test/assert-error test/assert-no-error test/assert-not test/capture-stderr test/capture-stdout test/end-suite test/start-suite test/suppress-stderr test/suppress-stdout test/timeit
(assert x &opt e) -Override's the default assert with some nice error handling.Community Examples
(assert-docs path) +Override's the default assert with some nice error handling.
(assert-docs path) Assert that all symbols, when module on the path is required, -have proper doc stringCommunity Examples
(assert-error msg & forms) -Test passes if forms error.Community Examples
(assert-no-error msg & forms) -Test passes if forms do not error.Community Examples
(capture-stderr & body) Runs the form and captures stderr. Returns tuple with result of the form -and a string with captured stderr.Community Examples
(capture-stdout & body) Runs the form and captures stdout. Returns tuple with result of the form -and a string with captured stdout.Community Examples
(end-suite) -Ends test suite, prints summary and exits if any have failed.Community Examples
(start-suite &opt name) +Ends test suite, prints summary and exits if any have failed.
(suppress-stderr & body) -Suppreses stdout from the bodyCommunity Examples
(suppress-stdout & body) -Suppreses stdout from the bodyCommunity Examples
(timeit form &opt tag) Time the execution of `form` using `os/clock` before and after, and print the result to stdout. returns: result of executing `form`. -Uses `tag` (default "Elapsed time:") to tag the printout.Community Examples
zip/add-bytes zip/add-file zip/compress zip/decompress zip/extract zip/file-directory? zip/file-encrypted? zip/file-supported? zip/get-filename zip/locate-file zip/read-bytes zip/read-file zip/reader-close zip/reader-count zip/stat zip/version zip/write-buffer zip/write-file zip/writer-close zip/writer-finalize
(zip/add-bytes writer path data &opt comment flags) -Add a byte sequence to the zip writer.Community Examples
(zip/add-file writer path filename &opt comment flags) +Add a byte sequence to the zip writer.
(zip/add-file writer path filename &opt comment flags) -Add a file to the zip writer.Community Examples
(zip/compress bytes &opt level into) -Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.Community Examples
(zip/decompress bytes &opt into) +Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.
(zip/decompress bytes &opt into) -Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.Community Examples
(zip/extract reader idx-or-filename &opt into flags) +Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.
(zip/extract reader idx-or-filename &opt into flags) -Extract a file from the zip archive, either to memory or to a file on disk.Community Examples
(zip/file-directory? reader idx) +Extract a file from the zip archive, either to memory or to a file on disk.
(zip/file-directory? reader idx) -Check if a file index is a directory.Community Examples
(zip/file-encrypted? reader idx) +Check if a file index is a directory.
(zip/file-encrypted? reader idx) -Check if a file is encrypted inside an archive.Community Examples
(zip/file-supported? reader idx) +Check if a file is encrypted inside an archive.
(zip/file-supported? reader idx) -Check if a file is supported with this verstion of miniz.Community Examples
(zip/get-filename reader idx) +Check if a file is supported with this verstion of miniz.
(zip/get-filename reader idx) -Convert a file index index in the archive to a filename.Community Examples
(zip/locate-file reader path &opt comment flags) +Convert a file index index in the archive to a filename.
(zip/locate-file reader path &opt comment flags) -Get the index of a particular filename in the archive.Community Examples
(zip/read-bytes bytes &opt flags) +Get the index of a particular filename in the archive.
(zip/read-bytes bytes &opt flags) -Read a byte sequence as a zip archive. Returns a new zip reader.Community Examples
(zip/read-file filename &opt flags) +Read a byte sequence as a zip archive. Returns a new zip reader.
(zip/read-file filename &opt flags) -Read a file as a zip archive. Returns a new zip reader.Community Examples
(zip/reader-close reader) +Read a file as a zip archive. Returns a new zip reader.
(zip/reader-close reader) -Close a reader and free related memory.Community Examples
(zip/reader-count reader) +Close a reader and free related memory.
(zip/reader-count reader) -Get the number of files inside the zip archive. The files can be indexedCommunity Examples
(zip/stat reader idx) +Get the number of files inside the zip archive. The files can be indexed
(zip/stat reader idx) Get stat information of file. Returns a new struct with the following fields: @@ -155,17 +155,17 @@Community ExamplesIndex * :comment * :internal-attr * :external-attr -
(zip/version) -Get the version string of the underlying miniz library.Community Examples
(zip/write-buffer) +Get the version string of the underlying miniz library.
(zip/write-buffer) -Create a new zip archive writer that write to memory.Community Examples
(zip/write-file dest-path) +Create a new zip archive writer that write to memory.
(zip/write-file dest-path) -Create a new zip archive writer that will write into an archive file.Community Examples
(zip/writer-close writer) +Create a new zip archive writer that will write into an archive file.
(zip/writer-finalizer writer) -Finalize a writer, writing any zip files to disk. Return the writer.Community Examples
cc/archive-c cc/compile-c cc/create-buffer-c cc/create-buffer-c-impl cc/create-executable cc/embed-name cc/entry-name cc/entry-replace cc/link-c cc/make-bin-source cc/make-define cc/make-defines cc/modpath-to-meta cc/modpath-to-static cc/out-path
(archive-c opts target & objects) -Link object files together to make a static library.Community Examples
(compile-c compiler opts src dest &opt static?) +Link object files together to make a static library.
(compile-c compiler opts src dest &opt static?) -Compile a C file into an object file.Community Examples
(create-buffer-c source dest name) +Compile a C file into an object file.
(create-buffer-c source dest name) -Inline raw byte file as a c file.Community Examples
(create-buffer-c-impl bytes dest name) +Inline raw byte file as a c file.
(create-executable opts source dest no-core) -Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.Community Examples
(embed-name path) +Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.
(embed-name path) -Rename a janet symbol for embedding.Community Examples
(entry-name name) -Name of symbol that enters static compilation of a module.Community Examples
(entry-replace name) +Name of symbol that enters static compilation of a module.
(entry-replace name) -Escape special characters in the entry-nameCommunity Examples
(link-c has-cpp opts target & objects) +Escape special characters in the entry-name
(link-c has-cpp opts target & objects) -Link C or C++ object files together to make a native module.Community Examples
(make-bin-source declarations lookup-into-invocations no-core) +Link C or C++ object files together to make a native module.
(make-bin-source declarations lookup-into-invocations no-core) -Community Examples
(make-define define value) -Generate strings for adding custom defines to the compiler.Community Examples
(make-defines defines) +Generate strings for adding custom defines to the compiler.
(make-defines defines) -Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.Community Examples
(modpath-to-meta path) +Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.
(modpath-to-meta path) -Get the meta file path (.meta.janet) corresponding to a native module path (.so).Community Examples
(modpath-to-static path) +Get the meta file path (.meta.janet) corresponding to a native module path (.so).
(modpath-to-static path) -Get the static library (.a) path corresponding to a native module path (.so).Community Examples
(out-path path from-ext to-ext) +Get the static library (.a) path corresponding to a native module path (.so).
(out-path path from-ext to-ext) -Take a source file path and convert it to an output path.Community Examples
cgen/add-loader cgen/ir cgen/mangle cgen/print-ir
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(ir & body) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(ir & body) -Macro that automatically quotes the body provided and calls (print-ir ...) on the body.Community Examples
(mangle token) +Macro that automatically quotes the body provided and calls (print-ir ...) on the body.
(mangle token) -Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.Community Examples
(print-ir ir) +Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.
(print-ir ir) -Compile the CGEN IR to C and print it to (dyn :out).Community Examples
cli/jpm cli/main cli/run cli/setup
(jpm & argv) -A Macro User Interface for jpm to be used from a repl in a way similar to the command line.Community Examples
(main & argv) +A Macro User Interface for jpm to be used from a repl in a way similar to the command line.
(setup args) Load configuration from the command line, environment variables, and configuration files. Returns array of non-configuration arguments as well. @@ -126,7 +126,7 @@Community ExamplesIndex 1. Commmand line settings 2. The value of `(dyn :jpm-config)` 3. Environment variables - 4. Config file settings (default-config if non specified)
commands/build commands/clean commands/configure commands/deps commands/enable-local-mode commands/help commands/install commands/jpm-debug-repl commands/list-installed commands/list-pkgs commands/list-rules commands/list-tasks commands/new-c-project commands/new-project commands/quickbin commands/set-tree commands/show-paths commands/show-rule-tree commands/test commands/update-pkgs
(configure &opt path) -Setup an out-of-tree build with certain configuration options.Community Examples
(deps) +Setup an out-of-tree build with certain configuration options.
(enable-local-mode) -Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/Community Examples
(help) +Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/
(new-c-project name) -Create a new C projectCommunity Examples
(set-tree tree) -Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.Community Examples
(show-paths) +Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.
config/builtin-configs config/config-checkers config/config-docs config/config-options config/config-parsers config/config-set config/defconf config/dyn:ar config/dyn:auto-shebang config/dyn:binpath config/dyn:build-type config/dyn:buildpath config/dyn:c++ config/dyn:c++-link config/dyn:cc config/dyn:cc-link config/dyn:cflags config/dyn:cflags-verbose config/dyn:config-file config/dyn:cppflags config/dyn:curlpath config/dyn:dest-dir config/dyn:dynamic-cflags config/dyn:dynamic-lflags config/dyn:gitpath config/dyn:headerpath config/dyn:is-msvc config/dyn:janet config/dyn:janet-cflags config/dyn:janet-importlib config/dyn:janet-lflags config/dyn:ldflags config/dyn:lflags config/dyn:libpath config/dyn:local config/dyn:manpath config/dyn:modext config/dyn:modpath config/dyn:nocolor config/dyn:offline config/dyn:optimize config/dyn:pkglist config/dyn:silent config/dyn:statext config/dyn:tarpath config/dyn:test config/dyn:tree config/dyn:update-pkgs config/dyn:use-batch-shell config/dyn:verbose config/dyn:workers config/load-config config/load-config-file config/load-default config/load-options config/opt config/read-env-variables config/save-config config/shorthand-mapping
Table of all built-in options, as opposed to project deifned options.Community Examples
A table of all of the dynamic config bindings to checkers (validators).Community Examples
Table of all of the help text for each config option.Community Examples
A table of possible options for enum option types.Community Examples
A table of all of the dynamic config bindings to parsers.Community Examples
(defconf kw &opt parser docs options) +config/builtin-configs config/config-checkers config/config-docs config/config-options config/config-parsers config/config-set config/defconf config/dyn:ar config/dyn:auto-shebang config/dyn:binpath config/dyn:build-type config/dyn:buildpath config/dyn:c++ config/dyn:c++-link config/dyn:cc config/dyn:cc-link config/dyn:cflags config/dyn:cflags-verbose config/dyn:config-file config/dyn:cppflags config/dyn:curlpath config/dyn:dest-dir config/dyn:dynamic-cflags config/dyn:dynamic-lflags config/dyn:gitpath config/dyn:headerpath config/dyn:is-msvc config/dyn:janet config/dyn:janet-cflags config/dyn:janet-importlib config/dyn:janet-lflags config/dyn:ldflags config/dyn:lflags config/dyn:libpath config/dyn:local config/dyn:manpath config/dyn:modext config/dyn:modpath config/dyn:nocolor config/dyn:offline config/dyn:optimize config/dyn:pkglist config/dyn:silent config/dyn:statext config/dyn:tarpath config/dyn:test config/dyn:tree config/dyn:update-pkgs config/dyn:use-batch-shell config/dyn:verbose config/dyn:workers config/load-config config/load-config-file config/load-default config/load-options config/opt config/read-env-variables config/save-config config/shorthand-mapping
config/builtin-configs table sourceTable of all built-in options, as opposed to project deifned options.config/config-checkers table sourceA table of all of the dynamic config bindings to checkers (validators).config/defconf macro source(defconf kw &opt parser docs options) -Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.Community Examplesconfig/dyn:ar function source(dyn:ar &opt dflt) +Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.config/load-config function source(load-config settings &opt override) -Load a configuration from a table or struct.Community Examplesconfig/load-config-file function source(load-config-file path &opt override) +Load a configuration from a table or struct.config/load-config-file function source(load-config-file path &opt override) -Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.Community Examplesconfig/load-default function source(load-default &opt override) +Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.config/load-default function source(load-default &opt override) -Load the default configuration.Community Examplesconfig/load-options function source(load-options &opt path) -Load a file that contains config options that can be set. If no such file exists, then do nothing.Community Examplesconfig/opt function source(opt opts key &opt dflt) +Load a file that contains config options that can be set. If no such file exists, then do nothing.config/opt function source(opt opts key &opt dflt) -Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.Community Examplesconfig/read-env-variables function source(read-env-variables) +Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.config/read-env-variables function source(read-env-variables) -Read environment variables that correspond to config variables into dyns.Community Examplesconfig/save-config function source(save-config path) +Read environment variables that correspond to config variables into dyns.config/save-config function source(save-config path) -Write the current configuration information to a file.Community Examplesconfig/shorthand-mapping struct source+Write the current configuration information to a file.Map some single characters to long options.Community Examples
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.
(pmap f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.Community Examples
jpm/cc/archive-c jpm/cc/compile-c jpm/cc/create-buffer-c jpm/cc/create-buffer-c-impl jpm/cc/create-executable jpm/cc/embed-name jpm/cc/entry-name jpm/cc/entry-replace jpm/cc/link-c jpm/cc/make-bin-source jpm/cc/make-define jpm/cc/make-defines jpm/cc/modpath-to-meta jpm/cc/modpath-to-static jpm/cc/out-path jpm/cgen/add-loader jpm/cgen/ir jpm/cgen/mangle jpm/cgen/print-ir jpm/commands/build jpm/commands/clean jpm/commands/configure jpm/commands/deps jpm/commands/enable-local-mode jpm/commands/help jpm/commands/install jpm/commands/jpm-debug-repl jpm/commands/list-installed jpm/commands/list-pkgs jpm/commands/list-rules jpm/commands/list-tasks jpm/commands/new-c-project jpm/commands/new-project jpm/commands/quickbin jpm/commands/set-tree jpm/commands/show-paths jpm/commands/show-rule-tree jpm/commands/test jpm/commands/update-pkgs jpm/config/builtin-configs jpm/config/config-checkers jpm/config/config-docs jpm/config/config-options jpm/config/config-parsers jpm/config/config-set jpm/config/defconf jpm/config/dyn:ar jpm/config/dyn:auto-shebang jpm/config/dyn:binpath jpm/config/dyn:build-type jpm/config/dyn:buildpath jpm/config/dyn:c++ jpm/config/dyn:c++-link jpm/config/dyn:cc jpm/config/dyn:cc-link jpm/config/dyn:cflags jpm/config/dyn:cflags-verbose jpm/config/dyn:config-file jpm/config/dyn:cppflags jpm/config/dyn:curlpath jpm/config/dyn:dest-dir jpm/config/dyn:dynamic-cflags jpm/config/dyn:dynamic-lflags jpm/config/dyn:gitpath jpm/config/dyn:headerpath jpm/config/dyn:is-msvc jpm/config/dyn:janet jpm/config/dyn:janet-cflags jpm/config/dyn:janet-importlib jpm/config/dyn:janet-lflags jpm/config/dyn:ldflags jpm/config/dyn:lflags jpm/config/dyn:libpath jpm/config/dyn:local jpm/config/dyn:manpath jpm/config/dyn:modext jpm/config/dyn:modpath jpm/config/dyn:nocolor jpm/config/dyn:offline jpm/config/dyn:optimize jpm/config/dyn:pkglist jpm/config/dyn:silent jpm/config/dyn:statext jpm/config/dyn:tarpath jpm/config/dyn:test jpm/config/dyn:tree jpm/config/dyn:update-pkgs jpm/config/dyn:use-batch-shell jpm/config/dyn:verbose jpm/config/dyn:workers jpm/config/load-config jpm/config/load-config-file jpm/config/load-default jpm/config/load-options jpm/config/opt jpm/config/read-env-variables jpm/config/save-config jpm/config/shorthand-mapping jpm/dagbuild/pdag jpm/dagbuild/pmap jpm/make-config/auto jpm/make-config/generate-config jpm/pm/bundle-install jpm/pm/curl jpm/pm/do-rule jpm/pm/download-bundle jpm/pm/download-git-bundle jpm/pm/download-tar-bundle jpm/pm/git jpm/pm/import-rules jpm/pm/load-lockfile jpm/pm/load-project-meta jpm/pm/make-jpm-env jpm/pm/make-lockfile jpm/pm/out-of-tree-config jpm/pm/post-deps jpm/pm/require-jpm jpm/pm/resolve-bundle jpm/pm/tar jpm/pm/update-git-bundle jpm/pm/update-installed jpm/rules/add-body jpm/rules/add-dep jpm/rules/add-input jpm/rules/add-output jpm/rules/add-thunk jpm/rules/build-rules jpm/rules/getrules jpm/rules/phony jpm/rules/rule jpm/rules/sh-phony jpm/rules/sh-rule jpm/rules/sh-task jpm/rules/task jpm/scaffold/scaffold-project jpm/shutil/abspath jpm/shutil/basename jpm/shutil/clear-cache jpm/shutil/clear-manifest jpm/shutil/clexe-shell jpm/shutil/copy jpm/shutil/copyfile jpm/shutil/create-dirs jpm/shutil/devnull jpm/shutil/dirname jpm/shutil/drop1-shell jpm/shutil/exec-slurp jpm/shutil/filepath-replace jpm/shutil/find-build-dir jpm/shutil/find-cache jpm/shutil/find-manifest jpm/shutil/find-manifest-dir jpm/shutil/is-mingw jpm/shutil/is-win jpm/shutil/is-win-or-mingw jpm/shutil/path-splitter jpm/shutil/rimraf jpm/shutil/rm jpm/shutil/shell
(archive-c opts target & objects) -Link object files together to make a static library.Community Examples
(compile-c compiler opts src dest &opt static?) +Link object files together to make a static library.
(compile-c compiler opts src dest &opt static?) -Compile a C file into an object file.Community Examples
(create-buffer-c source dest name) +Compile a C file into an object file.
(create-buffer-c source dest name) -Inline raw byte file as a c file.Community Examples
(create-buffer-c-impl bytes dest name) +Inline raw byte file as a c file.
(create-buffer-c-impl bytes dest name) -Community Examples
(create-executable opts source dest no-core) -Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.Community Examples
(embed-name path) +Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.
(embed-name path) -Rename a janet symbol for embedding.Community Examples
(entry-name name) -Name of symbol that enters static compilation of a module.Community Examples
(entry-replace name) +Name of symbol that enters static compilation of a module.
(entry-replace name) -Escape special characters in the entry-nameCommunity Examples
(link-c has-cpp opts target & objects) +Escape special characters in the entry-name
(link-c has-cpp opts target & objects) -Link C or C++ object files together to make a native module.Community Examples
(make-bin-source declarations lookup-into-invocations no-core) +Link C or C++ object files together to make a native module.
(make-bin-source declarations lookup-into-invocations no-core) -Community Examples
(make-define define value) -Generate strings for adding custom defines to the compiler.Community Examples
(make-defines defines) +Generate strings for adding custom defines to the compiler.
(make-defines defines) -Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.Community Examples
(modpath-to-meta path) +Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.
(modpath-to-meta path) -Get the meta file path (.meta.janet) corresponding to a native module path (.so).Community Examples
(modpath-to-static path) +Get the meta file path (.meta.janet) corresponding to a native module path (.so).
(modpath-to-static path) -Get the static library (.a) path corresponding to a native module path (.so).Community Examples
(out-path path from-ext to-ext) +Get the static library (.a) path corresponding to a native module path (.so).
(out-path path from-ext to-ext) -Take a source file path and convert it to an output path.Community Examples
(add-loader) +Take a source file path and convert it to an output path.
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(ir & body) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(ir & body) -Macro that automatically quotes the body provided and calls (print-ir ...) on the body.Community Examples
(mangle token) +Macro that automatically quotes the body provided and calls (print-ir ...) on the body.
(mangle token) -Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.Community Examples
(print-ir ir) +Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.
(print-ir ir) -Compile the CGEN IR to C and print it to (dyn :out).Community Examples
(configure &opt path) -Setup an out-of-tree build with certain configuration options.Community Examples
(deps) +Setup an out-of-tree build with certain configuration options.
(enable-local-mode) -Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/Community Examples
(help) +Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/
(new-c-project name) -Create a new C projectCommunity Examples
(set-tree tree) -Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.Community Examples
(show-paths) +Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.
Table of all built-in options, as opposed to project deifned options.Community Examples
A table of all of the dynamic config bindings to checkers (validators).Community Examples
Table of all of the help text for each config option.Community Examples
A table of possible options for enum option types.Community Examples
A table of all of the dynamic config bindings to parsers.Community Examples
Table of all built-in options, as opposed to project deifned options.
A table of all of the dynamic config bindings to checkers (validators).
(defconf kw &opt parser docs options) -Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.Community Examples
(dyn:ar &opt dflt) +Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.
(load-config settings &opt override) -Load a configuration from a table or struct.Community Examples
(load-config-file path &opt override) +Load a configuration from a table or struct.
(load-config-file path &opt override) -Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.Community Examples
(load-default &opt override) +Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.
(load-default &opt override) -Load the default configuration.Community Examples
(load-options &opt path) -Load a file that contains config options that can be set. If no such file exists, then do nothing.Community Examples
(opt opts key &opt dflt) +Load a file that contains config options that can be set. If no such file exists, then do nothing.
(opt opts key &opt dflt) -Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.Community Examples
(read-env-variables) +Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.
(read-env-variables) -Read environment variables that correspond to config variables into dyns.Community Examples
(save-config path) +Read environment variables that correspond to config variables into dyns.
(save-config path) -Write the current configuration information to a file.Community Examples
Map some single characters to long options.Community Examples
(pdag f dag &opt n-workers) +Write the current configuration information to a file.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.
(pmap f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.Community Examples
(auto) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.
(generate-config &opt destdir silent as-data) +Get an autodetected config.
(generate-config &opt destdir silent as-data) -Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.Community Examples
(bundle-install bundle &opt no-deps) +Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.
(bundle-install bundle &opt no-deps) -Install a bundle from a git repository.Community Examples
(do-rule target) -Evaluate a given rule in a one-off manner.Community Examples
(download-bundle url bundle-type &opt tag shallow) +Evaluate a given rule in a one-off manner.
(download-bundle url bundle-type &opt tag shallow) -Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.Community Examples
(download-git-bundle bundle-dir url tag shallow) +Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.
(download-git-bundle bundle-dir url tag shallow) -Download a git bundle from a remote respositoryCommunity Examples
(download-tar-bundle bundle-dir url &opt force-gz) +Download a git bundle from a remote respository
(download-tar-bundle bundle-dir url &opt force-gz) -Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.Community Examples
(git & args) +Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.
(import-rules path &opt base-env) -Import another file that defines more rules. This ruleset is merged into the current ruleset.Community Examples
(load-lockfile &opt filename) +Import another file that defines more rules. This ruleset is merged into the current ruleset.
(load-lockfile &opt filename) -Load packages from a lockfile.Community Examples
(load-project-meta &opt path) +Load packages from a lockfile.
(load-project-meta &opt path) -Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.Community Examples
(make-jpm-env &opt base-env) +Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.
(make-jpm-env &opt base-env) -Create an environment that is preloaded with jpm symbols.Community Examples
(make-lockfile &opt filename) +Create an environment that is preloaded with jpm symbols.
(out-of-tree-config path &opt options) -Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.Community Examples
(post-deps & body) +Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.
(post-deps & body) -Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.Community Examples
(require-jpm path &opt base-env) +Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.
(require-jpm path &opt base-env) -Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.Community Examples
(resolve-bundle bundle) +Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.
(resolve-bundle bundle) -Convert any bundle string/table to the normalized table form.Community Examples
(tar & args) +Convert any bundle string/table to the normalized table form.
(update-git-bundle bundle-dir tag shallow) +Make a call to tar.
(update-git-bundle bundle-dir tag shallow) -Fetch latest tag version from remote repositoryCommunity Examples
(update-installed) +Fetch latest tag version from remote repository
(update-installed) -Update all previously installed packages to their latest versions.Community Examples
(add-body target & body) +Update all previously installed packages to their latest versions.
(add-body target & body) -Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.Community Examples
(add-dep target dep) +Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.
(add-input target input) -Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.Community Examples
(add-output target output) +Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.
(add-output target output) -Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.Community Examples
(add-thunk target thunk) +Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.
(add-thunk target thunk) -Append a thunk to a target's recipe.Community Examples
(build-rules rules targets &opt n-workers) +Append a thunk to a target's recipe.
(build-rules rules targets &opt n-workers) -Given a graph of all rules, extract a work graph that will build out-of-date files.Community Examples
(getrules) +Given a graph of all rules, extract a work graph that will build out-of-date files.
(rule target deps & body) -Add a rule to the rule graph.Community Examples
(sh-phony target deps & body) -Alias for `sh-task`.Community Examples
(sh-rule target deps & body) -Add a rule that invokes a shell command, and fails if the command returns non-zero.Community Examples
(sh-task target deps & body) +Add a rule that invokes a shell command, and fails if the command returns non-zero.
(sh-task target deps & body) -Add a task that invokes a shell command, and fails if the command returns non-zero.Community Examples
(task target deps & body) +Add a task that invokes a shell command, and fails if the command returns non-zero.
(task target deps & body) -Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).Community Examples
(scaffold-project name &opt options) +Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).
(scaffold-project name &opt options) -Generate a standardized project scaffold.Community Examples
(abspath path) -Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).Community Examples
(basename path) +Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).
(basename path) -Get the filename of a path without any leading directory components.Community Examples
(clear-cache) +Get the filename of a path without any leading directory components.
(clear-manifest) -Clear the global installation manifest.Community Examples
(clexe-shell & args) +Clear the global installation manifest.
(copy src dest) -Copy a file or directory recursively from one location to another.Community Examples
(copyfile src dest) +Copy a file or directory recursively from one location to another.
(copyfile src dest) -Copy a file one location to another.Community Examples
(create-dirs dest) -Create all directories needed for a file (mkdir -p).Community Examples
(dirname path) -Get the directory of a file without the filename.Community Examples
(drop1-shell std args) +Get the directory of a file without the filename.
(drop1-shell std args) -Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.Community Examples
(exec-slurp & args) +Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.
(exec-slurp & args) -Read stdout of subprocess and return it trimmed in a string.Community Examples
(filepath-replace repo) +Read stdout of subprocess and return it trimmed in a string.
(filepath-replace repo) -Remove special characters from a string or path to make it into a path segment.Community Examples
(find-build-dir) +Remove special characters from a string or path to make it into a path segment.
(find-build-dir) -Gets the build directory to output files to.Community Examples
(find-cache) -Return the path to the global cache.Community Examples
(find-manifest name) -Get the full path of a manifest file given a package name.Community Examples
(find-manifest-dir) +Get the full path of a manifest file given a package name.
(find-manifest-dir) -Get the path to the directory containing manifests for installed packages.Community Examples
(is-mingw) +Get the path to the directory containing manifests for installed packages.
(is-win) -Check if we should assume a DOS-like shell or default to posix shell.Community Examples
(is-win-or-mingw) +Check if we should assume a DOS-like shell or default to posix shell.
(is-win-or-mingw) -Check if built with mingwCommunity Examples
(rm path) -Remove a directory and all sub directories.Community Examples
make-config/auto make-config/generate-config
(generate-config &opt destdir silent as-data) +Get an autodetected config.
(generate-config &opt destdir silent as-data) -Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.Community Examples
pm/bundle-install pm/curl pm/do-rule pm/download-bundle pm/download-git-bundle pm/download-tar-bundle pm/git pm/import-rules pm/load-lockfile pm/load-project-meta pm/make-jpm-env pm/make-lockfile pm/out-of-tree-config pm/post-deps pm/require-jpm pm/resolve-bundle pm/tar pm/update-git-bundle pm/update-installed
(bundle-install bundle &opt no-deps) -Install a bundle from a git repository.Community Examples
(do-rule target) -Evaluate a given rule in a one-off manner.Community Examples
(download-bundle url bundle-type &opt tag shallow) +Evaluate a given rule in a one-off manner.
(download-bundle url bundle-type &opt tag shallow) -Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.Community Examples
(download-git-bundle bundle-dir url tag shallow) +Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.
(download-git-bundle bundle-dir url tag shallow) -Download a git bundle from a remote respositoryCommunity Examples
(download-tar-bundle bundle-dir url &opt force-gz) +Download a git bundle from a remote respository
(download-tar-bundle bundle-dir url &opt force-gz) -Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.Community Examples
(git & args) +Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.
(import-rules path &opt base-env) -Import another file that defines more rules. This ruleset is merged into the current ruleset.Community Examples
(load-lockfile &opt filename) +Import another file that defines more rules. This ruleset is merged into the current ruleset.
(load-lockfile &opt filename) -Load packages from a lockfile.Community Examples
(load-project-meta &opt path) -Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.Community Examples
(make-jpm-env &opt base-env) +Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.
(make-jpm-env &opt base-env) -Create an environment that is preloaded with jpm symbols.Community Examples
(make-lockfile &opt filename) +Create an environment that is preloaded with jpm symbols.
(out-of-tree-config path &opt options) -Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.Community Examples
(post-deps & body) +Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.
(post-deps & body) -Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.Community Examples
(require-jpm path &opt base-env) +Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.
(require-jpm path &opt base-env) -Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.Community Examples
(resolve-bundle bundle) +Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.
(resolve-bundle bundle) -Convert any bundle string/table to the normalized table form.Community Examples
(update-git-bundle bundle-dir tag shallow) +Make a call to tar.
(update-git-bundle bundle-dir tag shallow) -Fetch latest tag version from remote repositoryCommunity Examples
(update-installed) +Fetch latest tag version from remote repository
(update-installed) -Update all previously installed packages to their latest versions.Community Examples
rules/add-body rules/add-dep rules/add-input rules/add-output rules/add-thunk rules/build-rules rules/getrules rules/phony rules/rule rules/sh-phony rules/sh-rule rules/sh-task rules/task
(add-body target & body) -Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.Community Examples
(add-dep target dep) +Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.
(add-input target input) -Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.Community Examples
(add-output target output) +Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.
(add-output target output) -Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.Community Examples
(add-thunk target thunk) +Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.
(add-thunk target thunk) -Append a thunk to a target's recipe.Community Examples
(build-rules rules targets &opt n-workers) +Append a thunk to a target's recipe.
(build-rules rules targets &opt n-workers) -Given a graph of all rules, extract a work graph that will build out-of-date files.Community Examples
(getrules) +Given a graph of all rules, extract a work graph that will build out-of-date files.
(sh-rule target deps & body) -Add a rule that invokes a shell command, and fails if the command returns non-zero.Community Examples
(sh-task target deps & body) +Add a rule that invokes a shell command, and fails if the command returns non-zero.
(sh-task target deps & body) -Add a task that invokes a shell command, and fails if the command returns non-zero.Community Examples
(task target deps & body) +Add a task that invokes a shell command, and fails if the command returns non-zero.
(task target deps & body) -Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).Community Examples
(scaffold-project name &opt options) -Generate a standardized project scaffold.Community Examples
shutil/abspath shutil/basename shutil/clear-cache shutil/clear-manifest shutil/clexe-shell shutil/copy shutil/copyfile shutil/create-dirs shutil/devnull shutil/dirname shutil/drop1-shell shutil/exec-slurp shutil/filepath-replace shutil/find-build-dir shutil/find-cache shutil/find-manifest shutil/find-manifest-dir shutil/is-mingw shutil/is-win shutil/is-win-or-mingw shutil/path-splitter shutil/rimraf shutil/rm shutil/shell
(abspath path) -Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).Community Examples
(basename path) +Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).
(basename path) -Get the filename of a path without any leading directory components.Community Examples
(clear-cache) +Get the filename of a path without any leading directory components.
(clear-manifest) -Clear the global installation manifest.Community Examples
(copy src dest) -Copy a file or directory recursively from one location to another.Community Examples
(copyfile src dest) +Copy a file or directory recursively from one location to another.
(copyfile src dest) -Copy a file one location to another.Community Examples
(create-dirs dest) -Create all directories needed for a file (mkdir -p).Community Examples
(dirname path) -Get the directory of a file without the filename.Community Examples
(drop1-shell std args) +Get the directory of a file without the filename.
(drop1-shell std args) -Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.Community Examples
(exec-slurp & args) +Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.
(exec-slurp & args) -Read stdout of subprocess and return it trimmed in a string.Community Examples
(filepath-replace repo) +Read stdout of subprocess and return it trimmed in a string.
(filepath-replace repo) -Remove special characters from a string or path to make it into a path segment.Community Examples
(find-build-dir) +Remove special characters from a string or path to make it into a path segment.
(find-build-dir) -Gets the build directory to output files to.Community Examples
(find-cache) -Return the path to the global cache.Community Examples
(find-manifest name) -Get the full path of a manifest file given a package name.Community Examples
(find-manifest-dir) +Get the full path of a manifest file given a package name.
(find-manifest-dir) -Get the path to the directory containing manifests for installed packages.Community Examples
(is-mingw) +Get the path to the directory containing manifests for installed packages.
(is-win) -Check if we should assume a DOS-like shell or default to posix shell.Community Examples
(is-win-or-mingw) +Check if we should assume a DOS-like shell or default to posix shell.
(is-win-or-mingw) -Check if built with mingwCommunity Examples
(decode s) Converts a base64 encoded string to its binary representation of any format -(UTF-8, binary, ..).Community Examples
(encode s) -Converts a string of any format (UTF-8, binary, ..) to base64 encoding.Community Examples
crc/make-variant crc/named-variant
(crc/make-variant size polynomial &opt init byte-flip xorout) -Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.Community Examples
(crc/named-variant name) +Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.
(crc/named-variant name) -Get a named CRC variant.Community Examples
cron/check cron/next-timestamp cron/parse-cron
(check cron &opt time local) -Check if a given time matches a cron specifier.Community Examples
(next-timestamp cron &opt time local) +Check if a given time matches a cron specifier.
(next-timestamp cron &opt time local) -Given a cron schedule, get the next instance on the cron tab after timeCommunity Examples
(parse-cron str) +Given a cron schedule, get the next instance on the cron tab after time
(parse-cron str) -Parse a cron string into a valid cron schedule objectCommunity Examples
ev-utils/go-nursery ev-utils/join-nursery ev-utils/multithread-service ev-utils/nursery ev-utils/pcall ev-utils/pdag ev-utils/pmap ev-utils/pmap-full ev-utils/pmap-limited ev-utils/spawn-nursery ev-utils/wait-cancel
(go-nursery nurse f &opt value) -Spawn a fiber into a nursery, similar to ev/go.Community Examples
(join-nursery nurse) +Spawn a fiber into a nursery, similar to ev/go.
(join-nursery nurse) -Suspend the current fiber until the nursery is emptied.Community Examples
(multithread-service thread-main n-threads) +Suspend the current fiber until the nursery is emptied.
(multithread-service thread-main n-threads) -Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.Community Examples
(nursery) +Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.
(nursery) -Group a number of fibers into a single object for structured concurrencyCommunity Examples
(pcall f n) +Group a number of fibers into a single object for structured concurrency
(pcall f n) -Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.Community Examples
(pdag f dag &opt n-workers) +Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data &opt n-workers) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.
(pmap f data &opt n-workers) -Map `f` over data in parallel, optionally limiting parallelism to `n` workers.Community Examples
(pmap-full f data) +Map `f` over data in parallel, optionally limiting parallelism to `n` workers.
(pmap-full f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.Community Examples
(pmap-limited f data n-workers) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.
(pmap-limited f data n-workers) -Similar to pmap-full, but only runs work n-ways parallel.Community Examples
(spawn-nursery nurse & body) +Similar to pmap-full, but only runs work n-ways parallel.
(spawn-nursery nurse & body) -Similar to ev/spawn but associate spawned fibers with a nurseryCommunity Examples
(wait-cancel & body) +Similar to ev/spawn but associate spawned fibers with a nursery
(wait-cancel & body) -Wait forever until the current fiber is canceled, and then run some cleanup code.Community Examples
fmt/format fmt/format-file fmt/format-print
(format source) -Format a string of source code to a buffer.Community Examples
(format-print source) -Format a string of source code and print the result.Community Examples
generators/concat generators/cycle generators/drop generators/drop-until generators/drop-while generators/filter generators/from-iterable generators/map generators/mapcat generators/range generators/run generators/take generators/take-until generators/take-while generators/to-array
(concat & xs) -Concatenate one or more generators or iterables into a single generator.Community Examples
(cycle ds) +Concatenate one or more generators or iterables into a single generator.
(cycle ds) -Repeatedly yield the elements of `ds`, looping back to the beginning when finished.Community Examples
(drop n ds) +Repeatedly yield the elements of `ds`, looping back to the beginning when finished.
(drop-until p ds) -Drop elements from `ds` until `p` is true.Community Examples
(drop-while p ds) -Drop elements from `ds` while `p` is true.Community Examples
(filter p ds) -Create a generator that filters `ds` with `p`.Community Examples
(from-iterable ds) +Create a generator that filters `ds` with `p`.
(from-iterable ds) -Create a new generator around any iterable data structure.Community Examples
(map f ds) +Create a new generator around any iterable data structure.
(map f ds) -Create a generator that maps `f` over `ds`.Community Examples
(mapcat f ds) -Map `f` over `ds`, concatenating the results into a new generator.Community Examples
(range from to) +Map `f` over `ds`, concatenating the results into a new generator.
(take n ds) -Take `n` elements from iterable `ds`.Community Examples
(take-until p ds) -Return elements from `ds` until `p` is true.Community Examples
(take-while p ds) +Return elements from `ds` until `p` is true.
(take-while p ds) -Return elements from `ds` while `p` is true.Community Examples
getline/default-autocomplete-context getline/default-autocomplete-options getline/default-doc-fetch getline/make-getline getline/max-history
(default-autocomplete-context buf pos) -Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.Community Examples
(default-autocomplete-options prefix &) +Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.
(default-autocomplete-options prefix &) -Default handler to get available autocomplete options for a given substring.Community Examples
(default-doc-fetch sym w &) +Default handler to get available autocomplete options for a given substring.
(default-doc-fetch sym w &) -Default handler for Ctrl-G to lookup docstrings in the current environment.Community Examples
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) +Default handler for Ctrl-G to lookup docstrings in the current environment.
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) -Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.Community Examples
htmlgen/doctype-html htmlgen/escape htmlgen/html htmlgen/raw
(escape x) +htmlgen/doctype-html htmlgen/escape htmlgen/html htmlgen/raw
htmlgen/html function source(html data &opt buf) -Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.Community Exampleshtmlgen/raw function source(raw text) +Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.htmlgen/raw function source+Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.(raw text) -Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.Community Examples
http/cookie-grammar http/cookies http/logger http/middleware http/query-string-grammar http/read-body http/read-request http/read-response http/request http/request-peg http/response-peg http/router http/send-response http/server http/server-handler http/status-messages http/url-grammar
Grammar to parse a cookie header to a series of keys and values.Community Examples
(cookies nextmw) +http/cookie-grammar http/cookies http/logger http/middleware http/query-string-grammar http/read-body http/read-request http/read-response http/request http/request-peg http/response-peg http/router http/send-response http/server http/server-handler http/status-messages http/url-grammar
http/cookie-grammar core/peg sourceGrammar to parse a cookie header to a series of keys and values.http/cookies function source(cookies nextmw) -Parses cookies into the table under :cookies keyCommunity Exampleshttp/logger function source(logger nextmw) -Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.Community Exampleshttp/middleware function source(middleware x) +Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.http/middleware function source(middleware x) -Coerce any type to http middlewareCommunity Exampleshttp/query-string-grammar core/peg sourceGrammar that parses a query string (sans url path and ? character) and returns a table.Community Exampleshttp/query-string-grammar core/peg sourceGrammar that parses a query string (sans url path and ? character) and returns a table.http/read-body function source(read-body req) -Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.Community Exampleshttp/read-request function source(read-request conn buf &opt no-query) +Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.http/read-request function source(read-request conn buf &opt no-query) -Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Exampleshttp/read-response function source(read-response conn buf) +Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`http/read-response function source(read-response conn buf) -Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Exampleshttp/request function source(request method url &keys {:headers headers :body body}) +Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`http/request function source(request method url &keys {:headers headers :body body}) -Make an HTTP request to a server. Returns a table contain response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.Community Exampleshttp/router function source(router routes) +Make an HTTP request to a server. Returns a table contain response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.http/router function source(router routes) -Creates a router middleware. A router will dispatch to different routes based on the URL path.Community Exampleshttp/send-response function source(send-response conn response &opt buf) +Creates a router middleware. A router will dispatch to different routes based on the URL path.http/send-response function source(send-response conn response &opt buf) -Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.Community Exampleshttp/server function source(server handler &opt host port) +Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.http/server function source(server handler &opt host port) -Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.Community Exampleshttp/server-handler function source(server-handler conn handler) +Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.http/server-handler function source(server-handler conn handler) -A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Community Exampleshttp/status-messages struct sourceMapping of HTTP status codes to their status message.Community Exampleshttp/url-grammar core/peg source+A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.Community Examples
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.
httpf/add-bindings-as-routes httpf/add-route httpf/default-payload-wrapper httpf/listen httpf/server
(add-bindings-as-routes server &opt env) -Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.Community Examples
(add-route server path docstring schema handler &opt read-mime render-mime) +Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.
(add-route server path docstring schema handler &opt read-mime render-mime) -Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.Community Examples
(default-payload-wrapper payload) +Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.
(default-payload-wrapper payload) -Add some metadata to all responsesCommunity Examples
(listen server &opt host port n-workers) +Add some metadata to all responses
(listen server &opt host port n-workers) -Start serverCommunity Examples
(decode s) Converts a base64 encoded string to its binary representation of any format -(UTF-8, binary, ..).Community Examples
(encode s) -Converts a string of any format (UTF-8, binary, ..) to base64 encoding.Community Examples
(crc/make-variant size polynomial &opt init byte-flip xorout) +Converts a string of any format (UTF-8, binary, ..) to base64 encoding.
(crc/make-variant size polynomial &opt init byte-flip xorout) -Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.Community Examples
(crc/named-variant name) +Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.
(crc/named-variant name) -Get a named CRC variant.Community Examples
(check cron &opt time local) -Check if a given time matches a cron specifier.Community Examples
(next-timestamp cron &opt time local) +Check if a given time matches a cron specifier.
(next-timestamp cron &opt time local) -Given a cron schedule, get the next instance on the cron tab after timeCommunity Examples
(parse-cron str) +Given a cron schedule, get the next instance on the cron tab after time
(parse-cron str) -Parse a cron string into a valid cron schedule objectCommunity Examples
(go-nursery nurse f &opt value) +Parse a cron string into a valid cron schedule object
(go-nursery nurse f &opt value) -Spawn a fiber into a nursery, similar to ev/go.Community Examples
(join-nursery nurse) +Spawn a fiber into a nursery, similar to ev/go.
(join-nursery nurse) -Suspend the current fiber until the nursery is emptied.Community Examples
(multithread-service thread-main n-threads) +Suspend the current fiber until the nursery is emptied.
(multithread-service thread-main n-threads) -Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.Community Examples
(nursery) +Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.
(nursery) -Group a number of fibers into a single object for structured concurrencyCommunity Examples
(pcall f n) +Group a number of fibers into a single object for structured concurrency
(pcall f n) -Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.Community Examples
(pdag f dag &opt n-workers) +Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data &opt n-workers) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.
(pmap f data &opt n-workers) -Map `f` over data in parallel, optionally limiting parallelism to `n` workers.Community Examples
(pmap-full f data) +Map `f` over data in parallel, optionally limiting parallelism to `n` workers.
(pmap-full f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.Community Examples
(pmap-limited f data n-workers) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.
(pmap-limited f data n-workers) -Similar to pmap-full, but only runs work n-ways parallel.Community Examples
(spawn-nursery nurse & body) +Similar to pmap-full, but only runs work n-ways parallel.
(spawn-nursery nurse & body) -Similar to ev/spawn but associate spawned fibers with a nurseryCommunity Examples
(wait-cancel & body) +Similar to ev/spawn but associate spawned fibers with a nursery
(wait-cancel & body) -Wait forever until the current fiber is canceled, and then run some cleanup code.Community Examples
(format source) +Wait forever until the current fiber is canceled, and then run some cleanup code.
(format source) -Format a string of source code to a buffer.Community Examples
(format-file file) +Format a string of source code to a buffer.
(format-print source) -Format a string of source code and print the result.Community Examples
(concat & xs) +Format a string of source code and print the result.
(concat & xs) -Concatenate one or more generators or iterables into a single generator.Community Examples
(cycle ds) +Concatenate one or more generators or iterables into a single generator.
(cycle ds) -Repeatedly yield the elements of `ds`, looping back to the beginning when finished.Community Examples
(drop n ds) +Repeatedly yield the elements of `ds`, looping back to the beginning when finished.
(drop-until p ds) -Drop elements from `ds` until `p` is true.Community Examples
(drop-while p ds) +Drop elements from `ds` until `p` is true.
(drop-while p ds) -Drop elements from `ds` while `p` is true.Community Examples
(filter p ds) -Create a generator that filters `ds` with `p`.Community Examples
(from-iterable ds) +Create a generator that filters `ds` with `p`.
(from-iterable ds) -Create a new generator around any iterable data structure.Community Examples
(map f ds) +Create a new generator around any iterable data structure.
(map f ds) -Create a generator that maps `f` over `ds`.Community Examples
(mapcat f ds) -Map `f` over `ds`, concatenating the results into a new generator.Community Examples
(range from to) +Map `f` over `ds`, concatenating the results into a new generator.
(take n ds) -Take `n` elements from iterable `ds`.Community Examples
(take-until p ds) +Take `n` elements from iterable `ds`.
(take-until p ds) -Return elements from `ds` until `p` is true.Community Examples
(take-while p ds) +Return elements from `ds` until `p` is true.
(take-while p ds) -Return elements from `ds` while `p` is true.Community Examples
(to-array s) +Return elements from `ds` while `p` is true.
(to-array s) -Consume `s` into a new array.Community Examples
(default-autocomplete-context buf pos) +Consume `s` into a new array.
(default-autocomplete-context buf pos) -Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.Community Examples
(default-autocomplete-options prefix &) +Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.
(default-autocomplete-options prefix &) -Default handler to get available autocomplete options for a given substring.Community Examples
(default-doc-fetch sym w &) +Default handler to get available autocomplete options for a given substring.
(default-doc-fetch sym w &) -Default handler for Ctrl-G to lookup docstrings in the current environment.Community Examples
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) +Default handler for Ctrl-G to lookup docstrings in the current environment.
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) -Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.Community Examples
(escape x) +Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.
(escape x) -Escape characters in a string for HTMLCommunity Examples
(html data &opt buf) -Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.Community Examples
(raw text) +Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.
(raw text) -Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.Community Examples
Grammar to parse a cookie header to a series of keys and values.Community Examples
(cookies nextmw) +Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.
Grammar to parse a cookie header to a series of keys and values.
(cookies nextmw) -Parses cookies into the table under :cookies keyCommunity Examples
(logger nextmw) -Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.Community Examples
(middleware x) +Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.
(middleware x) -Coerce any type to http middlewareCommunity Examples
Grammar that parses a query string (sans url path and ? character) and returns a table.Community Examples
Grammar that parses a query string (sans url path and ? character) and returns a table.
(read-body req) -Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.Community Examples
(read-request conn buf &opt no-query) +Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.
(read-request conn buf &opt no-query) -Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Examples
(read-response conn buf) +Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`
(read-response conn buf) -Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Examples
(request method url &keys {:headers headers :body body}) +Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`
(request method url &keys {:headers headers :body body}) -Make an HTTP request to a server. Returns a table contain response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.Community Examples
(router routes) +Make an HTTP request to a server. Returns a table contain response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.
(router routes) -Creates a router middleware. A router will dispatch to different routes based on the URL path.Community Examples
(send-response conn response &opt buf) +Creates a router middleware. A router will dispatch to different routes based on the URL path.
(send-response conn response &opt buf) -Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.Community Examples
(server handler &opt host port) +Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.
(server handler &opt host port) -Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.Community Examples
(server-handler conn handler) +Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.
(server-handler conn handler) -A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Community Examples
Mapping of HTTP status codes to their status message.Community Examples
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.Community Examples
(add-bindings-as-routes server &opt env) +A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.
(add-bindings-as-routes server &opt env) -Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.Community Examples
(add-route server path docstring schema handler &opt read-mime render-mime) +Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.
(add-route server path docstring schema handler &opt read-mime render-mime) -Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.Community Examples
(default-payload-wrapper payload) +Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.
(default-payload-wrapper payload) -Add some metadata to all responsesCommunity Examples
(listen server &opt host port n-workers) +Add some metadata to all responses
(listen server &opt host port n-workers) -Start serverCommunity Examples
(json/decode json-source &opt keywords nils) +Create a new server.
(json/decode json-source &opt keywords nils) -Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.Community Examples
(json/encode x &opt tab newline buf) +Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.
(json/encode x &opt tab newline buf) -Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.Community Examples
Dynamic binding to front matter after parsing, compilation, and evaluation, of markup completes.Community Examples
The htmlgen source that can be used to generate a document with htmlgen/html.Community Examples
(add-loader) +Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.
Dynamic binding to front matter after parsing, compilation, and evaluation, of markup completes.
The htmlgen source that can be used to generate a document with htmlgen/html.
(add-loader) -Allow importing and requiring markup as a moduleCommunity Examples
(anchor name & content) +Allow importing and requiring markup as a module
(anchor name & content) -Create an in-page anchor for a local link.Community Examples
(bigger content) -Make span element with bigger fontCommunity Examples
(blockquote content) -Make a block quote elementCommunity Examples
(code content) -Make code element with class mendoza-codeCommunity Examples
(codeblock lang &opt source) +Make code element with class mendoza-code
(codeblock lang &opt source) -Inline code or codeblockCommunity Examples
Make a div element
Make a em element
Make a li element
(markup source &opt env where) -Parse mendoza markup and evaluate it returning an htmlgen document tree.Community Examples
(mdz-loader path &) +Parse mendoza markup and evaluate it returning an htmlgen document tree.
(mdz-loader path &) -Loader for the mdz formatCommunity Examples
Make a ol element
Make a p element
Make a pre element
(section name content) -Create a section. Usually used to embed different parts of the content document into different parts of the main page.Community Examples
(smaller content) +Create a section. Usually used to embed different parts of the content document into different parts of the main page.
(smaller content) -Make span element with smaller fontCommunity Examples
Make a strong element
Make a sub element
Make a sup element
(tag name content) -Wrap some content in an html tag. If you need attributes or other properties, you may want to use raw HTML via the html function.Community Examples
(always x) +Wrap some content in an html tag. If you need attributes or other properties, you may want to use raw HTML via the html function.
Make a td element
Make a th element
Make a tr element
Make a u element
Make a ul element
(always x) -Return a function that discards any arguments and always returns `x`.Community Examples
(antepenultimate xs) +Return a function that discards any arguments and always returns `x`.
(antepenultimate xs) -Get the third-to-last element from an indexed data structure.Community Examples
(caperr & body) +Get the third-to-last element from an indexed data structure.
(caperr & body) Captures the standart error output of the variadic `body` and returns it -as a buffer.Community Examples
(capout & body) Captures the standart output of the variadic `body` and returns it as -a buffer.Community Examples
(cond-> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs with condition and operation to which the `val`, is put as first argument. All conditions are tried and for truthy conditions the operation is executed. -Returns the value mutated if any condition is truthy.Community Examples
(cond->> val & clauses) +Returns the value mutated if any condition is truthy.
(cond->> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs of condition and operation to which the `val`, is put as last argument. All conditions are tried and for truthy the operation is ran. -Returns mutated value if any condition is truthy.Community Examples
(dedent & xs) Remove indentation after concatenating the arguments. Works by removing leading whitespace, and then removing that same pattern of whitepsace after -new lines.Community Examples
(defs & bindings) -Defines many constants as in let `bindings`, but without creating new scope.Community Examples
(dfs data visit-leaf &opt node-before node-after get-children seen) +Defines many constants as in let `bindings`, but without creating new scope.
(dfs data visit-leaf &opt node-before node-after get-children seen) Do a depth first, pre-order traversal over a data structure. Also allow for callbacks before and after visiting the children of a node. Also allow for a custom `get-children` function to change traversal as needed. Will detect cycles if an empty table is passed as the `seen` parameter, which is used to cached values -that have been visited.Community Examples
(do-def c d & body) Convenience macro for defining constant named `c` with value `d` before `body` and returning it after evaluating `body`, that presumably modifies -the `c` refered content. For example buffer, table or array.Community Examples
(do-var v d & body) +the `c` refered content. For example buffer, table or array.
(do-var v d & body) Convenience macro for defining varible named `v` with value `d` before `body` -and returning it after evaluating `body`, that presumably modifies `v`.Community Examples
(format-table buf-into data &opt columns header-mapping column-mapping) +and returning it after evaluating `body`, that presumably modifies `v`.
(format-table buf-into data &opt columns header-mapping column-mapping) -Same as print-table but pushes table into a buffer.Community Examples
(gett ds & keys) -Recursive macro (get). Similar to get-in, but keys are variadic argument.Community Examples
(insert-sorted arr <? & xs) +Recursive macro (get). Similar to get-in, but keys are variadic argument.
(insert-sorted arr <? & xs) Insert elements in `arr` such that it remains sorted by the comparator. If -`arr` is not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(insert-sorted-by arr f & xs) +`arr` is not sorted beforehand, the results are undefined. Returns `arr`.
(insert-sorted-by arr f & xs) Insert elements in `arr` such that it remains sorted by the value returned when `f` is called with the element, comparing the values with <. If `arr` is -not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(int->string int &opt base) +not sorted beforehand, the results are undefined. Returns `arr`.
(int->string int &opt base) -Stringify an integer in a particular base. Defaults to decimal (base 10).Community Examples
(int/ & xs) +Stringify an integer in a particular base. Defaults to decimal (base 10).
(log level & args) Print to a dynamic binding stream if that stream is set, otherwise do nothing. Evaluate to nil. For example, `(log :err "value error: %V" my-value)` will print -to `(dyn :err)` only if `(dyn :err)` has been set.Community Examples
(make prototype & pairs) +to `(dyn :err)` only if `(dyn :err)` has been set.
(make prototype & pairs) Convenience macro for creating new table from even number of kvs pairs in a variadic `table-or-pairs` arguments and setting its prototype to `prototype`. -Factory function for creating new objects from prototypes.Community Examples
(make-id &opt prefix) +Factory function for creating new objects from prototypes.
(make-id &opt prefix) Create a random, printable keyword id with 10 bytes of entropy -with an optional prefix.Community Examples
(map-keys f data) Returns new table with function `f` applied to `data`'s -keys recursively.Community Examples
(map-vals f data) -Returns new table with function `f` applied to `data`'s values.Community Examples
(penultimate xs) +Returns new table with function `f` applied to `data`'s values.
(penultimate xs) -Get the second-to-last element from an indexed data structure.Community Examples
(print-table data &opt columns header-mapping column-mapping) +Get the second-to-last element from an indexed data structure.
(print-table data &opt columns header-mapping column-mapping) Iterate through the rows of a data structure and print a table in a human readable way, with padding and heading information. Can optionally provide @@ -388,302 +388,302 @@Community ExamplesSpork
for each row. Lastly, a `header-mapping` dictionary can be provided that changes the printed header names by mapping column keys to the desired header name. If no mapping is found, then the column key will be used as -the header name. Returns nil.
(randomize-array arr &opt rng) +the header name. Returns nil.
(randomize-array arr &opt rng) Randomizes array using the fisher-yates shuffle, takes an optional random -number generator.Community Examples
(second xs) -Get the second element from an indexed data structure.Community Examples
(select-keys data keyz) +Get the second element from an indexed data structure.
(select-keys data keyz) -Returns new table with selected `keyz` from dictionary `data`.Community Examples
(set* tgts exprs) +Returns new table with selected `keyz` from dictionary `data`.
(set* tgts exprs) Parallel `set` function. Takes a list of targets and expressions, evaluates all the expressions, and then assigns them to the targets. Each target can be a variable -or a 2-tuple, just like in the normal `set` special form.Community Examples
(string->int str &opt base) +or a 2-tuple, just like in the normal `set` special form.
(string->int str &opt base) Parse an integer in the given base. Defaults to decimal (base 10). Differs -from scan-number in that this does not recognize floating point notation.Community Examples
(table-filter pred dict) +from scan-number in that this does not recognize floating point notation.
(table-filter pred dict) Filter a key-value structure info a table. Semantics are the same as for built-in `filter`, except that `pred` takes two arguments (key and value.) -Does not consider prototypes.Community Examples
(third xs) -Get the third element from an indexed data structure.Community Examples
(trim-prefix prefix str) +Get the third element from an indexed data structure.
(trim-prefix prefix str) -Trim the specified prefix of a string if it has oneCommunity Examples
(trim-suffix suffix str) +Trim the specified prefix of a string if it has one
(trim-suffix suffix str) -Trim the specified suffix of a string if it has oneCommunity Examples
(until cnd & body) +Trim the specified suffix of a string if it has one
(until cnd & body) Repeat `body` while the `cnd` is false. -Equivalent to (while (not cnd) ;body).Community Examples
(vars & bindings) -Defines many variables as in let `bindings`, but without creating new scope.Community Examples
(make-proto stream &opt pack unpack) +Defines many variables as in let `bindings`, but without creating new scope.
(make-proto stream &opt pack unpack) -Create both a send an recv function from a stream, as with `make-send` and `make-recv`.Community Examples
(make-recv stream &opt unpack) +Create both a send an recv function from a stream, as with `make-send` and `make-recv`.
(make-recv stream &opt unpack) -Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.Community Examples
(make-send stream &opt pack) +Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.
(make-send stream &opt pack) -Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.Community Examples
(client &opt host port name) +Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.
(client &opt host port name) -Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".Community Examples
Default host to run server on and connect to.Community Examples
(server &opt host port env cleanup welcome-msg) +Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".
(server &opt host port env cleanup welcome-msg) -Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.Community Examples
(server-single &opt host port env cleanup welcome-msg) +Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.
(server-single &opt host port env cleanup welcome-msg) -Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.Community Examples
(posix/abspath path) +Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(ext path) -Get the file extension for a path.Community Examples
(posix/join & els) -Join path elements together.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/parts path) -Split a path into its parts.Community Examples
(posix/relpath source target) +Split a path into its parts.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(posix/relpath source target) +Get the relative path between two subpaths.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(win32/abspath path) +Get the relative path between two subpaths.
(win32/abspath path) -Coerce a path to be absolute.Community Examples
(win32/abspath? path) -Check if a path is absolute.Community Examples
(win32/basename path) -Gets the base file name of a path.Community Examples
(win32/dirname path) -Gets the directory name of a path.Community Examples
(ext path) -Get the file extension for a path.Community Examples
(win32/join & els) -Join path elements together.Community Examples
(win32/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(win32/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(win32/parts path) -Split a path into its parts.Community Examples
(win32/relpath source target) +Split a path into its parts.
(win32/relpath source target) -Get the relative path between two subpaths.Community Examples
(rawterm/begin &opt on-winch) +Get the relative path between two subpaths.
(rawterm/begin &opt on-winch) -Begin raw terminal functionality. Return a stream that can be read from to get input.Community Examples
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) +Begin raw terminal functionality. Return a stream that can be read from to get input.
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) -Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.Community Examples
(rawterm/ctrl-z) +Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.
(rawterm/ctrl-z) -A handler that a user can use to handle ctrl-z from input to suspend the current process.Community Examples
(rawterm/end) +A handler that a user can use to handle ctrl-z from input to suspend the current process.
(rawterm/getch &opt into) -Get a byte of input from stdin, without blocking if possible. Returns a buffer.Community Examples
(rawterm/isatty) +Get a byte of input from stdin, without blocking if possible. Returns a buffer.
(rawterm/isatty) -Check if the current stdin is a tty.Community Examples
(rawterm/monowidth bytes &opt start-index end-index) +Check if the current stdin is a tty.
(rawterm/monowidth bytes &opt start-index end-index) -Measure the monospace width of a string.Community Examples
(rawterm/rune-monowidth rune) +Measure the monospace width of a string.
(rawterm/rune-monowidth rune) -Get the monospace width of a rune. Returns either 0, 1, or 2.Community Examples
(rawterm/size) +Get the monospace width of a rune. Returns either 0, 1, or 2.
(rawterm/size) -Get the number of rows and columns visible in the terminal as tuple [rows cols]Community Examples
(rawterm/slice-monowidth bytes columns &opt start-index into) +Get the number of rows and columns visible in the terminal as tuple [rows cols]
(rawterm/slice-monowidth bytes columns &opt start-index into) -Get a byte slice that will fit into a number of columns.Community Examples
(compile pattern) +Get a byte slice that will fit into a number of columns.
(compile pattern) -Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.Community Examples
(find reg text &opt start) +Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.
(find reg text &opt start) -Similar to peg/find, but for regexes.Community Examples
(find-all reg text &opt start) +Similar to peg/find, but for regexes.
(find-all reg text &opt start) -Similar to peg/find-all, but for regexes.Community Examples
(match reg text &opt start) +Similar to peg/find-all, but for regexes.
(match reg text &opt start) -Similar to peg/match, but for regexes.Community Examples
Peg used to generate peg source code from a regular expression string.Community Examples
(replace reg rep text &opt start) +Similar to peg/match, but for regexes.
Peg used to generate peg source code from a regular expression string.
(replace reg rep text &opt start) -Similar to peg/replace, but for regexes.Community Examples
(replace-all reg rep text &opt start) +Similar to peg/replace, but for regexes.
(replace-all reg rep text &opt start) -Similar to peg/replace-all, but for regexes.Community Examples
(source pattern) -Compile a subset of regex to PEG source code.Community Examples
(client &opt host port name) +Compile a subset of regex to PEG source code.
(client &opt host port name) -Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.Community Examples
Default host to run server on and connect to.Community Examples
(server functions &opt host port workers-per-connection) +Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.
(server functions &opt host port workers-per-connection) -Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.Community Examples
(make-predicate schema) +Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.
(make-predicate schema) -Generate a function that can be used to validate a data structure. This is the function form of `predicate`.Community Examples
(make-validator schema) +Generate a function that can be used to validate a data structure. This is the function form of `predicate`.
(make-validator schema) -Generate a function that can be used to validate a data structure. This is the function form of `validator`.Community Examples
(predicate pattern) +Generate a function that can be used to validate a data structure. This is the function form of `validator`.
(predicate pattern) -Make a validation predicate given a certain schema.Community Examples
(validator pattern) +Make a validation predicate given a certain schema.
(validator pattern) -Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.Community Examples
The currently running service manager, if there is oneCommunity Examples
The currently running service, if there is oneCommunity Examples
(add-service service-name main-function & args) +Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.
The currently running service manager, if there is one
(add-service service-name main-function & args) -Spawn a serviceCommunity Examples
(all-services) -Get a list of running servicesCommunity Examples
(get-manager) -Get the current manager. If no manager exists, create one.Community Examples
(get-service) +Get the current manager. If no manager exists, create one.
(get-service) -Get the current service. If not in a service, raise an errorCommunity Examples
(make-manager &opt log-dir) +Get the current service. If not in a service, raise an error
(make-manager &opt log-dir) -Group a number of fibers into a single object for structured concurrency. Also includes utilities for running services like servers in the background.Community Examples
(print-all &opt filter-fn) +Group a number of fibers into a single object for structured concurrency. Also includes utilities for running services like servers in the background.
(print-all &opt filter-fn) -Print a table of all running services.Community Examples
(remove-service service-name) +Print a table of all running services.
(remove-service service-name) -Remove a serviceCommunity Examples
(set-title title) -Set a textual description of the service to describe what it is doing currentlyCommunity Examples
(start-service service-name) +Set a textual description of the service to describe what it is doing currently
(start-service service-name) -Start or restart a serviceCommunity Examples
(stop-service service-name &opt reason) +Start or restart a service
(stop-service service-name &opt reason) -Stop a running serviceCommunity Examples
(wait) -Once a number of services have been spawned, call `wait` to block the fiber until the manager is canceled. This lets a manager fiber behave as a service itself.Community Examples
(copy src dest) +Once a number of services have been spawned, call `wait` to block the fiber until the manager is canceled. This lets a manager fiber behave as a service itself.
(copy src dest) Copy a file or directory recursively from one location to another. -Expects input to be unix style pathsCommunity Examples
(copy-file src-path dst-path) +Expects input to be unix style paths
(copy-file src-path dst-path) -Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.Community Examples
(create-dirs dir-path) +Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.
(create-dirs dir-path) -Create all directories in path specified as string including itself.Community Examples
(devnull) +Create all directories in path specified as string including itself.
(devnull) -get the /dev/null equivalent of the current platform as an open fileCommunity Examples
(exec-slurp & args) +get the /dev/null equivalent of the current platform as an open file
(exec-slurp & args) -Read stdout of subprocess and return it trimmed in a string.Community Examples
(exec-slurp-all & args) +Read stdout of subprocess and return it trimmed in a string.
(exec-slurp-all & args) Read stdout and stderr of subprocess and return it trimmed in a struct with :err and :out containing the output as string. -This will also return the exit code under the :status key.Community Examples
(exists? path) +This will also return the exit code under the :status key.
(exists? path) -Check if the given file or directory exists. (Follows symlinks)Community Examples
(list-all-files dir &opt into) +Check if the given file or directory exists. (Follows symlinks)
(list-all-files dir &opt into) -List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.Community Examples
(make-new-file file-path &opt mode) +List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.
(make-new-file file-path &opt mode) -Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).Community Examples
(rm path) +Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).
(rm path) -Remove a directory and all sub directories recursively.Community Examples
(scan-directory dir func) +Remove a directory and all sub directories recursively.
(scan-directory dir func) -Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.Community Examples
(tarray/buffer array|size) +Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.
(tarray/buffer array|size) -Return typed array buffer or create a new buffer.Community Examples
(tarray/copy-bytes src sindex dst dindex &opt count) +Return typed array buffer or create a new buffer.
(tarray/copy-bytes src sindex dst dindex &opt count) -Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.Community Examples
(tarray/length array|buffer) +Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.
(tarray/length array|buffer) -Return typed array or buffer size.Community Examples
(tarray/new type size &opt stride offset tarray|buffer) +Return typed array or buffer size.
(tarray/new type size &opt stride offset tarray|buffer) -Create new typed array.Community Examples
(tarray/properties array) +Create new typed array.
(tarray/properties array) -Return typed array properties as a struct.Community Examples
(tarray/slice tarr &opt start end) +Return typed array properties as a struct.
(tarray/slice tarr &opt start end) -Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.Community Examples
(tarray/swap-bytes src sindex dst dindex &opt count) +Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.
(tarray/swap-bytes src sindex dst dindex &opt count) -Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.Community Examples
(all-tasks tasker &opt detailed) +Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.
(all-tasks tasker &opt detailed) -Get an array of all task ids for which there is still data on disk. If `detailed` is truthy, return full task metadata instead of ids.Community Examples
(cancel-task tasker task-id) +Get an array of all task ids for which there is still data on disk. If `detailed` is truthy, return full task metadata instead of ids.
(cancel-task tasker task-id) -Cancel a queued or running task.Community Examples
(close-queues tasker) -Prevent any tasks from being added to queues. When an executor finishes it's current job, if there are any, it will terminate. When all executors complete, the call to `run-executors` will complete.Community Examples
Default location of task recordsCommunity Examples
Maximum allowed priority (lower priority tasks will execute first)Community Examples
Minimum allowed priority (lower priority tasks will execute first)Community Examples
(new-tasker &opt task-directory queues queue-size) +Prevent any tasks from being added to queues. When an executor finishes it's current job, if there are any, it will terminate. When all executors complete, the call to `run-executors` will complete.
Maximum allowed priority (lower priority tasks will execute first)
Minimum allowed priority (lower priority tasks will execute first)
(new-tasker &opt task-directory queues queue-size) -Create queues and various settings to run tasks. Create a new tasker table.Community Examples
(queue-task tasker argv &opt note priority qname timeout expiration input) +Create queues and various settings to run tasks. Create a new tasker table.
(queue-task tasker argv &opt note priority qname timeout expiration input) -Add a task specification to a queue. Supply an argv string array that will be used to invoke s a subprocess. The optional `note` parameter is just a textual note for task trackingv. The `priority` parameter should be an integer between 0 and 9 inclusive, default is 4. Lower priority jobs in the same queue will be executed by higher priority. Use input to pass in generic, unstructured input to a task.Community Examples
(run-cleanup tasker) +Add a task specification to a queue. Supply an argv string array that will be used to invoke s a subprocess. The optional `note` parameter is just a textual note for task trackingv. The `priority` parameter should be an integer between 0 and 9 inclusive, default is 4. Lower priority jobs in the same queue will be executed by higher priority. Use input to pass in generic, unstructured input to a task.
(run-cleanup tasker) -Delete old expired jobs saved on diskCommunity Examples
(run-executors tasker &opt workers-per-queue pre-task post-task) +Delete old expired jobs saved on disk
(run-executors tasker &opt workers-per-queue pre-task post-task) -Start a number of executors to run tasks as with `tasker/spawn-executors`, and then wait for all executors to complete.Community Examples
(spawn-executors tasker &opt qnames workers-per-queue pre-task post-task) +Start a number of executors to run tasks as with `tasker/spawn-executors`, and then wait for all executors to complete.
(spawn-executors tasker &opt qnames workers-per-queue pre-task post-task) -Start a number of executors to run tasks. Tasks can be added to a queue by calling queue-task. A single tasker object can make multiple calls to spawn-executors.Community Examples
A tuple of all possible statuses that a task can have.Community Examples
(task-file tasker task-id &opt file-name) +Start a number of executors to run tasks. Tasks can be added to a queue by calling queue-task. A single tasker object can make multiple calls to spawn-executors.
(task-file tasker task-id &opt file-name) -Get a log file for a path. By default, will get a path to out.log.Community Examples
(task-status tasker task-id) +Get a log file for a path. By default, will get a path to out.log.
(task-status tasker task-id) -Look up the status of a given task by id.Community Examples
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(compile str) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(compile str) Compile a Temple template into a function which will return a rendered buffer. The resulting function should receive the template arguments in the -&keys format.Community Examples
(create source &opt where) -Compile a template string into a function. Optionally provide a location where the source is from to improve debugging. Returns the template function.Community Examples
(assert x &opt e) +Compile a template string into a function. Optionally provide a location where the source is from to improve debugging. Returns the template function.
(assert x &opt e) -Override's the default assert with some nice error handling.Community Examples
(assert-docs path) +Override's the default assert with some nice error handling.
(assert-docs path) Assert that all symbols, when module on the path is required, -have proper doc stringCommunity Examples
(assert-error msg & forms) -Test passes if forms error.Community Examples
(assert-no-error msg & forms) -Test passes if forms do not error.Community Examples
(capture-stderr & body) Runs the form and captures stderr. Returns tuple with result of the form -and a string with captured stderr.Community Examples
(capture-stdout & body) Runs the form and captures stdout. Returns tuple with result of the form -and a string with captured stdout.Community Examples
(end-suite) -Ends test suite, prints summary and exits if any have failed.Community Examples
(start-suite &opt name) +Ends test suite, prints summary and exits if any have failed.
(start-suite &opt name) -Starts test suite.Community Examples
(suppress-stderr & body) -Suppreses stdout from the bodyCommunity Examples
(suppress-stdout & body) -Suppreses stdout from the bodyCommunity Examples
(timeit form &opt tag) Time the execution of `form` using `os/clock` before and after, and print the result to stdout. returns: result of executing `form`. -Uses `tag` (default "Elapsed time:") to tag the printout.Community Examples
(utf8/decode-rune buf &opt start) +Uses `tag` (default "Elapsed time:") to tag the printout.
(utf8/decode-rune buf &opt start) -Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].Community Examples
(utf8/encode-rune rune &opt buf) +Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].
(utf8/encode-rune rune &opt buf) -Encode a Unicode codepoint into the end of a buffer.Community Examples
(utf8/prefix->width c) +Encode a Unicode codepoint into the end of a buffer.
(utf8/prefix->width c) -Given the first byte in an UTF-8 sequence, get the number of bytes that the codepoint sequence takes up, including the prefix byte.Community Examples
(zip/add-bytes writer path data &opt comment flags) +Given the first byte in an UTF-8 sequence, get the number of bytes that the codepoint sequence takes up, including the prefix byte.
(zip/add-bytes writer path data &opt comment flags) -Add a byte sequence to the zip writer.Community Examples
(zip/add-file writer path filename &opt comment flags) +Add a byte sequence to the zip writer.
(zip/add-file writer path filename &opt comment flags) -Add a file to the zip writer.Community Examples
(zip/compress bytes &opt level into) +Add a file to the zip writer.
(zip/compress bytes &opt level into) -Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.Community Examples
(zip/decompress bytes &opt into) +Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.
(zip/decompress bytes &opt into) -Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.Community Examples
(zip/extract reader idx-or-filename &opt into flags) +Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.
(zip/extract reader idx-or-filename &opt into flags) -Extract a file from the zip archive, either to memory or to a file on disk.Community Examples
(zip/file-directory? reader idx) +Extract a file from the zip archive, either to memory or to a file on disk.
(zip/file-directory? reader idx) -Check if a file index is a directory.Community Examples
(zip/file-encrypted? reader idx) +Check if a file index is a directory.
(zip/file-encrypted? reader idx) -Check if a file is encrypted inside an archive.Community Examples
(zip/file-supported? reader idx) +Check if a file is encrypted inside an archive.
(zip/file-supported? reader idx) -Check if a file is supported with this verstion of miniz.Community Examples
(zip/get-filename reader idx) +Check if a file is supported with this verstion of miniz.
(zip/get-filename reader idx) -Convert a file index index in the archive to a filename.Community Examples
(zip/locate-file reader path &opt comment flags) +Convert a file index index in the archive to a filename.
(zip/locate-file reader path &opt comment flags) -Get the index of a particular filename in the archive.Community Examples
(zip/read-bytes bytes &opt flags) +Get the index of a particular filename in the archive.
(zip/read-bytes bytes &opt flags) -Read a byte sequence as a zip archive. Returns a new zip reader.Community Examples
(zip/read-file filename &opt flags) +Read a byte sequence as a zip archive. Returns a new zip reader.
(zip/read-file filename &opt flags) -Read a file as a zip archive. Returns a new zip reader.Community Examples
(zip/reader-close reader) +Read a file as a zip archive. Returns a new zip reader.
(zip/reader-close reader) -Close a reader and free related memory.Community Examples
(zip/reader-count reader) +Close a reader and free related memory.
(zip/reader-count reader) -Get the number of files inside the zip archive. The files can be indexedCommunity Examples
(zip/stat reader idx) +Get the number of files inside the zip archive. The files can be indexed
(zip/stat reader idx) Get stat information of file. Returns a new struct with the following fields: @@ -700,17 +700,17 @@Community ExamplesSpork
* :comment * :internal-attr * :external-attr -
(zip/version) -Get the version string of the underlying miniz library.Community Examples
(zip/write-buffer) +Get the version string of the underlying miniz library.
(zip/write-buffer) -Create a new zip archive writer that write to memory.Community Examples
(zip/write-file dest-path) +Create a new zip archive writer that write to memory.
(zip/write-file dest-path) -Create a new zip archive writer that will write into an archive file.Community Examples
(zip/writer-close writer) +Create a new zip archive writer that will write into an archive file.
(zip/writer-close writer) -Close a ZipWriter.Community Examples
(zip/writer-finalizer writer) -Finalize a writer, writing any zip files to disk. Return the writer.Community Examples
(json/decode json-source &opt keywords nils) -Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.Community Examples
(json/encode x &opt tab newline buf) +Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.
(json/encode x &opt tab newline buf) -Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.Community Examples
math/add math/add-to-mean math/approx-eq math/bernoulli-distribution math/binominal-coeficient math/binominal-distribution math/check-propability math/chi-squared-distribution-table math/cols math/cumulative-std-normal-probability math/det math/dot math/epsilon math/extent math/factorial math/geometric-mean math/get-only-el math/harmonic-mean math/ident math/interquartile-range math/linear-regression math/linear-regression-line math/median math/median-absolute-deviation math/minor math/mode math/mop math/mul math/perm math/permutation-test math/permutations math/poisson-distribution math/quantile math/quantile-rank math/quantile-rank-sorted math/quantile-sorted math/quickselect math/relative-err math/root-mean-square math/rows math/sample-correlation math/sample-covariance math/sample-skewness math/sample-standard-deviation math/sample-variance math/scalar math/shuffle-in-place math/size math/sop math/standard-deviation math/standard-normal-table math/sum-compensated math/sum-nth-power-deviations math/swap math/t-test math/t-test-2 math/trans math/variance math/z-score math/zero
(add m a) Add `a` to matrix `m` where it can be matrix or scalar. -Matrix `m` is mutated.Community Examples
(add-to-mean m n v) -Adds new value `v` to mean `m` from `n` values.Community Examples
(approx-eq a e &opt t) +Adds new value `v` to mean `m` from `n` values.
(approx-eq a e &opt t) Approximate equality between actual number `a` and expected number `e`. Default tolerance `t` -is `epsilon`.Community Examples
(bernoulli-distribution p) -Creates Bernoulli distribution from popability `p` in the tuple.Community Examples
(binominal-coeficient n k) +Creates Bernoulli distribution from popability `p` in the tuple.
(binominal-coeficient n k) Computes binominal coeficient from set of size `n` -and sample size `k`.Community Examples
(binominal-distribution t p) Creates binominal distribution from trials `t` -and propability `p` in the tuple.Community Examples
(check-propability p) -Asserts that probability in in the [0 1] range.Community Examples
(cumulative-std-normal-probability z) +Returns numbers of columns of matrix `m`.
(cumulative-std-normal-probability z) -Computes standard normal probability for `y`.Community Examples
(dot mx my) -Computes dot product of matrices or vectors `x` and `y`.Community Examples
(extent xs) -Returns the minimum & maximum number in an `xs` as tuple.Community Examples
(factorial n) +Returns the minimum & maximum number in an `xs` as tuple.
(geometric-mean xs) -Gets the geometric mean from `xs`.Community Examples
(get-only-el m) Convenience macro for geting first element -from first row of the two dimensional array `m`.Community Examples
(harmonic-mean xs) +from first row of the two dimensional array `m`.
(harmonic-mean xs) -Gets the harmonic mean from `xs`.Community Examples
(ident c) -Creates identity matrix with `c` x `c` size.Community Examples
(interquartile-range xs) +Creates identity matrix with `c` x `c` size.
(interquartile-range xs) -Gets the interquartile range from `xs`.Community Examples
(linear-regression coords) +Gets the interquartile range from `xs`.
(linear-regression coords) Computes the slope `:m` and y-intercept `:b` -of the function in the struct from set of coordinates.Community Examples
(linear-regression-line {:m m :b b}) +of the function in the struct from set of coordinates.
(linear-regression-line {:m m :b b}) -Constructs function from struct returned by linear regression.Community Examples
(median xs) +Constructs function from struct returned by linear regression.
(median-absolute-deviation xs) +Gets the median value from `xs`
(median-absolute-deviation xs) -Gets median absolute deviation from `xs`.Community Examples
(minor m x y) -Computes minor matrix of matrix `m` and `x`, `y`.Community Examples
(mop m op a) Mutates every cell of the matrix `m` with `op` -and corresponding cell from matrix arg `a`.Community Examples
(mul m a) Multiply matrix `m` with `a` which can be matrix or vector. -Matrix `m` is mutated.Community Examples
(permutation-test xs ys &opt a k) +Computes permanent of the matrix `m`.
(permutation-test xs ys &opt a k) Conducts a permutation test to determine if two data sets `xs` and `ys` are *significantly* different from each other. You can use alternative hypotesis `a`, which defaults to `:two-side`, with `:greater` and `:lesser` being the other two options. The last optional argument is `k` number of values -in permutation distributionCommunity Examples
(permutations s &opt k) -Returns permutations of length `k` from members of `s`Community Examples
(poisson-distribution lambda) +Returns permutations of length `k` from members of `s`
(poisson-distribution lambda) -Creates Poisson distribution from `lambda` in tuple.Community Examples
(quantile xs p) -Gets the quantile value from `xs` at `p` from unsorted population.Community Examples
(quantile-rank xs p) +Gets the quantile value from `xs` at `p` from unsorted population.
(quantile-rank xs p) -Gets the quantile rank of value `v` from unsorted `xs`.Community Examples
(quantile-rank-sorted xs v) +Gets the quantile rank of value `v` from unsorted `xs`.
(quantile-rank-sorted xs v) -Gets the quantile rank of value `v` from sorted `xs`.Community Examples
(quantile-sorted xs p) +Gets the quantile rank of value `v` from sorted `xs`.
(quantile-sorted xs p) -Gets the quantile value from `xs` at `p` from sorted population.Community Examples
(quickselect arr k &opt left right) +Gets the quantile value from `xs` at `p` from sorted population.
(quickselect arr k &opt left right) Rearrange items in `arr` so that all items in `[left, k]` range are the smallest. The `k`-th element will have the `(k - left + 1)`-th smallest value in `[left, right]`. -Mutates `arr`.Community Examples
(relative-err a e) Gets the relative err between actual number `a` -and expected number `e`.Community Examples
(root-mean-square xs) -Gets the root mean square from `xs`.Community Examples
(sample-correlation xs ys) +Returns numbers of rows of matrix `m`.
(sample-correlation xs ys) -Gets the sample correlation between `xs` and `ys`.Community Examples
(sample-covariance xs ys) +Gets the sample correlation between `xs` and `ys`.
(sample-covariance xs ys) -Gets the sample covariance between `xs` and `ys`.Community Examples
(sample-skewness xs) +Gets the sample covariance between `xs` and `ys`.
(sample-skewness xs) -Gets the sample skeweness from the `xs`.Community Examples
(sample-standard-deviation xs) +Gets the sample skeweness from the `xs`.
(sample-standard-deviation xs) -Gets sample standard deviation from `xs`.Community Examples
(sample-variance xs) +Gets sample standard deviation from `xs`.
(sample-variance xs) -Get the sample variance from `xs`.Community Examples
(scalar c s) -Creates scalar `s` matrix with `c` x `c` size.Community Examples
(shuffle-in-place xs) +Creates scalar `s` matrix with `c` x `c` size.
(shuffle-in-place xs) Generate random permutation of the array `xs` -which is shuffled in place.Community Examples
(size m) -Returns tuple with the matrix `m` size [rows cols].Community Examples
(sop m op & a) Mutates every cell of the matrix `m` with `op` -and variadic args `a`.Community Examples
(standard-deviation xs) -Gets the standard deviation from `ds`.Community Examples
(sum-compensated xs) -Returns sum of the members of `xs` with Kahan-Babushka algorithm.Community Examples
(sum-nth-power-deviations xs n) +Returns sum of the members of `xs` with Kahan-Babushka algorithm.
(sum-nth-power-deviations xs n) -Get the sum of deviations to the n power.Community Examples
(swap arr i j) Swaps members with indices `i` and `j` of arr. -Noop when `i` equals `j`.Community Examples
(t-test xs expv) Computes one sample t-test comparing the mean of `xs` -to known value `expv`.Community Examples
(t-test-2 xs ys &opt d) Computes two sample t-test of two samples `xs` and `ys` -with difference optional `d` which defaults to 0.Community Examples
(z-score x m d) Gets the standard score for number `x` from mean `m` -and standard deviation `d`.Community Examples
(zero c &opt r) Creates vector of length `c`, or matrix if `r` -is provided, and fills it with zeros.Community Examples
misc/always misc/antepenultimate misc/caperr misc/capout misc/cond-> misc/cond->> misc/dedent misc/defs misc/dfs misc/do-def misc/do-var misc/format-table misc/gett misc/insert-sorted misc/insert-sorted-by misc/int->string misc/int/ misc/log misc/make misc/make-id misc/map-keys misc/map-vals misc/penultimate misc/print-table misc/randomize-array misc/second misc/select-keys misc/set* misc/string->int misc/table-filter misc/third misc/trim-prefix misc/trim-suffix misc/until misc/vars
(always x) -Return a function that discards any arguments and always returns `x`.Community Examples
(antepenultimate xs) +Return a function that discards any arguments and always returns `x`.
(antepenultimate xs) -Get the third-to-last element from an indexed data structure.Community Examples
(caperr & body) +Get the third-to-last element from an indexed data structure.
(caperr & body) Captures the standart error output of the variadic `body` and returns it -as a buffer.Community Examples
(capout & body) Captures the standart output of the variadic `body` and returns it as -a buffer.Community Examples
(cond-> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs with condition and operation to which the `val`, is put as first argument. All conditions are tried and for truthy conditions the operation is executed. -Returns the value mutated if any condition is truthy.Community Examples
(cond->> val & clauses) +Returns the value mutated if any condition is truthy.
(cond->> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs of condition and operation to which the `val`, is put as last argument. All conditions are tried and for truthy the operation is ran. -Returns mutated value if any condition is truthy.Community Examples
(dedent & xs) Remove indentation after concatenating the arguments. Works by removing leading whitespace, and then removing that same pattern of whitepsace after -new lines.Community Examples
(defs & bindings) -Defines many constants as in let `bindings`, but without creating new scope.Community Examples
(dfs data visit-leaf &opt node-before node-after get-children seen) +Defines many constants as in let `bindings`, but without creating new scope.
(dfs data visit-leaf &opt node-before node-after get-children seen) Do a depth first, pre-order traversal over a data structure. Also allow for callbacks before and after visiting the children of a node. Also allow for a custom `get-children` function to change traversal as needed. Will detect cycles if an empty table is passed as the `seen` parameter, which is used to cached values -that have been visited.Community Examples
(do-def c d & body) Convenience macro for defining constant named `c` with value `d` before `body` and returning it after evaluating `body`, that presumably modifies -the `c` refered content. For example buffer, table or array.Community Examples
(do-var v d & body) +the `c` refered content. For example buffer, table or array.
(do-var v d & body) Convenience macro for defining varible named `v` with value `d` before `body` -and returning it after evaluating `body`, that presumably modifies `v`.Community Examples
(format-table buf-into data &opt columns header-mapping column-mapping) +and returning it after evaluating `body`, that presumably modifies `v`.
(format-table buf-into data &opt columns header-mapping column-mapping) -Same as print-table but pushes table into a buffer.Community Examples
(gett ds & keys) -Recursive macro (get). Similar to get-in, but keys are variadic argument.Community Examples
(insert-sorted arr <? & xs) +Recursive macro (get). Similar to get-in, but keys are variadic argument.
(insert-sorted arr <? & xs) Insert elements in `arr` such that it remains sorted by the comparator. If -`arr` is not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(insert-sorted-by arr f & xs) +`arr` is not sorted beforehand, the results are undefined. Returns `arr`.
(insert-sorted-by arr f & xs) Insert elements in `arr` such that it remains sorted by the value returned when `f` is called with the element, comparing the values with <. If `arr` is -not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(int->string int &opt base) +not sorted beforehand, the results are undefined. Returns `arr`.
(int->string int &opt base) -Stringify an integer in a particular base. Defaults to decimal (base 10).Community Examples
(int/ & xs) +Stringify an integer in a particular base. Defaults to decimal (base 10).
(log level & args) Print to a dynamic binding stream if that stream is set, otherwise do nothing. Evaluate to nil. For example, `(log :err "value error: %V" my-value)` will print -to `(dyn :err)` only if `(dyn :err)` has been set.Community Examples
(make prototype & pairs) Convenience macro for creating new table from even number of kvs pairs in a variadic `table-or-pairs` arguments and setting its prototype to `prototype`. -Factory function for creating new objects from prototypes.Community Examples
(make-id &opt prefix) +Factory function for creating new objects from prototypes.
(make-id &opt prefix) Create a random, printable keyword id with 10 bytes of entropy -with an optional prefix.Community Examples
(map-keys f data) Returns new table with function `f` applied to `data`'s -keys recursively.Community Examples
(map-vals f data) -Returns new table with function `f` applied to `data`'s values.Community Examples
(penultimate xs) +Returns new table with function `f` applied to `data`'s values.
(penultimate xs) -Get the second-to-last element from an indexed data structure.Community Examples
(print-table data &opt columns header-mapping column-mapping) +Get the second-to-last element from an indexed data structure.
(print-table data &opt columns header-mapping column-mapping) Iterate through the rows of a data structure and print a table in a human readable way, with padding and heading information. Can optionally provide @@ -196,37 +196,37 @@Community ExamplesIndex for each row. Lastly, a `header-mapping` dictionary can be provided that changes the printed header names by mapping column keys to the desired header name. If no mapping is found, then the column key will be used as -the header name. Returns nil.
(randomize-array arr &opt rng) Randomizes array using the fisher-yates shuffle, takes an optional random -number generator.Community Examples
(second xs) -Get the second element from an indexed data structure.Community Examples
(select-keys data keyz) +Get the second element from an indexed data structure.
(select-keys data keyz) -Returns new table with selected `keyz` from dictionary `data`.Community Examples
(set* tgts exprs) +Returns new table with selected `keyz` from dictionary `data`.
(set* tgts exprs) Parallel `set` function. Takes a list of targets and expressions, evaluates all the expressions, and then assigns them to the targets. Each target can be a variable -or a 2-tuple, just like in the normal `set` special form.Community Examples
(string->int str &opt base) +or a 2-tuple, just like in the normal `set` special form.
(string->int str &opt base) Parse an integer in the given base. Defaults to decimal (base 10). Differs -from scan-number in that this does not recognize floating point notation.Community Examples
(table-filter pred dict) +from scan-number in that this does not recognize floating point notation.
(table-filter pred dict) Filter a key-value structure info a table. Semantics are the same as for built-in `filter`, except that `pred` takes two arguments (key and value.) -Does not consider prototypes.Community Examples
(third xs) -Get the third element from an indexed data structure.Community Examples
(trim-prefix prefix str) +Get the third element from an indexed data structure.
(trim-prefix prefix str) -Trim the specified prefix of a string if it has oneCommunity Examples
(trim-suffix suffix str) +Trim the specified prefix of a string if it has one
(trim-suffix suffix str) -Trim the specified suffix of a string if it has oneCommunity Examples
(until cnd & body) Repeat `body` while the `cnd` is false. -Equivalent to (while (not cnd) ;body).Community Examples
(vars & bindings) -Defines many variables as in let `bindings`, but without creating new scope.Community Examples
msg/make-proto msg/make-recv msg/make-send
(make-proto stream &opt pack unpack) -Create both a send an recv function from a stream, as with `make-send` and `make-recv`.Community Examples
(make-recv stream &opt unpack) +Create both a send an recv function from a stream, as with `make-send` and `make-recv`.
(make-recv stream &opt unpack) -Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.Community Examples
(make-send stream &opt pack) +Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.
(make-send stream &opt pack) -Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.Community Examples
netrepl/client netrepl/default-host netrepl/default-port netrepl/server netrepl/server-single
(client &opt host port name) -Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".Community Examples
(server &opt host port env cleanup welcome-msg) +Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".
(server &opt host port env cleanup welcome-msg) -Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.Community Examples
(server-single &opt host port env cleanup welcome-msg) +Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.
(server-single &opt host port env cleanup welcome-msg) -Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.Community Examples
path/abspath path/abspath? path/basename path/delim path/dirname path/ext path/join path/normalize path/parts path/posix/abspath path/posix/abspath? path/posix/basename path/posix/delim path/posix/dirname path/posix/ext path/posix/join path/posix/normalize path/posix/parts path/posix/relpath path/posix/sep path/relpath path/sep path/win32/abspath path/win32/abspath? path/win32/basename path/win32/delim path/win32/dirname path/win32/ext path/win32/join path/win32/normalize path/win32/parts path/win32/relpath path/win32/sep
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(posix/relpath source target) +Get the relative path between two subpaths.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(win32/abspath path) +Get the relative path between two subpaths.
(win32/abspath path) -Coerce a path to be absolute.Community Examples
(win32/abspath? path) -Check if a path is absolute.Community Examples
(win32/basename path) -Gets the base file name of a path.Community Examples
(win32/dirname path) -Gets the directory name of a path.Community Examples
(win32/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(win32/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(win32/relpath source target) -Get the relative path between two subpaths.Community Examples
rawterm/begin rawterm/buffer-traverse rawterm/ctrl-z rawterm/end rawterm/getch rawterm/isatty rawterm/monowidth rawterm/rune-monowidth rawterm/size rawterm/slice-monowidth
(rawterm/begin &opt on-winch) -Begin raw terminal functionality. Return a stream that can be read from to get input.Community Examples
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) +Begin raw terminal functionality. Return a stream that can be read from to get input.
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) -Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.Community Examples
(rawterm/ctrl-z) +Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.
(rawterm/ctrl-z) -A handler that a user can use to handle ctrl-z from input to suspend the current process.Community Examples
(rawterm/end) +A handler that a user can use to handle ctrl-z from input to suspend the current process.
(rawterm/getch &opt into) -Get a byte of input from stdin, without blocking if possible. Returns a buffer.Community Examples
(rawterm/isatty) +Get a byte of input from stdin, without blocking if possible. Returns a buffer.
(rawterm/isatty) -Check if the current stdin is a tty.Community Examples
(rawterm/monowidth bytes &opt start-index end-index) +Check if the current stdin is a tty.
(rawterm/monowidth bytes &opt start-index end-index) -Measure the monospace width of a string.Community Examples
(rawterm/rune-monowidth rune) +Measure the monospace width of a string.
(rawterm/rune-monowidth rune) -Get the monospace width of a rune. Returns either 0, 1, or 2.Community Examples
(rawterm/size) +Get the monospace width of a rune. Returns either 0, 1, or 2.
(rawterm/size) -Get the number of rows and columns visible in the terminal as tuple [rows cols]Community Examples
(rawterm/slice-monowidth bytes columns &opt start-index into) +Get the number of rows and columns visible in the terminal as tuple [rows cols]
(rawterm/slice-monowidth bytes columns &opt start-index into) -Get a byte slice that will fit into a number of columns.Community Examples
regex/compile regex/find regex/find-all regex/match regex/peg regex/replace regex/replace-all regex/source
(compile pattern) -Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.Community Examples
(find reg text &opt start) +Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.
(find reg text &opt start) -Similar to peg/find, but for regexes.Community Examples
(find-all reg text &opt start) +Similar to peg/find, but for regexes.
(find-all reg text &opt start) -Similar to peg/find-all, but for regexes.Community Examples
(match reg text &opt start) -Similar to peg/match, but for regexes.Community Examples
Peg used to generate peg source code from a regular expression string.Community Examples
(replace reg rep text &opt start) +Similar to peg/match, but for regexes.
(replace reg rep text &opt start) -Similar to peg/replace, but for regexes.Community Examples
(replace-all reg rep text &opt start) +Similar to peg/replace, but for regexes.
(replace-all reg rep text &opt start) -Similar to peg/replace-all, but for regexes.Community Examples
(source pattern) -Compile a subset of regex to PEG source code.Community Examples
rpc/client rpc/default-host rpc/default-port rpc/server
(client &opt host port name) -Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.Community Examples
(server functions &opt host port workers-per-connection) +Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.
(server functions &opt host port workers-per-connection) -Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.Community Examples
schema/make-predicate schema/make-validator schema/predicate schema/validator
(make-predicate schema) -Generate a function that can be used to validate a data structure. This is the function form of `predicate`.Community Examples
(make-validator schema) +Generate a function that can be used to validate a data structure. This is the function form of `predicate`.
(make-validator schema) -Generate a function that can be used to validate a data structure. This is the function form of `validator`.Community Examples
(predicate pattern) +Generate a function that can be used to validate a data structure. This is the function form of `validator`.
(predicate pattern) -Make a validation predicate given a certain schema.Community Examples
(validator pattern) +Make a validation predicate given a certain schema.
(validator pattern) -Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.Community Examples
sh/copy sh/copy-file sh/create-dirs sh/devnull sh/exec-slurp sh/exec-slurp-all sh/exists? sh/list-all-files sh/make-new-file sh/rm sh/scan-directory
(copy src dest) Copy a file or directory recursively from one location to another. -Expects input to be unix style pathsCommunity Examples
(copy-file src-path dst-path) -Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.Community Examples
(create-dirs dir-path) +Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.
(create-dirs dir-path) -Create all directories in path specified as string including itself.Community Examples
(devnull) +Create all directories in path specified as string including itself.
(devnull) -get the /dev/null equivalent of the current platform as an open fileCommunity Examples
(exec-slurp & args) +get the /dev/null equivalent of the current platform as an open file
(exec-slurp & args) -Read stdout of subprocess and return it trimmed in a string.Community Examples
(exec-slurp-all & args) +Read stdout of subprocess and return it trimmed in a string.
(exec-slurp-all & args) Read stdout and stderr of subprocess and return it trimmed in a struct with :err and :out containing the output as string. -This will also return the exit code under the :status key.Community Examples
(exists? path) +This will also return the exit code under the :status key.
(exists? path) -Check if the given file or directory exists. (Follows symlinks)Community Examples
(list-all-files dir &opt into) +Check if the given file or directory exists. (Follows symlinks)
(list-all-files dir &opt into) -List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.Community Examples
(make-new-file file-path &opt mode) +List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.
(make-new-file file-path &opt mode) -Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).Community Examples
(rm path) +Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).
(rm path) -Remove a directory and all sub directories recursively.Community Examples
(scan-directory dir func) +Remove a directory and all sub directories recursively.
(scan-directory dir func) -Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.Community Examples
tarray/buffer tarray/copy-bytes tarray/length tarray/new tarray/properties tarray/slice tarray/swap-bytes
(tarray/buffer array|size) -Return typed array buffer or create a new buffer.Community Examples
(tarray/copy-bytes src sindex dst dindex &opt count) +Return typed array buffer or create a new buffer.
(tarray/copy-bytes src sindex dst dindex &opt count) -Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.Community Examples
(tarray/length array|buffer) +Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.
(tarray/length array|buffer) -Return typed array or buffer size.Community Examples
(tarray/new type size &opt stride offset tarray|buffer) +Return typed array or buffer size.
(tarray/new type size &opt stride offset tarray|buffer) -Create new typed array.Community Examples
(tarray/properties array) +Create new typed array.
(tarray/properties array) -Return typed array properties as a struct.Community Examples
(tarray/slice tarr &opt start end) +Return typed array properties as a struct.
(tarray/slice tarr &opt start end) -Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.Community Examples
(tarray/swap-bytes src sindex dst dindex &opt count) +Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.
(tarray/swap-bytes src sindex dst dindex &opt count) -Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.Community Examples
test/assert test/assert-docs test/assert-error test/assert-no-error test/assert-not test/capture-stderr test/capture-stdout test/end-suite test/start-suite test/suppress-stderr test/suppress-stdout test/timeit
(assert x &opt e) -Override's the default assert with some nice error handling.Community Examples
(assert-docs path) +Override's the default assert with some nice error handling.
(assert-docs path) Assert that all symbols, when module on the path is required, -have proper doc stringCommunity Examples
(assert-error msg & forms) -Test passes if forms error.Community Examples
(assert-no-error msg & forms) -Test passes if forms do not error.Community Examples
(capture-stderr & body) Runs the form and captures stderr. Returns tuple with result of the form -and a string with captured stderr.Community Examples
(capture-stdout & body) Runs the form and captures stdout. Returns tuple with result of the form -and a string with captured stdout.Community Examples
(end-suite) -Ends test suite, prints summary and exits if any have failed.Community Examples
(start-suite &opt name) +Ends test suite, prints summary and exits if any have failed.
(suppress-stderr & body) -Suppreses stdout from the bodyCommunity Examples
(suppress-stdout & body) -Suppreses stdout from the bodyCommunity Examples
(timeit form &opt tag) Time the execution of `form` using `os/clock` before and after, and print the result to stdout. returns: result of executing `form`. -Uses `tag` (default "Elapsed time:") to tag the printout.Community Examples
zip/add-bytes zip/add-file zip/compress zip/decompress zip/extract zip/file-directory? zip/file-encrypted? zip/file-supported? zip/get-filename zip/locate-file zip/read-bytes zip/read-file zip/reader-close zip/reader-count zip/stat zip/version zip/write-buffer zip/write-file zip/writer-close zip/writer-finalize
(zip/add-bytes writer path data &opt comment flags) -Add a byte sequence to the zip writer.Community Examples
(zip/add-file writer path filename &opt comment flags) +Add a byte sequence to the zip writer.
(zip/add-file writer path filename &opt comment flags) -Add a file to the zip writer.Community Examples
(zip/compress bytes &opt level into) -Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.Community Examples
(zip/decompress bytes &opt into) +Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.
(zip/decompress bytes &opt into) -Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.Community Examples
(zip/extract reader idx-or-filename &opt into flags) +Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.
(zip/extract reader idx-or-filename &opt into flags) -Extract a file from the zip archive, either to memory or to a file on disk.Community Examples
(zip/file-directory? reader idx) +Extract a file from the zip archive, either to memory or to a file on disk.
(zip/file-directory? reader idx) -Check if a file index is a directory.Community Examples
(zip/file-encrypted? reader idx) +Check if a file index is a directory.
(zip/file-encrypted? reader idx) -Check if a file is encrypted inside an archive.Community Examples
(zip/file-supported? reader idx) +Check if a file is encrypted inside an archive.
(zip/file-supported? reader idx) -Check if a file is supported with this verstion of miniz.Community Examples
(zip/get-filename reader idx) +Check if a file is supported with this verstion of miniz.
(zip/get-filename reader idx) -Convert a file index index in the archive to a filename.Community Examples
(zip/locate-file reader path &opt comment flags) +Convert a file index index in the archive to a filename.
(zip/locate-file reader path &opt comment flags) -Get the index of a particular filename in the archive.Community Examples
(zip/read-bytes bytes &opt flags) +Get the index of a particular filename in the archive.
(zip/read-bytes bytes &opt flags) -Read a byte sequence as a zip archive. Returns a new zip reader.Community Examples
(zip/read-file filename &opt flags) +Read a byte sequence as a zip archive. Returns a new zip reader.
(zip/read-file filename &opt flags) -Read a file as a zip archive. Returns a new zip reader.Community Examples
(zip/reader-close reader) +Read a file as a zip archive. Returns a new zip reader.
(zip/reader-close reader) -Close a reader and free related memory.Community Examples
(zip/reader-count reader) +Close a reader and free related memory.
(zip/reader-count reader) -Get the number of files inside the zip archive. The files can be indexedCommunity Examples
(zip/stat reader idx) +Get the number of files inside the zip archive. The files can be indexed
(zip/stat reader idx) Get stat information of file. Returns a new struct with the following fields: @@ -157,17 +157,17 @@Community ExamplesIndex * :comment * :internal-attr * :external-attr -
(zip/version) -Get the version string of the underlying miniz library.Community Examples
(zip/write-buffer) +Get the version string of the underlying miniz library.
(zip/write-buffer) -Create a new zip archive writer that write to memory.Community Examples
(zip/write-file dest-path) +Create a new zip archive writer that write to memory.
(zip/write-file dest-path) -Create a new zip archive writer that will write into an archive file.Community Examples
(zip/writer-close writer) +Create a new zip archive writer that will write into an archive file.
(zip/writer-finalizer writer) -Finalize a writer, writing any zip files to disk. Return the writer.Community Examples
cc/archive-c cc/compile-c cc/create-buffer-c cc/create-buffer-c-impl cc/create-executable cc/embed-name cc/entry-name cc/entry-replace cc/link-c cc/make-bin-source cc/make-define cc/make-defines cc/modpath-to-meta cc/modpath-to-static cc/out-path
(archive-c opts target & objects) -Link object files together to make a static library.Community Examples
(compile-c compiler opts src dest &opt static?) +Link object files together to make a static library.
(compile-c compiler opts src dest &opt static?) -Compile a C file into an object file.Community Examples
(create-buffer-c source dest name) +Compile a C file into an object file.
(create-buffer-c source dest name) -Inline raw byte file as a c file.Community Examples
(create-buffer-c-impl bytes dest name) +Inline raw byte file as a c file.
(create-executable opts source dest no-core) -Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.Community Examples
(embed-name path) +Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.
(embed-name path) -Rename a janet symbol for embedding.Community Examples
(entry-name name) -Name of symbol that enters static compilation of a module.Community Examples
(entry-replace name) +Name of symbol that enters static compilation of a module.
(entry-replace name) -Escape special characters in the entry-nameCommunity Examples
(link-c has-cpp opts target & objects) +Escape special characters in the entry-name
(link-c has-cpp opts target & objects) -Link C or C++ object files together to make a native module.Community Examples
(make-bin-source declarations lookup-into-invocations no-core) +Link C or C++ object files together to make a native module.
(make-bin-source declarations lookup-into-invocations no-core) -Community Examples
(make-define define value) -Generate strings for adding custom defines to the compiler.Community Examples
(make-defines defines) +Generate strings for adding custom defines to the compiler.
(make-defines defines) -Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.Community Examples
(modpath-to-meta path) +Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.
(modpath-to-meta path) -Get the meta file path (.meta.janet) corresponding to a native module path (.so).Community Examples
(modpath-to-static path) +Get the meta file path (.meta.janet) corresponding to a native module path (.so).
(modpath-to-static path) -Get the static library (.a) path corresponding to a native module path (.so).Community Examples
(out-path path from-ext to-ext) +Get the static library (.a) path corresponding to a native module path (.so).
(out-path path from-ext to-ext) -Take a source file path and convert it to an output path.Community Examples
cgen/add-loader cgen/ir cgen/mangle cgen/print-ir
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(ir & body) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(ir & body) -Macro that automatically quotes the body provided and calls (print-ir ...) on the body.Community Examples
(mangle token) +Macro that automatically quotes the body provided and calls (print-ir ...) on the body.
(mangle token) -Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.Community Examples
(print-ir ir) +Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.
(print-ir ir) -Compile the CGEN IR to C and print it to (dyn :out).Community Examples
cli/jpm cli/main cli/run cli/setup
(jpm & argv) -A Macro User Interface for jpm to be used from a repl in a way similar to the command line.Community Examples
(main & argv) +A Macro User Interface for jpm to be used from a repl in a way similar to the command line.
(setup args) Load configuration from the command line, environment variables, and configuration files. Returns array of non-configuration arguments as well. @@ -128,7 +128,7 @@Community ExamplesIndex 1. Commmand line settings 2. The value of `(dyn :jpm-config)` 3. Environment variables - 4. Config file settings (default-config if non specified)
commands/build commands/clean commands/configure commands/deps commands/enable-local-mode commands/help commands/install commands/jpm-debug-repl commands/list-installed commands/list-pkgs commands/list-rules commands/list-tasks commands/new-c-project commands/new-exe-project commands/new-project commands/quickbin commands/set-tree commands/show-paths commands/show-rule-tree commands/test commands/update-pkgs
(configure &opt path) -Setup an out-of-tree build with certain configuration options.Community Examples
(deps) +Setup an out-of-tree build with certain configuration options.
(enable-local-mode) -Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/Community Examples
(help) +Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/
(new-c-project name) -Create a new C projectCommunity Examples
(new-exe-project name) -Create a new executable projectCommunity Examples
(set-tree tree) -Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.Community Examples
(show-paths) +Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.
config/builtin-configs config/config-checkers config/config-docs config/config-options config/config-parsers config/config-set config/defconf config/dyn:ar config/dyn:auto-shebang config/dyn:binpath config/dyn:build-type config/dyn:buildpath config/dyn:c++ config/dyn:c++-link config/dyn:cc config/dyn:cc-link config/dyn:cflags config/dyn:cflags-verbose config/dyn:config-file config/dyn:cppflags config/dyn:curlpath config/dyn:dest-dir config/dyn:dynamic-cflags config/dyn:dynamic-lflags config/dyn:gitpath config/dyn:headerpath config/dyn:is-msvc config/dyn:janet config/dyn:janet-cflags config/dyn:janet-importlib config/dyn:janet-lflags config/dyn:ldflags config/dyn:lflags config/dyn:libpath config/dyn:local config/dyn:manpath config/dyn:modext config/dyn:modpath config/dyn:nocolor config/dyn:offline config/dyn:optimize config/dyn:pkglist config/dyn:silent config/dyn:statext config/dyn:tarpath config/dyn:test config/dyn:tree config/dyn:update-pkgs config/dyn:use-batch-shell config/dyn:verbose config/dyn:workers config/load-config config/load-config-file config/load-default config/load-options config/opt config/read-env-variables config/save-config config/shorthand-mapping
Table of all built-in options, as opposed to project deifned options.Community Examples
A table of all of the dynamic config bindings to checkers (validators).Community Examples
Table of all of the help text for each config option.Community Examples
A table of possible options for enum option types.Community Examples
A table of all of the dynamic config bindings to parsers.Community Examples
(defconf kw &opt parser docs options) +config/builtin-configs config/config-checkers config/config-docs config/config-options config/config-parsers config/config-set config/defconf config/dyn:ar config/dyn:auto-shebang config/dyn:binpath config/dyn:build-type config/dyn:buildpath config/dyn:c++ config/dyn:c++-link config/dyn:cc config/dyn:cc-link config/dyn:cflags config/dyn:cflags-verbose config/dyn:config-file config/dyn:cppflags config/dyn:curlpath config/dyn:dest-dir config/dyn:dynamic-cflags config/dyn:dynamic-lflags config/dyn:gitpath config/dyn:headerpath config/dyn:is-msvc config/dyn:janet config/dyn:janet-cflags config/dyn:janet-importlib config/dyn:janet-lflags config/dyn:ldflags config/dyn:lflags config/dyn:libpath config/dyn:local config/dyn:manpath config/dyn:modext config/dyn:modpath config/dyn:nocolor config/dyn:offline config/dyn:optimize config/dyn:pkglist config/dyn:silent config/dyn:statext config/dyn:tarpath config/dyn:test config/dyn:tree config/dyn:update-pkgs config/dyn:use-batch-shell config/dyn:verbose config/dyn:workers config/load-config config/load-config-file config/load-default config/load-options config/opt config/read-env-variables config/save-config config/shorthand-mapping
config/builtin-configs table sourceTable of all built-in options, as opposed to project deifned options.config/config-checkers table sourceA table of all of the dynamic config bindings to checkers (validators).config/defconf macro source(defconf kw &opt parser docs options) -Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.Community Examplesconfig/dyn:ar function source(dyn:ar &opt dflt) +Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.config/load-config function source(load-config settings &opt override) -Load a configuration from a table or struct.Community Examplesconfig/load-config-file function source(load-config-file path &opt override) +Load a configuration from a table or struct.config/load-config-file function source(load-config-file path &opt override) -Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.Community Examplesconfig/load-default function source(load-default &opt override) +Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.config/load-default function source(load-default &opt override) -Load the default configuration.Community Examplesconfig/load-options function source(load-options &opt path) -Load a file that contains config options that can be set. If no such file exists, then do nothing.Community Examplesconfig/opt function source(opt opts key &opt dflt) +Load a file that contains config options that can be set. If no such file exists, then do nothing.config/opt function source(opt opts key &opt dflt) -Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.Community Examplesconfig/read-env-variables function source(read-env-variables) +Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.config/read-env-variables function source(read-env-variables) -Read environment variables that correspond to config variables into dyns.Community Examplesconfig/save-config function source(save-config path) +Read environment variables that correspond to config variables into dyns.config/save-config function source(save-config path) -Write the current configuration information to a file.Community Examplesconfig/shorthand-mapping struct source+Write the current configuration information to a file.Map some single characters to long options.Community Examples
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.
(pmap f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.Community Examples
jpm/cc/archive-c jpm/cc/compile-c jpm/cc/create-buffer-c jpm/cc/create-buffer-c-impl jpm/cc/create-executable jpm/cc/embed-name jpm/cc/entry-name jpm/cc/entry-replace jpm/cc/link-c jpm/cc/make-bin-source jpm/cc/make-define jpm/cc/make-defines jpm/cc/modpath-to-meta jpm/cc/modpath-to-static jpm/cc/out-path jpm/cgen/add-loader jpm/cgen/ir jpm/cgen/mangle jpm/cgen/print-ir jpm/commands/build jpm/commands/clean jpm/commands/configure jpm/commands/deps jpm/commands/enable-local-mode jpm/commands/help jpm/commands/install jpm/commands/jpm-debug-repl jpm/commands/list-installed jpm/commands/list-pkgs jpm/commands/list-rules jpm/commands/list-tasks jpm/commands/new-c-project jpm/commands/new-exe-project jpm/commands/new-project jpm/commands/quickbin jpm/commands/set-tree jpm/commands/show-paths jpm/commands/show-rule-tree jpm/commands/test jpm/commands/update-pkgs jpm/config/builtin-configs jpm/config/config-checkers jpm/config/config-docs jpm/config/config-options jpm/config/config-parsers jpm/config/config-set jpm/config/defconf jpm/config/dyn:ar jpm/config/dyn:auto-shebang jpm/config/dyn:binpath jpm/config/dyn:build-type jpm/config/dyn:buildpath jpm/config/dyn:c++ jpm/config/dyn:c++-link jpm/config/dyn:cc jpm/config/dyn:cc-link jpm/config/dyn:cflags jpm/config/dyn:cflags-verbose jpm/config/dyn:config-file jpm/config/dyn:cppflags jpm/config/dyn:curlpath jpm/config/dyn:dest-dir jpm/config/dyn:dynamic-cflags jpm/config/dyn:dynamic-lflags jpm/config/dyn:gitpath jpm/config/dyn:headerpath jpm/config/dyn:is-msvc jpm/config/dyn:janet jpm/config/dyn:janet-cflags jpm/config/dyn:janet-importlib jpm/config/dyn:janet-lflags jpm/config/dyn:ldflags jpm/config/dyn:lflags jpm/config/dyn:libpath jpm/config/dyn:local jpm/config/dyn:manpath jpm/config/dyn:modext jpm/config/dyn:modpath jpm/config/dyn:nocolor jpm/config/dyn:offline jpm/config/dyn:optimize jpm/config/dyn:pkglist jpm/config/dyn:silent jpm/config/dyn:statext jpm/config/dyn:tarpath jpm/config/dyn:test jpm/config/dyn:tree jpm/config/dyn:update-pkgs jpm/config/dyn:use-batch-shell jpm/config/dyn:verbose jpm/config/dyn:workers jpm/config/load-config jpm/config/load-config-file jpm/config/load-default jpm/config/load-options jpm/config/opt jpm/config/read-env-variables jpm/config/save-config jpm/config/shorthand-mapping jpm/dagbuild/pdag jpm/dagbuild/pmap jpm/make-config/auto jpm/make-config/generate-config jpm/pm/bundle-install jpm/pm/curl jpm/pm/do-rule jpm/pm/download-bundle jpm/pm/download-git-bundle jpm/pm/download-tar-bundle jpm/pm/git jpm/pm/import-rules jpm/pm/load-lockfile jpm/pm/load-project-meta jpm/pm/make-jpm-env jpm/pm/make-lockfile jpm/pm/out-of-tree-config jpm/pm/post-deps jpm/pm/require-jpm jpm/pm/resolve-bundle jpm/pm/tar jpm/pm/update-git-bundle jpm/pm/update-installed jpm/rules/add-body jpm/rules/add-dep jpm/rules/add-input jpm/rules/add-output jpm/rules/add-thunk jpm/rules/build-rules jpm/rules/getrules jpm/rules/phony jpm/rules/rule jpm/rules/sh-phony jpm/rules/sh-rule jpm/rules/sh-task jpm/rules/task jpm/scaffold/scaffold-project jpm/shutil/abspath jpm/shutil/basename jpm/shutil/clear-cache jpm/shutil/clear-manifest jpm/shutil/clexe-shell jpm/shutil/copy jpm/shutil/copyfile jpm/shutil/create-dirs jpm/shutil/devnull jpm/shutil/dirname jpm/shutil/do-monkeypatch jpm/shutil/drop1-shell jpm/shutil/exec-slurp jpm/shutil/filepath-replace jpm/shutil/find-build-dir jpm/shutil/find-cache jpm/shutil/find-manifest jpm/shutil/find-manifest-dir jpm/shutil/is-mingw jpm/shutil/is-win jpm/shutil/is-win-or-mingw jpm/shutil/path-splitter jpm/shutil/rimraf jpm/shutil/rm jpm/shutil/run-patched jpm/shutil/run-repl jpm/shutil/run-script jpm/shutil/shell jpm/shutil/undo-monkeypatch
(archive-c opts target & objects) -Link object files together to make a static library.Community Examples
(compile-c compiler opts src dest &opt static?) +Link object files together to make a static library.
(compile-c compiler opts src dest &opt static?) -Compile a C file into an object file.Community Examples
(create-buffer-c source dest name) +Compile a C file into an object file.
(create-buffer-c source dest name) -Inline raw byte file as a c file.Community Examples
(create-buffer-c-impl bytes dest name) +Inline raw byte file as a c file.
(create-buffer-c-impl bytes dest name) -Community Examples
(create-executable opts source dest no-core) -Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.Community Examples
(embed-name path) +Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.
(embed-name path) -Rename a janet symbol for embedding.Community Examples
(entry-name name) -Name of symbol that enters static compilation of a module.Community Examples
(entry-replace name) +Name of symbol that enters static compilation of a module.
(entry-replace name) -Escape special characters in the entry-nameCommunity Examples
(link-c has-cpp opts target & objects) +Escape special characters in the entry-name
(link-c has-cpp opts target & objects) -Link C or C++ object files together to make a native module.Community Examples
(make-bin-source declarations lookup-into-invocations no-core) +Link C or C++ object files together to make a native module.
(make-bin-source declarations lookup-into-invocations no-core) -Community Examples
(make-define define value) -Generate strings for adding custom defines to the compiler.Community Examples
(make-defines defines) +Generate strings for adding custom defines to the compiler.
(make-defines defines) -Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.Community Examples
(modpath-to-meta path) +Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.
(modpath-to-meta path) -Get the meta file path (.meta.janet) corresponding to a native module path (.so).Community Examples
(modpath-to-static path) +Get the meta file path (.meta.janet) corresponding to a native module path (.so).
(modpath-to-static path) -Get the static library (.a) path corresponding to a native module path (.so).Community Examples
(out-path path from-ext to-ext) +Get the static library (.a) path corresponding to a native module path (.so).
(out-path path from-ext to-ext) -Take a source file path and convert it to an output path.Community Examples
(add-loader) +Take a source file path and convert it to an output path.
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(ir & body) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(ir & body) -Macro that automatically quotes the body provided and calls (print-ir ...) on the body.Community Examples
(mangle token) +Macro that automatically quotes the body provided and calls (print-ir ...) on the body.
(mangle token) -Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.Community Examples
(print-ir ir) +Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.
(print-ir ir) -Compile the CGEN IR to C and print it to (dyn :out).Community Examples
(configure &opt path) -Setup an out-of-tree build with certain configuration options.Community Examples
(deps) +Setup an out-of-tree build with certain configuration options.
(enable-local-mode) -Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/Community Examples
(help) +Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/
(new-c-project name) -Create a new C projectCommunity Examples
(new-exe-project name) -Create a new executable projectCommunity Examples
(set-tree tree) -Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.Community Examples
(show-paths) +Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.
Table of all built-in options, as opposed to project deifned options.Community Examples
A table of all of the dynamic config bindings to checkers (validators).Community Examples
Table of all of the help text for each config option.Community Examples
A table of possible options for enum option types.Community Examples
A table of all of the dynamic config bindings to parsers.Community Examples
Table of all built-in options, as opposed to project deifned options.
A table of all of the dynamic config bindings to checkers (validators).
(defconf kw &opt parser docs options) -Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.Community Examples
(dyn:ar &opt dflt) +Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.
(load-config settings &opt override) -Load a configuration from a table or struct.Community Examples
(load-config-file path &opt override) +Load a configuration from a table or struct.
(load-config-file path &opt override) -Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.Community Examples
(load-default &opt override) +Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.
(load-default &opt override) -Load the default configuration.Community Examples
(load-options &opt path) -Load a file that contains config options that can be set. If no such file exists, then do nothing.Community Examples
(opt opts key &opt dflt) +Load a file that contains config options that can be set. If no such file exists, then do nothing.
(opt opts key &opt dflt) -Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.Community Examples
(read-env-variables) +Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.
(read-env-variables) -Read environment variables that correspond to config variables into dyns.Community Examples
(save-config path) +Read environment variables that correspond to config variables into dyns.
(save-config path) -Write the current configuration information to a file.Community Examples
Map some single characters to long options.Community Examples
(pdag f dag &opt n-workers) +Write the current configuration information to a file.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.
(pmap f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.Community Examples
(auto) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.
(generate-config &opt destdir silent as-data) +Get an autodetected config.
(generate-config &opt destdir silent as-data) -Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.Community Examples
(bundle-install bundle &opt no-deps) +Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.
(bundle-install bundle &opt no-deps) -Install a bundle from a git repository.Community Examples
(do-rule target) -Evaluate a given rule in a one-off manner.Community Examples
(download-bundle url bundle-type &opt tag shallow) +Evaluate a given rule in a one-off manner.
(download-bundle url bundle-type &opt tag shallow) -Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.Community Examples
(download-git-bundle bundle-dir url tag shallow) +Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.
(download-git-bundle bundle-dir url tag shallow) -Download a git bundle from a remote respositoryCommunity Examples
(download-tar-bundle bundle-dir url &opt force-gz) +Download a git bundle from a remote respository
(download-tar-bundle bundle-dir url &opt force-gz) -Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.Community Examples
(git & args) +Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.
(import-rules path &opt base-env) -Import another file that defines more rules. This ruleset is merged into the current ruleset.Community Examples
(load-lockfile &opt filename) +Import another file that defines more rules. This ruleset is merged into the current ruleset.
(load-lockfile &opt filename) -Load packages from a lockfile.Community Examples
(load-project-meta &opt path) +Load packages from a lockfile.
(load-project-meta &opt path) -Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.Community Examples
(make-jpm-env &opt base-env) +Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.
(make-jpm-env &opt base-env) -Create an environment that is preloaded with jpm symbols.Community Examples
(make-lockfile &opt filename) +Create an environment that is preloaded with jpm symbols.
(out-of-tree-config path &opt options) -Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.Community Examples
(post-deps & body) +Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.
(post-deps & body) -Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.Community Examples
(require-jpm path &opt base-env) +Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.
(require-jpm path &opt base-env) -Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.Community Examples
(resolve-bundle bundle) +Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.
(resolve-bundle bundle) -Convert any bundle string/table to the normalized table form.Community Examples
(tar & args) +Convert any bundle string/table to the normalized table form.
(update-git-bundle bundle-dir tag shallow) +Make a call to tar.
(update-git-bundle bundle-dir tag shallow) -Fetch latest tag version from remote repositoryCommunity Examples
(update-installed) +Fetch latest tag version from remote repository
(update-installed) -Update all previously installed packages to their latest versions.Community Examples
(add-body target & body) +Update all previously installed packages to their latest versions.
(add-body target & body) -Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.Community Examples
(add-dep target dep) +Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.
(add-input target input) -Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.Community Examples
(add-output target output) +Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.
(add-output target output) -Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.Community Examples
(add-thunk target thunk) +Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.
(add-thunk target thunk) -Append a thunk to a target's recipe.Community Examples
(build-rules rules targets &opt n-workers) +Append a thunk to a target's recipe.
(build-rules rules targets &opt n-workers) -Given a graph of all rules, extract a work graph that will build out-of-date files.Community Examples
(getrules) +Given a graph of all rules, extract a work graph that will build out-of-date files.
(rule target deps & body) -Add a rule to the rule graph.Community Examples
(sh-phony target deps & body) -Alias for `sh-task`.Community Examples
(sh-rule target deps & body) -Add a rule that invokes a shell command, and fails if the command returns non-zero.Community Examples
(sh-task target deps & body) +Add a rule that invokes a shell command, and fails if the command returns non-zero.
(sh-task target deps & body) -Add a task that invokes a shell command, and fails if the command returns non-zero.Community Examples
(task target deps & body) +Add a task that invokes a shell command, and fails if the command returns non-zero.
(task target deps & body) -Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).Community Examples
(scaffold-project name &opt options) +Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).
(scaffold-project name &opt options) -Generate a standardized project scaffold.Community Examples
(abspath path) -Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).Community Examples
(basename path) +Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).
(basename path) -Get the filename of a path without any leading directory components.Community Examples
(clear-cache) +Get the filename of a path without any leading directory components.
(clear-manifest) -Clear the global installation manifest.Community Examples
(clexe-shell & args) +Clear the global installation manifest.
(copy src dest) -Copy a file or directory recursively from one location to another.Community Examples
(copyfile src dest) +Copy a file or directory recursively from one location to another.
(copyfile src dest) -Copy a file one location to another.Community Examples
(create-dirs dest) -Create all directories needed for a file (mkdir -p).Community Examples
(dirname path) -Get the directory of a file without the filename.Community Examples
(do-monkeypatch build-dir) +Get the directory of a file without the filename.
(do-monkeypatch build-dir) -Modify the existing environment to have the same paths as the test environment.Community Examples
(drop1-shell std args) +Modify the existing environment to have the same paths as the test environment.
(drop1-shell std args) -Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.Community Examples
(exec-slurp & args) +Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.
(exec-slurp & args) -Read stdout of subprocess and return it trimmed in a string.Community Examples
(filepath-replace repo) +Read stdout of subprocess and return it trimmed in a string.
(filepath-replace repo) -Remove special characters from a string or path to make it into a path segment.Community Examples
(find-build-dir) +Remove special characters from a string or path to make it into a path segment.
(find-build-dir) -Gets the build directory to output files to.Community Examples
(find-cache) -Return the path to the global cache.Community Examples
(find-manifest name) -Get the full path of a manifest file given a package name.Community Examples
(find-manifest-dir) +Get the full path of a manifest file given a package name.
(find-manifest-dir) -Get the path to the directory containing manifests for installed packages.Community Examples
(is-mingw) +Get the path to the directory containing manifests for installed packages.
(is-win) -Check if we should assume a DOS-like shell or default to posix shell.Community Examples
(is-win-or-mingw) +Check if we should assume a DOS-like shell or default to posix shell.
(is-win-or-mingw) -Check if built with mingwCommunity Examples
(rm path) -Remove a directory and all sub directories.Community Examples
(run-patched & extra-args) +Remove a directory and all sub directories.
(run-patched & extra-args) -Run a subprocess Janet repl that has the same environment as the test environment.Community Examples
(run-repl) +Run a subprocess Janet repl that has the same environment as the test environment.
(run-repl) -Run a repl in the monkey patched test environmentCommunity Examples
(run-script path) +Run a repl in the monkey patched test environment
(run-script path) -Run a local script in the monkey patched environment.Community Examples
(shell & args) +Run a local script in the monkey patched environment.
make-config/auto make-config/generate-config
(generate-config &opt destdir silent as-data) +Get an autodetected config.
(generate-config &opt destdir silent as-data) -Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.Community Examples
pm/bundle-install pm/curl pm/do-rule pm/download-bundle pm/download-git-bundle pm/download-tar-bundle pm/git pm/import-rules pm/load-lockfile pm/load-project-meta pm/make-jpm-env pm/make-lockfile pm/out-of-tree-config pm/post-deps pm/require-jpm pm/resolve-bundle pm/tar pm/update-git-bundle pm/update-installed
(bundle-install bundle &opt no-deps) -Install a bundle from a git repository.Community Examples
(do-rule target) -Evaluate a given rule in a one-off manner.Community Examples
(download-bundle url bundle-type &opt tag shallow) +Evaluate a given rule in a one-off manner.
(download-bundle url bundle-type &opt tag shallow) -Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.Community Examples
(download-git-bundle bundle-dir url tag shallow) +Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.
(download-git-bundle bundle-dir url tag shallow) -Download a git bundle from a remote respositoryCommunity Examples
(download-tar-bundle bundle-dir url &opt force-gz) +Download a git bundle from a remote respository
(download-tar-bundle bundle-dir url &opt force-gz) -Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.Community Examples
(git & args) +Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.
(import-rules path &opt base-env) -Import another file that defines more rules. This ruleset is merged into the current ruleset.Community Examples
(load-lockfile &opt filename) +Import another file that defines more rules. This ruleset is merged into the current ruleset.
(load-lockfile &opt filename) -Load packages from a lockfile.Community Examples
(load-project-meta &opt path) -Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.Community Examples
(make-jpm-env &opt base-env) +Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.
(make-jpm-env &opt base-env) -Create an environment that is preloaded with jpm symbols.Community Examples
(make-lockfile &opt filename) +Create an environment that is preloaded with jpm symbols.
(out-of-tree-config path &opt options) -Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.Community Examples
(post-deps & body) +Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.
(post-deps & body) -Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.Community Examples
(require-jpm path &opt base-env) +Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.
(require-jpm path &opt base-env) -Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.Community Examples
(resolve-bundle bundle) +Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.
(resolve-bundle bundle) -Convert any bundle string/table to the normalized table form.Community Examples
(update-git-bundle bundle-dir tag shallow) +Make a call to tar.
(update-git-bundle bundle-dir tag shallow) -Fetch latest tag version from remote repositoryCommunity Examples
(update-installed) +Fetch latest tag version from remote repository
(update-installed) -Update all previously installed packages to their latest versions.Community Examples
rules/add-body rules/add-dep rules/add-input rules/add-output rules/add-thunk rules/build-rules rules/getrules rules/phony rules/rule rules/sh-phony rules/sh-rule rules/sh-task rules/task
(add-body target & body) -Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.Community Examples
(add-dep target dep) +Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.
(add-input target input) -Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.Community Examples
(add-output target output) +Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.
(add-output target output) -Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.Community Examples
(add-thunk target thunk) +Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.
(add-thunk target thunk) -Append a thunk to a target's recipe.Community Examples
(build-rules rules targets &opt n-workers) +Append a thunk to a target's recipe.
(build-rules rules targets &opt n-workers) -Given a graph of all rules, extract a work graph that will build out-of-date files.Community Examples
(getrules) +Given a graph of all rules, extract a work graph that will build out-of-date files.
(sh-rule target deps & body) -Add a rule that invokes a shell command, and fails if the command returns non-zero.Community Examples
(sh-task target deps & body) +Add a rule that invokes a shell command, and fails if the command returns non-zero.
(sh-task target deps & body) -Add a task that invokes a shell command, and fails if the command returns non-zero.Community Examples
(task target deps & body) +Add a task that invokes a shell command, and fails if the command returns non-zero.
(task target deps & body) -Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).Community Examples
(scaffold-project name &opt options) -Generate a standardized project scaffold.Community Examples
shutil/abspath shutil/basename shutil/clear-cache shutil/clear-manifest shutil/clexe-shell shutil/copy shutil/copyfile shutil/create-dirs shutil/devnull shutil/dirname shutil/do-monkeypatch shutil/drop1-shell shutil/exec-slurp shutil/filepath-replace shutil/find-build-dir shutil/find-cache shutil/find-manifest shutil/find-manifest-dir shutil/is-mingw shutil/is-win shutil/is-win-or-mingw shutil/path-splitter shutil/rimraf shutil/rm shutil/run-patched shutil/run-repl shutil/run-script shutil/shell shutil/undo-monkeypatch
(abspath path) -Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).Community Examples
(basename path) +Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).
(basename path) -Get the filename of a path without any leading directory components.Community Examples
(clear-cache) +Get the filename of a path without any leading directory components.
(clear-manifest) -Clear the global installation manifest.Community Examples
(copy src dest) -Copy a file or directory recursively from one location to another.Community Examples
(copyfile src dest) +Copy a file or directory recursively from one location to another.
(copyfile src dest) -Copy a file one location to another.Community Examples
(create-dirs dest) -Create all directories needed for a file (mkdir -p).Community Examples
(dirname path) -Get the directory of a file without the filename.Community Examples
(do-monkeypatch build-dir) +Get the directory of a file without the filename.
(do-monkeypatch build-dir) -Modify the existing environment to have the same paths as the test environment.Community Examples
(drop1-shell std args) +Modify the existing environment to have the same paths as the test environment.
(drop1-shell std args) -Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.Community Examples
(exec-slurp & args) +Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.
(exec-slurp & args) -Read stdout of subprocess and return it trimmed in a string.Community Examples
(filepath-replace repo) +Read stdout of subprocess and return it trimmed in a string.
(filepath-replace repo) -Remove special characters from a string or path to make it into a path segment.Community Examples
(find-build-dir) +Remove special characters from a string or path to make it into a path segment.
(find-build-dir) -Gets the build directory to output files to.Community Examples
(find-cache) -Return the path to the global cache.Community Examples
(find-manifest name) -Get the full path of a manifest file given a package name.Community Examples
(find-manifest-dir) +Get the full path of a manifest file given a package name.
(find-manifest-dir) -Get the path to the directory containing manifests for installed packages.Community Examples
(is-mingw) +Get the path to the directory containing manifests for installed packages.
(is-win) -Check if we should assume a DOS-like shell or default to posix shell.Community Examples
(is-win-or-mingw) +Check if we should assume a DOS-like shell or default to posix shell.
(is-win-or-mingw) -Check if built with mingwCommunity Examples
(run-patched & extra-args) +Remove a directory and all sub directories.
(run-patched & extra-args) -Run a subprocess Janet repl that has the same environment as the test environment.Community Examples
(run-repl) +Run a subprocess Janet repl that has the same environment as the test environment.
(run-repl) -Run a repl in the monkey patched test environmentCommunity Examples
(run-script path) +Run a repl in the monkey patched test environment
(run-script path) -Run a local script in the monkey patched environment.Community Examples
(decode s) Converts a base64 encoded string to its binary representation of any format -(UTF-8, binary, ..).Community Examples
(encode s) -Converts a string of any format (UTF-8, binary, ..) to base64 encoding.Community Examples
crc/make-variant crc/named-variant
(crc/make-variant size polynomial &opt init byte-flip xorout) -Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.Community Examples
(crc/named-variant name) +Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.
(crc/named-variant name) -Get a named CRC variant.Community Examples
cron/check cron/next-timestamp cron/parse-cron
(check cron &opt time local) -Check if a given time matches a cron specifier.Community Examples
(next-timestamp cron &opt time local) +Check if a given time matches a cron specifier.
(next-timestamp cron &opt time local) -Given a cron schedule, get the next instance on the cron tab after timeCommunity Examples
(parse-cron str) +Given a cron schedule, get the next instance on the cron tab after time
(parse-cron str) -Parse a cron string into a valid cron schedule objectCommunity Examples
ev-utils/go-nursery ev-utils/join-nursery ev-utils/multithread-service ev-utils/nursery ev-utils/pcall ev-utils/pdag ev-utils/pmap ev-utils/pmap-full ev-utils/pmap-limited ev-utils/spawn-nursery ev-utils/wait-cancel
(go-nursery nurse f &opt value) -Spawn a fiber into a nursery, similar to ev/go.Community Examples
(join-nursery nurse) +Spawn a fiber into a nursery, similar to ev/go.
(join-nursery nurse) -Suspend the current fiber until the nursery is emptied.Community Examples
(multithread-service thread-main n-threads) +Suspend the current fiber until the nursery is emptied.
(multithread-service thread-main n-threads) -Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.Community Examples
(nursery) +Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.
(nursery) -Group a number of fibers into a single object for structured concurrencyCommunity Examples
(pcall f n) +Group a number of fibers into a single object for structured concurrency
(pcall f n) -Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.Community Examples
(pdag f dag &opt n-workers) +Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data &opt n-workers) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.
(pmap f data &opt n-workers) -Map `f` over data in parallel, optionally limiting parallelism to `n` workers.Community Examples
(pmap-full f data) +Map `f` over data in parallel, optionally limiting parallelism to `n` workers.
(pmap-full f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.Community Examples
(pmap-limited f data n-workers) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.
(pmap-limited f data n-workers) -Similar to pmap-full, but only runs work n-ways parallel.Community Examples
(spawn-nursery nurse & body) +Similar to pmap-full, but only runs work n-ways parallel.
(spawn-nursery nurse & body) -Similar to ev/spawn but associate spawned fibers with a nurseryCommunity Examples
(wait-cancel & body) +Similar to ev/spawn but associate spawned fibers with a nursery
(wait-cancel & body) -Wait forever until the current fiber is canceled, and then run some cleanup code.Community Examples
fmt/format fmt/format-file fmt/format-print
(format source) -Format a string of source code to a buffer.Community Examples
(format-print source) -Format a string of source code and print the result.Community Examples
generators/concat generators/cycle generators/drop generators/drop-until generators/drop-while generators/filter generators/from-iterable generators/map generators/mapcat generators/range generators/run generators/take generators/take-until generators/take-while generators/to-array
(concat & xs) -Concatenate one or more generators or iterables into a single generator.Community Examples
(cycle ds) +Concatenate one or more generators or iterables into a single generator.
(cycle ds) -Repeatedly yield the elements of `ds`, looping back to the beginning when finished.Community Examples
(drop n ds) +Repeatedly yield the elements of `ds`, looping back to the beginning when finished.
(drop-until p ds) -Drop elements from `ds` until `p` is true.Community Examples
(drop-while p ds) -Drop elements from `ds` while `p` is true.Community Examples
(filter p ds) -Create a generator that filters `ds` with `p`.Community Examples
(from-iterable ds) +Create a generator that filters `ds` with `p`.
(from-iterable ds) -Create a new generator around any iterable data structure.Community Examples
(map f ds) +Create a new generator around any iterable data structure.
(map f ds) -Create a generator that maps `f` over `ds`.Community Examples
(mapcat f ds) -Map `f` over `ds`, concatenating the results into a new generator.Community Examples
(range from to) +Map `f` over `ds`, concatenating the results into a new generator.
(take n ds) -Take `n` elements from iterable `ds`.Community Examples
(take-until p ds) -Return elements from `ds` until `p` is true.Community Examples
(take-while p ds) +Return elements from `ds` until `p` is true.
(take-while p ds) -Return elements from `ds` while `p` is true.Community Examples
getline/default-autocomplete-context getline/default-autocomplete-options getline/default-doc-fetch getline/make-getline getline/max-history
(default-autocomplete-context buf pos) -Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.Community Examples
(default-autocomplete-options prefix &) +Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.
(default-autocomplete-options prefix &) -Default handler to get available autocomplete options for a given substring.Community Examples
(default-doc-fetch sym w &) +Default handler to get available autocomplete options for a given substring.
(default-doc-fetch sym w &) -Default handler for Ctrl-G to lookup docstrings in the current environment.Community Examples
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) +Default handler for Ctrl-G to lookup docstrings in the current environment.
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) -Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.Community Examples
htmlgen/doctype-html htmlgen/escape htmlgen/html htmlgen/raw
(escape x) +htmlgen/doctype-html htmlgen/escape htmlgen/html htmlgen/raw
htmlgen/html function source(html data &opt buf) -Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.Community Exampleshtmlgen/raw function source(raw text) +Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.htmlgen/raw function source+Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.(raw text) -Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.Community Examples
http/cookie-grammar http/cookies http/logger http/middleware http/query-string-grammar http/read-body http/read-request http/read-response http/request http/request-peg http/response-peg http/router http/send-response http/server http/server-handler http/status-messages http/url-grammar
Grammar to parse a cookie header to a series of keys and values.Community Examples
(cookies nextmw) +http/cookie-grammar http/cookies http/logger http/middleware http/query-string-grammar http/read-body http/read-request http/read-response http/request http/request-peg http/response-peg http/router http/send-response http/server http/server-handler http/status-messages http/url-grammar
http/cookie-grammar core/peg sourceGrammar to parse a cookie header to a series of keys and values.http/cookies function source(cookies nextmw) -Parses cookies into the table under :cookies keyCommunity Exampleshttp/logger function source(logger nextmw) -Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.Community Exampleshttp/middleware function source(middleware x) +Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.http/middleware function source(middleware x) -Coerce any type to http middlewareCommunity Exampleshttp/query-string-grammar core/peg sourceGrammar that parses a query string (sans url path and ? character) and returns a table.Community Exampleshttp/query-string-grammar core/peg sourceGrammar that parses a query string (sans url path and ? character) and returns a table.http/read-body function source(read-body req) -Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.Community Exampleshttp/read-request function source(read-request conn buf &opt no-query) +Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.http/read-request function source(read-request conn buf &opt no-query) -Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Exampleshttp/read-response function source(read-response conn buf) +Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`http/read-response function source(read-response conn buf) -Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Exampleshttp/request function source(request method url &keys {:headers headers :body body}) +Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`http/request function source(request method url &keys {:headers headers :body body}) -Make an HTTP request to a server. Returns a table contain response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.Community Exampleshttp/router function source(router routes) +Make an HTTP request to a server. Returns a table contain response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.http/router function source(router routes) -Creates a router middleware. A router will dispatch to different routes based on the URL path.Community Exampleshttp/send-response function source(send-response conn response &opt buf) +Creates a router middleware. A router will dispatch to different routes based on the URL path.http/send-response function source(send-response conn response &opt buf) -Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.Community Exampleshttp/server function source(server handler &opt host port) +Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.http/server function source(server handler &opt host port) -Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.Community Exampleshttp/server-handler function source(server-handler conn handler) +Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.http/server-handler function source(server-handler conn handler) -A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Community Exampleshttp/status-messages struct sourceMapping of HTTP status codes to their status message.Community Exampleshttp/url-grammar core/peg source+A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.Community Examples
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.
httpf/add-bindings-as-routes httpf/add-route httpf/default-payload-wrapper httpf/listen httpf/server
(add-bindings-as-routes server &opt env) -Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.Community Examples
(add-route server path docstring schema handler &opt read-mime render-mime) +Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.
(add-route server path docstring schema handler &opt read-mime render-mime) -Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.Community Examples
(default-payload-wrapper payload) +Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.
(default-payload-wrapper payload) -Add some metadata to all responsesCommunity Examples
(listen server &opt host port n-workers) +Add some metadata to all responses
(listen server &opt host port n-workers) -Start serverCommunity Examples
(decode s) Converts a base64 encoded string to its binary representation of any format -(UTF-8, binary, ..).Community Examples
(encode s) -Converts a string of any format (UTF-8, binary, ..) to base64 encoding.Community Examples
(crc/make-variant size polynomial &opt init byte-flip xorout) +Converts a string of any format (UTF-8, binary, ..) to base64 encoding.
(crc/make-variant size polynomial &opt init byte-flip xorout) -Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.Community Examples
(crc/named-variant name) +Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.
(crc/named-variant name) -Get a named CRC variant.Community Examples
(check cron &opt time local) -Check if a given time matches a cron specifier.Community Examples
(next-timestamp cron &opt time local) +Check if a given time matches a cron specifier.
(next-timestamp cron &opt time local) -Given a cron schedule, get the next instance on the cron tab after timeCommunity Examples
(parse-cron str) +Given a cron schedule, get the next instance on the cron tab after time
(parse-cron str) -Parse a cron string into a valid cron schedule objectCommunity Examples
(go-nursery nurse f &opt value) +Parse a cron string into a valid cron schedule object
(go-nursery nurse f &opt value) -Spawn a fiber into a nursery, similar to ev/go.Community Examples
(join-nursery nurse) +Spawn a fiber into a nursery, similar to ev/go.
(join-nursery nurse) -Suspend the current fiber until the nursery is emptied.Community Examples
(multithread-service thread-main n-threads) +Suspend the current fiber until the nursery is emptied.
(multithread-service thread-main n-threads) -Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.Community Examples
(nursery) +Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.
(nursery) -Group a number of fibers into a single object for structured concurrencyCommunity Examples
(pcall f n) +Group a number of fibers into a single object for structured concurrency
(pcall f n) -Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.Community Examples
(pdag f dag &opt n-workers) +Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data &opt n-workers) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.
(pmap f data &opt n-workers) -Map `f` over data in parallel, optionally limiting parallelism to `n` workers.Community Examples
(pmap-full f data) +Map `f` over data in parallel, optionally limiting parallelism to `n` workers.
(pmap-full f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.Community Examples
(pmap-limited f data n-workers) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.
(pmap-limited f data n-workers) -Similar to pmap-full, but only runs work n-ways parallel.Community Examples
(spawn-nursery nurse & body) +Similar to pmap-full, but only runs work n-ways parallel.
(spawn-nursery nurse & body) -Similar to ev/spawn but associate spawned fibers with a nurseryCommunity Examples
(wait-cancel & body) +Similar to ev/spawn but associate spawned fibers with a nursery
(wait-cancel & body) -Wait forever until the current fiber is canceled, and then run some cleanup code.Community Examples
(format source) +Wait forever until the current fiber is canceled, and then run some cleanup code.
(format source) -Format a string of source code to a buffer.Community Examples
(format-file file) +Format a string of source code to a buffer.
(format-print source) -Format a string of source code and print the result.Community Examples
(concat & xs) +Format a string of source code and print the result.
(concat & xs) -Concatenate one or more generators or iterables into a single generator.Community Examples
(cycle ds) +Concatenate one or more generators or iterables into a single generator.
(cycle ds) -Repeatedly yield the elements of `ds`, looping back to the beginning when finished.Community Examples
(drop n ds) +Repeatedly yield the elements of `ds`, looping back to the beginning when finished.
(drop-until p ds) -Drop elements from `ds` until `p` is true.Community Examples
(drop-while p ds) +Drop elements from `ds` until `p` is true.
(drop-while p ds) -Drop elements from `ds` while `p` is true.Community Examples
(filter p ds) -Create a generator that filters `ds` with `p`.Community Examples
(from-iterable ds) +Create a generator that filters `ds` with `p`.
(from-iterable ds) -Create a new generator around any iterable data structure.Community Examples
(map f ds) +Create a new generator around any iterable data structure.
(map f ds) -Create a generator that maps `f` over `ds`.Community Examples
(mapcat f ds) -Map `f` over `ds`, concatenating the results into a new generator.Community Examples
(range from to) +Map `f` over `ds`, concatenating the results into a new generator.
(take n ds) -Take `n` elements from iterable `ds`.Community Examples
(take-until p ds) +Take `n` elements from iterable `ds`.
(take-until p ds) -Return elements from `ds` until `p` is true.Community Examples
(take-while p ds) +Return elements from `ds` until `p` is true.
(take-while p ds) -Return elements from `ds` while `p` is true.Community Examples
(to-array s) +Return elements from `ds` while `p` is true.
(to-array s) -Consume `s` into a new array.Community Examples
(default-autocomplete-context buf pos) +Consume `s` into a new array.
(default-autocomplete-context buf pos) -Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.Community Examples
(default-autocomplete-options prefix &) +Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.
(default-autocomplete-options prefix &) -Default handler to get available autocomplete options for a given substring.Community Examples
(default-doc-fetch sym w &) +Default handler to get available autocomplete options for a given substring.
(default-doc-fetch sym w &) -Default handler for Ctrl-G to lookup docstrings in the current environment.Community Examples
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) +Default handler for Ctrl-G to lookup docstrings in the current environment.
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) -Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.Community Examples
(escape x) +Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.
(escape x) -Escape characters in a string for HTMLCommunity Examples
(html data &opt buf) -Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.Community Examples
(raw text) +Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.
(raw text) -Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.Community Examples
Grammar to parse a cookie header to a series of keys and values.Community Examples
(cookies nextmw) +Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.
Grammar to parse a cookie header to a series of keys and values.
(cookies nextmw) -Parses cookies into the table under :cookies keyCommunity Examples
(logger nextmw) -Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.Community Examples
(middleware x) +Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.
(middleware x) -Coerce any type to http middlewareCommunity Examples
Grammar that parses a query string (sans url path and ? character) and returns a table.Community Examples
Grammar that parses a query string (sans url path and ? character) and returns a table.
(read-body req) -Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.Community Examples
(read-request conn buf &opt no-query) +Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.
(read-request conn buf &opt no-query) -Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Examples
(read-response conn buf) +Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`
(read-response conn buf) -Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Examples
(request method url &keys {:headers headers :body body}) +Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`
(request method url &keys {:headers headers :body body}) -Make an HTTP request to a server. Returns a table contain response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.Community Examples
(router routes) +Make an HTTP request to a server. Returns a table contain response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.
(router routes) -Creates a router middleware. A router will dispatch to different routes based on the URL path.Community Examples
(send-response conn response &opt buf) +Creates a router middleware. A router will dispatch to different routes based on the URL path.
(send-response conn response &opt buf) -Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.Community Examples
(server handler &opt host port) +Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.
(server handler &opt host port) -Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.Community Examples
(server-handler conn handler) +Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.
(server-handler conn handler) -A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Community Examples
Mapping of HTTP status codes to their status message.Community Examples
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.Community Examples
(add-bindings-as-routes server &opt env) +A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.
(add-bindings-as-routes server &opt env) -Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.Community Examples
(add-route server path docstring schema handler &opt read-mime render-mime) +Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.
(add-route server path docstring schema handler &opt read-mime render-mime) -Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.Community Examples
(default-payload-wrapper payload) +Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.
(default-payload-wrapper payload) -Add some metadata to all responsesCommunity Examples
(listen server &opt host port n-workers) +Add some metadata to all responses
(listen server &opt host port n-workers) -Start serverCommunity Examples
(json/decode json-source &opt keywords nils) +Create a new server.
(json/decode json-source &opt keywords nils) -Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.Community Examples
(json/encode x &opt tab newline buf) +Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.
(json/encode x &opt tab newline buf) -Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.Community Examples
Dynamic binding to front matter after parsing, compilation, and evaluation, of markup completes.Community Examples
The htmlgen source that can be used to generate a document with htmlgen/html.Community Examples
(add-loader) +Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.
Dynamic binding to front matter after parsing, compilation, and evaluation, of markup completes.
The htmlgen source that can be used to generate a document with htmlgen/html.
(add-loader) -Allow importing and requiring markup as a moduleCommunity Examples
(anchor name & content) +Allow importing and requiring markup as a module
(anchor name & content) -Create an in-page anchor for a local link.Community Examples
(bigger content) -Make span element with bigger fontCommunity Examples
(blockquote content) -Make a block quote elementCommunity Examples
(code content) -Make code element with class mendoza-codeCommunity Examples
(codeblock lang &opt source) +Make code element with class mendoza-code
(codeblock lang &opt source) -Inline code or codeblockCommunity Examples
Make a div element
Make a em element
Make a li element
(markup source &opt env where) -Parse mendoza markup and evaluate it returning an htmlgen document tree.Community Examples
(mdz-loader path &) +Parse mendoza markup and evaluate it returning an htmlgen document tree.
(mdz-loader path &) -Loader for the mdz formatCommunity Examples
Make a ol element
Make a p element
Make a pre element
(section name content) -Create a section. Usually used to embed different parts of the content document into different parts of the main page.Community Examples
(smaller content) +Create a section. Usually used to embed different parts of the content document into different parts of the main page.
(smaller content) -Make span element with smaller fontCommunity Examples
Make a strong element
Make a sub element
Make a sup element
(tag name content) -Wrap some content in an html tag. If you need attributes or other properties, you may want to use raw HTML via the html function.Community Examples
(always x) +Wrap some content in an html tag. If you need attributes or other properties, you may want to use raw HTML via the html function.
Make a td element
Make a th element
Make a tr element
Make a u element
Make a ul element
(always x) -Return a function that discards any arguments and always returns `x`.Community Examples
(antepenultimate xs) +Return a function that discards any arguments and always returns `x`.
(antepenultimate xs) -Get the third-to-last element from an indexed data structure.Community Examples
(caperr & body) +Get the third-to-last element from an indexed data structure.
(caperr & body) Captures the standart error output of the variadic `body` and returns it -as a buffer.Community Examples
(capout & body) Captures the standart output of the variadic `body` and returns it as -a buffer.Community Examples
(cond-> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs with condition and operation to which the `val`, is put as first argument. All conditions are tried and for truthy conditions the operation is executed. -Returns the value mutated if any condition is truthy.Community Examples
(cond->> val & clauses) +Returns the value mutated if any condition is truthy.
(cond->> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs of condition and operation to which the `val`, is put as last argument. All conditions are tried and for truthy the operation is ran. -Returns mutated value if any condition is truthy.Community Examples
(dedent & xs) Remove indentation after concatenating the arguments. Works by removing leading whitespace, and then removing that same pattern of whitepsace after -new lines.Community Examples
(defs & bindings) -Defines many constants as in let `bindings`, but without creating new scope.Community Examples
(dfs data visit-leaf &opt node-before node-after get-children seen) +Defines many constants as in let `bindings`, but without creating new scope.
(dfs data visit-leaf &opt node-before node-after get-children seen) Do a depth first, pre-order traversal over a data structure. Also allow for callbacks before and after visiting the children of a node. Also allow for a custom `get-children` function to change traversal as needed. Will detect cycles if an empty table is passed as the `seen` parameter, which is used to cached values -that have been visited.Community Examples
(do-def c d & body) Convenience macro for defining constant named `c` with value `d` before `body` and returning it after evaluating `body`, that presumably modifies -the `c` refered content. For example buffer, table or array.Community Examples
(do-var v d & body) +the `c` refered content. For example buffer, table or array.
(do-var v d & body) Convenience macro for defining varible named `v` with value `d` before `body` -and returning it after evaluating `body`, that presumably modifies `v`.Community Examples
(format-table buf-into data &opt columns header-mapping column-mapping) +and returning it after evaluating `body`, that presumably modifies `v`.
(format-table buf-into data &opt columns header-mapping column-mapping) -Same as print-table but pushes table into a buffer.Community Examples
(gett ds & keys) -Recursive macro (get). Similar to get-in, but keys are variadic argument.Community Examples
(insert-sorted arr <? & xs) +Recursive macro (get). Similar to get-in, but keys are variadic argument.
(insert-sorted arr <? & xs) Insert elements in `arr` such that it remains sorted by the comparator. If -`arr` is not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(insert-sorted-by arr f & xs) +`arr` is not sorted beforehand, the results are undefined. Returns `arr`.
(insert-sorted-by arr f & xs) Insert elements in `arr` such that it remains sorted by the value returned when `f` is called with the element, comparing the values with <. If `arr` is -not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(int->string int &opt base) +not sorted beforehand, the results are undefined. Returns `arr`.
(int->string int &opt base) -Stringify an integer in a particular base. Defaults to decimal (base 10).Community Examples
(int/ & xs) +Stringify an integer in a particular base. Defaults to decimal (base 10).
(log level & args) Print to a dynamic binding stream if that stream is set, otherwise do nothing. Evaluate to nil. For example, `(log :err "value error: %V" my-value)` will print -to `(dyn :err)` only if `(dyn :err)` has been set.Community Examples
(make prototype & pairs) +to `(dyn :err)` only if `(dyn :err)` has been set.
(make prototype & pairs) Convenience macro for creating new table from even number of kvs pairs in a variadic `table-or-pairs` arguments and setting its prototype to `prototype`. -Factory function for creating new objects from prototypes.Community Examples
(make-id &opt prefix) +Factory function for creating new objects from prototypes.
(make-id &opt prefix) Create a random, printable keyword id with 10 bytes of entropy -with an optional prefix.Community Examples
(map-keys f data) Returns new table with function `f` applied to `data`'s -keys recursively.Community Examples
(map-vals f data) -Returns new table with function `f` applied to `data`'s values.Community Examples
(penultimate xs) +Returns new table with function `f` applied to `data`'s values.
(penultimate xs) -Get the second-to-last element from an indexed data structure.Community Examples
(print-table data &opt columns header-mapping column-mapping) +Get the second-to-last element from an indexed data structure.
(print-table data &opt columns header-mapping column-mapping) Iterate through the rows of a data structure and print a table in a human readable way, with padding and heading information. Can optionally provide @@ -390,310 +390,310 @@Community ExamplesSpork
for each row. Lastly, a `header-mapping` dictionary can be provided that changes the printed header names by mapping column keys to the desired header name. If no mapping is found, then the column key will be used as -the header name. Returns nil.
(randomize-array arr &opt rng) +the header name. Returns nil.
(randomize-array arr &opt rng) Randomizes array using the fisher-yates shuffle, takes an optional random -number generator.Community Examples
(second xs) -Get the second element from an indexed data structure.Community Examples
(select-keys data keyz) +Get the second element from an indexed data structure.
(select-keys data keyz) -Returns new table with selected `keyz` from dictionary `data`.Community Examples
(set* tgts exprs) +Returns new table with selected `keyz` from dictionary `data`.
(set* tgts exprs) Parallel `set` function. Takes a list of targets and expressions, evaluates all the expressions, and then assigns them to the targets. Each target can be a variable -or a 2-tuple, just like in the normal `set` special form.Community Examples
(string->int str &opt base) +or a 2-tuple, just like in the normal `set` special form.
(string->int str &opt base) Parse an integer in the given base. Defaults to decimal (base 10). Differs -from scan-number in that this does not recognize floating point notation.Community Examples
(table-filter pred dict) +from scan-number in that this does not recognize floating point notation.
(table-filter pred dict) Filter a key-value structure info a table. Semantics are the same as for built-in `filter`, except that `pred` takes two arguments (key and value.) -Does not consider prototypes.Community Examples
(third xs) -Get the third element from an indexed data structure.Community Examples
(trim-prefix prefix str) +Get the third element from an indexed data structure.
(trim-prefix prefix str) -Trim the specified prefix of a string if it has oneCommunity Examples
(trim-suffix suffix str) +Trim the specified prefix of a string if it has one
(trim-suffix suffix str) -Trim the specified suffix of a string if it has oneCommunity Examples
(until cnd & body) +Trim the specified suffix of a string if it has one
(until cnd & body) Repeat `body` while the `cnd` is false. -Equivalent to (while (not cnd) ;body).Community Examples
(vars & bindings) -Defines many variables as in let `bindings`, but without creating new scope.Community Examples
(make-proto stream &opt pack unpack) +Defines many variables as in let `bindings`, but without creating new scope.
(make-proto stream &opt pack unpack) -Create both a send an recv function from a stream, as with `make-send` and `make-recv`.Community Examples
(make-recv stream &opt unpack) +Create both a send an recv function from a stream, as with `make-send` and `make-recv`.
(make-recv stream &opt unpack) -Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.Community Examples
(make-send stream &opt pack) +Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.
(make-send stream &opt pack) -Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.Community Examples
(client &opt host port name) +Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.
(client &opt host port name) -Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".Community Examples
Default host to run server on and connect to.Community Examples
(server &opt host port env cleanup welcome-msg) +Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".
(server &opt host port env cleanup welcome-msg) -Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.Community Examples
(server-single &opt host port env cleanup welcome-msg) +Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.
(server-single &opt host port env cleanup welcome-msg) -Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.Community Examples
(posix/abspath path) +Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(ext path) -Get the file extension for a path.Community Examples
(posix/join & els) -Join path elements together.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/parts path) -Split a path into its parts.Community Examples
(posix/relpath source target) +Split a path into its parts.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(posix/relpath source target) +Get the relative path between two subpaths.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(win32/abspath path) +Get the relative path between two subpaths.
(win32/abspath path) -Coerce a path to be absolute.Community Examples
(win32/abspath? path) -Check if a path is absolute.Community Examples
(win32/basename path) -Gets the base file name of a path.Community Examples
(win32/dirname path) -Gets the directory name of a path.Community Examples
(ext path) -Get the file extension for a path.Community Examples
(win32/join & els) -Join path elements together.Community Examples
(win32/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(win32/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(win32/parts path) -Split a path into its parts.Community Examples
(win32/relpath source target) +Split a path into its parts.
(win32/relpath source target) -Get the relative path between two subpaths.Community Examples
(rawterm/begin &opt on-winch) +Get the relative path between two subpaths.
(rawterm/begin &opt on-winch) -Begin raw terminal functionality. Return a stream that can be read from to get input.Community Examples
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) +Begin raw terminal functionality. Return a stream that can be read from to get input.
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) -Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.Community Examples
(rawterm/ctrl-z) +Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.
(rawterm/ctrl-z) -A handler that a user can use to handle ctrl-z from input to suspend the current process.Community Examples
(rawterm/end) +A handler that a user can use to handle ctrl-z from input to suspend the current process.
(rawterm/getch &opt into) -Get a byte of input from stdin, without blocking if possible. Returns a buffer.Community Examples
(rawterm/isatty) +Get a byte of input from stdin, without blocking if possible. Returns a buffer.
(rawterm/isatty) -Check if the current stdin is a tty.Community Examples
(rawterm/monowidth bytes &opt start-index end-index) +Check if the current stdin is a tty.
(rawterm/monowidth bytes &opt start-index end-index) -Measure the monospace width of a string.Community Examples
(rawterm/rune-monowidth rune) +Measure the monospace width of a string.
(rawterm/rune-monowidth rune) -Get the monospace width of a rune. Returns either 0, 1, or 2.Community Examples
(rawterm/size) +Get the monospace width of a rune. Returns either 0, 1, or 2.
(rawterm/size) -Get the number of rows and columns visible in the terminal as tuple [rows cols]Community Examples
(rawterm/slice-monowidth bytes columns &opt start-index into) +Get the number of rows and columns visible in the terminal as tuple [rows cols]
(rawterm/slice-monowidth bytes columns &opt start-index into) -Get a byte slice that will fit into a number of columns.Community Examples
(compile pattern) +Get a byte slice that will fit into a number of columns.
(compile pattern) -Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.Community Examples
(find reg text &opt start) +Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.
(find reg text &opt start) -Similar to peg/find, but for regexes.Community Examples
(find-all reg text &opt start) +Similar to peg/find, but for regexes.
(find-all reg text &opt start) -Similar to peg/find-all, but for regexes.Community Examples
(match reg text &opt start) +Similar to peg/find-all, but for regexes.
(match reg text &opt start) -Similar to peg/match, but for regexes.Community Examples
Peg used to generate peg source code from a regular expression string.Community Examples
(replace reg rep text &opt start) +Similar to peg/match, but for regexes.
Peg used to generate peg source code from a regular expression string.
(replace reg rep text &opt start) -Similar to peg/replace, but for regexes.Community Examples
(replace-all reg rep text &opt start) +Similar to peg/replace, but for regexes.
(replace-all reg rep text &opt start) -Similar to peg/replace-all, but for regexes.Community Examples
(source pattern) -Compile a subset of regex to PEG source code.Community Examples
(client &opt host port name) +Compile a subset of regex to PEG source code.
(client &opt host port name) -Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.Community Examples
Default host to run server on and connect to.Community Examples
(server functions &opt host port workers-per-connection) +Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.
(server functions &opt host port workers-per-connection) -Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.Community Examples
(make-predicate schema) +Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.
(make-predicate schema) -Generate a function that can be used to validate a data structure. This is the function form of `predicate`.Community Examples
(make-validator schema) +Generate a function that can be used to validate a data structure. This is the function form of `predicate`.
(make-validator schema) -Generate a function that can be used to validate a data structure. This is the function form of `validator`.Community Examples
(predicate pattern) +Generate a function that can be used to validate a data structure. This is the function form of `validator`.
(predicate pattern) -Make a validation predicate given a certain schema.Community Examples
(validator pattern) +Make a validation predicate given a certain schema.
(validator pattern) -Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.Community Examples
The currently running service manager, if there is oneCommunity Examples
The currently running service, if there is oneCommunity Examples
(add-service service-name main-function & args) +Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.
The currently running service manager, if there is one
(add-service service-name main-function & args) -Spawn a serviceCommunity Examples
(all-services) -Get a list of running servicesCommunity Examples
(get-manager) -Get the current manager. If no manager exists, create one.Community Examples
(get-service) +Get the current manager. If no manager exists, create one.
(get-service) -Get the current service. If not in a service, raise an errorCommunity Examples
(make-manager &opt log-dir) +Get the current service. If not in a service, raise an error
(make-manager &opt log-dir) -Group a number of fibers into a single object for structured concurrency. Also includes utilities for running services like servers in the background.Community Examples
(print-all &opt filter-fn) +Group a number of fibers into a single object for structured concurrency. Also includes utilities for running services like servers in the background.
(print-all &opt filter-fn) -Print a table of all running services.Community Examples
(remove-service service-name) +Print a table of all running services.
(remove-service service-name) -Remove a serviceCommunity Examples
(set-title title) -Set a textual description of the service to describe what it is doing currentlyCommunity Examples
(start-service service-name) +Set a textual description of the service to describe what it is doing currently
(start-service service-name) -Start or restart a serviceCommunity Examples
(stop-service service-name &opt reason) +Start or restart a service
(stop-service service-name &opt reason) -Stop a running serviceCommunity Examples
(wait) -Once a number of services have been spawned, call `wait` to block the fiber until the manager is canceled. This lets a manager fiber behave as a service itself.Community Examples
(copy src dest) +Once a number of services have been spawned, call `wait` to block the fiber until the manager is canceled. This lets a manager fiber behave as a service itself.
(copy src dest) Copy a file or directory recursively from one location to another. -Expects input to be unix style pathsCommunity Examples
(copy-file src-path dst-path) +Expects input to be unix style paths
(copy-file src-path dst-path) -Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.Community Examples
(create-dirs dir-path) +Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.
(create-dirs dir-path) -Create all directories in path specified as string including itself.Community Examples
(devnull) +Create all directories in path specified as string including itself.
(devnull) -get the /dev/null equivalent of the current platform as an open fileCommunity Examples
(escape & args) +get the /dev/null equivalent of the current platform as an open file
(escape & args) -Output a string with all arguments correctly quotedCommunity Examples
(exec & args) -Execute command specified by args returning it's exit codeCommunity Examples
(exec-fail & args) +Execute command specified by args returning it's exit code
(exec-fail & args) -Execute command specified by args, fails when command exits with non-zero exit codeCommunity Examples
(exec-slurp & args) +Execute command specified by args, fails when command exits with non-zero exit code
(exec-slurp & args) -Read stdout of command specified by args and return it trimmed in a string.Community Examples
(exec-slurp-all & args) +Read stdout of command specified by args and return it trimmed in a string.
(exec-slurp-all & args) Read stdout and stderr of subprocess and return it trimmed in a struct with :err and :out containing the output as string. -This will also return the exit code under the :status key.Community Examples
(exists? path) +This will also return the exit code under the :status key.
(exists? path) -Check if the given file or directory exists. (Follows symlinks)Community Examples
(list-all-files dir &opt into) +Check if the given file or directory exists. (Follows symlinks)
(list-all-files dir &opt into) -List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.Community Examples
(make-new-file file-path &opt mode) +List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.
(make-new-file file-path &opt mode) -Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).Community Examples
(rm path) +Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).
(rm path) -Remove a directory and all sub directories recursively.Community Examples
(scan-directory dir func) +Remove a directory and all sub directories recursively.
(scan-directory dir func) -Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.Community Examples
(split s) +Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.
(split s) -Split a string into 'sh like' tokens, returns nil if unable to parse the string.Community Examples
(tarray/buffer array|size) +Split a string into 'sh like' tokens, returns nil if unable to parse the string.
(tarray/buffer array|size) -Return typed array buffer or create a new buffer.Community Examples
(tarray/copy-bytes src sindex dst dindex &opt count) +Return typed array buffer or create a new buffer.
(tarray/copy-bytes src sindex dst dindex &opt count) -Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.Community Examples
(tarray/length array|buffer) +Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.
(tarray/length array|buffer) -Return typed array or buffer size.Community Examples
(tarray/new type size &opt stride offset tarray|buffer) +Return typed array or buffer size.
(tarray/new type size &opt stride offset tarray|buffer) -Create new typed array.Community Examples
(tarray/properties array) +Create new typed array.
(tarray/properties array) -Return typed array properties as a struct.Community Examples
(tarray/slice tarr &opt start end) +Return typed array properties as a struct.
(tarray/slice tarr &opt start end) -Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.Community Examples
(tarray/swap-bytes src sindex dst dindex &opt count) +Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.
(tarray/swap-bytes src sindex dst dindex &opt count) -Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.Community Examples
(all-tasks tasker &opt detailed) +Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.
(all-tasks tasker &opt detailed) -Get an array of all task ids for which there is still data on disk. If `detailed` is truthy, return full task metadata instead of ids.Community Examples
(cancel-task tasker task-id) +Get an array of all task ids for which there is still data on disk. If `detailed` is truthy, return full task metadata instead of ids.
(cancel-task tasker task-id) -Cancel a queued or running task.Community Examples
(close-queues tasker) -Prevent any tasks from being added to queues. When an executor finishes it's current job, if there are any, it will terminate. When all executors complete, the call to `run-executors` will complete.Community Examples
Default location of task recordsCommunity Examples
Maximum allowed priority (lower priority tasks will execute first)Community Examples
Minimum allowed priority (lower priority tasks will execute first)Community Examples
(new-tasker &opt task-directory queues queue-size) +Prevent any tasks from being added to queues. When an executor finishes it's current job, if there are any, it will terminate. When all executors complete, the call to `run-executors` will complete.
Maximum allowed priority (lower priority tasks will execute first)
Minimum allowed priority (lower priority tasks will execute first)
(new-tasker &opt task-directory queues queue-size) -Create queues and various settings to run tasks. Create a new tasker table.Community Examples
(queue-task tasker argv &opt note priority qname timeout expiration input) +Create queues and various settings to run tasks. Create a new tasker table.
(queue-task tasker argv &opt note priority qname timeout expiration input) -Add a task specification to a queue. Supply an argv string array that will be used to invoke s a subprocess. The optional `note` parameter is just a textual note for task trackingv. The `priority` parameter should be an integer between 0 and 9 inclusive, default is 4. Lower priority jobs in the same queue will be executed by higher priority. Use input to pass in generic, unstructured input to a task.Community Examples
(run-cleanup tasker) +Add a task specification to a queue. Supply an argv string array that will be used to invoke s a subprocess. The optional `note` parameter is just a textual note for task trackingv. The `priority` parameter should be an integer between 0 and 9 inclusive, default is 4. Lower priority jobs in the same queue will be executed by higher priority. Use input to pass in generic, unstructured input to a task.
(run-cleanup tasker) -Delete old expired jobs saved on diskCommunity Examples
(run-executors tasker &opt workers-per-queue pre-task post-task) +Delete old expired jobs saved on disk
(run-executors tasker &opt workers-per-queue pre-task post-task) -Start a number of executors to run tasks as with `tasker/spawn-executors`, and then wait for all executors to complete.Community Examples
(spawn-executors tasker &opt qnames workers-per-queue pre-task post-task) +Start a number of executors to run tasks as with `tasker/spawn-executors`, and then wait for all executors to complete.
(spawn-executors tasker &opt qnames workers-per-queue pre-task post-task) -Start a number of executors to run tasks. Tasks can be added to a queue by calling queue-task. A single tasker object can make multiple calls to spawn-executors.Community Examples
A tuple of all possible statuses that a task can have.Community Examples
(task-file tasker task-id &opt file-name) +Start a number of executors to run tasks. Tasks can be added to a queue by calling queue-task. A single tasker object can make multiple calls to spawn-executors.
(task-file tasker task-id &opt file-name) -Get a log file for a path. By default, will get a path to out.log.Community Examples
(task-status tasker task-id) +Get a log file for a path. By default, will get a path to out.log.
(task-status tasker task-id) -Look up the status of a given task by id.Community Examples
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(compile str) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(compile str) Compile a Temple template into a function which will return a rendered buffer. The resulting function should receive the template arguments in the -&keys format.Community Examples
(create source &opt where) -Compile a template string into a function. Optionally provide a location where the source is from to improve debugging. Returns the template function.Community Examples
(assert x &opt e) +Compile a template string into a function. Optionally provide a location where the source is from to improve debugging. Returns the template function.
(assert x &opt e) -Override's the default assert with some nice error handling.Community Examples
(assert-docs path) +Override's the default assert with some nice error handling.
(assert-docs path) Assert that all symbols, when module on the path is required, -have proper doc stringCommunity Examples
(assert-error msg & forms) -Test passes if forms error.Community Examples
(assert-no-error msg & forms) -Test passes if forms do not error.Community Examples
(capture-stderr & body) Runs the form and captures stderr. Returns tuple with result of the form -and a string with captured stderr.Community Examples
(capture-stdout & body) Runs the form and captures stdout. Returns tuple with result of the form -and a string with captured stdout.Community Examples
(end-suite) -Ends test suite, prints summary and exits if any have failed.Community Examples
(start-suite &opt name) +Ends test suite, prints summary and exits if any have failed.
(start-suite &opt name) -Starts test suite.Community Examples
(suppress-stderr & body) -Suppreses stdout from the bodyCommunity Examples
(suppress-stdout & body) -Suppreses stdout from the bodyCommunity Examples
(timeit form &opt tag) Time the execution of `form` using `os/clock` before and after, and print the result to stdout. returns: result of executing `form`. -Uses `tag` (default "Elapsed time:") to tag the printout.Community Examples
(utf8/decode-rune buf &opt start) +Uses `tag` (default "Elapsed time:") to tag the printout.
(utf8/decode-rune buf &opt start) -Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].Community Examples
(utf8/encode-rune rune &opt buf) +Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].
(utf8/encode-rune rune &opt buf) -Encode a Unicode codepoint into the end of a buffer.Community Examples
(utf8/prefix->width c) +Encode a Unicode codepoint into the end of a buffer.
(utf8/prefix->width c) -Given the first byte in an UTF-8 sequence, get the number of bytes that the codepoint sequence takes up, including the prefix byte.Community Examples
(zip/add-bytes writer path data &opt comment flags) +Given the first byte in an UTF-8 sequence, get the number of bytes that the codepoint sequence takes up, including the prefix byte.
(zip/add-bytes writer path data &opt comment flags) -Add a byte sequence to the zip writer.Community Examples
(zip/add-file writer path filename &opt comment flags) +Add a byte sequence to the zip writer.
(zip/add-file writer path filename &opt comment flags) -Add a file to the zip writer.Community Examples
(zip/compress bytes &opt level into) +Add a file to the zip writer.
(zip/compress bytes &opt level into) -Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.Community Examples
(zip/decompress bytes &opt into) +Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.
(zip/decompress bytes &opt into) -Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.Community Examples
(zip/extract reader idx-or-filename &opt into flags) +Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.
(zip/extract reader idx-or-filename &opt into flags) -Extract a file from the zip archive, either to memory or to a file on disk.Community Examples
(zip/file-directory? reader idx) +Extract a file from the zip archive, either to memory or to a file on disk.
(zip/file-directory? reader idx) -Check if a file index is a directory.Community Examples
(zip/file-encrypted? reader idx) +Check if a file index is a directory.
(zip/file-encrypted? reader idx) -Check if a file is encrypted inside an archive.Community Examples
(zip/file-supported? reader idx) +Check if a file is encrypted inside an archive.
(zip/file-supported? reader idx) -Check if a file is supported with this verstion of miniz.Community Examples
(zip/get-filename reader idx) +Check if a file is supported with this verstion of miniz.
(zip/get-filename reader idx) -Convert a file index index in the archive to a filename.Community Examples
(zip/locate-file reader path &opt comment flags) +Convert a file index index in the archive to a filename.
(zip/locate-file reader path &opt comment flags) -Get the index of a particular filename in the archive.Community Examples
(zip/read-bytes bytes &opt flags) +Get the index of a particular filename in the archive.
(zip/read-bytes bytes &opt flags) -Read a byte sequence as a zip archive. Returns a new zip reader.Community Examples
(zip/read-file filename &opt flags) +Read a byte sequence as a zip archive. Returns a new zip reader.
(zip/read-file filename &opt flags) -Read a file as a zip archive. Returns a new zip reader.Community Examples
(zip/reader-close reader) +Read a file as a zip archive. Returns a new zip reader.
(zip/reader-close reader) -Close a reader and free related memory.Community Examples
(zip/reader-count reader) +Close a reader and free related memory.
(zip/reader-count reader) -Get the number of files inside the zip archive. The files can be indexedCommunity Examples
(zip/stat reader idx) +Get the number of files inside the zip archive. The files can be indexed
(zip/stat reader idx) Get stat information of file. Returns a new struct with the following fields: @@ -710,17 +710,17 @@Community ExamplesSpork
* :comment * :internal-attr * :external-attr -
(zip/version) -Get the version string of the underlying miniz library.Community Examples
(zip/write-buffer) +Get the version string of the underlying miniz library.
(zip/write-buffer) -Create a new zip archive writer that write to memory.Community Examples
(zip/write-file dest-path) +Create a new zip archive writer that write to memory.
(zip/write-file dest-path) -Create a new zip archive writer that will write into an archive file.Community Examples
(zip/writer-close writer) +Create a new zip archive writer that will write into an archive file.
(zip/writer-close writer) -Close a ZipWriter.Community Examples
(zip/writer-finalizer writer) -Finalize a writer, writing any zip files to disk. Return the writer.Community Examples
(json/decode json-source &opt keywords nils) -Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.Community Examples
(json/encode x &opt tab newline buf) +Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.
(json/encode x &opt tab newline buf) -Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.Community Examples
math/add math/add-to-mean math/approx-eq math/bernoulli-distribution math/binominal-coeficient math/binominal-distribution math/check-probability math/chi-squared-distribution-table math/cols math/cumulative-std-normal-probability math/det math/dot math/epsilon math/extent math/factorial math/geometric-mean math/get-only-el math/harmonic-mean math/ident math/interquartile-range math/linear-regression math/linear-regression-line math/median math/median-absolute-deviation math/minor math/mode math/mop math/mul math/perm math/permutation-test math/permutations math/poisson-distribution math/quantile math/quantile-rank math/quantile-rank-sorted math/quantile-sorted math/quickselect math/relative-err math/root-mean-square math/rows math/sample-correlation math/sample-covariance math/sample-skewness math/sample-standard-deviation math/sample-variance math/scalar math/shuffle-in-place math/size math/sop math/standard-deviation math/standard-normal-table math/sum-compensated math/sum-nth-power-deviations math/swap math/t-test math/t-test-2 math/trans math/variance math/z-score math/zero
(add m a) Add `a` to matrix `m` where it can be matrix or scalar. -Matrix `m` is mutated.Community Examples
(add-to-mean m n v) -Adds new value `v` to mean `m` from `n` values.Community Examples
(approx-eq a e &opt t) +Adds new value `v` to mean `m` from `n` values.
(approx-eq a e &opt t) Approximate equality between actual number `a` and expected number `e`. Default tolerance `t` -is `epsilon`.Community Examples
(bernoulli-distribution p) -Creates Bernoulli distribution from popability `p` in the tuple.Community Examples
(binominal-coeficient n k) +Creates Bernoulli distribution from popability `p` in the tuple.
(binominal-coeficient n k) Computes binominal coeficient from set of size `n` -and sample size `k`.Community Examples
(binominal-distribution t p) Creates binominal distribution from trials `t` -and probability `p` in the tuple.Community Examples
(check-probability p) -Asserts that probability in in the [0 1] range.Community Examples
(cumulative-std-normal-probability z) +Returns numbers of columns of matrix `m`.
(cumulative-std-normal-probability z) -Computes standard normal probability for `y`.Community Examples
(dot mx my) -Computes dot product of matrices or vectors `x` and `y`.Community Examples
(extent xs) -Returns the minimum & maximum number in an `xs` as tuple.Community Examples
(factorial n) +Returns the minimum & maximum number in an `xs` as tuple.
(geometric-mean xs) -Gets the geometric mean from `xs`.Community Examples
(get-only-el m) Convenience macro for geting first element -from first row of the two dimensional array `m`.Community Examples
(harmonic-mean xs) +from first row of the two dimensional array `m`.
(harmonic-mean xs) -Gets the harmonic mean from `xs`.Community Examples
(ident c) -Creates identity matrix with `c` x `c` size.Community Examples
(interquartile-range xs) +Creates identity matrix with `c` x `c` size.
(interquartile-range xs) -Gets the interquartile range from `xs`.Community Examples
(linear-regression coords) +Gets the interquartile range from `xs`.
(linear-regression coords) Computes the slope `:m` and y-intercept `:b` -of the function in the struct from set of coordinates.Community Examples
(linear-regression-line {:m m :b b}) +of the function in the struct from set of coordinates.
(linear-regression-line {:m m :b b}) -Constructs function from struct returned by linear regression.Community Examples
(median xs) +Constructs function from struct returned by linear regression.
(median-absolute-deviation xs) +Gets the median value from `xs`
(median-absolute-deviation xs) -Gets median absolute deviation from `xs`.Community Examples
(minor m x y) -Computes minor matrix of matrix `m` and `x`, `y`.Community Examples
(mop m op a) Mutates every cell of the matrix `m` with `op` -and corresponding cell from matrix arg `a`.Community Examples
(mul m a) Multiply matrix `m` with `a` which can be matrix or vector. -Matrix `m` is mutated.Community Examples
(permutation-test xs ys &opt a k) +Computes permanent of the matrix `m`.
(permutation-test xs ys &opt a k) Conducts a permutation test to determine if two data sets `xs` and `ys` are *significantly* different from each other. You can use alternative hypotesis `a`, which defaults to `:two-side`, with `:greater` and `:lesser` being the other two options. The last optional argument is `k` number of values -in permutation distributionCommunity Examples
(permutations s &opt k) -Returns permutations of length `k` from members of `s`Community Examples
(poisson-distribution lambda) +Returns permutations of length `k` from members of `s`
(poisson-distribution lambda) -Creates Poisson distribution from `lambda` in tuple.Community Examples
(quantile xs p) -Gets the quantile value from `xs` at `p` from unsorted population.Community Examples
(quantile-rank xs p) +Gets the quantile value from `xs` at `p` from unsorted population.
(quantile-rank xs p) -Gets the quantile rank of value `v` from unsorted `xs`.Community Examples
(quantile-rank-sorted xs v) +Gets the quantile rank of value `v` from unsorted `xs`.
(quantile-rank-sorted xs v) -Gets the quantile rank of value `v` from sorted `xs`.Community Examples
(quantile-sorted xs p) +Gets the quantile rank of value `v` from sorted `xs`.
(quantile-sorted xs p) -Gets the quantile value from `xs` at `p` from sorted population.Community Examples
(quickselect arr k &opt left right) +Gets the quantile value from `xs` at `p` from sorted population.
(quickselect arr k &opt left right) Rearrange items in `arr` so that all items in `[left, k]` range are the smallest. The `k`-th element will have the `(k - left + 1)`-th smallest value in `[left, right]`. -Mutates `arr`.Community Examples
(relative-err a e) Gets the relative err between actual number `a` -and expected number `e`.Community Examples
(root-mean-square xs) -Gets the root mean square from `xs`.Community Examples
(sample-correlation xs ys) +Returns numbers of rows of matrix `m`.
(sample-correlation xs ys) -Gets the sample correlation between `xs` and `ys`.Community Examples
(sample-covariance xs ys) +Gets the sample correlation between `xs` and `ys`.
(sample-covariance xs ys) -Gets the sample covariance between `xs` and `ys`.Community Examples
(sample-skewness xs) +Gets the sample covariance between `xs` and `ys`.
(sample-skewness xs) -Gets the sample skeweness from the `xs`.Community Examples
(sample-standard-deviation xs) +Gets the sample skeweness from the `xs`.
(sample-standard-deviation xs) -Gets sample standard deviation from `xs`.Community Examples
(sample-variance xs) +Gets sample standard deviation from `xs`.
(sample-variance xs) -Get the sample variance from `xs`.Community Examples
(scalar c s) -Creates scalar `s` matrix with `c` x `c` size.Community Examples
(shuffle-in-place xs) +Creates scalar `s` matrix with `c` x `c` size.
(shuffle-in-place xs) Generate random permutation of the array `xs` -which is shuffled in place.Community Examples
(size m) -Returns tuple with the matrix `m` size [rows cols].Community Examples
(sop m op & a) Mutates every cell of the matrix `m` with `op` -and variadic args `a`.Community Examples
(standard-deviation xs) -Gets the standard deviation from `ds`.Community Examples
(sum-compensated xs) -Returns sum of the members of `xs` with Kahan-Babushka algorithm.Community Examples
(sum-nth-power-deviations xs n) +Returns sum of the members of `xs` with Kahan-Babushka algorithm.
(sum-nth-power-deviations xs n) -Get the sum of deviations to the n power.Community Examples
(swap arr i j) Swaps members with indices `i` and `j` of arr. -Noop when `i` equals `j`.Community Examples
(t-test xs expv) Computes one sample t-test comparing the mean of `xs` -to known value `expv`.Community Examples
(t-test-2 xs ys &opt d) Computes two sample t-test of two samples `xs` and `ys` -with difference optional `d` which defaults to 0.Community Examples
(z-score x m d) Gets the standard score for number `x` from mean `m` -and standard deviation `d`.Community Examples
(zero c &opt r) Creates vector of length `c`, or matrix if `r` -is provided, and fills it with zeros.Community Examples
misc/always misc/antepenultimate misc/caperr misc/capout misc/cond-> misc/cond->> misc/dedent misc/defs misc/dfs misc/do-def misc/do-var misc/format-table misc/gett misc/insert-sorted misc/insert-sorted-by misc/int->string misc/int/ misc/log misc/make misc/make-id misc/map-keys misc/map-vals misc/penultimate misc/print-table misc/randomize-array misc/second misc/select-keys misc/set* misc/string->int misc/table-filter misc/third misc/trim-prefix misc/trim-suffix misc/until misc/vars
(always x) -Return a function that discards any arguments and always returns `x`.Community Examples
(antepenultimate xs) +Return a function that discards any arguments and always returns `x`.
(antepenultimate xs) -Get the third-to-last element from an indexed data structure.Community Examples
(caperr & body) +Get the third-to-last element from an indexed data structure.
(caperr & body) Captures the standart error output of the variadic `body` and returns it -as a buffer.Community Examples
(capout & body) Captures the standart output of the variadic `body` and returns it as -a buffer.Community Examples
(cond-> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs with condition and operation to which the `val`, is put as first argument. All conditions are tried and for truthy conditions the operation is executed. -Returns the value mutated if any condition is truthy.Community Examples
(cond->> val & clauses) +Returns the value mutated if any condition is truthy.
(cond->> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs of condition and operation to which the `val`, is put as last argument. All conditions are tried and for truthy the operation is ran. -Returns mutated value if any condition is truthy.Community Examples
(dedent & xs) Remove indentation after concatenating the arguments. Works by removing leading whitespace, and then removing that same pattern of whitepsace after -new lines.Community Examples
(defs & bindings) -Defines many constants as in let `bindings`, but without creating new scope.Community Examples
(dfs data visit-leaf &opt node-before node-after get-children seen) +Defines many constants as in let `bindings`, but without creating new scope.
(dfs data visit-leaf &opt node-before node-after get-children seen) Do a depth first, pre-order traversal over a data structure. Also allow for callbacks before and after visiting the children of a node. Also allow for a custom `get-children` function to change traversal as needed. Will detect cycles if an empty table is passed as the `seen` parameter, which is used to cached values -that have been visited.Community Examples
(do-def c d & body) Convenience macro for defining constant named `c` with value `d` before `body` and returning it after evaluating `body`, that presumably modifies -the `c` refered content. For example buffer, table or array.Community Examples
(do-var v d & body) +the `c` refered content. For example buffer, table or array.
(do-var v d & body) Convenience macro for defining varible named `v` with value `d` before `body` -and returning it after evaluating `body`, that presumably modifies `v`.Community Examples
(format-table buf-into data &opt columns header-mapping column-mapping) +and returning it after evaluating `body`, that presumably modifies `v`.
(format-table buf-into data &opt columns header-mapping column-mapping) -Same as print-table but pushes table into a buffer.Community Examples
(gett ds & keys) -Recursive macro (get). Similar to get-in, but keys are variadic argument.Community Examples
(insert-sorted arr <? & xs) +Recursive macro (get). Similar to get-in, but keys are variadic argument.
(insert-sorted arr <? & xs) Insert elements in `arr` such that it remains sorted by the comparator. If -`arr` is not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(insert-sorted-by arr f & xs) +`arr` is not sorted beforehand, the results are undefined. Returns `arr`.
(insert-sorted-by arr f & xs) Insert elements in `arr` such that it remains sorted by the value returned when `f` is called with the element, comparing the values with <. If `arr` is -not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(int->string int &opt base) +not sorted beforehand, the results are undefined. Returns `arr`.
(int->string int &opt base) -Stringify an integer in a particular base. Defaults to decimal (base 10).Community Examples
(int/ & xs) +Stringify an integer in a particular base. Defaults to decimal (base 10).
(log level & args) Print to a dynamic binding stream if that stream is set, otherwise do nothing. Evaluate to nil. For example, `(log :err "value error: %V" my-value)` will print -to `(dyn :err)` only if `(dyn :err)` has been set.Community Examples
(make prototype & pairs) Convenience macro for creating new table from even number of kvs pairs in a variadic `table-or-pairs` arguments and setting its prototype to `prototype`. -Factory function for creating new objects from prototypes.Community Examples
(make-id &opt prefix) +Factory function for creating new objects from prototypes.
(make-id &opt prefix) Create a random, printable keyword id with 10 bytes of entropy -with an optional prefix.Community Examples
(map-keys f data) Returns new table with function `f` applied to `data`'s -keys recursively.Community Examples
(map-vals f data) -Returns new table with function `f` applied to `data`'s values.Community Examples
(penultimate xs) +Returns new table with function `f` applied to `data`'s values.
(penultimate xs) -Get the second-to-last element from an indexed data structure.Community Examples
(print-table data &opt columns header-mapping column-mapping) +Get the second-to-last element from an indexed data structure.
(print-table data &opt columns header-mapping column-mapping) Iterate through the rows of a data structure and print a table in a human readable way, with padding and heading information. Can optionally provide @@ -198,37 +198,37 @@Community ExamplesIndex for each row. Lastly, a `header-mapping` dictionary can be provided that changes the printed header names by mapping column keys to the desired header name. If no mapping is found, then the column key will be used as -the header name. Returns nil.
(randomize-array arr &opt rng) Randomizes array using the fisher-yates shuffle, takes an optional random -number generator.Community Examples
(second xs) -Get the second element from an indexed data structure.Community Examples
(select-keys data keyz) +Get the second element from an indexed data structure.
(select-keys data keyz) -Returns new table with selected `keyz` from dictionary `data`.Community Examples
(set* tgts exprs) +Returns new table with selected `keyz` from dictionary `data`.
(set* tgts exprs) Parallel `set` function. Takes a list of targets and expressions, evaluates all the expressions, and then assigns them to the targets. Each target can be a variable -or a 2-tuple, just like in the normal `set` special form.Community Examples
(string->int str &opt base) +or a 2-tuple, just like in the normal `set` special form.
(string->int str &opt base) Parse an integer in the given base. Defaults to decimal (base 10). Differs -from scan-number in that this does not recognize floating point notation.Community Examples
(table-filter pred dict) +from scan-number in that this does not recognize floating point notation.
(table-filter pred dict) Filter a key-value structure info a table. Semantics are the same as for built-in `filter`, except that `pred` takes two arguments (key and value.) -Does not consider prototypes.Community Examples
(third xs) -Get the third element from an indexed data structure.Community Examples
(trim-prefix prefix str) +Get the third element from an indexed data structure.
(trim-prefix prefix str) -Trim the specified prefix of a string if it has oneCommunity Examples
(trim-suffix suffix str) +Trim the specified prefix of a string if it has one
(trim-suffix suffix str) -Trim the specified suffix of a string if it has oneCommunity Examples
(until cnd & body) Repeat `body` while the `cnd` is false. -Equivalent to (while (not cnd) ;body).Community Examples
(vars & bindings) -Defines many variables as in let `bindings`, but without creating new scope.Community Examples
msg/make-proto msg/make-recv msg/make-send
(make-proto stream &opt pack unpack) -Create both a send an recv function from a stream, as with `make-send` and `make-recv`.Community Examples
(make-recv stream &opt unpack) +Create both a send an recv function from a stream, as with `make-send` and `make-recv`.
(make-recv stream &opt unpack) -Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.Community Examples
(make-send stream &opt pack) +Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.
(make-send stream &opt pack) -Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.Community Examples
netrepl/client netrepl/default-host netrepl/default-port netrepl/server netrepl/server-single
(client &opt host port name) -Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".Community Examples
(server &opt host port env cleanup welcome-msg) +Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".
(server &opt host port env cleanup welcome-msg) -Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.Community Examples
(server-single &opt host port env cleanup welcome-msg) +Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.
(server-single &opt host port env cleanup welcome-msg) -Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.Community Examples
path/abspath path/abspath? path/basename path/delim path/dirname path/ext path/join path/normalize path/parts path/posix/abspath path/posix/abspath? path/posix/basename path/posix/delim path/posix/dirname path/posix/ext path/posix/join path/posix/normalize path/posix/parts path/posix/relpath path/posix/sep path/relpath path/sep path/win32/abspath path/win32/abspath? path/win32/basename path/win32/delim path/win32/dirname path/win32/ext path/win32/join path/win32/normalize path/win32/parts path/win32/relpath path/win32/sep
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(posix/relpath source target) +Get the relative path between two subpaths.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(win32/abspath path) +Get the relative path between two subpaths.
(win32/abspath path) -Coerce a path to be absolute.Community Examples
(win32/abspath? path) -Check if a path is absolute.Community Examples
(win32/basename path) -Gets the base file name of a path.Community Examples
(win32/dirname path) -Gets the directory name of a path.Community Examples
(win32/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(win32/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(win32/relpath source target) -Get the relative path between two subpaths.Community Examples
rawterm/begin rawterm/buffer-traverse rawterm/ctrl-z rawterm/end rawterm/getch rawterm/isatty rawterm/monowidth rawterm/rune-monowidth rawterm/size rawterm/slice-monowidth
(rawterm/begin &opt on-winch) -Begin raw terminal functionality. Return a stream that can be read from to get input.Community Examples
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) +Begin raw terminal functionality. Return a stream that can be read from to get input.
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) -Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.Community Examples
(rawterm/ctrl-z) +Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.
(rawterm/ctrl-z) -A handler that a user can use to handle ctrl-z from input to suspend the current process.Community Examples
(rawterm/end) +A handler that a user can use to handle ctrl-z from input to suspend the current process.
(rawterm/getch &opt into) -Get a byte of input from stdin, without blocking if possible. Returns a buffer.Community Examples
(rawterm/isatty) +Get a byte of input from stdin, without blocking if possible. Returns a buffer.
(rawterm/isatty) -Check if the current stdin is a tty.Community Examples
(rawterm/monowidth bytes &opt start-index end-index) +Check if the current stdin is a tty.
(rawterm/monowidth bytes &opt start-index end-index) -Measure the monospace width of a string.Community Examples
(rawterm/rune-monowidth rune) +Measure the monospace width of a string.
(rawterm/rune-monowidth rune) -Get the monospace width of a rune. Returns either 0, 1, or 2.Community Examples
(rawterm/size) +Get the monospace width of a rune. Returns either 0, 1, or 2.
(rawterm/size) -Get the number of rows and columns visible in the terminal as tuple [rows cols]Community Examples
(rawterm/slice-monowidth bytes columns &opt start-index into) +Get the number of rows and columns visible in the terminal as tuple [rows cols]
(rawterm/slice-monowidth bytes columns &opt start-index into) -Get a byte slice that will fit into a number of columns.Community Examples
regex/compile regex/find regex/find-all regex/match regex/peg regex/replace regex/replace-all regex/source
(compile pattern) -Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.Community Examples
(find reg text &opt start) +Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.
(find reg text &opt start) -Similar to peg/find, but for regexes.Community Examples
(find-all reg text &opt start) +Similar to peg/find, but for regexes.
(find-all reg text &opt start) -Similar to peg/find-all, but for regexes.Community Examples
(match reg text &opt start) -Similar to peg/match, but for regexes.Community Examples
Peg used to generate peg source code from a regular expression string.Community Examples
(replace reg rep text &opt start) +Similar to peg/match, but for regexes.
(replace reg rep text &opt start) -Similar to peg/replace, but for regexes.Community Examples
(replace-all reg rep text &opt start) +Similar to peg/replace, but for regexes.
(replace-all reg rep text &opt start) -Similar to peg/replace-all, but for regexes.Community Examples
(source pattern) -Compile a subset of regex to PEG source code.Community Examples
rpc/client rpc/default-host rpc/default-port rpc/server
(client &opt host port name) -Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.Community Examples
(server functions &opt host port workers-per-connection) +Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.
(server functions &opt host port workers-per-connection) -Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.Community Examples
schema/make-predicate schema/make-validator schema/predicate schema/validator
(make-predicate schema) -Generate a function that can be used to validate a data structure. This is the function form of `predicate`.Community Examples
(make-validator schema) +Generate a function that can be used to validate a data structure. This is the function form of `predicate`.
(make-validator schema) -Generate a function that can be used to validate a data structure. This is the function form of `validator`.Community Examples
(predicate pattern) +Generate a function that can be used to validate a data structure. This is the function form of `validator`.
(predicate pattern) -Make a validation predicate given a certain schema.Community Examples
(validator pattern) +Make a validation predicate given a certain schema.
(validator pattern) -Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.Community Examples
sh/copy sh/copy-file sh/create-dirs sh/devnull sh/escape sh/exec sh/exec-fail sh/exec-slurp sh/exec-slurp-all sh/exists? sh/list-all-files sh/make-new-file sh/rm sh/scan-directory sh/split
(copy src dest) Copy a file or directory recursively from one location to another. -Expects input to be unix style pathsCommunity Examples
(copy-file src-path dst-path) -Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.Community Examples
(create-dirs dir-path) +Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.
(create-dirs dir-path) -Create all directories in path specified as string including itself.Community Examples
(devnull) +Create all directories in path specified as string including itself.
(devnull) -get the /dev/null equivalent of the current platform as an open fileCommunity Examples
(escape & args) +get the /dev/null equivalent of the current platform as an open file
(escape & args) -Output a string with all arguments correctly quotedCommunity Examples
(exec & args) -Execute command specified by args returning it's exit codeCommunity Examples
(exec-fail & args) +Execute command specified by args returning it's exit code
(exec-fail & args) -Execute command specified by args, fails when command exits with non-zero exit codeCommunity Examples
(exec-slurp & args) +Execute command specified by args, fails when command exits with non-zero exit code
(exec-slurp & args) -Read stdout of command specified by args and return it trimmed in a string.Community Examples
(exec-slurp-all & args) +Read stdout of command specified by args and return it trimmed in a string.
(exec-slurp-all & args) Read stdout and stderr of subprocess and return it trimmed in a struct with :err and :out containing the output as string. -This will also return the exit code under the :status key.Community Examples
(exists? path) +This will also return the exit code under the :status key.
(exists? path) -Check if the given file or directory exists. (Follows symlinks)Community Examples
(list-all-files dir &opt into) +Check if the given file or directory exists. (Follows symlinks)
(list-all-files dir &opt into) -List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.Community Examples
(make-new-file file-path &opt mode) +List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.
(make-new-file file-path &opt mode) -Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).Community Examples
(rm path) +Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).
(rm path) -Remove a directory and all sub directories recursively.Community Examples
(scan-directory dir func) +Remove a directory and all sub directories recursively.
(scan-directory dir func) -Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.Community Examples
(split s) +Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.
(split s) -Split a string into 'sh like' tokens, returns nil if unable to parse the string.Community Examples
tarray/buffer tarray/copy-bytes tarray/length tarray/new tarray/properties tarray/slice tarray/swap-bytes
(tarray/buffer array|size) -Return typed array buffer or create a new buffer.Community Examples
(tarray/copy-bytes src sindex dst dindex &opt count) +Return typed array buffer or create a new buffer.
(tarray/copy-bytes src sindex dst dindex &opt count) -Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.Community Examples
(tarray/length array|buffer) +Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.
(tarray/length array|buffer) -Return typed array or buffer size.Community Examples
(tarray/new type size &opt stride offset tarray|buffer) +Return typed array or buffer size.
(tarray/new type size &opt stride offset tarray|buffer) -Create new typed array.Community Examples
(tarray/properties array) +Create new typed array.
(tarray/properties array) -Return typed array properties as a struct.Community Examples
(tarray/slice tarr &opt start end) +Return typed array properties as a struct.
(tarray/slice tarr &opt start end) -Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.Community Examples
(tarray/swap-bytes src sindex dst dindex &opt count) +Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.
(tarray/swap-bytes src sindex dst dindex &opt count) -Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.Community Examples
test/assert test/assert-docs test/assert-error test/assert-no-error test/assert-not test/capture-stderr test/capture-stdout test/end-suite test/start-suite test/suppress-stderr test/suppress-stdout test/timeit
(assert x &opt e) -Override's the default assert with some nice error handling.Community Examples
(assert-docs path) +Override's the default assert with some nice error handling.
(assert-docs path) Assert that all symbols, when module on the path is required, -have proper doc stringCommunity Examples
(assert-error msg & forms) -Test passes if forms error.Community Examples
(assert-no-error msg & forms) -Test passes if forms do not error.Community Examples
(capture-stderr & body) Runs the form and captures stderr. Returns tuple with result of the form -and a string with captured stderr.Community Examples
(capture-stdout & body) Runs the form and captures stdout. Returns tuple with result of the form -and a string with captured stdout.Community Examples
(end-suite) -Ends test suite, prints summary and exits if any have failed.Community Examples
(start-suite &opt name) +Ends test suite, prints summary and exits if any have failed.
(suppress-stderr & body) -Suppreses stdout from the bodyCommunity Examples
(suppress-stdout & body) -Suppreses stdout from the bodyCommunity Examples
(timeit form &opt tag) Time the execution of `form` using `os/clock` before and after, and print the result to stdout. returns: result of executing `form`. -Uses `tag` (default "Elapsed time:") to tag the printout.Community Examples
zip/add-bytes zip/add-file zip/compress zip/decompress zip/extract zip/file-directory? zip/file-encrypted? zip/file-supported? zip/get-filename zip/locate-file zip/read-bytes zip/read-file zip/reader-close zip/reader-count zip/stat zip/version zip/write-buffer zip/write-file zip/writer-close zip/writer-finalize
(zip/add-bytes writer path data &opt comment flags) -Add a byte sequence to the zip writer.Community Examples
(zip/add-file writer path filename &opt comment flags) +Add a byte sequence to the zip writer.
(zip/add-file writer path filename &opt comment flags) -Add a file to the zip writer.Community Examples
(zip/compress bytes &opt level into) -Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.Community Examples
(zip/decompress bytes &opt into) +Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.
(zip/decompress bytes &opt into) -Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.Community Examples
(zip/extract reader idx-or-filename &opt into flags) +Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.
(zip/extract reader idx-or-filename &opt into flags) -Extract a file from the zip archive, either to memory or to a file on disk.Community Examples
(zip/file-directory? reader idx) +Extract a file from the zip archive, either to memory or to a file on disk.
(zip/file-directory? reader idx) -Check if a file index is a directory.Community Examples
(zip/file-encrypted? reader idx) +Check if a file index is a directory.
(zip/file-encrypted? reader idx) -Check if a file is encrypted inside an archive.Community Examples
(zip/file-supported? reader idx) +Check if a file is encrypted inside an archive.
(zip/file-supported? reader idx) -Check if a file is supported with this verstion of miniz.Community Examples
(zip/get-filename reader idx) +Check if a file is supported with this verstion of miniz.
(zip/get-filename reader idx) -Convert a file index index in the archive to a filename.Community Examples
(zip/locate-file reader path &opt comment flags) +Convert a file index index in the archive to a filename.
(zip/locate-file reader path &opt comment flags) -Get the index of a particular filename in the archive.Community Examples
(zip/read-bytes bytes &opt flags) +Get the index of a particular filename in the archive.
(zip/read-bytes bytes &opt flags) -Read a byte sequence as a zip archive. Returns a new zip reader.Community Examples
(zip/read-file filename &opt flags) +Read a byte sequence as a zip archive. Returns a new zip reader.
(zip/read-file filename &opt flags) -Read a file as a zip archive. Returns a new zip reader.Community Examples
(zip/reader-close reader) +Read a file as a zip archive. Returns a new zip reader.
(zip/reader-close reader) -Close a reader and free related memory.Community Examples
(zip/reader-count reader) +Close a reader and free related memory.
(zip/reader-count reader) -Get the number of files inside the zip archive. The files can be indexedCommunity Examples
(zip/stat reader idx) +Get the number of files inside the zip archive. The files can be indexed
(zip/stat reader idx) Get stat information of file. Returns a new struct with the following fields: @@ -159,17 +159,17 @@Community ExamplesIndex * :comment * :internal-attr * :external-attr -
(zip/version) -Get the version string of the underlying miniz library.Community Examples
(zip/write-buffer) +Get the version string of the underlying miniz library.
(zip/write-buffer) -Create a new zip archive writer that write to memory.Community Examples
(zip/write-file dest-path) +Create a new zip archive writer that write to memory.
(zip/write-file dest-path) -Create a new zip archive writer that will write into an archive file.Community Examples
(zip/writer-close writer) +Create a new zip archive writer that will write into an archive file.
(zip/writer-finalizer writer) -Finalize a writer, writing any zip files to disk. Return the writer.Community Examples
cc/archive-c cc/compile-c cc/create-buffer-c cc/create-buffer-c-impl cc/create-executable cc/embed-name cc/entry-name cc/entry-replace cc/link-c cc/make-bin-source cc/make-define cc/make-defines cc/modpath-to-meta cc/modpath-to-static cc/out-path
(archive-c opts target & objects) -Link object files together to make a static library.Community Examples
(compile-c compiler opts src dest &opt static?) +Link object files together to make a static library.
(compile-c compiler opts src dest &opt static?) -Compile a C file into an object file.Community Examples
(create-buffer-c source dest name) +Compile a C file into an object file.
(create-buffer-c source dest name) -Inline raw byte file as a c file.Community Examples
(create-buffer-c-impl bytes dest name) +Inline raw byte file as a c file.
(create-executable opts source dest no-core) -Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.Community Examples
(embed-name path) +Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.
(embed-name path) -Rename a janet symbol for embedding.Community Examples
(entry-name name) -Name of symbol that enters static compilation of a module.Community Examples
(entry-replace name) +Name of symbol that enters static compilation of a module.
(entry-replace name) -Escape special characters in the entry-nameCommunity Examples
(link-c has-cpp opts target & objects) +Escape special characters in the entry-name
(link-c has-cpp opts target & objects) -Link C or C++ object files together to make a native module.Community Examples
(make-bin-source declarations lookup-into-invocations no-core) +Link C or C++ object files together to make a native module.
(make-bin-source declarations lookup-into-invocations no-core) -Community Examples
(make-define define value) -Generate strings for adding custom defines to the compiler.Community Examples
(make-defines defines) +Generate strings for adding custom defines to the compiler.
(make-defines defines) -Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.Community Examples
(modpath-to-meta path) +Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.
(modpath-to-meta path) -Get the meta file path (.meta.janet) corresponding to a native module path (.so).Community Examples
(modpath-to-static path) +Get the meta file path (.meta.janet) corresponding to a native module path (.so).
(modpath-to-static path) -Get the static library (.a) path corresponding to a native module path (.so).Community Examples
(out-path path from-ext to-ext) +Get the static library (.a) path corresponding to a native module path (.so).
(out-path path from-ext to-ext) -Take a source file path and convert it to an output path.Community Examples
cgen/add-loader cgen/ir cgen/mangle cgen/print-ir
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(ir & body) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(ir & body) -Macro that automatically quotes the body provided and calls (print-ir ...) on the body.Community Examples
(mangle token) +Macro that automatically quotes the body provided and calls (print-ir ...) on the body.
(mangle token) -Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.Community Examples
(print-ir ir) +Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.
(print-ir ir) -Compile the CGEN IR to C and print it to (dyn :out).Community Examples
cli/jpm cli/main cli/run cli/setup
(jpm & argv) -A Macro User Interface for jpm to be used from a repl in a way similar to the command line.Community Examples
(main & argv) +A Macro User Interface for jpm to be used from a repl in a way similar to the command line.
(setup args) Load configuration from the command line, environment variables, and configuration files. Returns array of non-configuration arguments as well. @@ -130,7 +130,7 @@Community ExamplesIndex 1. Commmand line settings 2. The value of `(dyn :jpm-config)` 3. Environment variables - 4. Config file settings (default-config if non specified)
commands/build commands/clean commands/configure commands/deps commands/enable-local-mode commands/help commands/install commands/jpm-debug-repl commands/list-installed commands/list-pkgs commands/list-rules commands/list-tasks commands/new-c-project commands/new-exe-project commands/new-project commands/quickbin commands/set-tree commands/show-paths commands/show-rule-tree commands/test commands/update-pkgs
(configure &opt path) -Setup an out-of-tree build with certain configuration options.Community Examples
(deps) +Setup an out-of-tree build with certain configuration options.
(enable-local-mode) -Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/Community Examples
(help) +Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/
(new-c-project name) -Create a new C projectCommunity Examples
(new-exe-project name) -Create a new executable projectCommunity Examples
(set-tree tree) -Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.Community Examples
(show-paths) +Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.
config/builtin-configs config/config-checkers config/config-docs config/config-options config/config-parsers config/config-set config/defconf config/dyn:ar config/dyn:auto-shebang config/dyn:binpath config/dyn:build-type config/dyn:buildpath config/dyn:c++ config/dyn:c++-link config/dyn:cc config/dyn:cc-link config/dyn:cflags config/dyn:cflags-verbose config/dyn:config-file config/dyn:cppflags config/dyn:curlpath config/dyn:dest-dir config/dyn:dynamic-cflags config/dyn:dynamic-lflags config/dyn:gitpath config/dyn:headerpath config/dyn:is-msvc config/dyn:janet config/dyn:janet-cflags config/dyn:janet-importlib config/dyn:janet-lflags config/dyn:ldflags config/dyn:lflags config/dyn:libpath config/dyn:local config/dyn:manpath config/dyn:modext config/dyn:modpath config/dyn:nocolor config/dyn:offline config/dyn:optimize config/dyn:pkglist config/dyn:silent config/dyn:statext config/dyn:tarpath config/dyn:test config/dyn:tree config/dyn:update-pkgs config/dyn:use-batch-shell config/dyn:verbose config/dyn:workers config/load-config config/load-config-file config/load-default config/load-options config/opt config/read-env-variables config/save-config config/shorthand-mapping
Table of all built-in options, as opposed to project deifned options.Community Examples
A table of all of the dynamic config bindings to checkers (validators).Community Examples
Table of all of the help text for each config option.Community Examples
A table of possible options for enum option types.Community Examples
A table of all of the dynamic config bindings to parsers.Community Examples
(defconf kw &opt parser docs options) +config/builtin-configs config/config-checkers config/config-docs config/config-options config/config-parsers config/config-set config/defconf config/dyn:ar config/dyn:auto-shebang config/dyn:binpath config/dyn:build-type config/dyn:buildpath config/dyn:c++ config/dyn:c++-link config/dyn:cc config/dyn:cc-link config/dyn:cflags config/dyn:cflags-verbose config/dyn:config-file config/dyn:cppflags config/dyn:curlpath config/dyn:dest-dir config/dyn:dynamic-cflags config/dyn:dynamic-lflags config/dyn:gitpath config/dyn:headerpath config/dyn:is-msvc config/dyn:janet config/dyn:janet-cflags config/dyn:janet-importlib config/dyn:janet-lflags config/dyn:ldflags config/dyn:lflags config/dyn:libpath config/dyn:local config/dyn:manpath config/dyn:modext config/dyn:modpath config/dyn:nocolor config/dyn:offline config/dyn:optimize config/dyn:pkglist config/dyn:silent config/dyn:statext config/dyn:tarpath config/dyn:test config/dyn:tree config/dyn:update-pkgs config/dyn:use-batch-shell config/dyn:verbose config/dyn:workers config/load-config config/load-config-file config/load-default config/load-options config/opt config/read-env-variables config/save-config config/shorthand-mapping
config/builtin-configs table sourceTable of all built-in options, as opposed to project deifned options.config/config-checkers table sourceA table of all of the dynamic config bindings to checkers (validators).config/defconf macro source(defconf kw &opt parser docs options) -Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.Community Examplesconfig/dyn:ar function source(dyn:ar &opt dflt) +Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.config/load-config function source(load-config settings &opt override) -Load a configuration from a table or struct.Community Examplesconfig/load-config-file function source(load-config-file path &opt override) +Load a configuration from a table or struct.config/load-config-file function source(load-config-file path &opt override) -Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.Community Examplesconfig/load-default function source(load-default &opt override) +Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.config/load-default function source(load-default &opt override) -Load the default configuration.Community Examplesconfig/load-options function source(load-options &opt path) -Load a file that contains config options that can be set. If no such file exists, then do nothing.Community Examplesconfig/opt function source(opt opts key &opt dflt) +Load a file that contains config options that can be set. If no such file exists, then do nothing.config/opt function source(opt opts key &opt dflt) -Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.Community Examplesconfig/read-env-variables function source(read-env-variables) +Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.config/read-env-variables function source(read-env-variables) -Read environment variables that correspond to config variables into dyns.Community Examplesconfig/save-config function source(save-config path) +Read environment variables that correspond to config variables into dyns.config/save-config function source(save-config path) -Write the current configuration information to a file.Community Examplesconfig/shorthand-mapping struct source+Write the current configuration information to a file.Map some single characters to long options.Community Examples
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.
(pmap f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.Community Examples
jpm/cc/archive-c jpm/cc/compile-c jpm/cc/create-buffer-c jpm/cc/create-buffer-c-impl jpm/cc/create-executable jpm/cc/embed-name jpm/cc/entry-name jpm/cc/entry-replace jpm/cc/link-c jpm/cc/make-bin-source jpm/cc/make-define jpm/cc/make-defines jpm/cc/modpath-to-meta jpm/cc/modpath-to-static jpm/cc/out-path jpm/cgen/add-loader jpm/cgen/ir jpm/cgen/mangle jpm/cgen/print-ir jpm/commands/build jpm/commands/clean jpm/commands/configure jpm/commands/deps jpm/commands/enable-local-mode jpm/commands/help jpm/commands/install jpm/commands/jpm-debug-repl jpm/commands/list-installed jpm/commands/list-pkgs jpm/commands/list-rules jpm/commands/list-tasks jpm/commands/new-c-project jpm/commands/new-exe-project jpm/commands/new-project jpm/commands/quickbin jpm/commands/set-tree jpm/commands/show-paths jpm/commands/show-rule-tree jpm/commands/test jpm/commands/update-pkgs jpm/config/builtin-configs jpm/config/config-checkers jpm/config/config-docs jpm/config/config-options jpm/config/config-parsers jpm/config/config-set jpm/config/defconf jpm/config/dyn:ar jpm/config/dyn:auto-shebang jpm/config/dyn:binpath jpm/config/dyn:build-type jpm/config/dyn:buildpath jpm/config/dyn:c++ jpm/config/dyn:c++-link jpm/config/dyn:cc jpm/config/dyn:cc-link jpm/config/dyn:cflags jpm/config/dyn:cflags-verbose jpm/config/dyn:config-file jpm/config/dyn:cppflags jpm/config/dyn:curlpath jpm/config/dyn:dest-dir jpm/config/dyn:dynamic-cflags jpm/config/dyn:dynamic-lflags jpm/config/dyn:gitpath jpm/config/dyn:headerpath jpm/config/dyn:is-msvc jpm/config/dyn:janet jpm/config/dyn:janet-cflags jpm/config/dyn:janet-importlib jpm/config/dyn:janet-lflags jpm/config/dyn:ldflags jpm/config/dyn:lflags jpm/config/dyn:libpath jpm/config/dyn:local jpm/config/dyn:manpath jpm/config/dyn:modext jpm/config/dyn:modpath jpm/config/dyn:nocolor jpm/config/dyn:offline jpm/config/dyn:optimize jpm/config/dyn:pkglist jpm/config/dyn:silent jpm/config/dyn:statext jpm/config/dyn:tarpath jpm/config/dyn:test jpm/config/dyn:tree jpm/config/dyn:update-pkgs jpm/config/dyn:use-batch-shell jpm/config/dyn:verbose jpm/config/dyn:workers jpm/config/load-config jpm/config/load-config-file jpm/config/load-default jpm/config/load-options jpm/config/opt jpm/config/read-env-variables jpm/config/save-config jpm/config/shorthand-mapping jpm/dagbuild/pdag jpm/dagbuild/pmap jpm/make-config/auto jpm/make-config/generate-config jpm/pm/bundle-install jpm/pm/curl jpm/pm/do-rule jpm/pm/download-bundle jpm/pm/download-git-bundle jpm/pm/download-tar-bundle jpm/pm/git jpm/pm/import-rules jpm/pm/load-lockfile jpm/pm/load-project-meta jpm/pm/make-jpm-env jpm/pm/make-lockfile jpm/pm/out-of-tree-config jpm/pm/post-deps jpm/pm/require-jpm jpm/pm/resolve-bundle jpm/pm/tar jpm/pm/update-git-bundle jpm/pm/update-installed jpm/rules/add-body jpm/rules/add-dep jpm/rules/add-input jpm/rules/add-output jpm/rules/add-thunk jpm/rules/build-rules jpm/rules/getrules jpm/rules/phony jpm/rules/rule jpm/rules/sh-phony jpm/rules/sh-rule jpm/rules/sh-task jpm/rules/task jpm/scaffold/scaffold-project jpm/shutil/abspath jpm/shutil/basename jpm/shutil/clear-cache jpm/shutil/clear-manifest jpm/shutil/clexe-shell jpm/shutil/copy jpm/shutil/copyfile jpm/shutil/create-dirs jpm/shutil/devnull jpm/shutil/dirname jpm/shutil/do-monkeypatch jpm/shutil/drop1-shell jpm/shutil/exec-slurp jpm/shutil/filepath-replace jpm/shutil/find-build-dir jpm/shutil/find-cache jpm/shutil/find-manifest jpm/shutil/find-manifest-dir jpm/shutil/is-mingw jpm/shutil/is-win jpm/shutil/is-win-or-mingw jpm/shutil/path-splitter jpm/shutil/rimraf jpm/shutil/rm jpm/shutil/run-patched jpm/shutil/run-repl jpm/shutil/run-script jpm/shutil/shell jpm/shutil/undo-monkeypatch
(archive-c opts target & objects) -Link object files together to make a static library.Community Examples
(compile-c compiler opts src dest &opt static?) +Link object files together to make a static library.
(compile-c compiler opts src dest &opt static?) -Compile a C file into an object file.Community Examples
(create-buffer-c source dest name) +Compile a C file into an object file.
(create-buffer-c source dest name) -Inline raw byte file as a c file.Community Examples
(create-buffer-c-impl bytes dest name) +Inline raw byte file as a c file.
(create-buffer-c-impl bytes dest name) -Community Examples
(create-executable opts source dest no-core) -Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.Community Examples
(embed-name path) +Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.
(embed-name path) -Rename a janet symbol for embedding.Community Examples
(entry-name name) -Name of symbol that enters static compilation of a module.Community Examples
(entry-replace name) +Name of symbol that enters static compilation of a module.
(entry-replace name) -Escape special characters in the entry-nameCommunity Examples
(link-c has-cpp opts target & objects) +Escape special characters in the entry-name
(link-c has-cpp opts target & objects) -Link C or C++ object files together to make a native module.Community Examples
(make-bin-source declarations lookup-into-invocations no-core) +Link C or C++ object files together to make a native module.
(make-bin-source declarations lookup-into-invocations no-core) -Community Examples
(make-define define value) -Generate strings for adding custom defines to the compiler.Community Examples
(make-defines defines) +Generate strings for adding custom defines to the compiler.
(make-defines defines) -Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.Community Examples
(modpath-to-meta path) +Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.
(modpath-to-meta path) -Get the meta file path (.meta.janet) corresponding to a native module path (.so).Community Examples
(modpath-to-static path) +Get the meta file path (.meta.janet) corresponding to a native module path (.so).
(modpath-to-static path) -Get the static library (.a) path corresponding to a native module path (.so).Community Examples
(out-path path from-ext to-ext) +Get the static library (.a) path corresponding to a native module path (.so).
(out-path path from-ext to-ext) -Take a source file path and convert it to an output path.Community Examples
(add-loader) +Take a source file path and convert it to an output path.
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(ir & body) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(ir & body) -Macro that automatically quotes the body provided and calls (print-ir ...) on the body.Community Examples
(mangle token) +Macro that automatically quotes the body provided and calls (print-ir ...) on the body.
(mangle token) -Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.Community Examples
(print-ir ir) +Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.
(print-ir ir) -Compile the CGEN IR to C and print it to (dyn :out).Community Examples
(configure &opt path) -Setup an out-of-tree build with certain configuration options.Community Examples
(deps) +Setup an out-of-tree build with certain configuration options.
(enable-local-mode) -Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/Community Examples
(help) +Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/
(new-c-project name) -Create a new C projectCommunity Examples
(new-exe-project name) -Create a new executable projectCommunity Examples
(set-tree tree) -Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.Community Examples
(show-paths) +Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.
Table of all built-in options, as opposed to project deifned options.Community Examples
A table of all of the dynamic config bindings to checkers (validators).Community Examples
Table of all of the help text for each config option.Community Examples
A table of possible options for enum option types.Community Examples
A table of all of the dynamic config bindings to parsers.Community Examples
Table of all built-in options, as opposed to project deifned options.
A table of all of the dynamic config bindings to checkers (validators).
(defconf kw &opt parser docs options) -Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.Community Examples
(dyn:ar &opt dflt) +Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.
(load-config settings &opt override) -Load a configuration from a table or struct.Community Examples
(load-config-file path &opt override) +Load a configuration from a table or struct.
(load-config-file path &opt override) -Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.Community Examples
(load-default &opt override) +Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.
(load-default &opt override) -Load the default configuration.Community Examples
(load-options &opt path) -Load a file that contains config options that can be set. If no such file exists, then do nothing.Community Examples
(opt opts key &opt dflt) +Load a file that contains config options that can be set. If no such file exists, then do nothing.
(opt opts key &opt dflt) -Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.Community Examples
(read-env-variables) +Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.
(read-env-variables) -Read environment variables that correspond to config variables into dyns.Community Examples
(save-config path) +Read environment variables that correspond to config variables into dyns.
(save-config path) -Write the current configuration information to a file.Community Examples
Map some single characters to long options.Community Examples
(pdag f dag &opt n-workers) +Write the current configuration information to a file.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.
(pmap f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.Community Examples
(auto) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.
(generate-config &opt destdir silent as-data) +Get an autodetected config.
(generate-config &opt destdir silent as-data) -Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.Community Examples
(bundle-install bundle &opt no-deps) +Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.
(bundle-install bundle &opt no-deps) -Install a bundle from a git repository.Community Examples
(do-rule target) -Evaluate a given rule in a one-off manner.Community Examples
(download-bundle url bundle-type &opt tag shallow) +Evaluate a given rule in a one-off manner.
(download-bundle url bundle-type &opt tag shallow) -Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.Community Examples
(download-git-bundle bundle-dir url tag shallow) +Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.
(download-git-bundle bundle-dir url tag shallow) -Download a git bundle from a remote respositoryCommunity Examples
(download-tar-bundle bundle-dir url &opt force-gz) +Download a git bundle from a remote respository
(download-tar-bundle bundle-dir url &opt force-gz) -Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.Community Examples
(git & args) +Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.
(import-rules path &opt base-env) -Import another file that defines more rules. This ruleset is merged into the current ruleset.Community Examples
(load-lockfile &opt filename) +Import another file that defines more rules. This ruleset is merged into the current ruleset.
(load-lockfile &opt filename) -Load packages from a lockfile.Community Examples
(load-project-meta &opt path) +Load packages from a lockfile.
(load-project-meta &opt path) -Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.Community Examples
(make-jpm-env &opt base-env) +Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.
(make-jpm-env &opt base-env) -Create an environment that is preloaded with jpm symbols.Community Examples
(make-lockfile &opt filename) +Create an environment that is preloaded with jpm symbols.
(out-of-tree-config path &opt options) -Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.Community Examples
(post-deps & body) +Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.
(post-deps & body) -Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.Community Examples
(require-jpm path &opt base-env) +Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.
(require-jpm path &opt base-env) -Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.Community Examples
(resolve-bundle bundle) +Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.
(resolve-bundle bundle) -Convert any bundle string/table to the normalized table form.Community Examples
(tar & args) +Convert any bundle string/table to the normalized table form.
(update-git-bundle bundle-dir tag shallow) +Make a call to tar.
(update-git-bundle bundle-dir tag shallow) -Fetch latest tag version from remote repositoryCommunity Examples
(update-installed) +Fetch latest tag version from remote repository
(update-installed) -Update all previously installed packages to their latest versions.Community Examples
(add-body target & body) +Update all previously installed packages to their latest versions.
(add-body target & body) -Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.Community Examples
(add-dep target dep) +Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.
(add-input target input) -Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.Community Examples
(add-output target output) +Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.
(add-output target output) -Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.Community Examples
(add-thunk target thunk) +Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.
(add-thunk target thunk) -Append a thunk to a target's recipe.Community Examples
(build-rules rules targets &opt n-workers) +Append a thunk to a target's recipe.
(build-rules rules targets &opt n-workers) -Given a graph of all rules, extract a work graph that will build out-of-date files.Community Examples
(getrules) +Given a graph of all rules, extract a work graph that will build out-of-date files.
(rule target deps & body) -Add a rule to the rule graph.Community Examples
(sh-phony target deps & body) -Alias for `sh-task`.Community Examples
(sh-rule target deps & body) -Add a rule that invokes a shell command, and fails if the command returns non-zero.Community Examples
(sh-task target deps & body) +Add a rule that invokes a shell command, and fails if the command returns non-zero.
(sh-task target deps & body) -Add a task that invokes a shell command, and fails if the command returns non-zero.Community Examples
(task target deps & body) +Add a task that invokes a shell command, and fails if the command returns non-zero.
(task target deps & body) -Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).Community Examples
(scaffold-project name &opt options) +Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).
(scaffold-project name &opt options) -Generate a standardized project scaffold.Community Examples
(abspath path) -Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).Community Examples
(basename path) +Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).
(basename path) -Get the filename of a path without any leading directory components.Community Examples
(clear-cache) +Get the filename of a path without any leading directory components.
(clear-manifest) -Clear the global installation manifest.Community Examples
(clexe-shell & args) +Clear the global installation manifest.
(copy src dest) -Copy a file or directory recursively from one location to another.Community Examples
(copyfile src dest) +Copy a file or directory recursively from one location to another.
(copyfile src dest) -Copy a file one location to another.Community Examples
(create-dirs dest) -Create all directories needed for a file (mkdir -p).Community Examples
(dirname path) -Get the directory of a file without the filename.Community Examples
(do-monkeypatch build-dir) +Get the directory of a file without the filename.
(do-monkeypatch build-dir) -Modify the existing environment to have the same paths as the test environment.Community Examples
(drop1-shell std args) +Modify the existing environment to have the same paths as the test environment.
(drop1-shell std args) -Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.Community Examples
(exec-slurp & args) +Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.
(exec-slurp & args) -Read stdout of subprocess and return it trimmed in a string.Community Examples
(filepath-replace repo) +Read stdout of subprocess and return it trimmed in a string.
(filepath-replace repo) -Remove special characters from a string or path to make it into a path segment.Community Examples
(find-build-dir) +Remove special characters from a string or path to make it into a path segment.
(find-build-dir) -Gets the build directory to output files to.Community Examples
(find-cache) -Return the path to the global cache.Community Examples
(find-manifest name) -Get the full path of a manifest file given a package name.Community Examples
(find-manifest-dir) +Get the full path of a manifest file given a package name.
(find-manifest-dir) -Get the path to the directory containing manifests for installed packages.Community Examples
(is-mingw) +Get the path to the directory containing manifests for installed packages.
(is-win) -Check if we should assume a DOS-like shell or default to posix shell.Community Examples
(is-win-or-mingw) +Check if we should assume a DOS-like shell or default to posix shell.
(is-win-or-mingw) -Check if built with mingwCommunity Examples
(rm path) -Remove a directory and all sub directories.Community Examples
(run-patched & extra-args) +Remove a directory and all sub directories.
(run-patched & extra-args) -Run a subprocess Janet repl that has the same environment as the test environment.Community Examples
(run-repl) +Run a subprocess Janet repl that has the same environment as the test environment.
(run-repl) -Run a repl in the monkey patched test environmentCommunity Examples
(run-script path) +Run a repl in the monkey patched test environment
(run-script path) -Run a local script in the monkey patched environment.Community Examples
(shell & args) +Run a local script in the monkey patched environment.
make-config/auto make-config/generate-config
(generate-config &opt destdir silent as-data) +Get an autodetected config.
(generate-config &opt destdir silent as-data) -Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.Community Examples
pm/bundle-install pm/curl pm/do-rule pm/download-bundle pm/download-git-bundle pm/download-tar-bundle pm/git pm/import-rules pm/load-lockfile pm/load-project-meta pm/make-jpm-env pm/make-lockfile pm/out-of-tree-config pm/post-deps pm/require-jpm pm/resolve-bundle pm/tar pm/update-git-bundle pm/update-installed
(bundle-install bundle &opt no-deps) -Install a bundle from a git repository.Community Examples
(do-rule target) -Evaluate a given rule in a one-off manner.Community Examples
(download-bundle url bundle-type &opt tag shallow) +Evaluate a given rule in a one-off manner.
(download-bundle url bundle-type &opt tag shallow) -Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.Community Examples
(download-git-bundle bundle-dir url tag shallow) +Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.
(download-git-bundle bundle-dir url tag shallow) -Download a git bundle from a remote respositoryCommunity Examples
(download-tar-bundle bundle-dir url &opt force-gz) +Download a git bundle from a remote respository
(download-tar-bundle bundle-dir url &opt force-gz) -Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.Community Examples
(git & args) +Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.
(import-rules path &opt base-env) -Import another file that defines more rules. This ruleset is merged into the current ruleset.Community Examples
(load-lockfile &opt filename) +Import another file that defines more rules. This ruleset is merged into the current ruleset.
(load-lockfile &opt filename) -Load packages from a lockfile.Community Examples
(load-project-meta &opt path) -Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.Community Examples
(make-jpm-env &opt base-env) +Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.
(make-jpm-env &opt base-env) -Create an environment that is preloaded with jpm symbols.Community Examples
(make-lockfile &opt filename) +Create an environment that is preloaded with jpm symbols.
(out-of-tree-config path &opt options) -Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.Community Examples
(post-deps & body) +Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.
(post-deps & body) -Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.Community Examples
(require-jpm path &opt base-env) +Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.
(require-jpm path &opt base-env) -Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.Community Examples
(resolve-bundle bundle) +Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.
(resolve-bundle bundle) -Convert any bundle string/table to the normalized table form.Community Examples
(update-git-bundle bundle-dir tag shallow) +Make a call to tar.
(update-git-bundle bundle-dir tag shallow) -Fetch latest tag version from remote repositoryCommunity Examples
(update-installed) +Fetch latest tag version from remote repository
(update-installed) -Update all previously installed packages to their latest versions.Community Examples
rules/add-body rules/add-dep rules/add-input rules/add-output rules/add-thunk rules/build-rules rules/getrules rules/phony rules/rule rules/sh-phony rules/sh-rule rules/sh-task rules/task
(add-body target & body) -Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.Community Examples
(add-dep target dep) +Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.
(add-input target input) -Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.Community Examples
(add-output target output) +Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.
(add-output target output) -Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.Community Examples
(add-thunk target thunk) +Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.
(add-thunk target thunk) -Append a thunk to a target's recipe.Community Examples
(build-rules rules targets &opt n-workers) +Append a thunk to a target's recipe.
(build-rules rules targets &opt n-workers) -Given a graph of all rules, extract a work graph that will build out-of-date files.Community Examples
(getrules) +Given a graph of all rules, extract a work graph that will build out-of-date files.
(sh-rule target deps & body) -Add a rule that invokes a shell command, and fails if the command returns non-zero.Community Examples
(sh-task target deps & body) +Add a rule that invokes a shell command, and fails if the command returns non-zero.
(sh-task target deps & body) -Add a task that invokes a shell command, and fails if the command returns non-zero.Community Examples
(task target deps & body) +Add a task that invokes a shell command, and fails if the command returns non-zero.
(task target deps & body) -Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).Community Examples
(scaffold-project name &opt options) -Generate a standardized project scaffold.Community Examples
shutil/abspath shutil/basename shutil/clear-cache shutil/clear-manifest shutil/clexe-shell shutil/copy shutil/copyfile shutil/create-dirs shutil/devnull shutil/dirname shutil/do-monkeypatch shutil/drop1-shell shutil/exec-slurp shutil/filepath-replace shutil/find-build-dir shutil/find-cache shutil/find-manifest shutil/find-manifest-dir shutil/is-mingw shutil/is-win shutil/is-win-or-mingw shutil/path-splitter shutil/rimraf shutil/rm shutil/run-patched shutil/run-repl shutil/run-script shutil/shell shutil/undo-monkeypatch
(abspath path) -Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).Community Examples
(basename path) +Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).
(basename path) -Get the filename of a path without any leading directory components.Community Examples
(clear-cache) +Get the filename of a path without any leading directory components.
(clear-manifest) -Clear the global installation manifest.Community Examples
(copy src dest) -Copy a file or directory recursively from one location to another.Community Examples
(copyfile src dest) +Copy a file or directory recursively from one location to another.
(copyfile src dest) -Copy a file one location to another.Community Examples
(create-dirs dest) -Create all directories needed for a file (mkdir -p).Community Examples
(dirname path) -Get the directory of a file without the filename.Community Examples
(do-monkeypatch build-dir) +Get the directory of a file without the filename.
(do-monkeypatch build-dir) -Modify the existing environment to have the same paths as the test environment.Community Examples
(drop1-shell std args) +Modify the existing environment to have the same paths as the test environment.
(drop1-shell std args) -Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.Community Examples
(exec-slurp & args) +Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.
(exec-slurp & args) -Read stdout of subprocess and return it trimmed in a string.Community Examples
(filepath-replace repo) +Read stdout of subprocess and return it trimmed in a string.
(filepath-replace repo) -Remove special characters from a string or path to make it into a path segment.Community Examples
(find-build-dir) +Remove special characters from a string or path to make it into a path segment.
(find-build-dir) -Gets the build directory to output files to.Community Examples
(find-cache) -Return the path to the global cache.Community Examples
(find-manifest name) -Get the full path of a manifest file given a package name.Community Examples
(find-manifest-dir) +Get the full path of a manifest file given a package name.
(find-manifest-dir) -Get the path to the directory containing manifests for installed packages.Community Examples
(is-mingw) +Get the path to the directory containing manifests for installed packages.
(is-win) -Check if we should assume a DOS-like shell or default to posix shell.Community Examples
(is-win-or-mingw) +Check if we should assume a DOS-like shell or default to posix shell.
(is-win-or-mingw) -Check if built with mingwCommunity Examples
(run-patched & extra-args) +Remove a directory and all sub directories.
(run-patched & extra-args) -Run a subprocess Janet repl that has the same environment as the test environment.Community Examples
(run-repl) +Run a subprocess Janet repl that has the same environment as the test environment.
(run-repl) -Run a repl in the monkey patched test environmentCommunity Examples
(run-script path) +Run a repl in the monkey patched test environment
(run-script path) -Run a local script in the monkey patched environment.Community Examples
(decode s) Converts a base64 encoded string to its binary representation of any format -(UTF-8, binary, ..).Community Examples
(encode s) -Converts a string of any format (UTF-8, binary, ..) to base64 encoding.Community Examples
crc/make-variant crc/named-variant
(crc/make-variant size polynomial &opt init byte-flip xorout) -Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.Community Examples
(crc/named-variant name) +Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.
(crc/named-variant name) -Get a named CRC variant.Community Examples
cron/check cron/next-timestamp cron/parse-cron
(check cron &opt time local) -Check if a given time matches a cron specifier.Community Examples
(next-timestamp cron &opt time local) +Check if a given time matches a cron specifier.
(next-timestamp cron &opt time local) -Given a cron schedule, get the next instance on the cron tab after timeCommunity Examples
(parse-cron str) +Given a cron schedule, get the next instance on the cron tab after time
(parse-cron str) -Parse a cron string into a valid cron schedule objectCommunity Examples
ev-utils/go-nursery ev-utils/join-nursery ev-utils/multithread-service ev-utils/nursery ev-utils/pcall ev-utils/pdag ev-utils/pmap ev-utils/pmap-full ev-utils/pmap-limited ev-utils/spawn-nursery ev-utils/wait-cancel
(go-nursery nurse f &opt value) -Spawn a fiber into a nursery, similar to ev/go.Community Examples
(join-nursery nurse) +Spawn a fiber into a nursery, similar to ev/go.
(join-nursery nurse) -Suspend the current fiber until the nursery is emptied.Community Examples
(multithread-service thread-main n-threads) +Suspend the current fiber until the nursery is emptied.
(multithread-service thread-main n-threads) -Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.Community Examples
(nursery) +Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.
(nursery) -Group a number of fibers into a single object for structured concurrencyCommunity Examples
(pcall f n) +Group a number of fibers into a single object for structured concurrency
(pcall f n) -Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.Community Examples
(pdag f dag &opt n-workers) +Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data &opt n-workers) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.
(pmap f data &opt n-workers) -Map `f` over data in parallel, optionally limiting parallelism to `n` workers.Community Examples
(pmap-full f data) +Map `f` over data in parallel, optionally limiting parallelism to `n` workers.
(pmap-full f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.Community Examples
(pmap-limited f data n-workers) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.
(pmap-limited f data n-workers) -Similar to pmap-full, but only runs work n-ways parallel.Community Examples
(spawn-nursery nurse & body) +Similar to pmap-full, but only runs work n-ways parallel.
(spawn-nursery nurse & body) -Similar to ev/spawn but associate spawned fibers with a nurseryCommunity Examples
(wait-cancel & body) +Similar to ev/spawn but associate spawned fibers with a nursery
(wait-cancel & body) -Wait forever until the current fiber is canceled, and then run some cleanup code.Community Examples
fmt/format fmt/format-file fmt/format-print
(format source) -Format a string of source code to a buffer.Community Examples
(format-print source) -Format a string of source code and print the result.Community Examples
generators/concat generators/cycle generators/drop generators/drop-until generators/drop-while generators/filter generators/from-iterable generators/map generators/mapcat generators/range generators/run generators/take generators/take-until generators/take-while generators/to-array
(concat & xs) -Concatenate one or more generators or iterables into a single generator.Community Examples
(cycle ds) +Concatenate one or more generators or iterables into a single generator.
(cycle ds) -Repeatedly yield the elements of `ds`, looping back to the beginning when finished.Community Examples
(drop n ds) +Repeatedly yield the elements of `ds`, looping back to the beginning when finished.
(drop-until p ds) -Drop elements from `ds` until `p` is true.Community Examples
(drop-while p ds) -Drop elements from `ds` while `p` is true.Community Examples
(filter p ds) -Create a generator that filters `ds` with `p`.Community Examples
(from-iterable ds) +Create a generator that filters `ds` with `p`.
(from-iterable ds) -Create a new generator around any iterable data structure.Community Examples
(map f ds) +Create a new generator around any iterable data structure.
(map f ds) -Create a generator that maps `f` over `ds`.Community Examples
(mapcat f ds) -Map `f` over `ds`, concatenating the results into a new generator.Community Examples
(range from to) +Map `f` over `ds`, concatenating the results into a new generator.
(take n ds) -Take `n` elements from iterable `ds`.Community Examples
(take-until p ds) -Return elements from `ds` until `p` is true.Community Examples
(take-while p ds) +Return elements from `ds` until `p` is true.
(take-while p ds) -Return elements from `ds` while `p` is true.Community Examples
getline/default-autocomplete-context getline/default-autocomplete-options getline/default-doc-fetch getline/make-getline getline/max-history
(default-autocomplete-context buf pos) -Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.Community Examples
(default-autocomplete-options prefix &) +Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.
(default-autocomplete-options prefix &) -Default handler to get available autocomplete options for a given substring.Community Examples
(default-doc-fetch sym w &) +Default handler to get available autocomplete options for a given substring.
(default-doc-fetch sym w &) -Default handler for Ctrl-G to lookup docstrings in the current environment.Community Examples
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) +Default handler for Ctrl-G to lookup docstrings in the current environment.
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) -Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.Community Examples
htmlgen/doctype-html htmlgen/escape htmlgen/html htmlgen/raw
(escape x) +htmlgen/doctype-html htmlgen/escape htmlgen/html htmlgen/raw
htmlgen/html function source(html data &opt buf) -Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.Community Exampleshtmlgen/raw function source(raw text) +Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.htmlgen/raw function source+Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.(raw text) -Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.Community Examples
http/cookie-grammar http/cookies http/logger http/middleware http/query-string-grammar http/read-body http/read-request http/read-response http/request http/request-peg http/response-peg http/router http/send-response http/server http/server-handler http/status-messages http/url-grammar
Grammar to parse a cookie header to a series of keys and values.Community Examples
(cookies nextmw) +http/cookie-grammar http/cookies http/logger http/middleware http/query-string-grammar http/read-body http/read-request http/read-response http/request http/request-peg http/response-peg http/router http/send-response http/server http/server-handler http/status-messages http/url-grammar
http/cookie-grammar core/peg sourceGrammar to parse a cookie header to a series of keys and values.http/cookies function source(cookies nextmw) -Parses cookies into the table under :cookies keyCommunity Exampleshttp/logger function source(logger nextmw) -Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.Community Exampleshttp/middleware function source(middleware x) +Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.http/middleware function source(middleware x) -Coerce any type to http middlewareCommunity Exampleshttp/query-string-grammar core/peg sourceGrammar that parses a query string (sans url path and ? character) and returns a table.Community Exampleshttp/query-string-grammar core/peg sourceGrammar that parses a query string (sans url path and ? character) and returns a table.http/read-body function source(read-body req) -Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.Community Exampleshttp/read-request function source(read-request conn buf &opt no-query) +Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.http/read-request function source(read-request conn buf &opt no-query) -Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Exampleshttp/read-response function source(read-response conn buf) +Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`http/read-response function source(read-response conn buf) -Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Exampleshttp/request function source(request method url &keys {:headers headers :body body}) +Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`http/request function source(request method url &keys {:headers headers :body body}) -Make an HTTP request to a server. Returns a table contain response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.Community Exampleshttp/router function source(router routes) +Make an HTTP request to a server. Returns a table contain response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.http/router function source(router routes) -Creates a router middleware. A router will dispatch to different routes based on the URL path.Community Exampleshttp/send-response function source(send-response conn response &opt buf) +Creates a router middleware. A router will dispatch to different routes based on the URL path.http/send-response function source(send-response conn response &opt buf) -Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.Community Exampleshttp/server function source(server handler &opt host port) +Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.http/server function source(server handler &opt host port) -Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.Community Exampleshttp/server-handler function source(server-handler conn handler) +Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.http/server-handler function source(server-handler conn handler) -A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Community Exampleshttp/status-messages struct sourceMapping of HTTP status codes to their status message.Community Exampleshttp/url-grammar core/peg source+A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.Community Examples
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.
httpf/add-bindings-as-routes httpf/add-route httpf/default-payload-wrapper httpf/listen httpf/server
(add-bindings-as-routes server &opt env) -Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.Community Examples
(add-route server path docstring schema handler &opt read-mime render-mime) +Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.
(add-route server path docstring schema handler &opt read-mime render-mime) -Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.Community Examples
(default-payload-wrapper payload) +Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.
(default-payload-wrapper payload) -Add some metadata to all responsesCommunity Examples
(listen server &opt host port n-workers) +Add some metadata to all responses
(listen server &opt host port n-workers) -Start serverCommunity Examples
(decode s) +You may also use a custom args array when specified via the special option `:args`
(decode s) Converts a base64 encoded string to its binary representation of any format -(UTF-8, binary, ..).Community Examples
(encode s) -Converts a string of any format (UTF-8, binary, ..) to base64 encoding.Community Examples
(crc/make-variant size polynomial &opt init byte-flip xorout) +Converts a string of any format (UTF-8, binary, ..) to base64 encoding.
(crc/make-variant size polynomial &opt init byte-flip xorout) -Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.Community Examples
(crc/named-variant name) +Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.
(crc/named-variant name) -Get a named CRC variant.Community Examples
(check cron &opt time local) -Check if a given time matches a cron specifier.Community Examples
(next-timestamp cron &opt time local) +Check if a given time matches a cron specifier.
(next-timestamp cron &opt time local) -Given a cron schedule, get the next instance on the cron tab after timeCommunity Examples
(parse-cron str) +Given a cron schedule, get the next instance on the cron tab after time
(parse-cron str) -Parse a cron string into a valid cron schedule objectCommunity Examples
(go-nursery nurse f &opt value) +Parse a cron string into a valid cron schedule object
(go-nursery nurse f &opt value) -Spawn a fiber into a nursery, similar to ev/go.Community Examples
(join-nursery nurse) +Spawn a fiber into a nursery, similar to ev/go.
(join-nursery nurse) -Suspend the current fiber until the nursery is emptied.Community Examples
(multithread-service thread-main n-threads) +Suspend the current fiber until the nursery is emptied.
(multithread-service thread-main n-threads) -Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.Community Examples
(nursery) +Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.
(nursery) -Group a number of fibers into a single object for structured concurrencyCommunity Examples
(pcall f n) +Group a number of fibers into a single object for structured concurrency
(pcall f n) -Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.Community Examples
(pdag f dag &opt n-workers) +Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data &opt n-workers) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.
(pmap f data &opt n-workers) -Map `f` over data in parallel, optionally limiting parallelism to `n` workers.Community Examples
(pmap-full f data) +Map `f` over data in parallel, optionally limiting parallelism to `n` workers.
(pmap-full f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.Community Examples
(pmap-limited f data n-workers) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.
(pmap-limited f data n-workers) -Similar to pmap-full, but only runs work n-ways parallel.Community Examples
(spawn-nursery nurse & body) +Similar to pmap-full, but only runs work n-ways parallel.
(spawn-nursery nurse & body) -Similar to ev/spawn but associate spawned fibers with a nurseryCommunity Examples
(wait-cancel & body) +Similar to ev/spawn but associate spawned fibers with a nursery
(wait-cancel & body) -Wait forever until the current fiber is canceled, and then run some cleanup code.Community Examples
(format source) +Wait forever until the current fiber is canceled, and then run some cleanup code.
(format source) -Format a string of source code to a buffer.Community Examples
(format-file file) +Format a string of source code to a buffer.
(format-print source) -Format a string of source code and print the result.Community Examples
(concat & xs) +Format a string of source code and print the result.
(concat & xs) -Concatenate one or more generators or iterables into a single generator.Community Examples
(cycle ds) +Concatenate one or more generators or iterables into a single generator.
(cycle ds) -Repeatedly yield the elements of `ds`, looping back to the beginning when finished.Community Examples
(drop n ds) +Repeatedly yield the elements of `ds`, looping back to the beginning when finished.
(drop-until p ds) -Drop elements from `ds` until `p` is true.Community Examples
(drop-while p ds) +Drop elements from `ds` until `p` is true.
(drop-while p ds) -Drop elements from `ds` while `p` is true.Community Examples
(filter p ds) -Create a generator that filters `ds` with `p`.Community Examples
(from-iterable ds) +Create a generator that filters `ds` with `p`.
(from-iterable ds) -Create a new generator around any iterable data structure.Community Examples
(map f ds) +Create a new generator around any iterable data structure.
(map f ds) -Create a generator that maps `f` over `ds`.Community Examples
(mapcat f ds) -Map `f` over `ds`, concatenating the results into a new generator.Community Examples
(range from to) +Map `f` over `ds`, concatenating the results into a new generator.
(take n ds) -Take `n` elements from iterable `ds`.Community Examples
(take-until p ds) +Take `n` elements from iterable `ds`.
(take-until p ds) -Return elements from `ds` until `p` is true.Community Examples
(take-while p ds) +Return elements from `ds` until `p` is true.
(take-while p ds) -Return elements from `ds` while `p` is true.Community Examples
(to-array s) +Return elements from `ds` while `p` is true.
(to-array s) -Consume `s` into a new array.Community Examples
(default-autocomplete-context buf pos) +Consume `s` into a new array.
(default-autocomplete-context buf pos) -Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.Community Examples
(default-autocomplete-options prefix &) +Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.
(default-autocomplete-options prefix &) -Default handler to get available autocomplete options for a given substring.Community Examples
(default-doc-fetch sym w &) +Default handler to get available autocomplete options for a given substring.
(default-doc-fetch sym w &) -Default handler for Ctrl-G to lookup docstrings in the current environment.Community Examples
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) +Default handler for Ctrl-G to lookup docstrings in the current environment.
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) -Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.Community Examples
(escape x) +Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.
(escape x) -Escape characters in a string for HTMLCommunity Examples
(html data &opt buf) -Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.Community Examples
(raw text) +Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.
(raw text) -Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.Community Examples
Grammar to parse a cookie header to a series of keys and values.Community Examples
(cookies nextmw) +Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.
Grammar to parse a cookie header to a series of keys and values.
(cookies nextmw) -Parses cookies into the table under :cookies keyCommunity Examples
(logger nextmw) -Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.Community Examples
(middleware x) +Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.
(middleware x) -Coerce any type to http middlewareCommunity Examples
Grammar that parses a query string (sans url path and ? character) and returns a table.Community Examples
Grammar that parses a query string (sans url path and ? character) and returns a table.
(read-body req) -Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.Community Examples
(read-request conn buf &opt no-query) +Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.
(read-request conn buf &opt no-query) -Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Examples
(read-response conn buf) +Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`
(read-response conn buf) -Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Examples
(request method url &keys {:headers headers :body body}) +Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`
(request method url &keys {:headers headers :body body}) -Make an HTTP request to a server. Returns a table contain response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.Community Examples
(router routes) +Make an HTTP request to a server. Returns a table contain response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.
(router routes) -Creates a router middleware. A router will dispatch to different routes based on the URL path.Community Examples
(send-response conn response &opt buf) +Creates a router middleware. A router will dispatch to different routes based on the URL path.
(send-response conn response &opt buf) -Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.Community Examples
(server handler &opt host port) +Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.
(server handler &opt host port) -Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.Community Examples
(server-handler conn handler) +Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.
(server-handler conn handler) -A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Community Examples
Mapping of HTTP status codes to their status message.Community Examples
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.Community Examples
(add-bindings-as-routes server &opt env) +A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.
(add-bindings-as-routes server &opt env) -Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.Community Examples
(add-route server path docstring schema handler &opt read-mime render-mime) +Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.
(add-route server path docstring schema handler &opt read-mime render-mime) -Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.Community Examples
(default-payload-wrapper payload) +Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.
(default-payload-wrapper payload) -Add some metadata to all responsesCommunity Examples
(listen server &opt host port n-workers) +Add some metadata to all responses
(listen server &opt host port n-workers) -Start serverCommunity Examples
(json/decode json-source &opt keywords nils) +Create a new server.
(json/decode json-source &opt keywords nils) -Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.Community Examples
(json/encode x &opt tab newline buf) +Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.
(json/encode x &opt tab newline buf) -Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.Community Examples
Dynamic binding to front matter after parsing, compilation, and evaluation, of markup completes.Community Examples
The htmlgen source that can be used to generate a document with htmlgen/html.Community Examples
(add-loader) +Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.
Dynamic binding to front matter after parsing, compilation, and evaluation, of markup completes.
The htmlgen source that can be used to generate a document with htmlgen/html.
(add-loader) -Allow importing and requiring markup as a moduleCommunity Examples
(anchor name & content) +Allow importing and requiring markup as a module
(anchor name & content) -Create an in-page anchor for a local link.Community Examples
(bigger content) -Make span element with bigger fontCommunity Examples
(blockquote content) -Make a block quote elementCommunity Examples
(code content) -Make code element with class mendoza-codeCommunity Examples
(codeblock lang &opt source) +Make code element with class mendoza-code
(codeblock lang &opt source) -Inline code or codeblockCommunity Examples
Make a div element
Make a em element
Make a li element
(markup source &opt env where) -Parse mendoza markup and evaluate it returning an htmlgen document tree.Community Examples
(mdz-loader path &) +Parse mendoza markup and evaluate it returning an htmlgen document tree.
(mdz-loader path &) -Loader for the mdz formatCommunity Examples
Make a ol element
Make a p element
Make a pre element
(section name content) -Create a section. Usually used to embed different parts of the content document into different parts of the main page.Community Examples
(smaller content) +Create a section. Usually used to embed different parts of the content document into different parts of the main page.
(smaller content) -Make span element with smaller fontCommunity Examples
Make a strong element
Make a sub element
Make a sup element
(tag name content) -Wrap some content in an html tag. If you need attributes or other properties, you may want to use raw HTML via the html function.Community Examples
(always x) +Wrap some content in an html tag. If you need attributes or other properties, you may want to use raw HTML via the html function.
Make a td element
Make a th element
Make a tr element
Make a u element
Make a ul element
(always x) -Return a function that discards any arguments and always returns `x`.Community Examples
(antepenultimate xs) +Return a function that discards any arguments and always returns `x`.
(antepenultimate xs) -Get the third-to-last element from an indexed data structure.Community Examples
(caperr & body) +Get the third-to-last element from an indexed data structure.
(caperr & body) Captures the standart error output of the variadic `body` and returns it -as a buffer.Community Examples
(capout & body) Captures the standart output of the variadic `body` and returns it as -a buffer.Community Examples
(cond-> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs with condition and operation to which the `val`, is put as first argument. All conditions are tried and for truthy conditions the operation is executed. -Returns the value mutated if any condition is truthy.Community Examples
(cond->> val & clauses) +Returns the value mutated if any condition is truthy.
(cond->> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs of condition and operation to which the `val`, is put as last argument. All conditions are tried and for truthy the operation is ran. -Returns mutated value if any condition is truthy.Community Examples
(dedent & xs) Remove indentation after concatenating the arguments. Works by removing leading whitespace, and then removing that same pattern of whitepsace after -new lines.Community Examples
(defs & bindings) -Defines many constants as in let `bindings`, but without creating new scope.Community Examples
(dfs data visit-leaf &opt node-before node-after get-children seen) +Defines many constants as in let `bindings`, but without creating new scope.
(dfs data visit-leaf &opt node-before node-after get-children seen) Do a depth first, pre-order traversal over a data structure. Also allow for callbacks before and after visiting the children of a node. Also allow for a custom `get-children` function to change traversal as needed. Will detect cycles if an empty table is passed as the `seen` parameter, which is used to cached values -that have been visited.Community Examples
(do-def c d & body) Convenience macro for defining constant named `c` with value `d` before `body` and returning it after evaluating `body`, that presumably modifies -the `c` refered content. For example buffer, table or array.Community Examples
(do-var v d & body) +the `c` refered content. For example buffer, table or array.
(do-var v d & body) Convenience macro for defining varible named `v` with value `d` before `body` -and returning it after evaluating `body`, that presumably modifies `v`.Community Examples
(format-table buf-into data &opt columns header-mapping column-mapping) +and returning it after evaluating `body`, that presumably modifies `v`.
(format-table buf-into data &opt columns header-mapping column-mapping) -Same as print-table but pushes table into a buffer.Community Examples
(gett ds & keys) -Recursive macro (get). Similar to get-in, but keys are variadic argument.Community Examples
(insert-sorted arr <? & xs) +Recursive macro (get). Similar to get-in, but keys are variadic argument.
(insert-sorted arr <? & xs) Insert elements in `arr` such that it remains sorted by the comparator. If -`arr` is not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(insert-sorted-by arr f & xs) +`arr` is not sorted beforehand, the results are undefined. Returns `arr`.
(insert-sorted-by arr f & xs) Insert elements in `arr` such that it remains sorted by the value returned when `f` is called with the element, comparing the values with <. If `arr` is -not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(int->string int &opt base) +not sorted beforehand, the results are undefined. Returns `arr`.
(int->string int &opt base) -Stringify an integer in a particular base. Defaults to decimal (base 10).Community Examples
(int/ & xs) +Stringify an integer in a particular base. Defaults to decimal (base 10).
(log level & args) Print to a dynamic binding stream if that stream is set, otherwise do nothing. Evaluate to nil. For example, `(log :err "value error: %V" my-value)` will print -to `(dyn :err)` only if `(dyn :err)` has been set.Community Examples
(make prototype & pairs) +to `(dyn :err)` only if `(dyn :err)` has been set.
(make prototype & pairs) Convenience macro for creating new table from even number of kvs pairs in a variadic `table-or-pairs` arguments and setting its prototype to `prototype`. -Factory function for creating new objects from prototypes.Community Examples
(make-id &opt prefix) +Factory function for creating new objects from prototypes.
(make-id &opt prefix) Create a random, printable keyword id with 10 bytes of entropy -with an optional prefix.Community Examples
(map-keys f data) Returns new table with function `f` applied to `data`'s -keys recursively.Community Examples
(map-vals f data) -Returns new table with function `f` applied to `data`'s values.Community Examples
(penultimate xs) +Returns new table with function `f` applied to `data`'s values.
(penultimate xs) -Get the second-to-last element from an indexed data structure.Community Examples
(print-table data &opt columns header-mapping column-mapping) +Get the second-to-last element from an indexed data structure.
(print-table data &opt columns header-mapping column-mapping) Iterate through the rows of a data structure and print a table in a human readable way, with padding and heading information. Can optionally provide @@ -393,315 +393,315 @@Community ExamplesSpork
for each row. Lastly, a `header-mapping` dictionary can be provided that changes the printed header names by mapping column keys to the desired header name. If no mapping is found, then the column key will be used as -the header name. Returns nil.
(randomize-array arr &opt rng) +the header name. Returns nil.
(randomize-array arr &opt rng) Randomizes array using the fisher-yates shuffle, takes an optional random -number generator.Community Examples
(second xs) -Get the second element from an indexed data structure.Community Examples
(select-keys data keyz) +Get the second element from an indexed data structure.
(select-keys data keyz) -Returns new table with selected `keyz` from dictionary `data`.Community Examples
(set* tgts exprs) +Returns new table with selected `keyz` from dictionary `data`.
(set* tgts exprs) Parallel `set` function. Takes a list of targets and expressions, evaluates all the expressions, and then assigns them to the targets. Each target can be a variable -or a 2-tuple, just like in the normal `set` special form.Community Examples
(string->int str &opt base) +or a 2-tuple, just like in the normal `set` special form.
(string->int str &opt base) Parse an integer in the given base. Defaults to decimal (base 10). Differs -from scan-number in that this does not recognize floating point notation.Community Examples
(table-filter pred dict) +from scan-number in that this does not recognize floating point notation.
(table-filter pred dict) Filter a key-value structure info a table. Semantics are the same as for built-in `filter`, except that `pred` takes two arguments (key and value.) -Does not consider prototypes.Community Examples
(third xs) -Get the third element from an indexed data structure.Community Examples
(trim-prefix prefix str) +Get the third element from an indexed data structure.
(trim-prefix prefix str) -Trim the specified prefix of a string if it has oneCommunity Examples
(trim-suffix suffix str) +Trim the specified prefix of a string if it has one
(trim-suffix suffix str) -Trim the specified suffix of a string if it has oneCommunity Examples
(until cnd & body) +Trim the specified suffix of a string if it has one
(until cnd & body) Repeat `body` while the `cnd` is false. -Equivalent to (while (not cnd) ;body).Community Examples
(vars & bindings) -Defines many variables as in let `bindings`, but without creating new scope.Community Examples
(make-proto stream &opt pack unpack) +Defines many variables as in let `bindings`, but without creating new scope.
(make-proto stream &opt pack unpack) -Create both a send an recv function from a stream, as with `make-send` and `make-recv`.Community Examples
(make-recv stream &opt unpack) +Create both a send an recv function from a stream, as with `make-send` and `make-recv`.
(make-recv stream &opt unpack) -Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.Community Examples
(make-send stream &opt pack) +Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.
(make-send stream &opt pack) -Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.Community Examples
(client &opt host port name) +Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.
(client &opt host port name) -Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".Community Examples
Default host to run server on and connect to.Community Examples
(server &opt host port env cleanup welcome-msg) +Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".
(server &opt host port env cleanup welcome-msg) -Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.Community Examples
(server-single &opt host port env cleanup welcome-msg) +Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.
(server-single &opt host port env cleanup welcome-msg) -Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.Community Examples
(posix/abspath path) +Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(ext path) -Get the file extension for a path.Community Examples
(posix/join & els) -Join path elements together.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/parts path) -Split a path into its parts.Community Examples
(posix/relpath source target) +Split a path into its parts.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(posix/relpath source target) +Get the relative path between two subpaths.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(win32/abspath path) +Get the relative path between two subpaths.
(win32/abspath path) -Coerce a path to be absolute.Community Examples
(win32/abspath? path) -Check if a path is absolute.Community Examples
(win32/basename path) -Gets the base file name of a path.Community Examples
(win32/dirname path) -Gets the directory name of a path.Community Examples
(ext path) -Get the file extension for a path.Community Examples
(win32/join & els) -Join path elements together.Community Examples
(win32/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(win32/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(win32/parts path) -Split a path into its parts.Community Examples
(win32/relpath source target) +Split a path into its parts.
(win32/relpath source target) -Get the relative path between two subpaths.Community Examples
(rawterm/begin &opt on-winch) +Get the relative path between two subpaths.
(rawterm/begin &opt on-winch) -Begin raw terminal functionality. Return a stream that can be read from to get input.Community Examples
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) +Begin raw terminal functionality. Return a stream that can be read from to get input.
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) -Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.Community Examples
(rawterm/ctrl-z) +Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.
(rawterm/ctrl-z) -A handler that a user can use to handle ctrl-z from input to suspend the current process.Community Examples
(rawterm/end) +A handler that a user can use to handle ctrl-z from input to suspend the current process.
(rawterm/getch &opt into) -Get a byte of input from stdin, without blocking if possible. Returns a buffer.Community Examples
(rawterm/isatty) +Get a byte of input from stdin, without blocking if possible. Returns a buffer.
(rawterm/isatty) -Check if the current stdin is a tty.Community Examples
(rawterm/monowidth bytes &opt start-index end-index) +Check if the current stdin is a tty.
(rawterm/monowidth bytes &opt start-index end-index) -Measure the monospace width of a string.Community Examples
(rawterm/rune-monowidth rune) +Measure the monospace width of a string.
(rawterm/rune-monowidth rune) -Get the monospace width of a rune. Returns either 0, 1, or 2.Community Examples
(rawterm/size) +Get the monospace width of a rune. Returns either 0, 1, or 2.
(rawterm/size) -Get the number of rows and columns visible in the terminal as tuple [rows cols]Community Examples
(rawterm/slice-monowidth bytes columns &opt start-index into) +Get the number of rows and columns visible in the terminal as tuple [rows cols]
(rawterm/slice-monowidth bytes columns &opt start-index into) -Get a byte slice that will fit into a number of columns.Community Examples
(compile pattern) +Get a byte slice that will fit into a number of columns.
(compile pattern) -Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.Community Examples
(find reg text &opt start) +Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.
(find reg text &opt start) -Similar to peg/find, but for regexes.Community Examples
(find-all reg text &opt start) +Similar to peg/find, but for regexes.
(find-all reg text &opt start) -Similar to peg/find-all, but for regexes.Community Examples
(match reg text &opt start) +Similar to peg/find-all, but for regexes.
(match reg text &opt start) -Similar to peg/match, but for regexes.Community Examples
Peg used to generate peg source code from a regular expression string.Community Examples
(replace reg rep text &opt start) +Similar to peg/match, but for regexes.
Peg used to generate peg source code from a regular expression string.
(replace reg rep text &opt start) -Similar to peg/replace, but for regexes.Community Examples
(replace-all reg rep text &opt start) +Similar to peg/replace, but for regexes.
(replace-all reg rep text &opt start) -Similar to peg/replace-all, but for regexes.Community Examples
(source pattern) -Compile a subset of regex to PEG source code.Community Examples
(client &opt host port name) +Compile a subset of regex to PEG source code.
(client &opt host port name) -Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.Community Examples
Default host to run server on and connect to.Community Examples
(server functions &opt host port workers-per-connection) +Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.
(server functions &opt host port workers-per-connection) -Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.Community Examples
(make-predicate schema) +Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.
(make-predicate schema) -Generate a function that can be used to validate a data structure. This is the function form of `predicate`.Community Examples
(make-validator schema) +Generate a function that can be used to validate a data structure. This is the function form of `predicate`.
(make-validator schema) -Generate a function that can be used to validate a data structure. This is the function form of `validator`.Community Examples
(predicate pattern) +Generate a function that can be used to validate a data structure. This is the function form of `validator`.
(predicate pattern) -Make a validation predicate given a certain schema.Community Examples
(validator pattern) +Make a validation predicate given a certain schema.
(validator pattern) -Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.Community Examples
The currently running service manager, if there is oneCommunity Examples
The currently running service, if there is oneCommunity Examples
(add-service service-name main-function & args) +Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.
The currently running service manager, if there is one
(add-service service-name main-function & args) -Spawn a serviceCommunity Examples
(all-services) -Get a list of running servicesCommunity Examples
(get-manager) -Get the current manager. If no manager exists, create one.Community Examples
(get-service) +Get the current manager. If no manager exists, create one.
(get-service) -Get the current service. If not in a service, raise an errorCommunity Examples
(make-manager &opt log-dir) +Get the current service. If not in a service, raise an error
(make-manager &opt log-dir) -Group a number of fibers into a single object for structured concurrency. Also includes utilities for running services like servers in the background.Community Examples
(print-all &opt filter-fn) +Group a number of fibers into a single object for structured concurrency. Also includes utilities for running services like servers in the background.
(print-all &opt filter-fn) -Print a table of all running services.Community Examples
(remove-service service-name) +Print a table of all running services.
(remove-service service-name) -Remove a serviceCommunity Examples
(set-title title) -Set a textual description of the service to describe what it is doing currentlyCommunity Examples
(start-service service-name) +Set a textual description of the service to describe what it is doing currently
(start-service service-name) -Start or restart a serviceCommunity Examples
(stop-service service-name &opt reason) +Start or restart a service
(stop-service service-name &opt reason) -Stop a running serviceCommunity Examples
(wait) -Once a number of services have been spawned, call `wait` to block the fiber until the manager is canceled. This lets a manager fiber behave as a service itself.Community Examples
(copy src dest) +Once a number of services have been spawned, call `wait` to block the fiber until the manager is canceled. This lets a manager fiber behave as a service itself.
(copy src dest) Copy a file or directory recursively from one location to another. -Expects input to be unix style pathsCommunity Examples
(copy-file src-path dst-path) +Expects input to be unix style paths
(copy-file src-path dst-path) -Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.Community Examples
(create-dirs dir-path) +Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.
(create-dirs dir-path) -Create all directories in path specified as string including itself.Community Examples
(devnull) +Create all directories in path specified as string including itself.
(devnull) -get the /dev/null equivalent of the current platform as an open fileCommunity Examples
(escape & args) +get the /dev/null equivalent of the current platform as an open file
(escape & args) -Output a string with all arguments correctly quotedCommunity Examples
(exec & args) -Execute command specified by args returning it's exit codeCommunity Examples
(exec-fail & args) +Execute command specified by args returning it's exit code
(exec-fail & args) -Execute command specified by args, fails when command exits with non-zero exit codeCommunity Examples
(exec-slurp & args) +Execute command specified by args, fails when command exits with non-zero exit code
(exec-slurp & args) -Read stdout of command specified by args and return it trimmed in a string.Community Examples
(exec-slurp-all & args) +Read stdout of command specified by args and return it trimmed in a string.
(exec-slurp-all & args) Read stdout and stderr of subprocess and return it trimmed in a struct with :err and :out containing the output as string. -This will also return the exit code under the :status key.Community Examples
(exists? path) +This will also return the exit code under the :status key.
(exists? path) -Check if the given file or directory exists. (Follows symlinks)Community Examples
(list-all-files dir &opt into) +Check if the given file or directory exists. (Follows symlinks)
(list-all-files dir &opt into) -List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.Community Examples
(make-new-file file-path &opt mode) +List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.
(make-new-file file-path &opt mode) -Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).Community Examples
(rm path) +Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).
(rm path) -Remove a directory and all sub directories recursively.Community Examples
(scan-directory dir func) +Remove a directory and all sub directories recursively.
(scan-directory dir func) -Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.Community Examples
(split s) +Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.
(split s) -Split a string into 'sh like' tokens, returns nil if unable to parse the string.Community Examples
(tarray/buffer array|size) +Split a string into 'sh like' tokens, returns nil if unable to parse the string.
(tarray/buffer array|size) -Return typed array buffer or create a new buffer.Community Examples
(tarray/copy-bytes src sindex dst dindex &opt count) +Return typed array buffer or create a new buffer.
(tarray/copy-bytes src sindex dst dindex &opt count) -Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.Community Examples
(tarray/length array|buffer) +Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.
(tarray/length array|buffer) -Return typed array or buffer size.Community Examples
(tarray/new type size &opt stride offset tarray|buffer) +Return typed array or buffer size.
(tarray/new type size &opt stride offset tarray|buffer) -Create new typed array.Community Examples
(tarray/properties array) +Create new typed array.
(tarray/properties array) -Return typed array properties as a struct.Community Examples
(tarray/slice tarr &opt start end) +Return typed array properties as a struct.
(tarray/slice tarr &opt start end) -Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.Community Examples
(tarray/swap-bytes src sindex dst dindex &opt count) +Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.
(tarray/swap-bytes src sindex dst dindex &opt count) -Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.Community Examples
(all-tasks tasker &opt detailed) +Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.
(all-tasks tasker &opt detailed) -Get an array of all task ids for which there is still data on disk. If `detailed` is truthy, return full task metadata instead of ids.Community Examples
(cancel-task tasker task-id) +Get an array of all task ids for which there is still data on disk. If `detailed` is truthy, return full task metadata instead of ids.
(cancel-task tasker task-id) -Cancel a queued or running task.Community Examples
(close-queues tasker) -Prevent any tasks from being added to queues. When an executor finishes it's current job, if there are any, it will terminate. When all executors complete, the call to `run-executors` will complete.Community Examples
Default location of task recordsCommunity Examples
Maximum allowed priority (lower priority tasks will execute first)Community Examples
Minimum allowed priority (lower priority tasks will execute first)Community Examples
(new-tasker &opt task-directory queues queue-size) +Prevent any tasks from being added to queues. When an executor finishes it's current job, if there are any, it will terminate. When all executors complete, the call to `run-executors` will complete.
Maximum allowed priority (lower priority tasks will execute first)
Minimum allowed priority (lower priority tasks will execute first)
(new-tasker &opt task-directory queues queue-size) -Create queues and various settings to run tasks. Create a new tasker table.Community Examples
(queue-task tasker argv &opt note priority qname timeout expiration input) +Create queues and various settings to run tasks. Create a new tasker table.
(queue-task tasker argv &opt note priority qname timeout expiration input) -Add a task specification to a queue. Supply an argv string array that will be used to invoke s a subprocess. The optional `note` parameter is just a textual note for task trackingv. The `priority` parameter should be an integer between 0 and 9 inclusive, default is 4. Lower priority jobs in the same queue will be executed by higher priority. Use input to pass in generic, unstructured input to a task.Community Examples
(run-cleanup tasker) +Add a task specification to a queue. Supply an argv string array that will be used to invoke s a subprocess. The optional `note` parameter is just a textual note for task trackingv. The `priority` parameter should be an integer between 0 and 9 inclusive, default is 4. Lower priority jobs in the same queue will be executed by higher priority. Use input to pass in generic, unstructured input to a task.
(run-cleanup tasker) -Delete old expired jobs saved on diskCommunity Examples
(run-executors tasker &opt workers-per-queue pre-task post-task) +Delete old expired jobs saved on disk
(run-executors tasker &opt workers-per-queue pre-task post-task) -Start a number of executors to run tasks as with `tasker/spawn-executors`, and then wait for all executors to complete.Community Examples
(spawn-executors tasker &opt qnames workers-per-queue pre-task post-task) +Start a number of executors to run tasks as with `tasker/spawn-executors`, and then wait for all executors to complete.
(spawn-executors tasker &opt qnames workers-per-queue pre-task post-task) -Start a number of executors to run tasks. Tasks can be added to a queue by calling queue-task. A single tasker object can make multiple calls to spawn-executors.Community Examples
A tuple of all possible statuses that a task can have.Community Examples
(task-file tasker task-id &opt file-name) +Start a number of executors to run tasks. Tasks can be added to a queue by calling queue-task. A single tasker object can make multiple calls to spawn-executors.
(task-file tasker task-id &opt file-name) -Get a log file for a path. By default, will get a path to out.log.Community Examples
(task-status tasker task-id) +Get a log file for a path. By default, will get a path to out.log.
(task-status tasker task-id) -Look up the status of a given task by id.Community Examples
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(compile str) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(compile str) Compile a Temple template into a function which will return a rendered buffer. The resulting function should receive the template arguments in the -&keys format.Community Examples
(create source &opt where) -Compile a template string into a function. Optionally provide a location where the source is from to improve debugging. Returns the template function.Community Examples
(assert x &opt e) +Compile a template string into a function. Optionally provide a location where the source is from to improve debugging. Returns the template function.
(assert x &opt e) -Override's the default assert with some nice error handling.Community Examples
(assert-docs path) +Override's the default assert with some nice error handling.
(assert-docs path) Assert that all symbols, when module on the path is required, -have proper doc stringCommunity Examples
(assert-error msg & forms) -Test passes if forms error.Community Examples
(assert-no-error msg & forms) -Test passes if forms do not error.Community Examples
(capture-stderr & body) Runs the form and captures stderr. Returns tuple with result of the form -and a string with captured stderr.Community Examples
(capture-stdout & body) Runs the form and captures stdout. Returns tuple with result of the form -and a string with captured stdout.Community Examples
(end-suite) -Ends test suite, prints summary and exits if any have failed.Community Examples
(start-suite &opt name) +Ends test suite, prints summary and exits if any have failed.
(start-suite &opt name) -Starts test suite.Community Examples
(suppress-stderr & body) -Suppreses stdout from the bodyCommunity Examples
(suppress-stdout & body) -Suppreses stdout from the bodyCommunity Examples
(timeit form &opt tag) Time the execution of `form` using `os/clock` before and after, and print the result to stdout. returns: result of executing `form`. -Uses `tag` (default "Elapsed time:") to tag the printout.Community Examples
(timeit-loop head & body) +Uses `tag` (default "Elapsed time:") to tag the printout.
(timeit-loop head & body) Similar to `loop`, but outputs performance statistics after completion. Additionally defines a `:timeout` verb to iterate continuously for a given number of seconds. If the first form of `body` is a bytes, it will be taken -as a custom tag.Community Examples
(utf8/decode-rune buf &opt start) -Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].Community Examples
(utf8/encode-rune rune &opt buf) +Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].
(utf8/encode-rune rune &opt buf) -Encode a Unicode codepoint into the end of a buffer.Community Examples
(utf8/prefix->width c) +Encode a Unicode codepoint into the end of a buffer.
(utf8/prefix->width c) -Given the first byte in an UTF-8 sequence, get the number of bytes that the codepoint sequence takes up, including the prefix byte.Community Examples
(zip/add-bytes writer path data &opt comment flags) +Given the first byte in an UTF-8 sequence, get the number of bytes that the codepoint sequence takes up, including the prefix byte.
(zip/add-bytes writer path data &opt comment flags) -Add a byte sequence to the zip writer.Community Examples
(zip/add-file writer path filename &opt comment flags) +Add a byte sequence to the zip writer.
(zip/add-file writer path filename &opt comment flags) -Add a file to the zip writer.Community Examples
(zip/compress bytes &opt level into) +Add a file to the zip writer.
(zip/compress bytes &opt level into) -Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.Community Examples
(zip/decompress bytes &opt into) +Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.
(zip/decompress bytes &opt into) -Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.Community Examples
(zip/extract reader idx-or-filename &opt into flags) +Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.
(zip/extract reader idx-or-filename &opt into flags) -Extract a file from the zip archive, either to memory or to a file on disk.Community Examples
(zip/file-directory? reader idx) +Extract a file from the zip archive, either to memory or to a file on disk.
(zip/file-directory? reader idx) -Check if a file index is a directory.Community Examples
(zip/file-encrypted? reader idx) +Check if a file index is a directory.
(zip/file-encrypted? reader idx) -Check if a file is encrypted inside an archive.Community Examples
(zip/file-supported? reader idx) +Check if a file is encrypted inside an archive.
(zip/file-supported? reader idx) -Check if a file is supported with this verstion of miniz.Community Examples
(zip/get-filename reader idx) +Check if a file is supported with this verstion of miniz.
(zip/get-filename reader idx) -Convert a file index index in the archive to a filename.Community Examples
(zip/locate-file reader path &opt comment flags) +Convert a file index index in the archive to a filename.
(zip/locate-file reader path &opt comment flags) -Get the index of a particular filename in the archive.Community Examples
(zip/read-bytes bytes &opt flags) +Get the index of a particular filename in the archive.
(zip/read-bytes bytes &opt flags) -Read a byte sequence as a zip archive. Returns a new zip reader.Community Examples
(zip/read-file filename &opt flags) +Read a byte sequence as a zip archive. Returns a new zip reader.
(zip/read-file filename &opt flags) -Read a file as a zip archive. Returns a new zip reader.Community Examples
(zip/reader-close reader) +Read a file as a zip archive. Returns a new zip reader.
(zip/reader-close reader) -Close a reader and free related memory.Community Examples
(zip/reader-count reader) +Close a reader and free related memory.
(zip/reader-count reader) -Get the number of files inside the zip archive. The files can be indexedCommunity Examples
(zip/stat reader idx) +Get the number of files inside the zip archive. The files can be indexed
(zip/stat reader idx) Get stat information of file. Returns a new struct with the following fields: @@ -718,17 +718,17 @@Community ExamplesSpork
* :comment * :internal-attr * :external-attr -
(zip/version) -Get the version string of the underlying miniz library.Community Examples
(zip/write-buffer) +Get the version string of the underlying miniz library.
(zip/write-buffer) -Create a new zip archive writer that write to memory.Community Examples
(zip/write-file dest-path) +Create a new zip archive writer that write to memory.
(zip/write-file dest-path) -Create a new zip archive writer that will write into an archive file.Community Examples
(zip/writer-close writer) +Create a new zip archive writer that will write into an archive file.
(zip/writer-close writer) -Close a ZipWriter.Community Examples
(zip/writer-finalizer writer) -Finalize a writer, writing any zip files to disk. Return the writer.Community Examples
(json/decode json-source &opt keywords nils) -Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.Community Examples
(json/encode x &opt tab newline buf) +Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.
(json/encode x &opt tab newline buf) -Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.Community Examples
math/add math/add-to-mean math/approx-eq math/bernoulli-distribution math/binominal-coeficient math/binominal-distribution math/check-probability math/chi-squared-distribution-table math/cols math/cumulative-std-normal-probability math/det math/dot math/epsilon math/extent math/factorial math/geometric-mean math/get-only-el math/harmonic-mean math/ident math/interquartile-range math/linear-regression math/linear-regression-line math/median math/median-absolute-deviation math/minor math/mode math/mop math/mul math/perm math/permutation-test math/permutations math/poisson-distribution math/quantile math/quantile-rank math/quantile-rank-sorted math/quantile-sorted math/quickselect math/relative-err math/root-mean-square math/rows math/sample-correlation math/sample-covariance math/sample-skewness math/sample-standard-deviation math/sample-variance math/scalar math/shuffle-in-place math/size math/sop math/standard-deviation math/standard-normal-table math/sum-compensated math/sum-nth-power-deviations math/swap math/t-test math/t-test-2 math/trans math/variance math/z-score math/zero
(add m a) Add `a` to matrix `m` where it can be matrix or scalar. -Matrix `m` is mutated.Community Examples
(add-to-mean m n v) -Adds new value `v` to mean `m` from `n` values.Community Examples
(approx-eq a e &opt t) +Adds new value `v` to mean `m` from `n` values.
(approx-eq a e &opt t) Approximate equality between actual number `a` and expected number `e`. Default tolerance `t` -is `epsilon`.Community Examples
(bernoulli-distribution p) -Creates Bernoulli distribution from popability `p` in the tuple.Community Examples
(binominal-coeficient n k) +Creates Bernoulli distribution from popability `p` in the tuple.
(binominal-coeficient n k) Computes binominal coeficient from set of size `n` -and sample size `k`.Community Examples
(binominal-distribution t p) Creates binominal distribution from trials `t` -and probability `p` in the tuple.Community Examples
(check-probability p) -Asserts that probability in in the [0 1] range.Community Examples
(cumulative-std-normal-probability z) +Returns numbers of columns of matrix `m`.
(cumulative-std-normal-probability z) -Computes standard normal probability for `y`.Community Examples
(dot mx my) -Computes dot product of matrices or vectors `x` and `y`.Community Examples
(extent xs) -Returns the minimum & maximum number in an `xs` as tuple.Community Examples
(factorial n) +Returns the minimum & maximum number in an `xs` as tuple.
(geometric-mean xs) -Gets the geometric mean from `xs`.Community Examples
(get-only-el m) Convenience macro for geting first element -from first row of the two dimensional array `m`.Community Examples
(harmonic-mean xs) +from first row of the two dimensional array `m`.
(harmonic-mean xs) -Gets the harmonic mean from `xs`.Community Examples
(ident c) -Creates identity matrix with `c` x `c` size.Community Examples
(interquartile-range xs) +Creates identity matrix with `c` x `c` size.
(interquartile-range xs) -Gets the interquartile range from `xs`.Community Examples
(linear-regression coords) +Gets the interquartile range from `xs`.
(linear-regression coords) Computes the slope `:m` and y-intercept `:b` -of the function in the struct from set of coordinates.Community Examples
(linear-regression-line {:m m :b b}) +of the function in the struct from set of coordinates.
(linear-regression-line {:m m :b b}) -Constructs function from struct returned by linear regression.Community Examples
(median xs) +Constructs function from struct returned by linear regression.
(median-absolute-deviation xs) +Gets the median value from `xs`
(median-absolute-deviation xs) -Gets median absolute deviation from `xs`.Community Examples
(minor m x y) -Computes minor matrix of matrix `m` and `x`, `y`.Community Examples
(mop m op a) Mutates every cell of the matrix `m` with `op` -and corresponding cell from matrix arg `a`.Community Examples
(mul m a) Multiply matrix `m` with `a` which can be matrix or vector. -Matrix `m` is mutated.Community Examples
(permutation-test xs ys &opt a k) +Computes permanent of the matrix `m`.
(permutation-test xs ys &opt a k) Conducts a permutation test to determine if two data sets `xs` and `ys` are *significantly* different from each other. You can use alternative hypotesis `a`, which defaults to `:two-side`, with `:greater` and `:lesser` being the other two options. The last optional argument is `k` number of values -in permutation distributionCommunity Examples
(permutations s &opt k) -Returns permutations of length `k` from members of `s`Community Examples
(poisson-distribution lambda) +Returns permutations of length `k` from members of `s`
(poisson-distribution lambda) -Creates Poisson distribution from `lambda` in tuple.Community Examples
(quantile xs p) -Gets the quantile value from `xs` at `p` from unsorted population.Community Examples
(quantile-rank xs p) +Gets the quantile value from `xs` at `p` from unsorted population.
(quantile-rank xs p) -Gets the quantile rank of value `v` from unsorted `xs`.Community Examples
(quantile-rank-sorted xs v) +Gets the quantile rank of value `v` from unsorted `xs`.
(quantile-rank-sorted xs v) -Gets the quantile rank of value `v` from sorted `xs`.Community Examples
(quantile-sorted xs p) +Gets the quantile rank of value `v` from sorted `xs`.
(quantile-sorted xs p) -Gets the quantile value from `xs` at `p` from sorted population.Community Examples
(quickselect arr k &opt left right) +Gets the quantile value from `xs` at `p` from sorted population.
(quickselect arr k &opt left right) Rearrange items in `arr` so that all items in `[left, k]` range are the smallest. The `k`-th element will have the `(k - left + 1)`-th smallest value in `[left, right]`. -Mutates `arr`.Community Examples
(relative-err a e) Gets the relative err between actual number `a` -and expected number `e`.Community Examples
(root-mean-square xs) -Gets the root mean square from `xs`.Community Examples
(sample-correlation xs ys) +Returns numbers of rows of matrix `m`.
(sample-correlation xs ys) -Gets the sample correlation between `xs` and `ys`.Community Examples
(sample-covariance xs ys) +Gets the sample correlation between `xs` and `ys`.
(sample-covariance xs ys) -Gets the sample covariance between `xs` and `ys`.Community Examples
(sample-skewness xs) +Gets the sample covariance between `xs` and `ys`.
(sample-skewness xs) -Gets the sample skeweness from the `xs`.Community Examples
(sample-standard-deviation xs) +Gets the sample skeweness from the `xs`.
(sample-standard-deviation xs) -Gets sample standard deviation from `xs`.Community Examples
(sample-variance xs) +Gets sample standard deviation from `xs`.
(sample-variance xs) -Get the sample variance from `xs`.Community Examples
(scalar c s) -Creates scalar `s` matrix with `c` x `c` size.Community Examples
(shuffle-in-place xs) +Creates scalar `s` matrix with `c` x `c` size.
(shuffle-in-place xs) Generate random permutation of the array `xs` -which is shuffled in place.Community Examples
(size m) -Returns tuple with the matrix `m` size [rows cols].Community Examples
(sop m op & a) Mutates every cell of the matrix `m` with `op` -and variadic args `a`.Community Examples
(standard-deviation xs) -Gets the standard deviation from `ds`.Community Examples
(sum-compensated xs) -Returns sum of the members of `xs` with Kahan-Babushka algorithm.Community Examples
(sum-nth-power-deviations xs n) +Returns sum of the members of `xs` with Kahan-Babushka algorithm.
(sum-nth-power-deviations xs n) -Get the sum of deviations to the n power.Community Examples
(swap arr i j) Swaps members with indices `i` and `j` of arr. -Noop when `i` equals `j`.Community Examples
(t-test xs expv) Computes one sample t-test comparing the mean of `xs` -to known value `expv`.Community Examples
(t-test-2 xs ys &opt d) Computes two sample t-test of two samples `xs` and `ys` -with difference optional `d` which defaults to 0.Community Examples
(z-score x m d) Gets the standard score for number `x` from mean `m` -and standard deviation `d`.Community Examples
(zero c &opt r) Creates vector of length `c`, or matrix if `r` -is provided, and fills it with zeros.Community Examples
misc/always misc/antepenultimate misc/caperr misc/capout misc/cond-> misc/cond->> misc/dedent misc/defs misc/dfs misc/do-def misc/do-var misc/format-table misc/gett misc/insert-sorted misc/insert-sorted-by misc/int->string misc/int/ misc/log misc/make misc/make-id misc/map-keys misc/map-vals misc/penultimate misc/print-table misc/randomize-array misc/second misc/select-keys misc/set* misc/string->int misc/table-filter misc/third misc/trim-prefix misc/trim-suffix misc/until misc/vars
(always x) -Return a function that discards any arguments and always returns `x`.Community Examples
(antepenultimate xs) +Return a function that discards any arguments and always returns `x`.
(antepenultimate xs) -Get the third-to-last element from an indexed data structure.Community Examples
(caperr & body) +Get the third-to-last element from an indexed data structure.
(caperr & body) Captures the standart error output of the variadic `body` and returns it -as a buffer.Community Examples
(capout & body) Captures the standart output of the variadic `body` and returns it as -a buffer.Community Examples
(cond-> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs with condition and operation to which the `val`, is put as first argument. All conditions are tried and for truthy conditions the operation is executed. -Returns the value mutated if any condition is truthy.Community Examples
(cond->> val & clauses) +Returns the value mutated if any condition is truthy.
(cond->> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs of condition and operation to which the `val`, is put as last argument. All conditions are tried and for truthy the operation is ran. -Returns mutated value if any condition is truthy.Community Examples
(dedent & xs) Remove indentation after concatenating the arguments. Works by removing leading whitespace, and then removing that same pattern of whitepsace after -new lines.Community Examples
(defs & bindings) -Defines many constants as in let `bindings`, but without creating new scope.Community Examples
(dfs data visit-leaf &opt node-before node-after get-children seen) +Defines many constants as in let `bindings`, but without creating new scope.
(dfs data visit-leaf &opt node-before node-after get-children seen) Do a depth first, pre-order traversal over a data structure. Also allow for callbacks before and after visiting the children of a node. Also allow for a custom `get-children` function to change traversal as needed. Will detect cycles if an empty table is passed as the `seen` parameter, which is used to cached values -that have been visited.Community Examples
(do-def c d & body) Convenience macro for defining constant named `c` with value `d` before `body` and returning it after evaluating `body`, that presumably modifies -the `c` refered content. For example buffer, table or array.Community Examples
(do-var v d & body) +the `c` refered content. For example buffer, table or array.
(do-var v d & body) Convenience macro for defining varible named `v` with value `d` before `body` -and returning it after evaluating `body`, that presumably modifies `v`.Community Examples
(format-table buf-into data &opt columns header-mapping column-mapping) +and returning it after evaluating `body`, that presumably modifies `v`.
(format-table buf-into data &opt columns header-mapping column-mapping) -Same as print-table but pushes table into a buffer.Community Examples
(gett ds & keys) -Recursive macro (get). Similar to get-in, but keys are variadic argument.Community Examples
(insert-sorted arr <? & xs) +Recursive macro (get). Similar to get-in, but keys are variadic argument.
(insert-sorted arr <? & xs) Insert elements in `arr` such that it remains sorted by the comparator. If -`arr` is not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(insert-sorted-by arr f & xs) +`arr` is not sorted beforehand, the results are undefined. Returns `arr`.
(insert-sorted-by arr f & xs) Insert elements in `arr` such that it remains sorted by the value returned when `f` is called with the element, comparing the values with <. If `arr` is -not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(int->string int &opt base) +not sorted beforehand, the results are undefined. Returns `arr`.
(int->string int &opt base) -Stringify an integer in a particular base. Defaults to decimal (base 10).Community Examples
(int/ & xs) +Stringify an integer in a particular base. Defaults to decimal (base 10).
(log level & args) Print to a dynamic binding stream if that stream is set, otherwise do nothing. Evaluate to nil. For example, `(log :err "value error: %V" my-value)` will print -to `(dyn :err)` only if `(dyn :err)` has been set.Community Examples
(make prototype & pairs) Convenience macro for creating new table from even number of kvs pairs in a variadic `table-or-pairs` arguments and setting its prototype to `prototype`. -Factory function for creating new objects from prototypes.Community Examples
(make-id &opt prefix) +Factory function for creating new objects from prototypes.
(make-id &opt prefix) Create a random, printable keyword id with 10 bytes of entropy -with an optional prefix.Community Examples
(map-keys f data) Returns new table with function `f` applied to `data`'s -keys recursively.Community Examples
(map-vals f data) -Returns new table with function `f` applied to `data`'s values.Community Examples
(penultimate xs) +Returns new table with function `f` applied to `data`'s values.
(penultimate xs) -Get the second-to-last element from an indexed data structure.Community Examples
(print-table data &opt columns header-mapping column-mapping) +Get the second-to-last element from an indexed data structure.
(print-table data &opt columns header-mapping column-mapping) Iterate through the rows of a data structure and print a table in a human readable way, with padding and heading information. Can optionally provide @@ -200,37 +200,37 @@Community ExamplesIndex for each row. Lastly, a `header-mapping` dictionary can be provided that changes the printed header names by mapping column keys to the desired header name. If no mapping is found, then the column key will be used as -the header name. Returns nil.
(randomize-array arr &opt rng) Randomizes array using the fisher-yates shuffle, takes an optional random -number generator.Community Examples
(second xs) -Get the second element from an indexed data structure.Community Examples
(select-keys data keyz) +Get the second element from an indexed data structure.
(select-keys data keyz) -Returns new table with selected `keyz` from dictionary `data`.Community Examples
(set* tgts exprs) +Returns new table with selected `keyz` from dictionary `data`.
(set* tgts exprs) Parallel `set` function. Takes a list of targets and expressions, evaluates all the expressions, and then assigns them to the targets. Each target can be a variable -or a 2-tuple, just like in the normal `set` special form.Community Examples
(string->int str &opt base) +or a 2-tuple, just like in the normal `set` special form.
(string->int str &opt base) Parse an integer in the given base. Defaults to decimal (base 10). Differs -from scan-number in that this does not recognize floating point notation.Community Examples
(table-filter pred dict) +from scan-number in that this does not recognize floating point notation.
(table-filter pred dict) Filter a key-value structure info a table. Semantics are the same as for built-in `filter`, except that `pred` takes two arguments (key and value.) -Does not consider prototypes.Community Examples
(third xs) -Get the third element from an indexed data structure.Community Examples
(trim-prefix prefix str) +Get the third element from an indexed data structure.
(trim-prefix prefix str) -Trim the specified prefix of a string if it has oneCommunity Examples
(trim-suffix suffix str) +Trim the specified prefix of a string if it has one
(trim-suffix suffix str) -Trim the specified suffix of a string if it has oneCommunity Examples
(until cnd & body) Repeat `body` while the `cnd` is false. -Equivalent to (while (not cnd) ;body).Community Examples
(vars & bindings) -Defines many variables as in let `bindings`, but without creating new scope.Community Examples
msg/make-proto msg/make-recv msg/make-send
(make-proto stream &opt pack unpack) -Create both a send an recv function from a stream, as with `make-send` and `make-recv`.Community Examples
(make-recv stream &opt unpack) +Create both a send an recv function from a stream, as with `make-send` and `make-recv`.
(make-recv stream &opt unpack) -Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.Community Examples
(make-send stream &opt pack) +Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.
(make-send stream &opt pack) -Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.Community Examples
netrepl/client netrepl/default-host netrepl/default-port netrepl/server netrepl/server-single
(client &opt host port name) -Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".Community Examples
(server &opt host port env cleanup welcome-msg) +Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".
(server &opt host port env cleanup welcome-msg) -Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.Community Examples
(server-single &opt host port env cleanup welcome-msg) +Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.
(server-single &opt host port env cleanup welcome-msg) -Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.Community Examples
path/abspath path/abspath? path/basename path/delim path/dirname path/ext path/join path/normalize path/parts path/posix/abspath path/posix/abspath? path/posix/basename path/posix/delim path/posix/dirname path/posix/ext path/posix/join path/posix/normalize path/posix/parts path/posix/relpath path/posix/sep path/relpath path/sep path/win32/abspath path/win32/abspath? path/win32/basename path/win32/delim path/win32/dirname path/win32/ext path/win32/join path/win32/normalize path/win32/parts path/win32/relpath path/win32/sep
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(posix/relpath source target) +Get the relative path between two subpaths.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(win32/abspath path) +Get the relative path between two subpaths.
(win32/abspath path) -Coerce a path to be absolute.Community Examples
(win32/abspath? path) -Check if a path is absolute.Community Examples
(win32/basename path) -Gets the base file name of a path.Community Examples
(win32/dirname path) -Gets the directory name of a path.Community Examples
(win32/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(win32/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(win32/relpath source target) -Get the relative path between two subpaths.Community Examples
rawterm/begin rawterm/buffer-traverse rawterm/ctrl-z rawterm/end rawterm/getch rawterm/isatty rawterm/monowidth rawterm/rune-monowidth rawterm/size rawterm/slice-monowidth
(rawterm/begin &opt on-winch) -Begin raw terminal functionality. Return a stream that can be read from to get input.Community Examples
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) +Begin raw terminal functionality. Return a stream that can be read from to get input.
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) -Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.Community Examples
(rawterm/ctrl-z) +Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.
(rawterm/ctrl-z) -A handler that a user can use to handle ctrl-z from input to suspend the current process.Community Examples
(rawterm/end) +A handler that a user can use to handle ctrl-z from input to suspend the current process.
(rawterm/getch &opt into) -Get a byte of input from stdin, without blocking if possible. Returns a buffer.Community Examples
(rawterm/isatty) +Get a byte of input from stdin, without blocking if possible. Returns a buffer.
(rawterm/isatty) -Check if the current stdin is a tty.Community Examples
(rawterm/monowidth bytes &opt start-index end-index) +Check if the current stdin is a tty.
(rawterm/monowidth bytes &opt start-index end-index) -Measure the monospace width of a string.Community Examples
(rawterm/rune-monowidth rune) +Measure the monospace width of a string.
(rawterm/rune-monowidth rune) -Get the monospace width of a rune. Returns either 0, 1, or 2.Community Examples
(rawterm/size) +Get the monospace width of a rune. Returns either 0, 1, or 2.
(rawterm/size) -Get the number of rows and columns visible in the terminal as tuple [rows cols]Community Examples
(rawterm/slice-monowidth bytes columns &opt start-index into) +Get the number of rows and columns visible in the terminal as tuple [rows cols]
(rawterm/slice-monowidth bytes columns &opt start-index into) -Get a byte slice that will fit into a number of columns.Community Examples
regex/compile regex/find regex/find-all regex/match regex/peg regex/replace regex/replace-all regex/source
(compile pattern) -Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.Community Examples
(find reg text &opt start) +Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.
(find reg text &opt start) -Similar to peg/find, but for regexes.Community Examples
(find-all reg text &opt start) +Similar to peg/find, but for regexes.
(find-all reg text &opt start) -Similar to peg/find-all, but for regexes.Community Examples
(match reg text &opt start) -Similar to peg/match, but for regexes.Community Examples
Peg used to generate peg source code from a regular expression string.Community Examples
(replace reg rep text &opt start) +Similar to peg/match, but for regexes.
(replace reg rep text &opt start) -Similar to peg/replace, but for regexes.Community Examples
(replace-all reg rep text &opt start) +Similar to peg/replace, but for regexes.
(replace-all reg rep text &opt start) -Similar to peg/replace-all, but for regexes.Community Examples
(source pattern) -Compile a subset of regex to PEG source code.Community Examples
rpc/client rpc/default-host rpc/default-port rpc/server
(client &opt host port name) -Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.Community Examples
(server functions &opt host port workers-per-connection) +Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.
(server functions &opt host port workers-per-connection) -Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.Community Examples
schema/make-predicate schema/make-validator schema/predicate schema/validator
(make-predicate schema) -Generate a function that can be used to validate a data structure. This is the function form of `predicate`.Community Examples
(make-validator schema) +Generate a function that can be used to validate a data structure. This is the function form of `predicate`.
(make-validator schema) -Generate a function that can be used to validate a data structure. This is the function form of `validator`.Community Examples
(predicate pattern) +Generate a function that can be used to validate a data structure. This is the function form of `validator`.
(predicate pattern) -Make a validation predicate given a certain schema.Community Examples
(validator pattern) +Make a validation predicate given a certain schema.
(validator pattern) -Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.Community Examples
sh/copy sh/copy-file sh/create-dirs sh/devnull sh/escape sh/exec sh/exec-fail sh/exec-slurp sh/exec-slurp-all sh/exists? sh/list-all-files sh/make-new-file sh/rm sh/scan-directory sh/split
(copy src dest) Copy a file or directory recursively from one location to another. -Expects input to be unix style pathsCommunity Examples
(copy-file src-path dst-path) -Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.Community Examples
(create-dirs dir-path) +Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.
(create-dirs dir-path) -Create all directories in path specified as string including itself.Community Examples
(devnull) +Create all directories in path specified as string including itself.
(devnull) -get the /dev/null equivalent of the current platform as an open fileCommunity Examples
(escape & args) +get the /dev/null equivalent of the current platform as an open file
(escape & args) -Output a string with all arguments correctly quotedCommunity Examples
(exec & args) -Execute command specified by args returning it's exit codeCommunity Examples
(exec-fail & args) +Execute command specified by args returning it's exit code
(exec-fail & args) -Execute command specified by args, fails when command exits with non-zero exit codeCommunity Examples
(exec-slurp & args) +Execute command specified by args, fails when command exits with non-zero exit code
(exec-slurp & args) -Read stdout of command specified by args and return it trimmed in a string.Community Examples
(exec-slurp-all & args) +Read stdout of command specified by args and return it trimmed in a string.
(exec-slurp-all & args) Read stdout and stderr of subprocess and return it trimmed in a struct with :err and :out containing the output as string. -This will also return the exit code under the :status key.Community Examples
(exists? path) +This will also return the exit code under the :status key.
(exists? path) -Check if the given file or directory exists. (Follows symlinks)Community Examples
(list-all-files dir &opt into) +Check if the given file or directory exists. (Follows symlinks)
(list-all-files dir &opt into) -List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.Community Examples
(make-new-file file-path &opt mode) +List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.
(make-new-file file-path &opt mode) -Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).Community Examples
(rm path) +Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).
(rm path) -Remove a directory and all sub directories recursively.Community Examples
(scan-directory dir func) +Remove a directory and all sub directories recursively.
(scan-directory dir func) -Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.Community Examples
(split s) +Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.
(split s) -Split a string into 'sh like' tokens, returns nil if unable to parse the string.Community Examples
tarray/buffer tarray/copy-bytes tarray/length tarray/new tarray/properties tarray/slice tarray/swap-bytes
(tarray/buffer array|size) -Return typed array buffer or create a new buffer.Community Examples
(tarray/copy-bytes src sindex dst dindex &opt count) +Return typed array buffer or create a new buffer.
(tarray/copy-bytes src sindex dst dindex &opt count) -Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.Community Examples
(tarray/length array|buffer) +Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.
(tarray/length array|buffer) -Return typed array or buffer size.Community Examples
(tarray/new type size &opt stride offset tarray|buffer) +Return typed array or buffer size.
(tarray/new type size &opt stride offset tarray|buffer) -Create new typed array.Community Examples
(tarray/properties array) +Create new typed array.
(tarray/properties array) -Return typed array properties as a struct.Community Examples
(tarray/slice tarr &opt start end) +Return typed array properties as a struct.
(tarray/slice tarr &opt start end) -Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.Community Examples
(tarray/swap-bytes src sindex dst dindex &opt count) +Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.
(tarray/swap-bytes src sindex dst dindex &opt count) -Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.Community Examples
test/assert test/assert-docs test/assert-error test/assert-no-error test/assert-not test/capture-stderr test/capture-stdout test/end-suite test/start-suite test/suppress-stderr test/suppress-stdout test/timeit test/timeit-loop
(assert x &opt e) -Override's the default assert with some nice error handling.Community Examples
(assert-docs path) +Override's the default assert with some nice error handling.
(assert-docs path) Assert that all symbols, when module on the path is required, -have proper doc stringCommunity Examples
(assert-error msg & forms) -Test passes if forms error.Community Examples
(assert-no-error msg & forms) -Test passes if forms do not error.Community Examples
(capture-stderr & body) Runs the form and captures stderr. Returns tuple with result of the form -and a string with captured stderr.Community Examples
(capture-stdout & body) Runs the form and captures stdout. Returns tuple with result of the form -and a string with captured stdout.Community Examples
(end-suite) -Ends test suite, prints summary and exits if any have failed.Community Examples
(start-suite &opt name) +Ends test suite, prints summary and exits if any have failed.
(suppress-stderr & body) -Suppreses stdout from the bodyCommunity Examples
(suppress-stdout & body) -Suppreses stdout from the bodyCommunity Examples
(timeit form &opt tag) Time the execution of `form` using `os/clock` before and after, and print the result to stdout. returns: result of executing `form`. -Uses `tag` (default "Elapsed time:") to tag the printout.Community Examples
(timeit-loop head & body) +Uses `tag` (default "Elapsed time:") to tag the printout.
(timeit-loop head & body) Similar to `loop`, but outputs performance statistics after completion. Additionally defines a `:timeout` verb to iterate continuously for a given number of seconds. If the first form of `body` is a bytes, it will be taken -as a custom tag.Community Examples
zip/add-bytes zip/add-file zip/compress zip/decompress zip/extract zip/file-directory? zip/file-encrypted? zip/file-supported? zip/get-filename zip/locate-file zip/read-bytes zip/read-file zip/reader-close zip/reader-count zip/stat zip/version zip/write-buffer zip/write-file zip/writer-close zip/writer-finalize
(zip/add-bytes writer path data &opt comment flags) -Add a byte sequence to the zip writer.Community Examples
(zip/add-file writer path filename &opt comment flags) +Add a byte sequence to the zip writer.
(zip/add-file writer path filename &opt comment flags) -Add a file to the zip writer.Community Examples
(zip/compress bytes &opt level into) -Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.Community Examples
(zip/decompress bytes &opt into) +Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.
(zip/decompress bytes &opt into) -Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.Community Examples
(zip/extract reader idx-or-filename &opt into flags) +Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.
(zip/extract reader idx-or-filename &opt into flags) -Extract a file from the zip archive, either to memory or to a file on disk.Community Examples
(zip/file-directory? reader idx) +Extract a file from the zip archive, either to memory or to a file on disk.
(zip/file-directory? reader idx) -Check if a file index is a directory.Community Examples
(zip/file-encrypted? reader idx) +Check if a file index is a directory.
(zip/file-encrypted? reader idx) -Check if a file is encrypted inside an archive.Community Examples
(zip/file-supported? reader idx) +Check if a file is encrypted inside an archive.
(zip/file-supported? reader idx) -Check if a file is supported with this verstion of miniz.Community Examples
(zip/get-filename reader idx) +Check if a file is supported with this verstion of miniz.
(zip/get-filename reader idx) -Convert a file index index in the archive to a filename.Community Examples
(zip/locate-file reader path &opt comment flags) +Convert a file index index in the archive to a filename.
(zip/locate-file reader path &opt comment flags) -Get the index of a particular filename in the archive.Community Examples
(zip/read-bytes bytes &opt flags) +Get the index of a particular filename in the archive.
(zip/read-bytes bytes &opt flags) -Read a byte sequence as a zip archive. Returns a new zip reader.Community Examples
(zip/read-file filename &opt flags) +Read a byte sequence as a zip archive. Returns a new zip reader.
(zip/read-file filename &opt flags) -Read a file as a zip archive. Returns a new zip reader.Community Examples
(zip/reader-close reader) +Read a file as a zip archive. Returns a new zip reader.
(zip/reader-close reader) -Close a reader and free related memory.Community Examples
(zip/reader-count reader) +Close a reader and free related memory.
(zip/reader-count reader) -Get the number of files inside the zip archive. The files can be indexedCommunity Examples
(zip/stat reader idx) +Get the number of files inside the zip archive. The files can be indexed
(zip/stat reader idx) Get stat information of file. Returns a new struct with the following fields: @@ -161,17 +161,17 @@Community ExamplesIndex * :comment * :internal-attr * :external-attr -
(zip/version) -Get the version string of the underlying miniz library.Community Examples
(zip/write-buffer) +Get the version string of the underlying miniz library.
(zip/write-buffer) -Create a new zip archive writer that write to memory.Community Examples
(zip/write-file dest-path) +Create a new zip archive writer that write to memory.
(zip/write-file dest-path) -Create a new zip archive writer that will write into an archive file.Community Examples
(zip/writer-close writer) +Create a new zip archive writer that will write into an archive file.
(zip/writer-finalizer writer) -Finalize a writer, writing any zip files to disk. Return the writer.Community Examples
cc/archive-c cc/compile-c cc/create-buffer-c cc/create-buffer-c-impl cc/create-executable cc/embed-name cc/entry-name cc/entry-replace cc/link-c cc/make-bin-source cc/make-define cc/make-defines cc/modpath-to-meta cc/modpath-to-static cc/out-path
(archive-c opts target & objects) -Link object files together to make a static library.Community Examples
(compile-c compiler opts src dest &opt static?) +Link object files together to make a static library.
(compile-c compiler opts src dest &opt static?) -Compile a C file into an object file.Community Examples
(create-buffer-c source dest name) +Compile a C file into an object file.
(create-buffer-c source dest name) -Inline raw byte file as a c file.Community Examples
(create-buffer-c-impl bytes dest name) +Inline raw byte file as a c file.
(create-executable opts source dest no-core) -Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.Community Examples
(embed-name path) +Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.
(embed-name path) -Rename a janet symbol for embedding.Community Examples
(entry-name name) -Name of symbol that enters static compilation of a module.Community Examples
(entry-replace name) +Name of symbol that enters static compilation of a module.
(entry-replace name) -Escape special characters in the entry-nameCommunity Examples
(link-c has-cpp opts target & objects) +Escape special characters in the entry-name
(link-c has-cpp opts target & objects) -Link C or C++ object files together to make a native module.Community Examples
(make-bin-source declarations lookup-into-invocations no-core) +Link C or C++ object files together to make a native module.
(make-bin-source declarations lookup-into-invocations no-core) -Community Examples
(make-define define value) -Generate strings for adding custom defines to the compiler.Community Examples
(make-defines defines) +Generate strings for adding custom defines to the compiler.
(make-defines defines) -Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.Community Examples
(modpath-to-meta path) +Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.
(modpath-to-meta path) -Get the meta file path (.meta.janet) corresponding to a native module path (.so).Community Examples
(modpath-to-static path) +Get the meta file path (.meta.janet) corresponding to a native module path (.so).
(modpath-to-static path) -Get the static library (.a) path corresponding to a native module path (.so).Community Examples
(out-path path from-ext to-ext) +Get the static library (.a) path corresponding to a native module path (.so).
(out-path path from-ext to-ext) -Take a source file path and convert it to an output path.Community Examples
cgen/add-loader cgen/ir cgen/mangle cgen/print-ir
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(ir & body) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(ir & body) -Macro that automatically quotes the body provided and calls (print-ir ...) on the body.Community Examples
(mangle token) +Macro that automatically quotes the body provided and calls (print-ir ...) on the body.
(mangle token) -Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.Community Examples
(print-ir ir) +Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.
(print-ir ir) -Compile the CGEN IR to C and print it to (dyn :out).Community Examples
cli/jpm cli/main cli/run cli/setup
(jpm & argv) -A Macro User Interface for jpm to be used from a repl in a way similar to the command line.Community Examples
(main & argv) +A Macro User Interface for jpm to be used from a repl in a way similar to the command line.
(setup args) Load configuration from the command line, environment variables, and configuration files. Returns array of non-configuration arguments as well. @@ -132,7 +132,7 @@Community ExamplesIndex 1. Commmand line settings 2. The value of `(dyn :jpm-config)` 3. Environment variables - 4. Config file settings (default-config if non specified)
commands/build commands/clean commands/configure commands/deps commands/enable-local-mode commands/help commands/install commands/jpm-debug-repl commands/list-installed commands/list-pkgs commands/list-rules commands/list-tasks commands/new-c-project commands/new-exe-project commands/new-project commands/quickbin commands/set-tree commands/show-paths commands/show-rule-tree commands/test commands/update-pkgs
(configure &opt path) -Setup an out-of-tree build with certain configuration options.Community Examples
(deps) +Setup an out-of-tree build with certain configuration options.
(enable-local-mode) -Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/Community Examples
(help) +Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/
(new-c-project name) -Create a new C projectCommunity Examples
(new-exe-project name) -Create a new executable projectCommunity Examples
(set-tree tree) -Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.Community Examples
(show-paths) +Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.
config/builtin-configs config/config-checkers config/config-docs config/config-options config/config-parsers config/config-set config/defconf config/dyn:ar config/dyn:auto-shebang config/dyn:binpath config/dyn:build-type config/dyn:buildpath config/dyn:c++ config/dyn:c++-link config/dyn:cc config/dyn:cc-link config/dyn:cflags config/dyn:cflags-verbose config/dyn:config-file config/dyn:cppflags config/dyn:curlpath config/dyn:dest-dir config/dyn:dynamic-cflags config/dyn:dynamic-lflags config/dyn:gitpath config/dyn:headerpath config/dyn:is-msvc config/dyn:janet config/dyn:janet-cflags config/dyn:janet-importlib config/dyn:janet-lflags config/dyn:ldflags config/dyn:lflags config/dyn:libpath config/dyn:local config/dyn:manpath config/dyn:modext config/dyn:modpath config/dyn:nocolor config/dyn:offline config/dyn:optimize config/dyn:pkglist config/dyn:silent config/dyn:statext config/dyn:tarpath config/dyn:test config/dyn:tree config/dyn:update-pkgs config/dyn:use-batch-shell config/dyn:verbose config/dyn:workers config/load-config config/load-config-file config/load-default config/load-options config/opt config/read-env-variables config/save-config config/shorthand-mapping
Table of all built-in options, as opposed to project deifned options.Community Examples
A table of all of the dynamic config bindings to checkers (validators).Community Examples
Table of all of the help text for each config option.Community Examples
A table of possible options for enum option types.Community Examples
A table of all of the dynamic config bindings to parsers.Community Examples
(defconf kw &opt parser docs options) +config/builtin-configs config/config-checkers config/config-docs config/config-options config/config-parsers config/config-set config/defconf config/dyn:ar config/dyn:auto-shebang config/dyn:binpath config/dyn:build-type config/dyn:buildpath config/dyn:c++ config/dyn:c++-link config/dyn:cc config/dyn:cc-link config/dyn:cflags config/dyn:cflags-verbose config/dyn:config-file config/dyn:cppflags config/dyn:curlpath config/dyn:dest-dir config/dyn:dynamic-cflags config/dyn:dynamic-lflags config/dyn:gitpath config/dyn:headerpath config/dyn:is-msvc config/dyn:janet config/dyn:janet-cflags config/dyn:janet-importlib config/dyn:janet-lflags config/dyn:ldflags config/dyn:lflags config/dyn:libpath config/dyn:local config/dyn:manpath config/dyn:modext config/dyn:modpath config/dyn:nocolor config/dyn:offline config/dyn:optimize config/dyn:pkglist config/dyn:silent config/dyn:statext config/dyn:tarpath config/dyn:test config/dyn:tree config/dyn:update-pkgs config/dyn:use-batch-shell config/dyn:verbose config/dyn:workers config/load-config config/load-config-file config/load-default config/load-options config/opt config/read-env-variables config/save-config config/shorthand-mapping
config/builtin-configs table sourceTable of all built-in options, as opposed to project deifned options.config/config-checkers table sourceA table of all of the dynamic config bindings to checkers (validators).config/defconf macro source(defconf kw &opt parser docs options) -Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.Community Examplesconfig/dyn:ar function source(dyn:ar &opt dflt) +Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.config/load-config function source(load-config settings &opt override) -Load a configuration from a table or struct.Community Examplesconfig/load-config-file function source(load-config-file path &opt override) +Load a configuration from a table or struct.config/load-config-file function source(load-config-file path &opt override) -Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.Community Examplesconfig/load-default function source(load-default &opt override) +Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.config/load-default function source(load-default &opt override) -Load the default configuration.Community Examplesconfig/load-options function source(load-options &opt path) -Load a file that contains config options that can be set. If no such file exists, then do nothing.Community Examplesconfig/opt function source(opt opts key &opt dflt) +Load a file that contains config options that can be set. If no such file exists, then do nothing.config/opt function source(opt opts key &opt dflt) -Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.Community Examplesconfig/read-env-variables function source(read-env-variables) +Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.config/read-env-variables function source(read-env-variables) -Read environment variables that correspond to config variables into dyns.Community Examplesconfig/save-config function source(save-config path) +Read environment variables that correspond to config variables into dyns.config/save-config function source(save-config path) -Write the current configuration information to a file.Community Examplesconfig/shorthand-mapping struct source+Write the current configuration information to a file.Map some single characters to long options.Community Examples
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.
(pmap f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.Community Examples
jpm/cc/archive-c jpm/cc/compile-c jpm/cc/create-buffer-c jpm/cc/create-buffer-c-impl jpm/cc/create-executable jpm/cc/embed-name jpm/cc/entry-name jpm/cc/entry-replace jpm/cc/link-c jpm/cc/make-bin-source jpm/cc/make-define jpm/cc/make-defines jpm/cc/modpath-to-meta jpm/cc/modpath-to-static jpm/cc/out-path jpm/cgen/add-loader jpm/cgen/ir jpm/cgen/mangle jpm/cgen/print-ir jpm/commands/build jpm/commands/clean jpm/commands/configure jpm/commands/deps jpm/commands/enable-local-mode jpm/commands/help jpm/commands/install jpm/commands/jpm-debug-repl jpm/commands/list-installed jpm/commands/list-pkgs jpm/commands/list-rules jpm/commands/list-tasks jpm/commands/new-c-project jpm/commands/new-exe-project jpm/commands/new-project jpm/commands/quickbin jpm/commands/set-tree jpm/commands/show-paths jpm/commands/show-rule-tree jpm/commands/test jpm/commands/update-pkgs jpm/config/builtin-configs jpm/config/config-checkers jpm/config/config-docs jpm/config/config-options jpm/config/config-parsers jpm/config/config-set jpm/config/defconf jpm/config/dyn:ar jpm/config/dyn:auto-shebang jpm/config/dyn:binpath jpm/config/dyn:build-type jpm/config/dyn:buildpath jpm/config/dyn:c++ jpm/config/dyn:c++-link jpm/config/dyn:cc jpm/config/dyn:cc-link jpm/config/dyn:cflags jpm/config/dyn:cflags-verbose jpm/config/dyn:config-file jpm/config/dyn:cppflags jpm/config/dyn:curlpath jpm/config/dyn:dest-dir jpm/config/dyn:dynamic-cflags jpm/config/dyn:dynamic-lflags jpm/config/dyn:gitpath jpm/config/dyn:headerpath jpm/config/dyn:is-msvc jpm/config/dyn:janet jpm/config/dyn:janet-cflags jpm/config/dyn:janet-importlib jpm/config/dyn:janet-lflags jpm/config/dyn:ldflags jpm/config/dyn:lflags jpm/config/dyn:libpath jpm/config/dyn:local jpm/config/dyn:manpath jpm/config/dyn:modext jpm/config/dyn:modpath jpm/config/dyn:nocolor jpm/config/dyn:offline jpm/config/dyn:optimize jpm/config/dyn:pkglist jpm/config/dyn:silent jpm/config/dyn:statext jpm/config/dyn:tarpath jpm/config/dyn:test jpm/config/dyn:tree jpm/config/dyn:update-pkgs jpm/config/dyn:use-batch-shell jpm/config/dyn:verbose jpm/config/dyn:workers jpm/config/load-config jpm/config/load-config-file jpm/config/load-default jpm/config/load-options jpm/config/opt jpm/config/read-env-variables jpm/config/save-config jpm/config/shorthand-mapping jpm/dagbuild/pdag jpm/dagbuild/pmap jpm/make-config/auto jpm/make-config/generate-config jpm/pm/bundle-install jpm/pm/curl jpm/pm/do-rule jpm/pm/download-bundle jpm/pm/download-git-bundle jpm/pm/download-tar-bundle jpm/pm/git jpm/pm/import-rules jpm/pm/load-lockfile jpm/pm/load-project-meta jpm/pm/make-jpm-env jpm/pm/make-lockfile jpm/pm/out-of-tree-config jpm/pm/post-deps jpm/pm/require-jpm jpm/pm/resolve-bundle jpm/pm/tar jpm/pm/update-git-bundle jpm/pm/update-installed jpm/rules/add-body jpm/rules/add-dep jpm/rules/add-input jpm/rules/add-output jpm/rules/add-thunk jpm/rules/build-rules jpm/rules/getrules jpm/rules/phony jpm/rules/rule jpm/rules/sh-phony jpm/rules/sh-rule jpm/rules/sh-task jpm/rules/task jpm/scaffold/scaffold-project jpm/shutil/abspath jpm/shutil/basename jpm/shutil/clear-cache jpm/shutil/clear-manifest jpm/shutil/clexe-shell jpm/shutil/color jpm/shutil/copy jpm/shutil/copyfile jpm/shutil/create-dirs jpm/shutil/devnull jpm/shutil/dirname jpm/shutil/do-monkeypatch jpm/shutil/drop1-shell jpm/shutil/exec-slurp jpm/shutil/filepath-replace jpm/shutil/find-build-dir jpm/shutil/find-cache jpm/shutil/find-manifest jpm/shutil/find-manifest-dir jpm/shutil/is-mingw jpm/shutil/is-win jpm/shutil/is-win-or-mingw jpm/shutil/path-splitter jpm/shutil/rimraf jpm/shutil/rm jpm/shutil/run-patched jpm/shutil/run-repl jpm/shutil/run-script jpm/shutil/shell jpm/shutil/undo-monkeypatch
(archive-c opts target & objects) -Link object files together to make a static library.Community Examples
(compile-c compiler opts src dest &opt static?) +Link object files together to make a static library.
(compile-c compiler opts src dest &opt static?) -Compile a C file into an object file.Community Examples
(create-buffer-c source dest name) +Compile a C file into an object file.
(create-buffer-c source dest name) -Inline raw byte file as a c file.Community Examples
(create-buffer-c-impl bytes dest name) +Inline raw byte file as a c file.
(create-buffer-c-impl bytes dest name) -Community Examples
(create-executable opts source dest no-core) -Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.Community Examples
(embed-name path) +Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.
(embed-name path) -Rename a janet symbol for embedding.Community Examples
(entry-name name) -Name of symbol that enters static compilation of a module.Community Examples
(entry-replace name) +Name of symbol that enters static compilation of a module.
(entry-replace name) -Escape special characters in the entry-nameCommunity Examples
(link-c has-cpp opts target & objects) +Escape special characters in the entry-name
(link-c has-cpp opts target & objects) -Link C or C++ object files together to make a native module.Community Examples
(make-bin-source declarations lookup-into-invocations no-core) +Link C or C++ object files together to make a native module.
(make-bin-source declarations lookup-into-invocations no-core) -Community Examples
(make-define define value) -Generate strings for adding custom defines to the compiler.Community Examples
(make-defines defines) +Generate strings for adding custom defines to the compiler.
(make-defines defines) -Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.Community Examples
(modpath-to-meta path) +Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.
(modpath-to-meta path) -Get the meta file path (.meta.janet) corresponding to a native module path (.so).Community Examples
(modpath-to-static path) +Get the meta file path (.meta.janet) corresponding to a native module path (.so).
(modpath-to-static path) -Get the static library (.a) path corresponding to a native module path (.so).Community Examples
(out-path path from-ext to-ext) +Get the static library (.a) path corresponding to a native module path (.so).
(out-path path from-ext to-ext) -Take a source file path and convert it to an output path.Community Examples
(add-loader) +Take a source file path and convert it to an output path.
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(ir & body) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(ir & body) -Macro that automatically quotes the body provided and calls (print-ir ...) on the body.Community Examples
(mangle token) +Macro that automatically quotes the body provided and calls (print-ir ...) on the body.
(mangle token) -Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.Community Examples
(print-ir ir) +Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.
(print-ir ir) -Compile the CGEN IR to C and print it to (dyn :out).Community Examples
(configure &opt path) -Setup an out-of-tree build with certain configuration options.Community Examples
(deps) +Setup an out-of-tree build with certain configuration options.
(enable-local-mode) -Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/Community Examples
(help) +Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/
(new-c-project name) -Create a new C projectCommunity Examples
(new-exe-project name) -Create a new executable projectCommunity Examples
(set-tree tree) -Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.Community Examples
(show-paths) +Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.
Table of all built-in options, as opposed to project deifned options.Community Examples
A table of all of the dynamic config bindings to checkers (validators).Community Examples
Table of all of the help text for each config option.Community Examples
A table of possible options for enum option types.Community Examples
A table of all of the dynamic config bindings to parsers.Community Examples
Table of all built-in options, as opposed to project deifned options.
A table of all of the dynamic config bindings to checkers (validators).
(defconf kw &opt parser docs options) -Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.Community Examples
(dyn:ar &opt dflt) +Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.
(load-config settings &opt override) -Load a configuration from a table or struct.Community Examples
(load-config-file path &opt override) +Load a configuration from a table or struct.
(load-config-file path &opt override) -Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.Community Examples
(load-default &opt override) +Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.
(load-default &opt override) -Load the default configuration.Community Examples
(load-options &opt path) -Load a file that contains config options that can be set. If no such file exists, then do nothing.Community Examples
(opt opts key &opt dflt) +Load a file that contains config options that can be set. If no such file exists, then do nothing.
(opt opts key &opt dflt) -Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.Community Examples
(read-env-variables) +Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.
(read-env-variables) -Read environment variables that correspond to config variables into dyns.Community Examples
(save-config path) +Read environment variables that correspond to config variables into dyns.
(save-config path) -Write the current configuration information to a file.Community Examples
Map some single characters to long options.Community Examples
(pdag f dag &opt n-workers) +Write the current configuration information to a file.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.
(pmap f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.Community Examples
(auto) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.
(generate-config &opt destdir silent as-data) +Get an autodetected config.
(generate-config &opt destdir silent as-data) -Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.Community Examples
(bundle-install bundle &opt no-deps) +Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.
(bundle-install bundle &opt no-deps) -Install a bundle from a git repository.Community Examples
(do-rule target) -Evaluate a given rule in a one-off manner.Community Examples
(download-bundle url bundle-type &opt tag shallow) +Evaluate a given rule in a one-off manner.
(download-bundle url bundle-type &opt tag shallow) -Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.Community Examples
(download-git-bundle bundle-dir url tag shallow) +Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.
(download-git-bundle bundle-dir url tag shallow) -Download a git bundle from a remote respositoryCommunity Examples
(download-tar-bundle bundle-dir url &opt force-gz) +Download a git bundle from a remote respository
(download-tar-bundle bundle-dir url &opt force-gz) -Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.Community Examples
(git & args) +Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.
(import-rules path &opt base-env) -Import another file that defines more rules. This ruleset is merged into the current ruleset.Community Examples
(load-lockfile &opt filename) +Import another file that defines more rules. This ruleset is merged into the current ruleset.
(load-lockfile &opt filename) -Load packages from a lockfile.Community Examples
(load-project-meta &opt path) +Load packages from a lockfile.
(load-project-meta &opt path) -Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.Community Examples
(make-jpm-env &opt base-env) +Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.
(make-jpm-env &opt base-env) -Create an environment that is preloaded with jpm symbols.Community Examples
(make-lockfile &opt filename) +Create an environment that is preloaded with jpm symbols.
(out-of-tree-config path &opt options) -Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.Community Examples
(post-deps & body) +Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.
(post-deps & body) -Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.Community Examples
(require-jpm path &opt base-env) +Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.
(require-jpm path &opt base-env) -Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.Community Examples
(resolve-bundle bundle) +Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.
(resolve-bundle bundle) -Convert any bundle string/table to the normalized table form.Community Examples
(tar & args) +Convert any bundle string/table to the normalized table form.
(update-git-bundle bundle-dir tag shallow) +Make a call to tar.
(update-git-bundle bundle-dir tag shallow) -Fetch latest tag version from remote repositoryCommunity Examples
(update-installed) +Fetch latest tag version from remote repository
(update-installed) -Update all previously installed packages to their latest versions.Community Examples
(add-body target & body) +Update all previously installed packages to their latest versions.
(add-body target & body) -Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.Community Examples
(add-dep target dep) +Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.
(add-input target input) -Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.Community Examples
(add-output target output) +Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.
(add-output target output) -Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.Community Examples
(add-thunk target thunk) +Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.
(add-thunk target thunk) -Append a thunk to a target's recipe.Community Examples
(build-rules rules targets &opt n-workers) +Append a thunk to a target's recipe.
(build-rules rules targets &opt n-workers) -Given a graph of all rules, extract a work graph that will build out-of-date files.Community Examples
(getrules) +Given a graph of all rules, extract a work graph that will build out-of-date files.
(rule target deps & body) -Add a rule to the rule graph.Community Examples
(sh-phony target deps & body) -Alias for `sh-task`.Community Examples
(sh-rule target deps & body) -Add a rule that invokes a shell command, and fails if the command returns non-zero.Community Examples
(sh-task target deps & body) +Add a rule that invokes a shell command, and fails if the command returns non-zero.
(sh-task target deps & body) -Add a task that invokes a shell command, and fails if the command returns non-zero.Community Examples
(task target deps & body) +Add a task that invokes a shell command, and fails if the command returns non-zero.
(task target deps & body) -Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).Community Examples
(scaffold-project name &opt options) +Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).
(scaffold-project name &opt options) -Generate a standardized project scaffold.Community Examples
(abspath path) -Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).Community Examples
(basename path) +Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).
(basename path) -Get the filename of a path without any leading directory components.Community Examples
(clear-cache) +Get the filename of a path without any leading directory components.
(clear-manifest) -Clear the global installation manifest.Community Examples
(clexe-shell & args) +Clear the global installation manifest.
(color input-color text) -Color text with ascii escape sequences if (os/isatty)Community Examples
(copy src dest) +Color text with ascii escape sequences if (os/isatty)
(copy src dest) -Copy a file or directory recursively from one location to another.Community Examples
(copyfile src dest) +Copy a file or directory recursively from one location to another.
(copyfile src dest) -Copy a file one location to another.Community Examples
(create-dirs dest) -Create all directories needed for a file (mkdir -p).Community Examples
(dirname path) -Get the directory of a file without the filename.Community Examples
(do-monkeypatch build-dir) +Get the directory of a file without the filename.
(do-monkeypatch build-dir) -Modify the existing environment to have the same paths as the test environment.Community Examples
(drop1-shell std args) +Modify the existing environment to have the same paths as the test environment.
(drop1-shell std args) -Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.Community Examples
(exec-slurp & args) +Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.
(exec-slurp & args) -Read stdout of subprocess and return it trimmed in a string.Community Examples
(filepath-replace repo) +Read stdout of subprocess and return it trimmed in a string.
(filepath-replace repo) -Remove special characters from a string or path to make it into a path segment.Community Examples
(find-build-dir) +Remove special characters from a string or path to make it into a path segment.
(find-build-dir) -Gets the build directory to output files to.Community Examples
(find-cache) -Return the path to the global cache.Community Examples
(find-manifest name) -Get the full path of a manifest file given a package name.Community Examples
(find-manifest-dir) +Get the full path of a manifest file given a package name.
(find-manifest-dir) -Get the path to the directory containing manifests for installed packages.Community Examples
(is-mingw) +Get the path to the directory containing manifests for installed packages.
(is-win) -Check if we should assume a DOS-like shell or default to posix shell.Community Examples
(is-win-or-mingw) +Check if we should assume a DOS-like shell or default to posix shell.
(is-win-or-mingw) -Check if built with mingwCommunity Examples
(rm path) -Remove a directory and all sub directories.Community Examples
(run-patched & extra-args) +Remove a directory and all sub directories.
(run-patched & extra-args) -Run a subprocess Janet repl that has the same environment as the test environment.Community Examples
(run-repl) +Run a subprocess Janet repl that has the same environment as the test environment.
(run-repl) -Run a repl in the monkey patched test environmentCommunity Examples
(run-script path) +Run a repl in the monkey patched test environment
(run-script path) -Run a local script in the monkey patched environment.Community Examples
(shell & args) +Run a local script in the monkey patched environment.
make-config/auto make-config/generate-config
(generate-config &opt destdir silent as-data) +Get an autodetected config.
(generate-config &opt destdir silent as-data) -Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.Community Examples
pm/bundle-install pm/curl pm/do-rule pm/download-bundle pm/download-git-bundle pm/download-tar-bundle pm/git pm/import-rules pm/load-lockfile pm/load-project-meta pm/make-jpm-env pm/make-lockfile pm/out-of-tree-config pm/post-deps pm/require-jpm pm/resolve-bundle pm/tar pm/update-git-bundle pm/update-installed
(bundle-install bundle &opt no-deps) -Install a bundle from a git repository.Community Examples
(do-rule target) -Evaluate a given rule in a one-off manner.Community Examples
(download-bundle url bundle-type &opt tag shallow) +Evaluate a given rule in a one-off manner.
(download-bundle url bundle-type &opt tag shallow) -Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.Community Examples
(download-git-bundle bundle-dir url tag shallow) +Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.
(download-git-bundle bundle-dir url tag shallow) -Download a git bundle from a remote respositoryCommunity Examples
(download-tar-bundle bundle-dir url &opt force-gz) +Download a git bundle from a remote respository
(download-tar-bundle bundle-dir url &opt force-gz) -Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.Community Examples
(git & args) +Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.
(import-rules path &opt base-env) -Import another file that defines more rules. This ruleset is merged into the current ruleset.Community Examples
(load-lockfile &opt filename) +Import another file that defines more rules. This ruleset is merged into the current ruleset.
(load-lockfile &opt filename) -Load packages from a lockfile.Community Examples
(load-project-meta &opt path) -Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.Community Examples
(make-jpm-env &opt base-env) +Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.
(make-jpm-env &opt base-env) -Create an environment that is preloaded with jpm symbols.Community Examples
(make-lockfile &opt filename) +Create an environment that is preloaded with jpm symbols.
(out-of-tree-config path &opt options) -Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.Community Examples
(post-deps & body) +Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.
(post-deps & body) -Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.Community Examples
(require-jpm path &opt base-env) +Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.
(require-jpm path &opt base-env) -Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.Community Examples
(resolve-bundle bundle) +Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.
(resolve-bundle bundle) -Convert any bundle string/table to the normalized table form.Community Examples
(update-git-bundle bundle-dir tag shallow) +Make a call to tar.
(update-git-bundle bundle-dir tag shallow) -Fetch latest tag version from remote repositoryCommunity Examples
(update-installed) +Fetch latest tag version from remote repository
(update-installed) -Update all previously installed packages to their latest versions.Community Examples
rules/add-body rules/add-dep rules/add-input rules/add-output rules/add-thunk rules/build-rules rules/getrules rules/phony rules/rule rules/sh-phony rules/sh-rule rules/sh-task rules/task
(add-body target & body) -Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.Community Examples
(add-dep target dep) +Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.
(add-input target input) -Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.Community Examples
(add-output target output) +Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.
(add-output target output) -Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.Community Examples
(add-thunk target thunk) +Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.
(add-thunk target thunk) -Append a thunk to a target's recipe.Community Examples
(build-rules rules targets &opt n-workers) +Append a thunk to a target's recipe.
(build-rules rules targets &opt n-workers) -Given a graph of all rules, extract a work graph that will build out-of-date files.Community Examples
(getrules) +Given a graph of all rules, extract a work graph that will build out-of-date files.
(sh-rule target deps & body) -Add a rule that invokes a shell command, and fails if the command returns non-zero.Community Examples
(sh-task target deps & body) +Add a rule that invokes a shell command, and fails if the command returns non-zero.
(sh-task target deps & body) -Add a task that invokes a shell command, and fails if the command returns non-zero.Community Examples
(task target deps & body) +Add a task that invokes a shell command, and fails if the command returns non-zero.
(task target deps & body) -Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).Community Examples
(scaffold-project name &opt options) -Generate a standardized project scaffold.Community Examples
shutil/abspath shutil/basename shutil/clear-cache shutil/clear-manifest shutil/clexe-shell shutil/color shutil/copy shutil/copyfile shutil/create-dirs shutil/devnull shutil/dirname shutil/do-monkeypatch shutil/drop1-shell shutil/exec-slurp shutil/filepath-replace shutil/find-build-dir shutil/find-cache shutil/find-manifest shutil/find-manifest-dir shutil/is-mingw shutil/is-win shutil/is-win-or-mingw shutil/path-splitter shutil/rimraf shutil/rm shutil/run-patched shutil/run-repl shutil/run-script shutil/shell shutil/undo-monkeypatch
(abspath path) -Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).Community Examples
(basename path) +Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).
(basename path) -Get the filename of a path without any leading directory components.Community Examples
(clear-cache) +Get the filename of a path without any leading directory components.
(clear-manifest) -Clear the global installation manifest.Community Examples
(color input-color text) -Color text with ascii escape sequences if (os/isatty)Community Examples
(copy src dest) -Copy a file or directory recursively from one location to another.Community Examples
(copyfile src dest) +Copy a file or directory recursively from one location to another.
(copyfile src dest) -Copy a file one location to another.Community Examples
(create-dirs dest) -Create all directories needed for a file (mkdir -p).Community Examples
(dirname path) -Get the directory of a file without the filename.Community Examples
(do-monkeypatch build-dir) +Get the directory of a file without the filename.
(do-monkeypatch build-dir) -Modify the existing environment to have the same paths as the test environment.Community Examples
(drop1-shell std args) +Modify the existing environment to have the same paths as the test environment.
(drop1-shell std args) -Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.Community Examples
(exec-slurp & args) +Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.
(exec-slurp & args) -Read stdout of subprocess and return it trimmed in a string.Community Examples
(filepath-replace repo) +Read stdout of subprocess and return it trimmed in a string.
(filepath-replace repo) -Remove special characters from a string or path to make it into a path segment.Community Examples
(find-build-dir) +Remove special characters from a string or path to make it into a path segment.
(find-build-dir) -Gets the build directory to output files to.Community Examples
(find-cache) -Return the path to the global cache.Community Examples
(find-manifest name) -Get the full path of a manifest file given a package name.Community Examples
(find-manifest-dir) +Get the full path of a manifest file given a package name.
(find-manifest-dir) -Get the path to the directory containing manifests for installed packages.Community Examples
(is-mingw) +Get the path to the directory containing manifests for installed packages.
(is-win) -Check if we should assume a DOS-like shell or default to posix shell.Community Examples
(is-win-or-mingw) +Check if we should assume a DOS-like shell or default to posix shell.
(is-win-or-mingw) -Check if built with mingwCommunity Examples
(run-patched & extra-args) +Remove a directory and all sub directories.
(run-patched & extra-args) -Run a subprocess Janet repl that has the same environment as the test environment.Community Examples
(run-repl) +Run a subprocess Janet repl that has the same environment as the test environment.
(run-repl) -Run a repl in the monkey patched test environmentCommunity Examples
(run-script path) +Run a repl in the monkey patched test environment
(run-script path) -Run a local script in the monkey patched environment.Community Examples
(decode s) Converts a base64 encoded string to its binary representation of any format -(UTF-8, binary, ..).Community Examples
(encode s) -Converts a string of any format (UTF-8, binary, ..) to base64 encoding.Community Examples
crc/make-variant crc/named-variant
(crc/make-variant size polynomial &opt init byte-flip xorout) -Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.Community Examples
(crc/named-variant name) +Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.
(crc/named-variant name) -Get a named CRC variant.Community Examples
cron/check cron/next-timestamp cron/parse-cron
(check cron &opt time local) -Check if a given time matches a cron specifier.Community Examples
(next-timestamp cron &opt time local) +Check if a given time matches a cron specifier.
(next-timestamp cron &opt time local) -Given a cron schedule, get the next instance on the cron tab after timeCommunity Examples
(parse-cron str) +Given a cron schedule, get the next instance on the cron tab after time
(parse-cron str) -Parse a cron string into a valid cron schedule objectCommunity Examples
ev-utils/go-nursery ev-utils/join-nursery ev-utils/multithread-service ev-utils/nursery ev-utils/pcall ev-utils/pdag ev-utils/pmap ev-utils/pmap-full ev-utils/pmap-limited ev-utils/spawn-nursery ev-utils/wait-cancel
(go-nursery nurse f &opt value) -Spawn a fiber into a nursery, similar to ev/go.Community Examples
(join-nursery nurse) +Spawn a fiber into a nursery, similar to ev/go.
(join-nursery nurse) -Suspend the current fiber until the nursery is emptied.Community Examples
(multithread-service thread-main n-threads) +Suspend the current fiber until the nursery is emptied.
(multithread-service thread-main n-threads) -Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.Community Examples
(nursery) +Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.
(nursery) -Group a number of fibers into a single object for structured concurrencyCommunity Examples
(pcall f n) +Group a number of fibers into a single object for structured concurrency
(pcall f n) -Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.Community Examples
(pdag f dag &opt n-workers) +Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data &opt n-workers) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.
(pmap f data &opt n-workers) -Map `f` over data in parallel, optionally limiting parallelism to `n` workers.Community Examples
(pmap-full f data) +Map `f` over data in parallel, optionally limiting parallelism to `n` workers.
(pmap-full f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.Community Examples
(pmap-limited f data n-workers) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.
(pmap-limited f data n-workers) -Similar to pmap-full, but only runs work n-ways parallel.Community Examples
(spawn-nursery nurse & body) +Similar to pmap-full, but only runs work n-ways parallel.
(spawn-nursery nurse & body) -Similar to ev/spawn but associate spawned fibers with a nurseryCommunity Examples
(wait-cancel & body) +Similar to ev/spawn but associate spawned fibers with a nursery
(wait-cancel & body) -Wait forever until the current fiber is canceled, and then run some cleanup code.Community Examples
fmt/*user-indent-2-forms* fmt/format fmt/format-file fmt/format-print
A user list of forms that are control forms and should be indented two spaces.Community Examples
(format source) +fmt/*user-indent-2-forms* fmt/format fmt/format-file fmt/format-print
fmt/*user-indent-2-forms* keyword sourceA user list of forms that are control forms and should be indented two spaces.fmt/format function source(format source) -Format a string of source code to a buffer.Community Examplesfmt/format-print function source+Format a string of source code and print the result.(format-print source) -Format a string of source code and print the result.Community Examples
generators/concat generators/cycle generators/drop generators/drop-until generators/drop-while generators/filter generators/from-iterable generators/map generators/mapcat generators/range generators/run generators/take generators/take-until generators/take-while generators/to-array
(concat & xs) -Concatenate one or more generators or iterables into a single generator.Community Examples
(cycle ds) +Concatenate one or more generators or iterables into a single generator.
(cycle ds) -Repeatedly yield the elements of `ds`, looping back to the beginning when finished.Community Examples
(drop n ds) +Repeatedly yield the elements of `ds`, looping back to the beginning when finished.
(drop-until p ds) -Drop elements from `ds` until `p` is true.Community Examples
(drop-while p ds) -Drop elements from `ds` while `p` is true.Community Examples
(filter p ds) -Create a generator that filters `ds` with `p`.Community Examples
(from-iterable ds) +Create a generator that filters `ds` with `p`.
(from-iterable ds) -Create a new generator around any iterable data structure.Community Examples
(map f ds) +Create a new generator around any iterable data structure.
(map f ds) -Create a generator that maps `f` over `ds`.Community Examples
(mapcat f ds) -Map `f` over `ds`, concatenating the results into a new generator.Community Examples
(range from to) +Map `f` over `ds`, concatenating the results into a new generator.
(take n ds) -Take `n` elements from iterable `ds`.Community Examples
(take-until p ds) -Return elements from `ds` until `p` is true.Community Examples
(take-while p ds) +Return elements from `ds` until `p` is true.
(take-while p ds) -Return elements from `ds` while `p` is true.Community Examples
getline/default-autocomplete-context getline/default-autocomplete-options getline/default-doc-fetch getline/make-getline getline/max-history
(default-autocomplete-context buf pos) -Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.Community Examples
(default-autocomplete-options prefix &) +Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.
(default-autocomplete-options prefix &) -Default handler to get available autocomplete options for a given substring.Community Examples
(default-doc-fetch sym w &) +Default handler to get available autocomplete options for a given substring.
(default-doc-fetch sym w &) -Default handler for Ctrl-G to lookup docstrings in the current environment.Community Examples
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) +Default handler for Ctrl-G to lookup docstrings in the current environment.
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) -Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.Community Examples
htmlgen/doctype-html htmlgen/escape htmlgen/html htmlgen/raw
(escape x) +htmlgen/doctype-html htmlgen/escape htmlgen/html htmlgen/raw
htmlgen/html function source(html data &opt buf) -Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.Community Exampleshtmlgen/raw function source(raw text) +Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.htmlgen/raw function source+Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.(raw text) -Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.Community Examples
http/cookie-grammar http/cookies http/logger http/middleware http/query-string-grammar http/read-body http/read-request http/read-response http/request http/request-peg http/response-peg http/router http/send-response http/server http/server-handler http/status-messages http/url-grammar
Grammar to parse a cookie header to a series of keys and values.Community Examples
(cookies nextmw) +http/cookie-grammar http/cookies http/logger http/middleware http/query-string-grammar http/read-body http/read-request http/read-response http/request http/request-peg http/response-peg http/router http/send-response http/server http/server-handler http/status-messages http/url-grammar
http/cookie-grammar core/peg sourceGrammar to parse a cookie header to a series of keys and values.http/cookies function source(cookies nextmw) -Parses cookies into the table under :cookies keyCommunity Exampleshttp/logger function source(logger nextmw) -Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.Community Exampleshttp/middleware function source(middleware x) +Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.http/middleware function source(middleware x) -Coerce any type to http middlewareCommunity Exampleshttp/query-string-grammar core/peg sourceGrammar that parses a query string (sans url path and ? character) and returns a table.Community Exampleshttp/query-string-grammar core/peg sourceGrammar that parses a query string (sans url path and ? character) and returns a table.http/read-body function source(read-body req) -Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.Community Exampleshttp/read-request function source(read-request conn buf &opt no-query) +Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.http/read-request function source(read-request conn buf &opt no-query) -Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Exampleshttp/read-response function source(read-response conn buf) +Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`http/read-response function source(read-response conn buf) -Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Exampleshttp/request function source(request method url &keys {:headers headers :body body}) +Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`http/request function source(request method url &keys {:headers headers :body body}) -Make an HTTP request to a server. Returns a table containing response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.Community Exampleshttp/router function source(router routes) +Make an HTTP request to a server. Returns a table containing response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.http/router function source(router routes) -Creates a router middleware. A router will dispatch to different routes based on the URL path.Community Exampleshttp/send-response function source(send-response conn response &opt buf) +Creates a router middleware. A router will dispatch to different routes based on the URL path.http/send-response function source(send-response conn response &opt buf) -Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.Community Exampleshttp/server function source(server handler &opt host port) +Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.http/server function source(server handler &opt host port) -Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.Community Exampleshttp/server-handler function source(server-handler conn handler) +Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.http/server-handler function source(server-handler conn handler) -A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Community Exampleshttp/status-messages struct sourceMapping of HTTP status codes to their status message.Community Exampleshttp/url-grammar core/peg source+A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.Community Examples
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.
httpf/add-bindings-as-routes httpf/add-route httpf/default-payload-wrapper httpf/listen httpf/server
(add-bindings-as-routes server &opt env) -Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.Community Examples
(add-route server path docstring schema handler &opt read-mime render-mime) +Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.
(add-route server path docstring schema handler &opt read-mime render-mime) -Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.Community Examples
(default-payload-wrapper payload) +Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.
(default-payload-wrapper payload) -Add some metadata to all responsesCommunity Examples
(listen server &opt host port n-workers) +Add some metadata to all responses
(listen server &opt host port n-workers) -Start serverCommunity Examples
(decode s) +You may also use a custom args array when specified via the special option `:args`.
(decode s) Converts a base64 encoded string to its binary representation of any format -(UTF-8, binary, ..).Community Examples
(encode s) -Converts a string of any format (UTF-8, binary, ..) to base64 encoding.Community Examples
(crc/make-variant size polynomial &opt init byte-flip xorout) +Converts a string of any format (UTF-8, binary, ..) to base64 encoding.
(crc/make-variant size polynomial &opt init byte-flip xorout) -Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.Community Examples
(crc/named-variant name) +Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.
(crc/named-variant name) -Get a named CRC variant.Community Examples
(check cron &opt time local) -Check if a given time matches a cron specifier.Community Examples
(next-timestamp cron &opt time local) +Check if a given time matches a cron specifier.
(next-timestamp cron &opt time local) -Given a cron schedule, get the next instance on the cron tab after timeCommunity Examples
(parse-cron str) +Given a cron schedule, get the next instance on the cron tab after time
(parse-cron str) -Parse a cron string into a valid cron schedule objectCommunity Examples
(go-nursery nurse f &opt value) +Parse a cron string into a valid cron schedule object
(go-nursery nurse f &opt value) -Spawn a fiber into a nursery, similar to ev/go.Community Examples
(join-nursery nurse) +Spawn a fiber into a nursery, similar to ev/go.
(join-nursery nurse) -Suspend the current fiber until the nursery is emptied.Community Examples
(multithread-service thread-main n-threads) +Suspend the current fiber until the nursery is emptied.
(multithread-service thread-main n-threads) -Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.Community Examples
(nursery) +Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.
(nursery) -Group a number of fibers into a single object for structured concurrencyCommunity Examples
(pcall f n) +Group a number of fibers into a single object for structured concurrency
(pcall f n) -Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.Community Examples
(pdag f dag &opt n-workers) +Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data &opt n-workers) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.
(pmap f data &opt n-workers) -Map `f` over data in parallel, optionally limiting parallelism to `n` workers.Community Examples
(pmap-full f data) +Map `f` over data in parallel, optionally limiting parallelism to `n` workers.
(pmap-full f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.Community Examples
(pmap-limited f data n-workers) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.
(pmap-limited f data n-workers) -Similar to pmap-full, but only runs work n-ways parallel.Community Examples
(spawn-nursery nurse & body) +Similar to pmap-full, but only runs work n-ways parallel.
(spawn-nursery nurse & body) -Similar to ev/spawn but associate spawned fibers with a nurseryCommunity Examples
(wait-cancel & body) +Similar to ev/spawn but associate spawned fibers with a nursery
(wait-cancel & body) -Wait forever until the current fiber is canceled, and then run some cleanup code.Community Examples
A user list of forms that are control forms and should be indented two spaces.Community Examples
(format source) +Wait forever until the current fiber is canceled, and then run some cleanup code.
A user list of forms that are control forms and should be indented two spaces.
(format source) -Format a string of source code to a buffer.Community Examples
(format-file file) +Format a string of source code to a buffer.
(format-print source) -Format a string of source code and print the result.Community Examples
(concat & xs) +Format a string of source code and print the result.
(concat & xs) -Concatenate one or more generators or iterables into a single generator.Community Examples
(cycle ds) +Concatenate one or more generators or iterables into a single generator.
(cycle ds) -Repeatedly yield the elements of `ds`, looping back to the beginning when finished.Community Examples
(drop n ds) +Repeatedly yield the elements of `ds`, looping back to the beginning when finished.
(drop-until p ds) -Drop elements from `ds` until `p` is true.Community Examples
(drop-while p ds) +Drop elements from `ds` until `p` is true.
(drop-while p ds) -Drop elements from `ds` while `p` is true.Community Examples
(filter p ds) -Create a generator that filters `ds` with `p`.Community Examples
(from-iterable ds) +Create a generator that filters `ds` with `p`.
(from-iterable ds) -Create a new generator around any iterable data structure.Community Examples
(map f ds) +Create a new generator around any iterable data structure.
(map f ds) -Create a generator that maps `f` over `ds`.Community Examples
(mapcat f ds) -Map `f` over `ds`, concatenating the results into a new generator.Community Examples
(range from to) +Map `f` over `ds`, concatenating the results into a new generator.
(take n ds) -Take `n` elements from iterable `ds`.Community Examples
(take-until p ds) +Take `n` elements from iterable `ds`.
(take-until p ds) -Return elements from `ds` until `p` is true.Community Examples
(take-while p ds) +Return elements from `ds` until `p` is true.
(take-while p ds) -Return elements from `ds` while `p` is true.Community Examples
(to-array s) +Return elements from `ds` while `p` is true.
(to-array s) -Consume `s` into a new array.Community Examples
(default-autocomplete-context buf pos) +Consume `s` into a new array.
(default-autocomplete-context buf pos) -Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.Community Examples
(default-autocomplete-options prefix &) +Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.
(default-autocomplete-options prefix &) -Default handler to get available autocomplete options for a given substring.Community Examples
(default-doc-fetch sym w &) +Default handler to get available autocomplete options for a given substring.
(default-doc-fetch sym w &) -Default handler for Ctrl-G to lookup docstrings in the current environment.Community Examples
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) +Default handler for Ctrl-G to lookup docstrings in the current environment.
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) -Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.Community Examples
(escape x) +Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.
(escape x) -Escape characters in a string for HTMLCommunity Examples
(html data &opt buf) -Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.Community Examples
(raw text) +Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.
(raw text) -Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.Community Examples
Grammar to parse a cookie header to a series of keys and values.Community Examples
(cookies nextmw) +Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.
Grammar to parse a cookie header to a series of keys and values.
(cookies nextmw) -Parses cookies into the table under :cookies keyCommunity Examples
(logger nextmw) -Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.Community Examples
(middleware x) +Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.
(middleware x) -Coerce any type to http middlewareCommunity Examples
Grammar that parses a query string (sans url path and ? character) and returns a table.Community Examples
Grammar that parses a query string (sans url path and ? character) and returns a table.
(read-body req) -Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.Community Examples
(read-request conn buf &opt no-query) +Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.
(read-request conn buf &opt no-query) -Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Examples
(read-response conn buf) +Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`
(read-response conn buf) -Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Examples
(request method url &keys {:headers headers :body body}) +Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`
(request method url &keys {:headers headers :body body}) -Make an HTTP request to a server. Returns a table containing response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.Community Examples
(router routes) +Make an HTTP request to a server. Returns a table containing response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.
(router routes) -Creates a router middleware. A router will dispatch to different routes based on the URL path.Community Examples
(send-response conn response &opt buf) +Creates a router middleware. A router will dispatch to different routes based on the URL path.
(send-response conn response &opt buf) -Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.Community Examples
(server handler &opt host port) +Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.
(server handler &opt host port) -Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.Community Examples
(server-handler conn handler) +Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.
(server-handler conn handler) -A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Community Examples
Mapping of HTTP status codes to their status message.Community Examples
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.Community Examples
(add-bindings-as-routes server &opt env) +A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.
(add-bindings-as-routes server &opt env) -Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.Community Examples
(add-route server path docstring schema handler &opt read-mime render-mime) +Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.
(add-route server path docstring schema handler &opt read-mime render-mime) -Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.Community Examples
(default-payload-wrapper payload) +Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.
(default-payload-wrapper payload) -Add some metadata to all responsesCommunity Examples
(listen server &opt host port n-workers) +Add some metadata to all responses
(listen server &opt host port n-workers) -Start serverCommunity Examples
(json/decode json-source &opt keywords nils) +Create a new server.
(json/decode json-source &opt keywords nils) -Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.Community Examples
(json/encode x &opt tab newline buf) +Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.
(json/encode x &opt tab newline buf) -Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.Community Examples
Dynamic binding to front matter after parsing, compilation, and evaluation, of markup completes.Community Examples
The htmlgen source that can be used to generate a document with htmlgen/html.Community Examples
(add-loader) +Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.
Dynamic binding to front matter after parsing, compilation, and evaluation, of markup completes.
The htmlgen source that can be used to generate a document with htmlgen/html.
(add-loader) -Allow importing and requiring markup as a moduleCommunity Examples
(anchor name & content) +Allow importing and requiring markup as a module
(anchor name & content) -Create an in-page anchor for a local link.Community Examples
(bigger content) -Make span element with bigger fontCommunity Examples
(blockquote content) -Make a block quote elementCommunity Examples
(code content) -Make code element with class mendoza-codeCommunity Examples
(codeblock lang &opt source) +Make code element with class mendoza-code
(codeblock lang &opt source) -Inline code or codeblockCommunity Examples
Make a div element
Make a em element
Make a li element
(markup source &opt env where) -Parse mendoza markup and evaluate it returning an htmlgen document tree.Community Examples
(mdz-loader path &) +Parse mendoza markup and evaluate it returning an htmlgen document tree.
(mdz-loader path &) -Loader for the mdz formatCommunity Examples
Make a ol element
Make a p element
Make a pre element
(section name content) -Create a section. Usually used to embed different parts of the content document into different parts of the main page.Community Examples
(smaller content) +Create a section. Usually used to embed different parts of the content document into different parts of the main page.
(smaller content) -Make span element with smaller fontCommunity Examples
Make a strong element
Make a sub element
Make a sup element
(tag name content) -Wrap some content in an html tag. If you need attributes or other properties, you may want to use raw HTML via the html function.Community Examples
(always x) +Wrap some content in an html tag. If you need attributes or other properties, you may want to use raw HTML via the html function.
Make a td element
Make a th element
Make a tr element
Make a u element
Make a ul element
(always x) -Return a function that discards any arguments and always returns `x`.Community Examples
(antepenultimate xs) +Return a function that discards any arguments and always returns `x`.
(antepenultimate xs) -Get the third-to-last element from an indexed data structure.Community Examples
(binary-search x arr &opt <?) +Get the third-to-last element from an indexed data structure.
(binary-search x arr &opt <?) Returns the index of `x` in a sorted array or tuple or the index of the next item if `x` is not present. This is the correct insert index for `x` within `arr`. If a `<?` comparator is given, the search uses -that to compare elements, otherwise uses `<`.Community Examples
(binary-search-by x arr f) +that to compare elements, otherwise uses `<`.
(binary-search-by x arr f) Returns the index of `x` in an array or tuple which has been sorted by a mapping function `f`, or the index of the next item if `x` is not -present. This is the correct insert index for `x` within `arr`.Community Examples
(caperr & body) +present. This is the correct insert index for `x` within `arr`.
(caperr & body) Captures the standart error output of the variadic `body` and returns it -as a buffer.Community Examples
(capout & body) Captures the standart output of the variadic `body` and returns it as -a buffer.Community Examples
(cond-> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs with condition and operation to which the `val`, is put as first argument. All conditions are tried and for truthy conditions the operation is executed. -Returns the value mutated if any condition is truthy.Community Examples
(cond->> val & clauses) +Returns the value mutated if any condition is truthy.
(cond->> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs of condition and operation to which the `val`, is put as last argument. All conditions are tried and for truthy the operation is ran. -Returns mutated value if any condition is truthy.Community Examples
(dedent & xs) Remove indentation after concatenating the arguments. Works by removing leading whitespace, and then removing that same pattern of whitepsace after -new lines.Community Examples
(defs & bindings) -Defines many constants as in let `bindings`, but without creating new scope.Community Examples
(dfs data visit-leaf &opt node-before node-after get-children seen) +Defines many constants as in let `bindings`, but without creating new scope.
(dfs data visit-leaf &opt node-before node-after get-children seen) Do a depth first, pre-order traversal over a data structure. Also allow for callbacks before and after visiting the children of a node. Also allow for a custom `get-children` function to change traversal as needed. Will detect cycles if an empty table is passed as the `seen` parameter, which is used to cached values -that have been visited.Community Examples
(do-def c d & body) Convenience macro for defining constant named `c` with value `d` before `body` and returning it after evaluating `body`, that presumably modifies -the `c` refered content. For example buffer, table or array.Community Examples
(do-var v d & body) +the `c` refered content. For example buffer, table or array.
(do-var v d & body) Convenience macro for defining varible named `v` with value `d` before `body` -and returning it after evaluating `body`, that presumably modifies `v`.Community Examples
(format-table buf-into data &opt columns header-mapping column-mapping) +and returning it after evaluating `body`, that presumably modifies `v`.
(format-table buf-into data &opt columns header-mapping column-mapping) -Same as print-table but pushes table into a buffer.Community Examples
(gett ds & keys) -Recursive macro (get). Similar to get-in, but keys are variadic argument.Community Examples
(insert-sorted arr <? & xs) +Recursive macro (get). Similar to get-in, but keys are variadic argument.
(insert-sorted arr <? & xs) Insert elements in `arr` such that it remains sorted by the comparator. If -`arr` is not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(insert-sorted-by arr f & xs) +`arr` is not sorted beforehand, the results are undefined. Returns `arr`.
(insert-sorted-by arr f & xs) Insert elements in `arr` such that it remains sorted by the value returned when `f` is called with the element, comparing the values with `<`. If `arr` is -not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(int->string int &opt base) +not sorted beforehand, the results are undefined. Returns `arr`.
(int->string int &opt base) -Stringify an integer in a particular base. Defaults to decimal (base 10).Community Examples
(int/ & xs) +Stringify an integer in a particular base. Defaults to decimal (base 10).
(log level & args) Print to a dynamic binding stream if that stream is set, otherwise do nothing. Evaluate to nil. For example, `(log :err "value error: %V" my-value)` will print -to `(dyn :err)` only if `(dyn :err)` has been set.Community Examples
(make prototype & pairs) +to `(dyn :err)` only if `(dyn :err)` has been set.
(make prototype & pairs) Convenience macro for creating new table from even number of kvs pairs in a variadic `table-or-pairs` arguments and setting its prototype to `prototype`. -Factory function for creating new objects from prototypes.Community Examples
(make-id &opt prefix) +Factory function for creating new objects from prototypes.
(make-id &opt prefix) Create a random, printable keyword id with 10 bytes of entropy -with an optional prefix.Community Examples
(map-keys f data) Returns new table with function `f` applied to `data`'s -keys recursively.Community Examples
(map-keys-flat f data) Returns new table with function `f` applied to `data`'s -keys without recursing.Community Examples
(map-vals f data) -Returns new table with function `f` applied to `data`'s values.Community Examples
(merge-sorted a b &opt <?) +Returns new table with function `f` applied to `data`'s values.
(merge-sorted a b &opt <?) Merges two sorted arrays so that the result remains sorted, using an optional comparator. -If no comparator is given, `<` is used.Community Examples
(merge-sorted-by a b f) +If no comparator is given, `<` is used.
(merge-sorted-by a b f) Merges two sorted arrays so that result remains sorted when `f` is called on each element, -comparing the values with `<`.Community Examples
(penultimate xs) -Get the second-to-last element from an indexed data structure.Community Examples
(print-table data &opt columns header-mapping column-mapping) +Get the second-to-last element from an indexed data structure.
(print-table data &opt columns header-mapping column-mapping) Iterate through the rows of a data structure and print a table in a human readable way, with padding and heading information. Can optionally provide @@ -415,315 +415,315 @@Community ExamplesSpork
for each row. Lastly, a `header-mapping` dictionary can be provided that changes the printed header names by mapping column keys to the desired header name. If no mapping is found, then the column key will be used as -the header name. Returns nil.
(randomize-array arr &opt rng) +the header name. Returns nil.
(randomize-array arr &opt rng) Randomizes array using the fisher-yates shuffle, takes an optional random -number generator.Community Examples
(second xs) -Get the second element from an indexed data structure.Community Examples
(select-keys data keyz) +Get the second element from an indexed data structure.
(select-keys data keyz) -Returns new table with selected `keyz` from dictionary `data`.Community Examples
(set* tgts exprs) +Returns new table with selected `keyz` from dictionary `data`.
(set* tgts exprs) Parallel `set` function. Takes a list of targets and expressions, evaluates all the expressions, and then assigns them to the targets. Each target can be a variable -or a 2-tuple, just like in the normal `set` special form.Community Examples
(string->int str &opt base) +or a 2-tuple, just like in the normal `set` special form.
(string->int str &opt base) Parse an integer in the given base. Defaults to decimal (base 10). Differs -from scan-number in that this does not recognize floating point notation.Community Examples
(table-filter pred dict) +from scan-number in that this does not recognize floating point notation.
(table-filter pred dict) Filter a key-value structure info a table. Semantics are the same as for built-in `filter`, except that `pred` takes two arguments (key and value.) -Does not consider prototypes.Community Examples
(third xs) -Get the third element from an indexed data structure.Community Examples
(trim-prefix prefix str) +Get the third element from an indexed data structure.
(trim-prefix prefix str) -Trim the specified prefix of a string if it has oneCommunity Examples
(trim-suffix suffix str) +Trim the specified prefix of a string if it has one
(trim-suffix suffix str) -Trim the specified suffix of a string if it has oneCommunity Examples
(until cnd & body) +Trim the specified suffix of a string if it has one
(until cnd & body) Repeat `body` while the `cnd` is false. -Equivalent to (while (not cnd) ;body).Community Examples
(vars & bindings) -Defines many variables as in let `bindings`, but without creating new scope.Community Examples
(make-proto stream &opt pack unpack) +Defines many variables as in let `bindings`, but without creating new scope.
(make-proto stream &opt pack unpack) -Create both a send an recv function from a stream, as with `make-send` and `make-recv`.Community Examples
(make-recv stream &opt unpack) +Create both a send an recv function from a stream, as with `make-send` and `make-recv`.
(make-recv stream &opt unpack) -Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.Community Examples
(make-send stream &opt pack) +Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.
(make-send stream &opt pack) -Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.Community Examples
(client &opt host port name) +Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.
(client &opt host port name) -Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".Community Examples
Default host to run server on and connect to.Community Examples
(server &opt host port env cleanup welcome-msg) +Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".
(server &opt host port env cleanup welcome-msg) -Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.Community Examples
(server-single &opt host port env cleanup welcome-msg) +Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.
(server-single &opt host port env cleanup welcome-msg) -Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.Community Examples
(posix/abspath path) +Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(ext path) -Get the file extension for a path.Community Examples
(posix/join & els) -Join path elements together.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/parts path) -Split a path into its parts.Community Examples
(posix/relpath source target) +Split a path into its parts.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(posix/relpath source target) +Get the relative path between two subpaths.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(win32/abspath path) +Get the relative path between two subpaths.
(win32/abspath path) -Coerce a path to be absolute.Community Examples
(win32/abspath? path) -Check if a path is absolute.Community Examples
(win32/basename path) -Gets the base file name of a path.Community Examples
(win32/dirname path) -Gets the directory name of a path.Community Examples
(ext path) -Get the file extension for a path.Community Examples
(win32/join & els) -Join path elements together.Community Examples
(win32/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(win32/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(win32/parts path) -Split a path into its parts.Community Examples
(win32/relpath source target) +Split a path into its parts.
(win32/relpath source target) -Get the relative path between two subpaths.Community Examples
(rawterm/begin &opt on-winch) +Get the relative path between two subpaths.
(rawterm/begin &opt on-winch) -Begin raw terminal functionality. Return a stream that can be read from to get input.Community Examples
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) +Begin raw terminal functionality. Return a stream that can be read from to get input.
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) -Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.Community Examples
(rawterm/ctrl-z) +Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.
(rawterm/ctrl-z) -A handler that a user can use to handle ctrl-z from input to suspend the current process.Community Examples
(rawterm/end) +A handler that a user can use to handle ctrl-z from input to suspend the current process.
(rawterm/getch &opt into) -Get a byte of input from stdin, without blocking if possible. Returns a buffer.Community Examples
(rawterm/isatty) +Get a byte of input from stdin, without blocking if possible. Returns a buffer.
(rawterm/isatty) -Check if the current stdin is a tty.Community Examples
(rawterm/monowidth bytes &opt start-index end-index) +Check if the current stdin is a tty.
(rawterm/monowidth bytes &opt start-index end-index) -Measure the monospace width of a string.Community Examples
(rawterm/rune-monowidth rune) +Measure the monospace width of a string.
(rawterm/rune-monowidth rune) -Get the monospace width of a rune. Returns either 0, 1, or 2.Community Examples
(rawterm/size) +Get the monospace width of a rune. Returns either 0, 1, or 2.
(rawterm/size) -Get the number of rows and columns visible in the terminal as tuple [rows cols]Community Examples
(rawterm/slice-monowidth bytes columns &opt start-index into) +Get the number of rows and columns visible in the terminal as tuple [rows cols]
(rawterm/slice-monowidth bytes columns &opt start-index into) -Get a byte slice that will fit into a number of columns.Community Examples
(compile pattern) +Get a byte slice that will fit into a number of columns.
(compile pattern) -Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.Community Examples
(find reg text &opt start) +Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.
(find reg text &opt start) -Similar to peg/find, but for regexes.Community Examples
(find-all reg text &opt start) +Similar to peg/find, but for regexes.
(find-all reg text &opt start) -Similar to peg/find-all, but for regexes.Community Examples
(match reg text &opt start) +Similar to peg/find-all, but for regexes.
(match reg text &opt start) -Similar to peg/match, but for regexes.Community Examples
Peg used to generate peg source code from a regular expression string.Community Examples
(replace reg rep text &opt start) +Similar to peg/match, but for regexes.
Peg used to generate peg source code from a regular expression string.
(replace reg rep text &opt start) -Similar to peg/replace, but for regexes.Community Examples
(replace-all reg rep text &opt start) +Similar to peg/replace, but for regexes.
(replace-all reg rep text &opt start) -Similar to peg/replace-all, but for regexes.Community Examples
(source pattern) -Compile a subset of regex to PEG source code.Community Examples
(client &opt host port name) +Compile a subset of regex to PEG source code.
(client &opt host port name) -Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.Community Examples
Default host to run server on and connect to.Community Examples
(server functions &opt host port workers-per-connection) +Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.
(server functions &opt host port workers-per-connection) -Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.Community Examples
(make-predicate schema) +Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.
(make-predicate schema) -Generate a function that can be used to validate a data structure. This is the function form of `predicate`.Community Examples
(make-validator schema) +Generate a function that can be used to validate a data structure. This is the function form of `predicate`.
(make-validator schema) -Generate a function that can be used to validate a data structure. This is the function form of `validator`.Community Examples
(predicate pattern) +Generate a function that can be used to validate a data structure. This is the function form of `validator`.
(predicate pattern) -Make a validation predicate given a certain schema.Community Examples
(validator pattern) +Make a validation predicate given a certain schema.
(validator pattern) -Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.Community Examples
The currently running service manager, if there is oneCommunity Examples
The currently running service, if there is oneCommunity Examples
(add-service service-name main-function & args) +Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.
The currently running service manager, if there is one
(add-service service-name main-function & args) -Spawn a serviceCommunity Examples
(all-services) -Get a list of running servicesCommunity Examples
(get-manager) -Get the current manager. If no manager exists, create one.Community Examples
(get-service) +Get the current manager. If no manager exists, create one.
(get-service) -Get the current service. If not in a service, raise an errorCommunity Examples
(make-manager &opt log-dir) +Get the current service. If not in a service, raise an error
(make-manager &opt log-dir) -Group a number of fibers into a single object for structured concurrency. Also includes utilities for running services like servers in the background.Community Examples
(print-all &opt filter-fn) +Group a number of fibers into a single object for structured concurrency. Also includes utilities for running services like servers in the background.
(print-all &opt filter-fn) -Print a table of all running services.Community Examples
(remove-service service-name) +Print a table of all running services.
(remove-service service-name) -Remove a serviceCommunity Examples
(set-title title) -Set a textual description of the service to describe what it is doing currentlyCommunity Examples
(start-service service-name) +Set a textual description of the service to describe what it is doing currently
(start-service service-name) -Start or restart a serviceCommunity Examples
(stop-service service-name &opt reason) +Start or restart a service
(stop-service service-name &opt reason) -Stop a running serviceCommunity Examples
(wait) -Once a number of services have been spawned, call `wait` to block the fiber until the manager is canceled. This lets a manager fiber behave as a service itself.Community Examples
(copy src dest) +Once a number of services have been spawned, call `wait` to block the fiber until the manager is canceled. This lets a manager fiber behave as a service itself.
(copy src dest) Copy a file or directory recursively from one location to another. -Expects input to be unix style pathsCommunity Examples
(copy-file src-path dst-path) +Expects input to be unix style paths
(copy-file src-path dst-path) -Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.Community Examples
(create-dirs dir-path) +Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.
(create-dirs dir-path) -Create all directories in path specified as string including itself.Community Examples
(devnull) +Create all directories in path specified as string including itself.
(devnull) -get the /dev/null equivalent of the current platform as an open fileCommunity Examples
(escape & args) +get the /dev/null equivalent of the current platform as an open file
(escape & args) -Output a string with all arguments correctly quotedCommunity Examples
(exec & args) -Execute command specified by args returning it's exit codeCommunity Examples
(exec-fail & args) +Execute command specified by args returning it's exit code
(exec-fail & args) -Execute command specified by args, fails when command exits with non-zero exit codeCommunity Examples
(exec-slurp & args) +Execute command specified by args, fails when command exits with non-zero exit code
(exec-slurp & args) -Read stdout of command specified by args and return it trimmed in a string.Community Examples
(exec-slurp-all & args) +Read stdout of command specified by args and return it trimmed in a string.
(exec-slurp-all & args) Read stdout and stderr of subprocess and return it trimmed in a struct with :err and :out containing the output as string. -This will also return the exit code under the :status key.Community Examples
(exists? path) +This will also return the exit code under the :status key.
(exists? path) -Check if the given file or directory exists. (Follows symlinks)Community Examples
(list-all-files dir &opt into) +Check if the given file or directory exists. (Follows symlinks)
(list-all-files dir &opt into) -List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.Community Examples
(make-new-file file-path &opt mode) +List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.
(make-new-file file-path &opt mode) -Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).Community Examples
(rm path) +Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).
(rm path) -Remove a directory and all sub directories recursively.Community Examples
(scan-directory dir func) +Remove a directory and all sub directories recursively.
(scan-directory dir func) -Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.Community Examples
(split s) +Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.
(split s) -Split a string into 'sh like' tokens, returns nil if unable to parse the string.Community Examples
(tarray/buffer array|size) +Split a string into 'sh like' tokens, returns nil if unable to parse the string.
(tarray/buffer array|size) -Return typed array buffer or create a new buffer.Community Examples
(tarray/copy-bytes src sindex dst dindex &opt count) +Return typed array buffer or create a new buffer.
(tarray/copy-bytes src sindex dst dindex &opt count) -Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.Community Examples
(tarray/length array|buffer) +Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.
(tarray/length array|buffer) -Return typed array or buffer size.Community Examples
(tarray/new type size &opt stride offset tarray|buffer) +Return typed array or buffer size.
(tarray/new type size &opt stride offset tarray|buffer) -Create new typed array.Community Examples
(tarray/properties array) +Create new typed array.
(tarray/properties array) -Return typed array properties as a struct.Community Examples
(tarray/slice tarr &opt start end) +Return typed array properties as a struct.
(tarray/slice tarr &opt start end) -Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.Community Examples
(tarray/swap-bytes src sindex dst dindex &opt count) +Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.
(tarray/swap-bytes src sindex dst dindex &opt count) -Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.Community Examples
(all-tasks tasker &opt detailed) +Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.
(all-tasks tasker &opt detailed) -Get an array of all task ids for which there is still data on disk. If `detailed` is truthy, return full task metadata instead of ids.Community Examples
(cancel-task tasker task-id) +Get an array of all task ids for which there is still data on disk. If `detailed` is truthy, return full task metadata instead of ids.
(cancel-task tasker task-id) -Cancel a queued or running task.Community Examples
(close-queues tasker) -Prevent any tasks from being added to queues. When an executor finishes it's current job, if there are any, it will terminate. When all executors complete, the call to `run-executors` will complete.Community Examples
Default location of task recordsCommunity Examples
Maximum allowed priority (lower priority tasks will execute first)Community Examples
Minimum allowed priority (lower priority tasks will execute first)Community Examples
(new-tasker &opt task-directory queues queue-size) +Prevent any tasks from being added to queues. When an executor finishes it's current job, if there are any, it will terminate. When all executors complete, the call to `run-executors` will complete.
Maximum allowed priority (lower priority tasks will execute first)
Minimum allowed priority (lower priority tasks will execute first)
(new-tasker &opt task-directory queues queue-size) -Create queues and various settings to run tasks. Create a new tasker table.Community Examples
(queue-task tasker argv &opt note priority qname timeout expiration input) +Create queues and various settings to run tasks. Create a new tasker table.
(queue-task tasker argv &opt note priority qname timeout expiration input) -Add a task specification to a queue. Supply an argv string array that will be used to invoke s a subprocess. The optional `note` parameter is just a textual note for task trackingv. The `priority` parameter should be an integer between 0 and 9 inclusive, default is 4. Lower priority jobs in the same queue will be executed by higher priority. Use input to pass in generic, unstructured input to a task.Community Examples
(run-cleanup tasker) +Add a task specification to a queue. Supply an argv string array that will be used to invoke s a subprocess. The optional `note` parameter is just a textual note for task trackingv. The `priority` parameter should be an integer between 0 and 9 inclusive, default is 4. Lower priority jobs in the same queue will be executed by higher priority. Use input to pass in generic, unstructured input to a task.
(run-cleanup tasker) -Delete old expired jobs saved on diskCommunity Examples
(run-executors tasker &opt workers-per-queue pre-task post-task) +Delete old expired jobs saved on disk
(run-executors tasker &opt workers-per-queue pre-task post-task) -Start a number of executors to run tasks as with `tasker/spawn-executors`, and then wait for all executors to complete.Community Examples
(spawn-executors tasker &opt qnames workers-per-queue pre-task post-task) +Start a number of executors to run tasks as with `tasker/spawn-executors`, and then wait for all executors to complete.
(spawn-executors tasker &opt qnames workers-per-queue pre-task post-task) -Start a number of executors to run tasks. Tasks can be added to a queue by calling queue-task. A single tasker object can make multiple calls to spawn-executors.Community Examples
A tuple of all possible statuses that a task can have.Community Examples
(task-file tasker task-id &opt file-name) +Start a number of executors to run tasks. Tasks can be added to a queue by calling queue-task. A single tasker object can make multiple calls to spawn-executors.
(task-file tasker task-id &opt file-name) -Get a log file for a path. By default, will get a path to out.log.Community Examples
(task-status tasker task-id) +Get a log file for a path. By default, will get a path to out.log.
(task-status tasker task-id) -Look up the status of a given task by id.Community Examples
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(compile str) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(compile str) Compile a Temple template into a function which will return a rendered buffer. The resulting function should receive the template arguments in the -&keys format.Community Examples
(create source &opt where) -Compile a template string into a function. Optionally provide a location where the source is from to improve debugging. Returns the template function.Community Examples
(assert x &opt e) +Compile a template string into a function. Optionally provide a location where the source is from to improve debugging. Returns the template function.
(assert x &opt e) -Override's the default assert with some nice error handling.Community Examples
(assert-docs path) +Override's the default assert with some nice error handling.
(assert-docs path) Assert that all symbols, when module on the path is required, -have proper doc stringCommunity Examples
(assert-error msg & forms) -Test passes if forms error.Community Examples
(assert-no-error msg & forms) -Test passes if forms do not error.Community Examples
(capture-stderr & body) Runs the form and captures stderr. Returns tuple with result of the form -and a string with captured stderr.Community Examples
(capture-stdout & body) Runs the form and captures stdout. Returns tuple with result of the form -and a string with captured stdout.Community Examples
(end-suite) -Ends test suite, prints summary and exits if any have failed.Community Examples
(start-suite &opt name) +Ends test suite, prints summary and exits if any have failed.
(start-suite &opt name) -Starts test suite.Community Examples
(suppress-stderr & body) -Suppreses stdout from the bodyCommunity Examples
(suppress-stdout & body) -Suppreses stdout from the bodyCommunity Examples
(timeit form &opt tag) Time the execution of `form` using `os/clock` before and after, and print the result to stdout. returns: result of executing `form`. -Uses `tag` (default "Elapsed time:") to tag the printout.Community Examples
(timeit-loop head & body) +Uses `tag` (default "Elapsed time:") to tag the printout.
(timeit-loop head & body) Similar to `loop`, but outputs performance statistics after completion. Additionally defines a `:timeout` verb to iterate continuously for a given number of seconds. If the first form of `body` is a bytes, it will be taken -as a custom tag.Community Examples
(utf8/decode-rune buf &opt start) -Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].Community Examples
(utf8/encode-rune rune &opt buf) +Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].
(utf8/encode-rune rune &opt buf) -Encode a Unicode codepoint into the end of a buffer.Community Examples
(utf8/prefix->width c) +Encode a Unicode codepoint into the end of a buffer.
(utf8/prefix->width c) -Given the first byte in an UTF-8 sequence, get the number of bytes that the codepoint sequence takes up, including the prefix byte.Community Examples
(zip/add-bytes writer path data &opt comment flags) +Given the first byte in an UTF-8 sequence, get the number of bytes that the codepoint sequence takes up, including the prefix byte.
(zip/add-bytes writer path data &opt comment flags) -Add a byte sequence to the zip writer.Community Examples
(zip/add-file writer path filename &opt comment flags) +Add a byte sequence to the zip writer.
(zip/add-file writer path filename &opt comment flags) -Add a file to the zip writer.Community Examples
(zip/compress bytes &opt level into) +Add a file to the zip writer.
(zip/compress bytes &opt level into) -Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.Community Examples
(zip/decompress bytes &opt into) +Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.
(zip/decompress bytes &opt into) -Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.Community Examples
(zip/extract reader idx-or-filename &opt into flags) +Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.
(zip/extract reader idx-or-filename &opt into flags) -Extract a file from the zip archive, either to memory or to a file on disk.Community Examples
(zip/file-directory? reader idx) +Extract a file from the zip archive, either to memory or to a file on disk.
(zip/file-directory? reader idx) -Check if a file index is a directory.Community Examples
(zip/file-encrypted? reader idx) +Check if a file index is a directory.
(zip/file-encrypted? reader idx) -Check if a file is encrypted inside an archive.Community Examples
(zip/file-supported? reader idx) +Check if a file is encrypted inside an archive.
(zip/file-supported? reader idx) -Check if a file is supported with this verstion of miniz.Community Examples
(zip/get-filename reader idx) +Check if a file is supported with this verstion of miniz.
(zip/get-filename reader idx) -Convert a file index index in the archive to a filename.Community Examples
(zip/locate-file reader path &opt comment flags) +Convert a file index index in the archive to a filename.
(zip/locate-file reader path &opt comment flags) -Get the index of a particular filename in the archive.Community Examples
(zip/read-bytes bytes &opt flags) +Get the index of a particular filename in the archive.
(zip/read-bytes bytes &opt flags) -Read a byte sequence as a zip archive. Returns a new zip reader.Community Examples
(zip/read-file filename &opt flags) +Read a byte sequence as a zip archive. Returns a new zip reader.
(zip/read-file filename &opt flags) -Read a file as a zip archive. Returns a new zip reader.Community Examples
(zip/reader-close reader) +Read a file as a zip archive. Returns a new zip reader.
(zip/reader-close reader) -Close a reader and free related memory.Community Examples
(zip/reader-count reader) +Close a reader and free related memory.
(zip/reader-count reader) -Get the number of files inside the zip archive. The files can be indexedCommunity Examples
(zip/stat reader idx) +Get the number of files inside the zip archive. The files can be indexed
(zip/stat reader idx) Get stat information of file. Returns a new struct with the following fields: @@ -740,17 +740,17 @@Community ExamplesSpork
* :comment * :internal-attr * :external-attr -
(zip/version) -Get the version string of the underlying miniz library.Community Examples
(zip/write-buffer) +Get the version string of the underlying miniz library.
(zip/write-buffer) -Create a new zip archive writer that write to memory.Community Examples
(zip/write-file dest-path) +Create a new zip archive writer that write to memory.
(zip/write-file dest-path) -Create a new zip archive writer that will write into an archive file.Community Examples
(zip/writer-close writer) +Create a new zip archive writer that will write into an archive file.
(zip/writer-close writer) -Close a ZipWriter.Community Examples
(zip/writer-finalizer writer) -Finalize a writer, writing any zip files to disk. Return the writer.Community Examples
(json/decode json-source &opt keywords nils) -Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.Community Examples
(json/encode x &opt tab newline buf) +Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.
(json/encode x &opt tab newline buf) -Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.Community Examples
math/add math/add-to-mean math/approx-eq math/bernoulli-distribution math/binominal-coeficient math/binominal-distribution math/check-probability math/chi-squared-distribution-table math/cols math/cumulative-std-normal-probability math/det math/dot math/epsilon math/extent math/factor math/factorial math/geometric-mean math/get-only-el math/harmonic-mean math/ident math/interquartile-range math/invmod math/jacobi math/linear-regression math/linear-regression-line math/median math/median-absolute-deviation math/minor math/mode math/mop math/mul math/mulmod math/next-prime math/perm math/permutation-test math/permutations math/poisson-distribution math/powmod math/prime? math/primes math/quantile math/quantile-rank math/quantile-rank-sorted math/quantile-sorted math/quickselect math/relative-err math/root-mean-square math/rows math/sample-correlation math/sample-covariance math/sample-skewness math/sample-standard-deviation math/sample-variance math/scalar math/shuffle-in-place math/size math/sop math/standard-deviation math/standard-normal-table math/sum-compensated math/sum-nth-power-deviations math/swap math/t-test math/t-test-2 math/trans math/variance math/z-score math/zero
(add m a) Add `a` to matrix `m` where it can be matrix or scalar. -Matrix `m` is mutated.Community Examples
(add-to-mean m n v) -Adds new value `v` to mean `m` from `n` values.Community Examples
(approx-eq a e &opt t) +Adds new value `v` to mean `m` from `n` values.
(approx-eq a e &opt t) Approximate equality between actual number `a` and expected number `e`. Default tolerance `t` -is `epsilon`.Community Examples
(bernoulli-distribution p) -Creates Bernoulli distribution from popability `p` in the tuple.Community Examples
(binominal-coeficient n k) +Creates Bernoulli distribution from popability `p` in the tuple.
(binominal-coeficient n k) Computes binominal coeficient from set of size `n` -and sample size `k`.Community Examples
(binominal-distribution t p) Creates binominal distribution from trials `t` -and probability `p` in the tuple.Community Examples
(check-probability p) -Asserts that probability in in the [0 1] range.Community Examples
(cumulative-std-normal-probability z) +Returns numbers of columns of matrix `m`.
(cumulative-std-normal-probability z) -Computes standard normal probability for `y`.Community Examples
(dot mx my) -Computes dot product of matrices or vectors `x` and `y`.Community Examples
(extent xs) -Returns the minimum & maximum number in an `xs` as tuple.Community Examples
(factor n) -Returns an array containing the prime factors of `n`.Community Examples
(geometric-mean xs) -Gets the geometric mean from `xs`.Community Examples
(get-only-el m) Convenience macro for geting first element -from first row of the two dimensional array `m`.Community Examples
(harmonic-mean xs) +from first row of the two dimensional array `m`.
(harmonic-mean xs) -Gets the harmonic mean from `xs`.Community Examples
(ident c) -Creates identity matrix with `c` x `c` size.Community Examples
(interquartile-range xs) +Creates identity matrix with `c` x `c` size.
(interquartile-range xs) -Gets the interquartile range from `xs`.Community Examples
(math/invmod a m) -Modular multiplicative inverse of `a` mod `m`. Both arguments must be integer. The return value has the same type as `m`. If no inverse exists, returns `math/nan` instead.Community Examples
(math/jacobi a m) +Modular multiplicative inverse of `a` mod `m`. Both arguments must be integer. The return value has the same type as `m`. If no inverse exists, returns `math/nan` instead.
(linear-regression coords) +Computes the Jacobi Symbol (a|m).
(linear-regression coords) Computes the slope `:m` and y-intercept `:b` -of the function in the struct from set of coordinates.Community Examples
(linear-regression-line {:m m :b b}) +of the function in the struct from set of coordinates.
(linear-regression-line {:m m :b b}) -Constructs function from struct returned by linear regression.Community Examples
(median xs) +Constructs function from struct returned by linear regression.
(median-absolute-deviation xs) +Gets the median value from `xs`
(median-absolute-deviation xs) -Gets median absolute deviation from `xs`.Community Examples
(minor m x y) -Computes minor matrix of matrix `m` and `x`, `y`.Community Examples
(mop m op a) Mutates every cell of the matrix `m` with `op` -and corresponding cell from matrix arg `a`.Community Examples
(mul m a) Multiply matrix `m` with `a` which can be matrix or vector. -Matrix `m` is mutated.Community Examples
(math/mulmod a b m) -Modular multiplication of `a` and `b` mod `m`. All arguments must be integer. The return value has the same type as `m`.Community Examples
(next-prime n) +Modular multiplication of `a` and `b` mod `m`. All arguments must be integer. The return value has the same type as `m`.
(next-prime n) -Returns the next prime number strictly larger than `n`.Community Examples
(permutation-test xs ys &opt a k) +Computes permanent of the matrix `m`.
(permutation-test xs ys &opt a k) Conducts a permutation test to determine if two data sets `xs` and `ys` are *significantly* different from each other. You can use alternative hypotesis `a`, which defaults to `:two-side`, with `:greater` and `:lesser` being the other two options. The last optional argument is `k` number of values -in permutation distributionCommunity Examples
(permutations s &opt k) -Returns permutations of length `k` from members of `s`Community Examples
(poisson-distribution lambda) +Returns permutations of length `k` from members of `s`
(poisson-distribution lambda) -Creates Poisson distribution from `lambda` in tuple.Community Examples
(math/powmod a b m) +Creates Poisson distribution from `lambda` in tuple.
(math/powmod a b m) -Modular exponentiation of `a` to the power of `b` mod `m`. All arguments must be integer. The return value has the same type as `m`.Community Examples
(prime? n) +Modular exponentiation of `a` to the power of `b` mod `m`. All arguments must be integer. The return value has the same type as `m`.
(prime? n) -A primality test, deterministic for all `n` less than 2^63.Community Examples
(quantile xs p) -Gets the quantile value from `xs` at `p` from unsorted population.Community Examples
(quantile-rank xs p) +Gets the quantile value from `xs` at `p` from unsorted population.
(quantile-rank xs p) -Gets the quantile rank of value `v` from unsorted `xs`.Community Examples
(quantile-rank-sorted xs v) +Gets the quantile rank of value `v` from unsorted `xs`.
(quantile-rank-sorted xs v) -Gets the quantile rank of value `v` from sorted `xs`.Community Examples
(quantile-sorted xs p) +Gets the quantile rank of value `v` from sorted `xs`.
(quantile-sorted xs p) -Gets the quantile value from `xs` at `p` from sorted population.Community Examples
(quickselect arr k &opt left right) +Gets the quantile value from `xs` at `p` from sorted population.
(quickselect arr k &opt left right) Rearrange items in `arr` so that all items in `[left, k]` range are the smallest. The `k`-th element will have the `(k - left + 1)`-th smallest value in `[left, right]`. -Mutates `arr`.Community Examples
(relative-err a e) Gets the relative err between actual number `a` -and expected number `e`.Community Examples
(root-mean-square xs) -Gets the root mean square from `xs`.Community Examples
(sample-correlation xs ys) +Returns numbers of rows of matrix `m`.
(sample-correlation xs ys) -Gets the sample correlation between `xs` and `ys`.Community Examples
(sample-covariance xs ys) +Gets the sample correlation between `xs` and `ys`.
(sample-covariance xs ys) -Gets the sample covariance between `xs` and `ys`.Community Examples
(sample-skewness xs) +Gets the sample covariance between `xs` and `ys`.
(sample-skewness xs) -Gets the sample skeweness from the `xs`.Community Examples
(sample-standard-deviation xs) +Gets the sample skeweness from the `xs`.
(sample-standard-deviation xs) -Gets sample standard deviation from `xs`.Community Examples
(sample-variance xs) +Gets sample standard deviation from `xs`.
(sample-variance xs) -Get the sample variance from `xs`.Community Examples
(scalar c s) -Creates scalar `s` matrix with `c` x `c` size.Community Examples
(shuffle-in-place xs) +Creates scalar `s` matrix with `c` x `c` size.
(shuffle-in-place xs) Generate random permutation of the array `xs` -which is shuffled in place.Community Examples
(size m) -Returns tuple with the matrix `m` size [rows cols].Community Examples
(sop m op & a) Mutates every cell of the matrix `m` with `op` -and variadic args `a`.Community Examples
(standard-deviation xs) -Gets the standard deviation from `ds`.Community Examples
(sum-compensated xs) -Returns sum of the members of `xs` with Kahan-Babushka algorithm.Community Examples
(sum-nth-power-deviations xs n) +Returns sum of the members of `xs` with Kahan-Babushka algorithm.
(sum-nth-power-deviations xs n) -Get the sum of deviations to the n power.Community Examples
(swap arr i j) Swaps members with indices `i` and `j` of arr. -Noop when `i` equals `j`.Community Examples
(t-test xs expv) Computes one sample t-test comparing the mean of `xs` -to known value `expv`.Community Examples
(t-test-2 xs ys &opt d) Computes two sample t-test of two samples `xs` and `ys` -with difference optional `d` which defaults to 0.Community Examples
(z-score x m d) Gets the standard score for number `x` from mean `m` -and standard deviation `d`.Community Examples
(zero c &opt r) Creates vector of length `c`, or matrix if `r` -is provided, and fills it with zeros.Community Examples
misc/always misc/antepenultimate misc/binary-search misc/binary-search-by misc/caperr misc/capout misc/cond-> misc/cond->> misc/dedent misc/defs misc/dfs misc/do-def misc/do-var misc/format-table misc/gett misc/insert-sorted misc/insert-sorted-by misc/int->string misc/int/ misc/log misc/make misc/make-id misc/map-keys misc/map-keys-flat misc/map-vals misc/merge-sorted misc/merge-sorted-by misc/penultimate misc/print-table misc/randomize-array misc/second misc/select-keys misc/set* misc/string->int misc/table-filter misc/third misc/trim-prefix misc/trim-suffix misc/until misc/vars
(always x) -Return a function that discards any arguments and always returns `x`.Community Examples
(antepenultimate xs) +Return a function that discards any arguments and always returns `x`.
(antepenultimate xs) -Get the third-to-last element from an indexed data structure.Community Examples
(binary-search x arr &opt <?) +Get the third-to-last element from an indexed data structure.
(binary-search x arr &opt <?) Returns the index of `x` in a sorted array or tuple or the index of the next item if `x` is not present. This is the correct insert index for `x` within `arr`. If a `<?` comparator is given, the search uses -that to compare elements, otherwise uses `<`.Community Examples
(binary-search-by x arr f) +that to compare elements, otherwise uses `<`.
(binary-search-by x arr f) Returns the index of `x` in an array or tuple which has been sorted by a mapping function `f`, or the index of the next item if `x` is not -present. This is the correct insert index for `x` within `arr`.Community Examples
(caperr & body) +present. This is the correct insert index for `x` within `arr`.
(caperr & body) Captures the standart error output of the variadic `body` and returns it -as a buffer.Community Examples
(capout & body) Captures the standart output of the variadic `body` and returns it as -a buffer.Community Examples
(cond-> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs with condition and operation to which the `val`, is put as first argument. All conditions are tried and for truthy conditions the operation is executed. -Returns the value mutated if any condition is truthy.Community Examples
(cond->> val & clauses) +Returns the value mutated if any condition is truthy.
(cond->> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs of condition and operation to which the `val`, is put as last argument. All conditions are tried and for truthy the operation is ran. -Returns mutated value if any condition is truthy.Community Examples
(dedent & xs) Remove indentation after concatenating the arguments. Works by removing leading whitespace, and then removing that same pattern of whitepsace after -new lines.Community Examples
(defs & bindings) -Defines many constants as in let `bindings`, but without creating new scope.Community Examples
(dfs data visit-leaf &opt node-before node-after get-children seen) +Defines many constants as in let `bindings`, but without creating new scope.
(dfs data visit-leaf &opt node-before node-after get-children seen) Do a depth first, pre-order traversal over a data structure. Also allow for callbacks before and after visiting the children of a node. Also allow for a custom `get-children` function to change traversal as needed. Will detect cycles if an empty table is passed as the `seen` parameter, which is used to cached values -that have been visited.Community Examples
(do-def c d & body) Convenience macro for defining constant named `c` with value `d` before `body` and returning it after evaluating `body`, that presumably modifies -the `c` refered content. For example buffer, table or array.Community Examples
(do-var v d & body) +the `c` refered content. For example buffer, table or array.
(do-var v d & body) Convenience macro for defining varible named `v` with value `d` before `body` -and returning it after evaluating `body`, that presumably modifies `v`.Community Examples
(format-table buf-into data &opt columns header-mapping column-mapping) +and returning it after evaluating `body`, that presumably modifies `v`.
(format-table buf-into data &opt columns header-mapping column-mapping) -Same as print-table but pushes table into a buffer.Community Examples
(gett ds & keys) -Recursive macro (get). Similar to get-in, but keys are variadic argument.Community Examples
(insert-sorted arr <? & xs) +Recursive macro (get). Similar to get-in, but keys are variadic argument.
(insert-sorted arr <? & xs) Insert elements in `arr` such that it remains sorted by the comparator. If -`arr` is not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(insert-sorted-by arr f & xs) +`arr` is not sorted beforehand, the results are undefined. Returns `arr`.
(insert-sorted-by arr f & xs) Insert elements in `arr` such that it remains sorted by the value returned when `f` is called with the element, comparing the values with `<`. If `arr` is -not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(int->string int &opt base) +not sorted beforehand, the results are undefined. Returns `arr`.
(int->string int &opt base) -Stringify an integer in a particular base. Defaults to decimal (base 10).Community Examples
(int/ & xs) +Stringify an integer in a particular base. Defaults to decimal (base 10).
(log level & args) Print to a dynamic binding stream if that stream is set, otherwise do nothing. Evaluate to nil. For example, `(log :err "value error: %V" my-value)` will print -to `(dyn :err)` only if `(dyn :err)` has been set.Community Examples
(make prototype & pairs) Convenience macro for creating new table from even number of kvs pairs in a variadic `table-or-pairs` arguments and setting its prototype to `prototype`. -Factory function for creating new objects from prototypes.Community Examples
(make-id &opt prefix) +Factory function for creating new objects from prototypes.
(make-id &opt prefix) Create a random, printable keyword id with 10 bytes of entropy -with an optional prefix.Community Examples
(map-keys f data) Returns new table with function `f` applied to `data`'s -keys recursively.Community Examples
(map-keys-flat f data) Returns new table with function `f` applied to `data`'s -keys without recursing.Community Examples
(map-vals f data) -Returns new table with function `f` applied to `data`'s values.Community Examples
(merge-sorted a b &opt <?) +Returns new table with function `f` applied to `data`'s values.
(merge-sorted a b &opt <?) Merges two sorted arrays so that the result remains sorted, using an optional comparator. -If no comparator is given, `<` is used.Community Examples
(merge-sorted-by a b f) +If no comparator is given, `<` is used.
(merge-sorted-by a b f) Merges two sorted arrays so that result remains sorted when `f` is called on each element, -comparing the values with `<`.Community Examples
(penultimate xs) -Get the second-to-last element from an indexed data structure.Community Examples
(print-table data &opt columns header-mapping column-mapping) +Get the second-to-last element from an indexed data structure.
(print-table data &opt columns header-mapping column-mapping) Iterate through the rows of a data structure and print a table in a human readable way, with padding and heading information. Can optionally provide @@ -220,37 +220,37 @@Community ExamplesIndex for each row. Lastly, a `header-mapping` dictionary can be provided that changes the printed header names by mapping column keys to the desired header name. If no mapping is found, then the column key will be used as -the header name. Returns nil.
(randomize-array arr &opt rng) Randomizes array using the fisher-yates shuffle, takes an optional random -number generator.Community Examples
(second xs) -Get the second element from an indexed data structure.Community Examples
(select-keys data keyz) +Get the second element from an indexed data structure.
(select-keys data keyz) -Returns new table with selected `keyz` from dictionary `data`.Community Examples
(set* tgts exprs) +Returns new table with selected `keyz` from dictionary `data`.
(set* tgts exprs) Parallel `set` function. Takes a list of targets and expressions, evaluates all the expressions, and then assigns them to the targets. Each target can be a variable -or a 2-tuple, just like in the normal `set` special form.Community Examples
(string->int str &opt base) +or a 2-tuple, just like in the normal `set` special form.
(string->int str &opt base) Parse an integer in the given base. Defaults to decimal (base 10). Differs -from scan-number in that this does not recognize floating point notation.Community Examples
(table-filter pred dict) +from scan-number in that this does not recognize floating point notation.
(table-filter pred dict) Filter a key-value structure info a table. Semantics are the same as for built-in `filter`, except that `pred` takes two arguments (key and value.) -Does not consider prototypes.Community Examples
(third xs) -Get the third element from an indexed data structure.Community Examples
(trim-prefix prefix str) +Get the third element from an indexed data structure.
(trim-prefix prefix str) -Trim the specified prefix of a string if it has oneCommunity Examples
(trim-suffix suffix str) +Trim the specified prefix of a string if it has one
(trim-suffix suffix str) -Trim the specified suffix of a string if it has oneCommunity Examples
(until cnd & body) Repeat `body` while the `cnd` is false. -Equivalent to (while (not cnd) ;body).Community Examples
(vars & bindings) -Defines many variables as in let `bindings`, but without creating new scope.Community Examples
msg/make-proto msg/make-recv msg/make-send
(make-proto stream &opt pack unpack) -Create both a send an recv function from a stream, as with `make-send` and `make-recv`.Community Examples
(make-recv stream &opt unpack) +Create both a send an recv function from a stream, as with `make-send` and `make-recv`.
(make-recv stream &opt unpack) -Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.Community Examples
(make-send stream &opt pack) +Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.
(make-send stream &opt pack) -Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.Community Examples
netrepl/client netrepl/default-host netrepl/default-port netrepl/server netrepl/server-single
(client &opt host port name) -Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".Community Examples
(server &opt host port env cleanup welcome-msg) +Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".
(server &opt host port env cleanup welcome-msg) -Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.Community Examples
(server-single &opt host port env cleanup welcome-msg) +Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.
(server-single &opt host port env cleanup welcome-msg) -Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.Community Examples
path/abspath path/abspath? path/basename path/delim path/dirname path/ext path/join path/normalize path/parts path/posix/abspath path/posix/abspath? path/posix/basename path/posix/delim path/posix/dirname path/posix/ext path/posix/join path/posix/normalize path/posix/parts path/posix/relpath path/posix/sep path/relpath path/sep path/win32/abspath path/win32/abspath? path/win32/basename path/win32/delim path/win32/dirname path/win32/ext path/win32/join path/win32/normalize path/win32/parts path/win32/relpath path/win32/sep
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(posix/relpath source target) +Get the relative path between two subpaths.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(win32/abspath path) +Get the relative path between two subpaths.
(win32/abspath path) -Coerce a path to be absolute.Community Examples
(win32/abspath? path) -Check if a path is absolute.Community Examples
(win32/basename path) -Gets the base file name of a path.Community Examples
(win32/dirname path) -Gets the directory name of a path.Community Examples
(win32/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(win32/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(win32/relpath source target) -Get the relative path between two subpaths.Community Examples
rawterm/begin rawterm/buffer-traverse rawterm/ctrl-z rawterm/end rawterm/getch rawterm/isatty rawterm/monowidth rawterm/rune-monowidth rawterm/size rawterm/slice-monowidth
(rawterm/begin &opt on-winch) -Begin raw terminal functionality. Return a stream that can be read from to get input.Community Examples
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) +Begin raw terminal functionality. Return a stream that can be read from to get input.
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) -Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.Community Examples
(rawterm/ctrl-z) +Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.
(rawterm/ctrl-z) -A handler that a user can use to handle ctrl-z from input to suspend the current process.Community Examples
(rawterm/end) +A handler that a user can use to handle ctrl-z from input to suspend the current process.
(rawterm/getch &opt into) -Get a byte of input from stdin, without blocking if possible. Returns a buffer.Community Examples
(rawterm/isatty) +Get a byte of input from stdin, without blocking if possible. Returns a buffer.
(rawterm/isatty) -Check if the current stdin is a tty.Community Examples
(rawterm/monowidth bytes &opt start-index end-index) +Check if the current stdin is a tty.
(rawterm/monowidth bytes &opt start-index end-index) -Measure the monospace width of a string.Community Examples
(rawterm/rune-monowidth rune) +Measure the monospace width of a string.
(rawterm/rune-monowidth rune) -Get the monospace width of a rune. Returns either 0, 1, or 2.Community Examples
(rawterm/size) +Get the monospace width of a rune. Returns either 0, 1, or 2.
(rawterm/size) -Get the number of rows and columns visible in the terminal as tuple [rows cols]Community Examples
(rawterm/slice-monowidth bytes columns &opt start-index into) +Get the number of rows and columns visible in the terminal as tuple [rows cols]
(rawterm/slice-monowidth bytes columns &opt start-index into) -Get a byte slice that will fit into a number of columns.Community Examples
regex/compile regex/find regex/find-all regex/match regex/peg regex/replace regex/replace-all regex/source
(compile pattern) -Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.Community Examples
(find reg text &opt start) +Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.
(find reg text &opt start) -Similar to peg/find, but for regexes.Community Examples
(find-all reg text &opt start) +Similar to peg/find, but for regexes.
(find-all reg text &opt start) -Similar to peg/find-all, but for regexes.Community Examples
(match reg text &opt start) -Similar to peg/match, but for regexes.Community Examples
Peg used to generate peg source code from a regular expression string.Community Examples
(replace reg rep text &opt start) +Similar to peg/match, but for regexes.
(replace reg rep text &opt start) -Similar to peg/replace, but for regexes.Community Examples
(replace-all reg rep text &opt start) +Similar to peg/replace, but for regexes.
(replace-all reg rep text &opt start) -Similar to peg/replace-all, but for regexes.Community Examples
(source pattern) -Compile a subset of regex to PEG source code.Community Examples
rpc/client rpc/default-host rpc/default-port rpc/server
(client &opt host port name) -Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.Community Examples
(server functions &opt host port workers-per-connection) +Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.
(server functions &opt host port workers-per-connection) -Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.Community Examples
schema/make-predicate schema/make-validator schema/predicate schema/validator
(make-predicate schema) -Generate a function that can be used to validate a data structure. This is the function form of `predicate`.Community Examples
(make-validator schema) +Generate a function that can be used to validate a data structure. This is the function form of `predicate`.
(make-validator schema) -Generate a function that can be used to validate a data structure. This is the function form of `validator`.Community Examples
(predicate pattern) +Generate a function that can be used to validate a data structure. This is the function form of `validator`.
(predicate pattern) -Make a validation predicate given a certain schema.Community Examples
(validator pattern) +Make a validation predicate given a certain schema.
(validator pattern) -Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.Community Examples
sh/copy sh/copy-file sh/create-dirs sh/devnull sh/escape sh/exec sh/exec-fail sh/exec-slurp sh/exec-slurp-all sh/exists? sh/list-all-files sh/make-new-file sh/rm sh/scan-directory sh/split
(copy src dest) Copy a file or directory recursively from one location to another. -Expects input to be unix style pathsCommunity Examples
(copy-file src-path dst-path) -Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.Community Examples
(create-dirs dir-path) +Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.
(create-dirs dir-path) -Create all directories in path specified as string including itself.Community Examples
(devnull) +Create all directories in path specified as string including itself.
(devnull) -get the /dev/null equivalent of the current platform as an open fileCommunity Examples
(escape & args) +get the /dev/null equivalent of the current platform as an open file
(escape & args) -Output a string with all arguments correctly quotedCommunity Examples
(exec & args) -Execute command specified by args returning it's exit codeCommunity Examples
(exec-fail & args) +Execute command specified by args returning it's exit code
(exec-fail & args) -Execute command specified by args, fails when command exits with non-zero exit codeCommunity Examples
(exec-slurp & args) +Execute command specified by args, fails when command exits with non-zero exit code
(exec-slurp & args) -Read stdout of command specified by args and return it trimmed in a string.Community Examples
(exec-slurp-all & args) +Read stdout of command specified by args and return it trimmed in a string.
(exec-slurp-all & args) Read stdout and stderr of subprocess and return it trimmed in a struct with :err and :out containing the output as string. -This will also return the exit code under the :status key.Community Examples
(exists? path) +This will also return the exit code under the :status key.
(exists? path) -Check if the given file or directory exists. (Follows symlinks)Community Examples
(list-all-files dir &opt into) +Check if the given file or directory exists. (Follows symlinks)
(list-all-files dir &opt into) -List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.Community Examples
(make-new-file file-path &opt mode) +List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.
(make-new-file file-path &opt mode) -Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).Community Examples
(rm path) +Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).
(rm path) -Remove a directory and all sub directories recursively.Community Examples
(scan-directory dir func) +Remove a directory and all sub directories recursively.
(scan-directory dir func) -Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.Community Examples
(split s) +Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.
(split s) -Split a string into 'sh like' tokens, returns nil if unable to parse the string.Community Examples
tarray/buffer tarray/copy-bytes tarray/length tarray/new tarray/properties tarray/slice tarray/swap-bytes
(tarray/buffer array|size) -Return typed array buffer or create a new buffer.Community Examples
(tarray/copy-bytes src sindex dst dindex &opt count) +Return typed array buffer or create a new buffer.
(tarray/copy-bytes src sindex dst dindex &opt count) -Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.Community Examples
(tarray/length array|buffer) +Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.
(tarray/length array|buffer) -Return typed array or buffer size.Community Examples
(tarray/new type size &opt stride offset tarray|buffer) +Return typed array or buffer size.
(tarray/new type size &opt stride offset tarray|buffer) -Create new typed array.Community Examples
(tarray/properties array) +Create new typed array.
(tarray/properties array) -Return typed array properties as a struct.Community Examples
(tarray/slice tarr &opt start end) +Return typed array properties as a struct.
(tarray/slice tarr &opt start end) -Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.Community Examples
(tarray/swap-bytes src sindex dst dindex &opt count) +Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.
(tarray/swap-bytes src sindex dst dindex &opt count) -Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.Community Examples
test/assert test/assert-docs test/assert-error test/assert-no-error test/assert-not test/capture-stderr test/capture-stdout test/end-suite test/start-suite test/suppress-stderr test/suppress-stdout test/timeit test/timeit-loop
(assert x &opt e) -Override's the default assert with some nice error handling.Community Examples
(assert-docs path) +Override's the default assert with some nice error handling.
(assert-docs path) Assert that all symbols, when module on the path is required, -have proper doc stringCommunity Examples
(assert-error msg & forms) -Test passes if forms error.Community Examples
(assert-no-error msg & forms) -Test passes if forms do not error.Community Examples
(capture-stderr & body) Runs the form and captures stderr. Returns tuple with result of the form -and a string with captured stderr.Community Examples
(capture-stdout & body) Runs the form and captures stdout. Returns tuple with result of the form -and a string with captured stdout.Community Examples
(end-suite) -Ends test suite, prints summary and exits if any have failed.Community Examples
(start-suite &opt name) +Ends test suite, prints summary and exits if any have failed.
(suppress-stderr & body) -Suppreses stdout from the bodyCommunity Examples
(suppress-stdout & body) -Suppreses stdout from the bodyCommunity Examples
(timeit form &opt tag) Time the execution of `form` using `os/clock` before and after, and print the result to stdout. returns: result of executing `form`. -Uses `tag` (default "Elapsed time:") to tag the printout.Community Examples
(timeit-loop head & body) +Uses `tag` (default "Elapsed time:") to tag the printout.
(timeit-loop head & body) Similar to `loop`, but outputs performance statistics after completion. Additionally defines a `:timeout` verb to iterate continuously for a given number of seconds. If the first form of `body` is a bytes, it will be taken -as a custom tag.Community Examples
zip/add-bytes zip/add-file zip/compress zip/decompress zip/extract zip/file-directory? zip/file-encrypted? zip/file-supported? zip/get-filename zip/locate-file zip/read-bytes zip/read-file zip/reader-close zip/reader-count zip/stat zip/version zip/write-buffer zip/write-file zip/writer-close zip/writer-finalize
(zip/add-bytes writer path data &opt comment flags) -Add a byte sequence to the zip writer.Community Examples
(zip/add-file writer path filename &opt comment flags) +Add a byte sequence to the zip writer.
(zip/add-file writer path filename &opt comment flags) -Add a file to the zip writer.Community Examples
(zip/compress bytes &opt level into) -Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.Community Examples
(zip/decompress bytes &opt into) +Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.
(zip/decompress bytes &opt into) -Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.Community Examples
(zip/extract reader idx-or-filename &opt into flags) +Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.
(zip/extract reader idx-or-filename &opt into flags) -Extract a file from the zip archive, either to memory or to a file on disk.Community Examples
(zip/file-directory? reader idx) +Extract a file from the zip archive, either to memory or to a file on disk.
(zip/file-directory? reader idx) -Check if a file index is a directory.Community Examples
(zip/file-encrypted? reader idx) +Check if a file index is a directory.
(zip/file-encrypted? reader idx) -Check if a file is encrypted inside an archive.Community Examples
(zip/file-supported? reader idx) +Check if a file is encrypted inside an archive.
(zip/file-supported? reader idx) -Check if a file is supported with this verstion of miniz.Community Examples
(zip/get-filename reader idx) +Check if a file is supported with this verstion of miniz.
(zip/get-filename reader idx) -Convert a file index index in the archive to a filename.Community Examples
(zip/locate-file reader path &opt comment flags) +Convert a file index index in the archive to a filename.
(zip/locate-file reader path &opt comment flags) -Get the index of a particular filename in the archive.Community Examples
(zip/read-bytes bytes &opt flags) +Get the index of a particular filename in the archive.
(zip/read-bytes bytes &opt flags) -Read a byte sequence as a zip archive. Returns a new zip reader.Community Examples
(zip/read-file filename &opt flags) +Read a byte sequence as a zip archive. Returns a new zip reader.
(zip/read-file filename &opt flags) -Read a file as a zip archive. Returns a new zip reader.Community Examples
(zip/reader-close reader) +Read a file as a zip archive. Returns a new zip reader.
(zip/reader-close reader) -Close a reader and free related memory.Community Examples
(zip/reader-count reader) +Close a reader and free related memory.
(zip/reader-count reader) -Get the number of files inside the zip archive. The files can be indexedCommunity Examples
(zip/stat reader idx) +Get the number of files inside the zip archive. The files can be indexed
(zip/stat reader idx) Get stat information of file. Returns a new struct with the following fields: @@ -163,17 +163,17 @@Community ExamplesIndex * :comment * :internal-attr * :external-attr -
(zip/version) -Get the version string of the underlying miniz library.Community Examples
(zip/write-buffer) +Get the version string of the underlying miniz library.
(zip/write-buffer) -Create a new zip archive writer that write to memory.Community Examples
(zip/write-file dest-path) +Create a new zip archive writer that write to memory.
(zip/write-file dest-path) -Create a new zip archive writer that will write into an archive file.Community Examples
(zip/writer-close writer) +Create a new zip archive writer that will write into an archive file.
(zip/writer-finalizer writer) -Finalize a writer, writing any zip files to disk. Return the writer.Community Examples
cc/archive-c cc/compile-c cc/create-buffer-c cc/create-buffer-c-impl cc/create-executable cc/embed-name cc/entry-name cc/entry-replace cc/link-c cc/make-bin-source cc/make-define cc/make-defines cc/modpath-to-meta cc/modpath-to-static cc/out-path
(archive-c opts target & objects) -Link object files together to make a static library.Community Examples
(compile-c compiler opts src dest &opt static?) +Link object files together to make a static library.
(compile-c compiler opts src dest &opt static?) -Compile a C file into an object file.Community Examples
(create-buffer-c source dest name) +Compile a C file into an object file.
(create-buffer-c source dest name) -Inline raw byte file as a c file.Community Examples
(create-buffer-c-impl bytes dest name) +Inline raw byte file as a c file.
(create-executable opts source dest no-core) -Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.Community Examples
(embed-name path) +Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.
(embed-name path) -Rename a janet symbol for embedding.Community Examples
(entry-name name) -Name of symbol that enters static compilation of a module.Community Examples
(entry-replace name) +Name of symbol that enters static compilation of a module.
(entry-replace name) -Escape special characters in the entry-nameCommunity Examples
(link-c has-cpp opts target & objects) +Escape special characters in the entry-name
(link-c has-cpp opts target & objects) -Link C or C++ object files together to make a native module.Community Examples
(make-bin-source declarations lookup-into-invocations no-core) +Link C or C++ object files together to make a native module.
(make-bin-source declarations lookup-into-invocations no-core) -Community Examples
(make-define define value) -Generate strings for adding custom defines to the compiler.Community Examples
(make-defines defines) +Generate strings for adding custom defines to the compiler.
(make-defines defines) -Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.Community Examples
(modpath-to-meta path) +Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.
(modpath-to-meta path) -Get the meta file path (.meta.janet) corresponding to a native module path (.so).Community Examples
(modpath-to-static path) +Get the meta file path (.meta.janet) corresponding to a native module path (.so).
(modpath-to-static path) -Get the static library (.a) path corresponding to a native module path (.so).Community Examples
(out-path path from-ext to-ext) +Get the static library (.a) path corresponding to a native module path (.so).
(out-path path from-ext to-ext) -Take a source file path and convert it to an output path.Community Examples
cgen/add-loader cgen/ir cgen/mangle cgen/print-ir
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(ir & body) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(ir & body) -Macro that automatically quotes the body provided and calls (print-ir ...) on the body.Community Examples
(mangle token) +Macro that automatically quotes the body provided and calls (print-ir ...) on the body.
(mangle token) -Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.Community Examples
(print-ir ir) +Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.
(print-ir ir) -Compile the CGEN IR to C and print it to (dyn :out).Community Examples
cli/jpm cli/main cli/run cli/setup
(jpm & argv) -A Macro User Interface for jpm to be used from a repl in a way similar to the command line.Community Examples
(main & argv) +A Macro User Interface for jpm to be used from a repl in a way similar to the command line.
(setup args) Load configuration from the command line, environment variables, and configuration files. Returns array of non-configuration arguments as well. @@ -134,7 +134,7 @@Community ExamplesIndex 1. Commmand line settings 2. The value of `(dyn :jpm-config)` 3. Environment variables - 4. Config file settings (default-config if non specified)
commands/build commands/clean commands/configure commands/deps commands/enable-local-mode commands/help commands/install commands/jpm-debug-repl commands/list-installed commands/list-pkgs commands/list-rules commands/list-tasks commands/new-c-project commands/new-exe-project commands/new-project commands/quickbin commands/set-tree commands/show-config commands/show-paths commands/show-rule-tree commands/test commands/update-pkgs
(configure &opt path) -Setup an out-of-tree build with certain configuration options.Community Examples
(deps) +Setup an out-of-tree build with certain configuration options.
(enable-local-mode) -Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/Community Examples
(help) +Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/
(new-c-project name) -Create a new C projectCommunity Examples
(new-exe-project name) -Create a new executable projectCommunity Examples
(set-tree tree) -Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.Community Examples
(show-config) +Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.
config/builtin-configs config/config-checkers config/config-docs config/config-options config/config-parsers config/config-set config/defconf config/dyn:ar config/dyn:auto-shebang config/dyn:binpath config/dyn:build-type config/dyn:buildpath config/dyn:c++ config/dyn:c++-link config/dyn:cc config/dyn:cc-link config/dyn:cflags config/dyn:cflags-verbose config/dyn:config-file config/dyn:cppflags config/dyn:curlpath config/dyn:dest-dir config/dyn:dynamic-cflags config/dyn:dynamic-lflags config/dyn:gitpath config/dyn:headerpath config/dyn:is-msvc config/dyn:janet config/dyn:janet-cflags config/dyn:janet-importlib config/dyn:janet-lflags config/dyn:ldflags config/dyn:lflags config/dyn:libpath config/dyn:local config/dyn:manpath config/dyn:modext config/dyn:modpath config/dyn:nocolor config/dyn:offline config/dyn:optimize config/dyn:pkglist config/dyn:silent config/dyn:statext config/dyn:tarpath config/dyn:test config/dyn:tree config/dyn:update-pkgs config/dyn:use-batch-shell config/dyn:verbose config/dyn:workers config/load-config config/load-config-file config/load-default config/load-options config/opt config/read-env-variables config/save-config config/shorthand-mapping
Table of all built-in options, as opposed to project deifned options.Community Examples
A table of all of the dynamic config bindings to checkers (validators).Community Examples
Table of all of the help text for each config option.Community Examples
A table of possible options for enum option types.Community Examples
A table of all of the dynamic config bindings to parsers.Community Examples
(defconf kw &opt parser docs options) +config/builtin-configs config/config-checkers config/config-docs config/config-options config/config-parsers config/config-set config/defconf config/dyn:ar config/dyn:auto-shebang config/dyn:binpath config/dyn:build-type config/dyn:buildpath config/dyn:c++ config/dyn:c++-link config/dyn:cc config/dyn:cc-link config/dyn:cflags config/dyn:cflags-verbose config/dyn:config-file config/dyn:cppflags config/dyn:curlpath config/dyn:dest-dir config/dyn:dynamic-cflags config/dyn:dynamic-lflags config/dyn:gitpath config/dyn:headerpath config/dyn:is-msvc config/dyn:janet config/dyn:janet-cflags config/dyn:janet-importlib config/dyn:janet-lflags config/dyn:ldflags config/dyn:lflags config/dyn:libpath config/dyn:local config/dyn:manpath config/dyn:modext config/dyn:modpath config/dyn:nocolor config/dyn:offline config/dyn:optimize config/dyn:pkglist config/dyn:silent config/dyn:statext config/dyn:tarpath config/dyn:test config/dyn:tree config/dyn:update-pkgs config/dyn:use-batch-shell config/dyn:verbose config/dyn:workers config/load-config config/load-config-file config/load-default config/load-options config/opt config/read-env-variables config/save-config config/shorthand-mapping
config/builtin-configs table sourceTable of all built-in options, as opposed to project deifned options.config/config-checkers table sourceA table of all of the dynamic config bindings to checkers (validators).config/defconf macro source(defconf kw &opt parser docs options) -Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.Community Examplesconfig/dyn:ar function source(dyn:ar &opt dflt) +Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.config/load-config function source(load-config settings &opt override) -Load a configuration from a table or struct.Community Examplesconfig/load-config-file function source(load-config-file path &opt override) +Load a configuration from a table or struct.config/load-config-file function source(load-config-file path &opt override) -Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.Community Examplesconfig/load-default function source(load-default &opt override) +Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.config/load-default function source(load-default &opt override) -Load the default configuration.Community Examplesconfig/load-options function source(load-options &opt path) -Load a file that contains config options that can be set. If no such file exists, then do nothing.Community Examplesconfig/opt function source(opt opts key &opt dflt) +Load a file that contains config options that can be set. If no such file exists, then do nothing.config/opt function source(opt opts key &opt dflt) -Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.Community Examplesconfig/read-env-variables function source(read-env-variables) +Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.config/read-env-variables function source(read-env-variables) -Read environment variables that correspond to config variables into dyns.Community Examplesconfig/save-config function source(save-config path) +Read environment variables that correspond to config variables into dyns.config/save-config function source(save-config path) -Write the current configuration information to a file.Community Examplesconfig/shorthand-mapping struct source+Write the current configuration information to a file.Map some single characters to long options.Community Examples
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.
(pmap f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.Community Examples
jpm/cc/archive-c jpm/cc/compile-c jpm/cc/create-buffer-c jpm/cc/create-buffer-c-impl jpm/cc/create-executable jpm/cc/embed-name jpm/cc/entry-name jpm/cc/entry-replace jpm/cc/link-c jpm/cc/make-bin-source jpm/cc/make-define jpm/cc/make-defines jpm/cc/modpath-to-meta jpm/cc/modpath-to-static jpm/cc/out-path jpm/cgen/add-loader jpm/cgen/ir jpm/cgen/mangle jpm/cgen/print-ir jpm/commands/build jpm/commands/clean jpm/commands/configure jpm/commands/deps jpm/commands/enable-local-mode jpm/commands/help jpm/commands/install jpm/commands/jpm-debug-repl jpm/commands/list-installed jpm/commands/list-pkgs jpm/commands/list-rules jpm/commands/list-tasks jpm/commands/new-c-project jpm/commands/new-exe-project jpm/commands/new-project jpm/commands/quickbin jpm/commands/set-tree jpm/commands/show-config jpm/commands/show-paths jpm/commands/show-rule-tree jpm/commands/test jpm/commands/update-pkgs jpm/config/builtin-configs jpm/config/config-checkers jpm/config/config-docs jpm/config/config-options jpm/config/config-parsers jpm/config/config-set jpm/config/defconf jpm/config/dyn:ar jpm/config/dyn:auto-shebang jpm/config/dyn:binpath jpm/config/dyn:build-type jpm/config/dyn:buildpath jpm/config/dyn:c++ jpm/config/dyn:c++-link jpm/config/dyn:cc jpm/config/dyn:cc-link jpm/config/dyn:cflags jpm/config/dyn:cflags-verbose jpm/config/dyn:config-file jpm/config/dyn:cppflags jpm/config/dyn:curlpath jpm/config/dyn:dest-dir jpm/config/dyn:dynamic-cflags jpm/config/dyn:dynamic-lflags jpm/config/dyn:gitpath jpm/config/dyn:headerpath jpm/config/dyn:is-msvc jpm/config/dyn:janet jpm/config/dyn:janet-cflags jpm/config/dyn:janet-importlib jpm/config/dyn:janet-lflags jpm/config/dyn:ldflags jpm/config/dyn:lflags jpm/config/dyn:libpath jpm/config/dyn:local jpm/config/dyn:manpath jpm/config/dyn:modext jpm/config/dyn:modpath jpm/config/dyn:nocolor jpm/config/dyn:offline jpm/config/dyn:optimize jpm/config/dyn:pkglist jpm/config/dyn:silent jpm/config/dyn:statext jpm/config/dyn:tarpath jpm/config/dyn:test jpm/config/dyn:tree jpm/config/dyn:update-pkgs jpm/config/dyn:use-batch-shell jpm/config/dyn:verbose jpm/config/dyn:workers jpm/config/load-config jpm/config/load-config-file jpm/config/load-default jpm/config/load-options jpm/config/opt jpm/config/read-env-variables jpm/config/save-config jpm/config/shorthand-mapping jpm/dagbuild/pdag jpm/dagbuild/pmap jpm/make-config/auto jpm/make-config/generate-config jpm/pm/bundle-install jpm/pm/curl jpm/pm/do-rule jpm/pm/download-bundle jpm/pm/download-git-bundle jpm/pm/download-tar-bundle jpm/pm/git jpm/pm/import-rules jpm/pm/is-bundle-installed jpm/pm/load-lockfile jpm/pm/load-project-meta jpm/pm/make-jpm-env jpm/pm/make-lockfile jpm/pm/out-of-tree-config jpm/pm/post-deps jpm/pm/require-jpm jpm/pm/resolve-bundle jpm/pm/tar jpm/pm/update-git-bundle jpm/pm/update-installed jpm/rules/add-body jpm/rules/add-dep jpm/rules/add-input jpm/rules/add-output jpm/rules/add-thunk jpm/rules/build-rules jpm/rules/getrules jpm/rules/phony jpm/rules/rule jpm/rules/sh-phony jpm/rules/sh-rule jpm/rules/sh-task jpm/rules/task jpm/scaffold/scaffold-project jpm/shutil/abspath jpm/shutil/basename jpm/shutil/clear-cache jpm/shutil/clear-manifest jpm/shutil/clexe-shell jpm/shutil/color jpm/shutil/copy jpm/shutil/copyfile jpm/shutil/create-dirs jpm/shutil/devnull jpm/shutil/dirname jpm/shutil/do-monkeypatch jpm/shutil/drop1-shell jpm/shutil/exec-slurp jpm/shutil/filepath-replace jpm/shutil/find-build-dir jpm/shutil/find-cache jpm/shutil/find-manifest jpm/shutil/find-manifest-dir jpm/shutil/is-mingw jpm/shutil/is-win jpm/shutil/is-win-or-mingw jpm/shutil/path-splitter jpm/shutil/rimraf jpm/shutil/rm jpm/shutil/run-patched jpm/shutil/run-repl jpm/shutil/run-script jpm/shutil/shell jpm/shutil/undo-monkeypatch
(archive-c opts target & objects) -Link object files together to make a static library.Community Examples
(compile-c compiler opts src dest &opt static?) +Link object files together to make a static library.
(compile-c compiler opts src dest &opt static?) -Compile a C file into an object file.Community Examples
(create-buffer-c source dest name) +Compile a C file into an object file.
(create-buffer-c source dest name) -Inline raw byte file as a c file.Community Examples
(create-buffer-c-impl bytes dest name) +Inline raw byte file as a c file.
(create-buffer-c-impl bytes dest name) -Community Examples
(create-executable opts source dest no-core) -Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.Community Examples
(embed-name path) +Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.
(embed-name path) -Rename a janet symbol for embedding.Community Examples
(entry-name name) -Name of symbol that enters static compilation of a module.Community Examples
(entry-replace name) +Name of symbol that enters static compilation of a module.
(entry-replace name) -Escape special characters in the entry-nameCommunity Examples
(link-c has-cpp opts target & objects) +Escape special characters in the entry-name
(link-c has-cpp opts target & objects) -Link C or C++ object files together to make a native module.Community Examples
(make-bin-source declarations lookup-into-invocations no-core) +Link C or C++ object files together to make a native module.
(make-bin-source declarations lookup-into-invocations no-core) -Community Examples
(make-define define value) -Generate strings for adding custom defines to the compiler.Community Examples
(make-defines defines) +Generate strings for adding custom defines to the compiler.
(make-defines defines) -Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.Community Examples
(modpath-to-meta path) +Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.
(modpath-to-meta path) -Get the meta file path (.meta.janet) corresponding to a native module path (.so).Community Examples
(modpath-to-static path) +Get the meta file path (.meta.janet) corresponding to a native module path (.so).
(modpath-to-static path) -Get the static library (.a) path corresponding to a native module path (.so).Community Examples
(out-path path from-ext to-ext) +Get the static library (.a) path corresponding to a native module path (.so).
(out-path path from-ext to-ext) -Take a source file path and convert it to an output path.Community Examples
(add-loader) +Take a source file path and convert it to an output path.
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(ir & body) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(ir & body) -Macro that automatically quotes the body provided and calls (print-ir ...) on the body.Community Examples
(mangle token) +Macro that automatically quotes the body provided and calls (print-ir ...) on the body.
(mangle token) -Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.Community Examples
(print-ir ir) +Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.
(print-ir ir) -Compile the CGEN IR to C and print it to (dyn :out).Community Examples
(configure &opt path) -Setup an out-of-tree build with certain configuration options.Community Examples
(deps) +Setup an out-of-tree build with certain configuration options.
(enable-local-mode) -Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/Community Examples
(help) +Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/
(new-c-project name) -Create a new C projectCommunity Examples
(new-exe-project name) -Create a new executable projectCommunity Examples
(set-tree tree) -Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.Community Examples
(show-config) +Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.
Table of all built-in options, as opposed to project deifned options.Community Examples
A table of all of the dynamic config bindings to checkers (validators).Community Examples
Table of all of the help text for each config option.Community Examples
A table of possible options for enum option types.Community Examples
A table of all of the dynamic config bindings to parsers.Community Examples
Table of all built-in options, as opposed to project deifned options.
A table of all of the dynamic config bindings to checkers (validators).
(defconf kw &opt parser docs options) -Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.Community Examples
(dyn:ar &opt dflt) +Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.
(load-config settings &opt override) -Load a configuration from a table or struct.Community Examples
(load-config-file path &opt override) +Load a configuration from a table or struct.
(load-config-file path &opt override) -Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.Community Examples
(load-default &opt override) +Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.
(load-default &opt override) -Load the default configuration.Community Examples
(load-options &opt path) -Load a file that contains config options that can be set. If no such file exists, then do nothing.Community Examples
(opt opts key &opt dflt) +Load a file that contains config options that can be set. If no such file exists, then do nothing.
(opt opts key &opt dflt) -Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.Community Examples
(read-env-variables) +Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.
(read-env-variables) -Read environment variables that correspond to config variables into dyns.Community Examples
(save-config path) +Read environment variables that correspond to config variables into dyns.
(save-config path) -Write the current configuration information to a file.Community Examples
Map some single characters to long options.Community Examples
(pdag f dag &opt n-workers) +Write the current configuration information to a file.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.
(pmap f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.Community Examples
(auto) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.
(generate-config &opt destdir silent as-data) +Get an autodetected config.
(generate-config &opt destdir silent as-data) -Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.Community Examples
(bundle-install bundle &opt no-deps force-update) +Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.
(bundle-install bundle &opt no-deps force-update) -Install a bundle from a git repository.Community Examples
(do-rule target) -Evaluate a given rule in a one-off manner.Community Examples
(download-bundle url bundle-type &opt tag shallow) +Evaluate a given rule in a one-off manner.
(download-bundle url bundle-type &opt tag shallow) -Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.Community Examples
(download-git-bundle bundle-dir url tag shallow) +Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.
(download-git-bundle bundle-dir url tag shallow) -Download a git bundle from a remote respositoryCommunity Examples
(download-tar-bundle bundle-dir url &opt force-gz) +Download a git bundle from a remote respository
(download-tar-bundle bundle-dir url &opt force-gz) -Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.Community Examples
(git & args) +Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.
(import-rules path &opt base-env) -Import another file that defines more rules. This ruleset is merged into the current ruleset.Community Examples
(is-bundle-installed bundle) +Import another file that defines more rules. This ruleset is merged into the current ruleset.
(is-bundle-installed bundle) -Determines if a bundle has been installed or notCommunity Examples
(load-lockfile &opt filename) +Determines if a bundle has been installed or not
(load-lockfile &opt filename) -Load packages from a lockfile.Community Examples
(load-project-meta &opt path) +Load packages from a lockfile.
(load-project-meta &opt path) -Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.Community Examples
(make-jpm-env &opt base-env) +Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.
(make-jpm-env &opt base-env) -Create an environment that is preloaded with jpm symbols.Community Examples
(make-lockfile &opt filename) +Create an environment that is preloaded with jpm symbols.
(out-of-tree-config path &opt options) -Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.Community Examples
(post-deps & body) +Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.
(post-deps & body) -Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.Community Examples
(require-jpm path &opt base-env) +Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.
(require-jpm path &opt base-env) -Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.Community Examples
(resolve-bundle bundle) +Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.
(resolve-bundle bundle) -Convert any bundle string/table to the normalized table form.Community Examples
(tar & args) +Convert any bundle string/table to the normalized table form.
(update-git-bundle bundle-dir tag shallow) +Make a call to tar.
(update-git-bundle bundle-dir tag shallow) -Fetch latest tag version from remote repositoryCommunity Examples
(update-installed) +Fetch latest tag version from remote repository
(update-installed) -Update all previously installed packages to their latest versions.Community Examples
(add-body target & body) +Update all previously installed packages to their latest versions.
(add-body target & body) -Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.Community Examples
(add-dep target dep) +Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.
(add-input target input) -Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.Community Examples
(add-output target output) +Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.
(add-output target output) -Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.Community Examples
(add-thunk target thunk) +Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.
(add-thunk target thunk) -Append a thunk to a target's recipe.Community Examples
(build-rules rules targets &opt n-workers) +Append a thunk to a target's recipe.
(build-rules rules targets &opt n-workers) -Given a graph of all rules, extract a work graph that will build out-of-date files.Community Examples
(getrules) +Given a graph of all rules, extract a work graph that will build out-of-date files.
(rule target deps & body) -Add a rule to the rule graph.Community Examples
(sh-phony target deps & body) -Alias for `sh-task`.Community Examples
(sh-rule target deps & body) -Add a rule that invokes a shell command, and fails if the command returns non-zero.Community Examples
(sh-task target deps & body) +Add a rule that invokes a shell command, and fails if the command returns non-zero.
(sh-task target deps & body) -Add a task that invokes a shell command, and fails if the command returns non-zero.Community Examples
(task target deps & body) +Add a task that invokes a shell command, and fails if the command returns non-zero.
(task target deps & body) -Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).Community Examples
(scaffold-project name &opt options) +Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).
(scaffold-project name &opt options) -Generate a standardized project scaffold.Community Examples
(abspath path) -Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).Community Examples
(basename path) +Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).
(basename path) -Get the filename of a path without any leading directory components.Community Examples
(clear-cache) +Get the filename of a path without any leading directory components.
(clear-manifest) -Clear the global installation manifest.Community Examples
(clexe-shell & args) +Clear the global installation manifest.
(color input-color text) -Color text with ascii escape sequences if (os/isatty)Community Examples
(copy src dest) +Color text with ascii escape sequences if (os/isatty)
(copy src dest) -Copy a file or directory recursively from one location to another.Community Examples
(copyfile src dest) +Copy a file or directory recursively from one location to another.
(copyfile src dest) -Copy a file one location to another.Community Examples
(create-dirs dest) -Create all directories needed for a file (mkdir -p).Community Examples
(dirname path) -Get the directory of a file without the filename.Community Examples
(do-monkeypatch build-dir) +Get the directory of a file without the filename.
(do-monkeypatch build-dir) -Modify the existing environment to have the same paths as the test environment.Community Examples
(drop1-shell std args) +Modify the existing environment to have the same paths as the test environment.
(drop1-shell std args) -Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.Community Examples
(exec-slurp & args) +Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.
(exec-slurp & args) -Read stdout of subprocess and return it trimmed in a string.Community Examples
(filepath-replace repo) +Read stdout of subprocess and return it trimmed in a string.
(filepath-replace repo) -Remove special characters from a string or path to make it into a path segment.Community Examples
(find-build-dir) +Remove special characters from a string or path to make it into a path segment.
(find-build-dir) -Gets the build directory to output files to.Community Examples
(find-cache) -Return the path to the global cache.Community Examples
(find-manifest name) -Get the full path of a manifest file given a package name.Community Examples
(find-manifest-dir) +Get the full path of a manifest file given a package name.
(find-manifest-dir) -Get the path to the directory containing manifests for installed packages.Community Examples
(is-mingw) +Get the path to the directory containing manifests for installed packages.
(is-win) -Check if we should assume a DOS-like shell or default to posix shell.Community Examples
(is-win-or-mingw) +Check if we should assume a DOS-like shell or default to posix shell.
(is-win-or-mingw) -Check if built with mingwCommunity Examples
(rm path) -Remove a directory and all sub directories.Community Examples
(run-patched & extra-args) +Remove a directory and all sub directories.
(run-patched & extra-args) -Run a subprocess Janet repl that has the same environment as the test environment.Community Examples
(run-repl) +Run a subprocess Janet repl that has the same environment as the test environment.
(run-repl) -Run a repl in the monkey patched test environmentCommunity Examples
(run-script path) +Run a repl in the monkey patched test environment
(run-script path) -Run a local script in the monkey patched environment.Community Examples
(shell & args) +Run a local script in the monkey patched environment.
make-config/auto make-config/generate-config
(generate-config &opt destdir silent as-data) +Get an autodetected config.
(generate-config &opt destdir silent as-data) -Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.Community Examples
pm/bundle-install pm/curl pm/do-rule pm/download-bundle pm/download-git-bundle pm/download-tar-bundle pm/git pm/import-rules pm/is-bundle-installed pm/load-lockfile pm/load-project-meta pm/make-jpm-env pm/make-lockfile pm/out-of-tree-config pm/post-deps pm/require-jpm pm/resolve-bundle pm/tar pm/update-git-bundle pm/update-installed
(bundle-install bundle &opt no-deps force-update) -Install a bundle from a git repository.Community Examples
(do-rule target) -Evaluate a given rule in a one-off manner.Community Examples
(download-bundle url bundle-type &opt tag shallow) +Evaluate a given rule in a one-off manner.
(download-bundle url bundle-type &opt tag shallow) -Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.Community Examples
(download-git-bundle bundle-dir url tag shallow) +Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.
(download-git-bundle bundle-dir url tag shallow) -Download a git bundle from a remote respositoryCommunity Examples
(download-tar-bundle bundle-dir url &opt force-gz) +Download a git bundle from a remote respository
(download-tar-bundle bundle-dir url &opt force-gz) -Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.Community Examples
(git & args) +Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.
(import-rules path &opt base-env) -Import another file that defines more rules. This ruleset is merged into the current ruleset.Community Examples
(is-bundle-installed bundle) +Import another file that defines more rules. This ruleset is merged into the current ruleset.
(is-bundle-installed bundle) -Determines if a bundle has been installed or notCommunity Examples
(load-lockfile &opt filename) +Determines if a bundle has been installed or not
(load-lockfile &opt filename) -Load packages from a lockfile.Community Examples
(load-project-meta &opt path) -Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.Community Examples
(make-jpm-env &opt base-env) +Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.
(make-jpm-env &opt base-env) -Create an environment that is preloaded with jpm symbols.Community Examples
(make-lockfile &opt filename) +Create an environment that is preloaded with jpm symbols.
(out-of-tree-config path &opt options) -Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.Community Examples
(post-deps & body) +Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.
(post-deps & body) -Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.Community Examples
(require-jpm path &opt base-env) +Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.
(require-jpm path &opt base-env) -Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.Community Examples
(resolve-bundle bundle) +Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.
(resolve-bundle bundle) -Convert any bundle string/table to the normalized table form.Community Examples
(update-git-bundle bundle-dir tag shallow) +Make a call to tar.
(update-git-bundle bundle-dir tag shallow) -Fetch latest tag version from remote repositoryCommunity Examples
(update-installed) +Fetch latest tag version from remote repository
(update-installed) -Update all previously installed packages to their latest versions.Community Examples
rules/add-body rules/add-dep rules/add-input rules/add-output rules/add-thunk rules/build-rules rules/getrules rules/phony rules/rule rules/sh-phony rules/sh-rule rules/sh-task rules/task
(add-body target & body) -Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.Community Examples
(add-dep target dep) +Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.
(add-input target input) -Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.Community Examples
(add-output target output) +Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.
(add-output target output) -Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.Community Examples
(add-thunk target thunk) +Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.
(add-thunk target thunk) -Append a thunk to a target's recipe.Community Examples
(build-rules rules targets &opt n-workers) +Append a thunk to a target's recipe.
(build-rules rules targets &opt n-workers) -Given a graph of all rules, extract a work graph that will build out-of-date files.Community Examples
(getrules) +Given a graph of all rules, extract a work graph that will build out-of-date files.
(sh-rule target deps & body) -Add a rule that invokes a shell command, and fails if the command returns non-zero.Community Examples
(sh-task target deps & body) +Add a rule that invokes a shell command, and fails if the command returns non-zero.
(sh-task target deps & body) -Add a task that invokes a shell command, and fails if the command returns non-zero.Community Examples
(task target deps & body) +Add a task that invokes a shell command, and fails if the command returns non-zero.
(task target deps & body) -Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).Community Examples
(scaffold-project name &opt options) -Generate a standardized project scaffold.Community Examples
shutil/abspath shutil/basename shutil/clear-cache shutil/clear-manifest shutil/clexe-shell shutil/color shutil/copy shutil/copyfile shutil/create-dirs shutil/devnull shutil/dirname shutil/do-monkeypatch shutil/drop1-shell shutil/exec-slurp shutil/filepath-replace shutil/find-build-dir shutil/find-cache shutil/find-manifest shutil/find-manifest-dir shutil/is-mingw shutil/is-win shutil/is-win-or-mingw shutil/path-splitter shutil/rimraf shutil/rm shutil/run-patched shutil/run-repl shutil/run-script shutil/shell shutil/undo-monkeypatch
(abspath path) -Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).Community Examples
(basename path) +Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).
(basename path) -Get the filename of a path without any leading directory components.Community Examples
(clear-cache) +Get the filename of a path without any leading directory components.
(clear-manifest) -Clear the global installation manifest.Community Examples
(color input-color text) -Color text with ascii escape sequences if (os/isatty)Community Examples
(copy src dest) -Copy a file or directory recursively from one location to another.Community Examples
(copyfile src dest) +Copy a file or directory recursively from one location to another.
(copyfile src dest) -Copy a file one location to another.Community Examples
(create-dirs dest) -Create all directories needed for a file (mkdir -p).Community Examples
(dirname path) -Get the directory of a file without the filename.Community Examples
(do-monkeypatch build-dir) +Get the directory of a file without the filename.
(do-monkeypatch build-dir) -Modify the existing environment to have the same paths as the test environment.Community Examples
(drop1-shell std args) +Modify the existing environment to have the same paths as the test environment.
(drop1-shell std args) -Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.Community Examples
(exec-slurp & args) +Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.
(exec-slurp & args) -Read stdout of subprocess and return it trimmed in a string.Community Examples
(filepath-replace repo) +Read stdout of subprocess and return it trimmed in a string.
(filepath-replace repo) -Remove special characters from a string or path to make it into a path segment.Community Examples
(find-build-dir) +Remove special characters from a string or path to make it into a path segment.
(find-build-dir) -Gets the build directory to output files to.Community Examples
(find-cache) -Return the path to the global cache.Community Examples
(find-manifest name) -Get the full path of a manifest file given a package name.Community Examples
(find-manifest-dir) +Get the full path of a manifest file given a package name.
(find-manifest-dir) -Get the path to the directory containing manifests for installed packages.Community Examples
(is-mingw) +Get the path to the directory containing manifests for installed packages.
(is-win) -Check if we should assume a DOS-like shell or default to posix shell.Community Examples
(is-win-or-mingw) +Check if we should assume a DOS-like shell or default to posix shell.
(is-win-or-mingw) -Check if built with mingwCommunity Examples
(run-patched & extra-args) +Remove a directory and all sub directories.
(run-patched & extra-args) -Run a subprocess Janet repl that has the same environment as the test environment.Community Examples
(run-repl) +Run a subprocess Janet repl that has the same environment as the test environment.
(run-repl) -Run a repl in the monkey patched test environmentCommunity Examples
(run-script path) +Run a repl in the monkey patched test environment
(run-script path) -Run a local script in the monkey patched environment.Community Examples
(decode s) Converts a base64 encoded string to its binary representation of any format -(UTF-8, binary, ..).Community Examples
(encode s) -Converts a string of any format (UTF-8, binary, ..) to base64 encoding.Community Examples
crc/make-variant crc/named-variant
(crc/make-variant size polynomial &opt init byte-flip xorout) -Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.Community Examples
(crc/named-variant name) +Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.
(crc/named-variant name) -Get a named CRC variant.Community Examples
cron/check cron/next-timestamp cron/parse-cron
(check cron &opt time local) -Check if a given time matches a cron specifier.Community Examples
(next-timestamp cron &opt time local) +Check if a given time matches a cron specifier.
(next-timestamp cron &opt time local) -Given a cron schedule, get the next instance on the cron tab after timeCommunity Examples
(parse-cron str) +Given a cron schedule, get the next instance on the cron tab after time
(parse-cron str) -Parse a cron string into a valid cron schedule objectCommunity Examples
ev-utils/go-nursery ev-utils/join-nursery ev-utils/multithread-service ev-utils/nursery ev-utils/pcall ev-utils/pdag ev-utils/pmap ev-utils/pmap-full ev-utils/pmap-limited ev-utils/spawn-nursery ev-utils/wait-cancel
(go-nursery nurse f &opt value) -Spawn a fiber into a nursery, similar to ev/go.Community Examples
(join-nursery nurse) +Spawn a fiber into a nursery, similar to ev/go.
(join-nursery nurse) -Suspend the current fiber until the nursery is emptied.Community Examples
(multithread-service thread-main n-threads) +Suspend the current fiber until the nursery is emptied.
(multithread-service thread-main n-threads) -Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.Community Examples
(nursery) +Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.
(nursery) -Group a number of fibers into a single object for structured concurrencyCommunity Examples
(pcall f n) +Group a number of fibers into a single object for structured concurrency
(pcall f n) -Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.Community Examples
(pdag f dag &opt n-workers) +Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data &opt n-workers) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.
(pmap f data &opt n-workers) -Map `f` over data in parallel, optionally limiting parallelism to `n` workers.Community Examples
(pmap-full f data) +Map `f` over data in parallel, optionally limiting parallelism to `n` workers.
(pmap-full f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.Community Examples
(pmap-limited f data n-workers) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.
(pmap-limited f data n-workers) -Similar to pmap-full, but only runs work n-ways parallel.Community Examples
(spawn-nursery nurse & body) +Similar to pmap-full, but only runs work n-ways parallel.
(spawn-nursery nurse & body) -Similar to ev/spawn but associate spawned fibers with a nurseryCommunity Examples
(wait-cancel & body) +Similar to ev/spawn but associate spawned fibers with a nursery
(wait-cancel & body) -Wait forever until the current fiber is canceled, and then run some cleanup code.Community Examples
fmt/*user-indent-2-forms* fmt/format fmt/format-file fmt/format-print
A user list of forms that are control forms and should be indented two spaces.Community Examples
(format source) +fmt/*user-indent-2-forms* fmt/format fmt/format-file fmt/format-print
fmt/*user-indent-2-forms* keyword sourceA user list of forms that are control forms and should be indented two spaces.fmt/format function source(format source) -Format a string of source code to a buffer.Community Examplesfmt/format-print function source+Format a string of source code and print the result.(format-print source) -Format a string of source code and print the result.Community Examples
generators/concat generators/cycle generators/drop generators/drop-until generators/drop-while generators/filter generators/from-iterable generators/map generators/mapcat generators/range generators/run generators/take generators/take-until generators/take-while generators/to-array
(concat & xs) -Concatenate one or more generators or iterables into a single generator.Community Examples
(cycle ds) +Concatenate one or more generators or iterables into a single generator.
(cycle ds) -Repeatedly yield the elements of `ds`, looping back to the beginning when finished.Community Examples
(drop n ds) +Repeatedly yield the elements of `ds`, looping back to the beginning when finished.
(drop-until p ds) -Drop elements from `ds` until `p` is true.Community Examples
(drop-while p ds) -Drop elements from `ds` while `p` is true.Community Examples
(filter p ds) -Create a generator that filters `ds` with `p`.Community Examples
(from-iterable ds) +Create a generator that filters `ds` with `p`.
(from-iterable ds) -Create a new generator around any iterable data structure.Community Examples
(map f ds) +Create a new generator around any iterable data structure.
(map f ds) -Create a generator that maps `f` over `ds`.Community Examples
(mapcat f ds) -Map `f` over `ds`, concatenating the results into a new generator.Community Examples
(range from to) +Map `f` over `ds`, concatenating the results into a new generator.
(take n ds) -Take `n` elements from iterable `ds`.Community Examples
(take-until p ds) -Return elements from `ds` until `p` is true.Community Examples
(take-while p ds) +Return elements from `ds` until `p` is true.
(take-while p ds) -Return elements from `ds` while `p` is true.Community Examples
getline/default-autocomplete-context getline/default-autocomplete-options getline/default-doc-fetch getline/make-getline getline/max-history
(default-autocomplete-context buf pos) -Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.Community Examples
(default-autocomplete-options prefix &) +Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.
(default-autocomplete-options prefix &) -Default handler to get available autocomplete options for a given substring.Community Examples
(default-doc-fetch sym w &) +Default handler to get available autocomplete options for a given substring.
(default-doc-fetch sym w &) -Default handler for Ctrl-G to lookup docstrings in the current environment.Community Examples
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) +Default handler for Ctrl-G to lookup docstrings in the current environment.
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) -Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.Community Examples
htmlgen/doctype-html htmlgen/escape htmlgen/html htmlgen/raw
(escape x) +htmlgen/doctype-html htmlgen/escape htmlgen/html htmlgen/raw
htmlgen/html function source(html data &opt buf) -Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.Community Exampleshtmlgen/raw function source(raw text) +Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.htmlgen/raw function source+Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.(raw text) -Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.Community Examples
http/cookie-grammar http/cookies http/logger http/middleware http/query-string-grammar http/read-body http/read-request http/read-response http/request http/request-peg http/response-peg http/router http/send-response http/server http/server-handler http/status-messages http/url-grammar
Grammar to parse a cookie header to a series of keys and values.Community Examples
(cookies nextmw) +http/cookie-grammar http/cookies http/logger http/middleware http/query-string-grammar http/read-body http/read-request http/read-response http/request http/request-peg http/response-peg http/router http/send-response http/server http/server-handler http/status-messages http/url-grammar
http/cookie-grammar core/peg sourceGrammar to parse a cookie header to a series of keys and values.http/cookies function source(cookies nextmw) -Parses cookies into the table under :cookies keyCommunity Exampleshttp/logger function source(logger nextmw) -Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.Community Exampleshttp/middleware function source(middleware x) +Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.http/middleware function source(middleware x) -Coerce any type to http middlewareCommunity Exampleshttp/query-string-grammar core/peg sourceGrammar that parses a query string (sans url path and ? character) and returns a table.Community Exampleshttp/query-string-grammar core/peg sourceGrammar that parses a query string (sans url path and ? character) and returns a table.http/read-body function source(read-body req) -Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.Community Exampleshttp/read-request function source(read-request conn buf &opt no-query) +Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.http/read-request function source(read-request conn buf &opt no-query) -Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Exampleshttp/read-response function source(read-response conn buf) +Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`http/read-response function source(read-response conn buf) -Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Exampleshttp/request function source(request method url &keys {:headers headers :body body}) +Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`http/request function source(request method url &keys {:headers headers :body body}) -Make an HTTP request to a server. Returns a table containing response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.Community Exampleshttp/router function source(router routes) +Make an HTTP request to a server. Returns a table containing response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.http/router function source(router routes) -Creates a router middleware. A router will dispatch to different routes based on the URL path.Community Exampleshttp/send-response function source(send-response conn response &opt buf) +Creates a router middleware. A router will dispatch to different routes based on the URL path.http/send-response function source(send-response conn response &opt buf) -Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.Community Exampleshttp/server function source(server handler &opt host port) +Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.http/server function source(server handler &opt host port) -Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.Community Exampleshttp/server-handler function source(server-handler conn handler) +Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.http/server-handler function source(server-handler conn handler) -A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Community Exampleshttp/status-messages struct sourceMapping of HTTP status codes to their status message.Community Exampleshttp/url-grammar core/peg source+A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.Community Examples
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.
httpf/add-bindings-as-routes httpf/add-route httpf/default-payload-wrapper httpf/listen httpf/server
(add-bindings-as-routes server &opt env) -Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.Community Examples
(add-route server path docstring schema handler &opt read-mime render-mime) +Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.
(add-route server path docstring schema handler &opt read-mime render-mime) -Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.Community Examples
(default-payload-wrapper payload) +Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.
(default-payload-wrapper payload) -Add some metadata to all responsesCommunity Examples
(listen server &opt host port n-workers) +Add some metadata to all responses
(listen server &opt host port n-workers) -Start serverCommunity Examples
(decode s) +You may also use a custom args array when specified via the special option `:args`.
(decode s) Converts a base64 encoded string to its binary representation of any format -(UTF-8, binary, ..).Community Examples
(encode s) -Converts a string of any format (UTF-8, binary, ..) to base64 encoding.Community Examples
(crc/make-variant size polynomial &opt init byte-flip xorout) +Converts a string of any format (UTF-8, binary, ..) to base64 encoding.
(crc/make-variant size polynomial &opt init byte-flip xorout) -Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.Community Examples
(crc/named-variant name) +Create a CRC function based on the given polynomial, initial value, xourout, and whether to invert input bytes.
(crc/named-variant name) -Get a named CRC variant.Community Examples
(check cron &opt time local) -Check if a given time matches a cron specifier.Community Examples
(next-timestamp cron &opt time local) +Check if a given time matches a cron specifier.
(next-timestamp cron &opt time local) -Given a cron schedule, get the next instance on the cron tab after timeCommunity Examples
(parse-cron str) +Given a cron schedule, get the next instance on the cron tab after time
(parse-cron str) -Parse a cron string into a valid cron schedule objectCommunity Examples
(go-nursery nurse f &opt value) +Parse a cron string into a valid cron schedule object
(go-nursery nurse f &opt value) -Spawn a fiber into a nursery, similar to ev/go.Community Examples
(join-nursery nurse) +Spawn a fiber into a nursery, similar to ev/go.
(join-nursery nurse) -Suspend the current fiber until the nursery is emptied.Community Examples
(multithread-service thread-main n-threads) +Suspend the current fiber until the nursery is emptied.
(multithread-service thread-main n-threads) -Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.Community Examples
(nursery) +Run instances of a function over multiple threads. On failures, restart the failed thread. Normal function returns will not trigger a restart.
(nursery) -Group a number of fibers into a single object for structured concurrencyCommunity Examples
(pcall f n) +Group a number of fibers into a single object for structured concurrency
(pcall f n) -Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.Community Examples
(pdag f dag &opt n-workers) +Call a function n times (in parallel) for side effects. Each function is called with an integer argument indicating a fiber index. Returns nil.
(pdag f dag &opt n-workers) -Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.Community Examples
(pmap f data &opt n-workers) +Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Modifying `dag` inside `f` will not affect the scheduling of workers. Returns a table mapping each node to the result of `(f node)`.
(pmap f data &opt n-workers) -Map `f` over data in parallel, optionally limiting parallelism to `n` workers.Community Examples
(pmap-full f data) +Map `f` over data in parallel, optionally limiting parallelism to `n` workers.
(pmap-full f data) -Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.Community Examples
(pmap-limited f data n-workers) +Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array. `data` can be any indexed data structure.
(pmap-limited f data n-workers) -Similar to pmap-full, but only runs work n-ways parallel.Community Examples
(spawn-nursery nurse & body) +Similar to pmap-full, but only runs work n-ways parallel.
(spawn-nursery nurse & body) -Similar to ev/spawn but associate spawned fibers with a nurseryCommunity Examples
(wait-cancel & body) +Similar to ev/spawn but associate spawned fibers with a nursery
(wait-cancel & body) -Wait forever until the current fiber is canceled, and then run some cleanup code.Community Examples
A user list of forms that are control forms and should be indented two spaces.Community Examples
(format source) +Wait forever until the current fiber is canceled, and then run some cleanup code.
A user list of forms that are control forms and should be indented two spaces.
(format source) -Format a string of source code to a buffer.Community Examples
(format-file file) +Format a string of source code to a buffer.
(format-print source) -Format a string of source code and print the result.Community Examples
(concat & xs) +Format a string of source code and print the result.
(concat & xs) -Concatenate one or more generators or iterables into a single generator.Community Examples
(cycle ds) +Concatenate one or more generators or iterables into a single generator.
(cycle ds) -Repeatedly yield the elements of `ds`, looping back to the beginning when finished.Community Examples
(drop n ds) +Repeatedly yield the elements of `ds`, looping back to the beginning when finished.
(drop-until p ds) -Drop elements from `ds` until `p` is true.Community Examples
(drop-while p ds) +Drop elements from `ds` until `p` is true.
(drop-while p ds) -Drop elements from `ds` while `p` is true.Community Examples
(filter p ds) -Create a generator that filters `ds` with `p`.Community Examples
(from-iterable ds) +Create a generator that filters `ds` with `p`.
(from-iterable ds) -Create a new generator around any iterable data structure.Community Examples
(map f ds) +Create a new generator around any iterable data structure.
(map f ds) -Create a generator that maps `f` over `ds`.Community Examples
(mapcat f ds) -Map `f` over `ds`, concatenating the results into a new generator.Community Examples
(range from to) +Map `f` over `ds`, concatenating the results into a new generator.
(take n ds) -Take `n` elements from iterable `ds`.Community Examples
(take-until p ds) +Take `n` elements from iterable `ds`.
(take-until p ds) -Return elements from `ds` until `p` is true.Community Examples
(take-while p ds) +Return elements from `ds` until `p` is true.
(take-while p ds) -Return elements from `ds` while `p` is true.Community Examples
(to-array s) +Return elements from `ds` while `p` is true.
(to-array s) -Consume `s` into a new array.Community Examples
(default-autocomplete-context buf pos) +Consume `s` into a new array.
(default-autocomplete-context buf pos) -Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.Community Examples
(default-autocomplete-options prefix &) +Given a buffer and a cursor position, extract a string that will be used as context for autocompletion. Return a position and substring from the buffer to use for autocompletion.
(default-autocomplete-options prefix &) -Default handler to get available autocomplete options for a given substring.Community Examples
(default-doc-fetch sym w &) +Default handler to get available autocomplete options for a given substring.
(default-doc-fetch sym w &) -Default handler for Ctrl-G to lookup docstrings in the current environment.Community Examples
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) +Default handler for Ctrl-G to lookup docstrings in the current environment.
(make-getline &opt autocomplete-context autocomplete-options doc-fetch) -Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.Community Examples
(escape x) +Reads a line of input into a buffer, like `getline`. However, allow looking up entries with a general lookup function rather than a environment table.
(escape x) -Escape characters in a string for HTMLCommunity Examples
(html data &opt buf) -Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.Community Examples
(raw text) +Render HTML from standard data structures. Fills the provided optional buffer, or new one if it is not provided, with the html bytes.
(raw text) -Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.Community Examples
Grammar to parse a cookie header to a series of keys and values.Community Examples
(cookies nextmw) +Get an object that can be used to splice in HTML literals. `text` is not escaped in the output string.
Grammar to parse a cookie header to a series of keys and values.
(cookies nextmw) -Parses cookies into the table under :cookies keyCommunity Examples
(logger nextmw) -Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.Community Examples
(middleware x) +Creates a logging middleware. The logger middleware prints URL route, return status, and elapsed request time.
(middleware x) -Coerce any type to http middlewareCommunity Examples
Grammar that parses a query string (sans url path and ? character) and returns a table.Community Examples
Grammar that parses a query string (sans url path and ? character) and returns a table.
(read-body req) -Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.Community Examples
(read-request conn buf &opt no-query) +Given a request, read the HTTP body from the connection. Returns the body as a buffer. If the request has no body, returns nil.
(read-request conn buf &opt no-query) -Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Examples
(read-response conn buf) +Read an HTTP request header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:method` - the HTTP method used. * `:path` - the path of the resource requested. The following keys are also present, but omitted if the user passes a truthy parameter to `no-query`. * `:route` - path of the resource requested without query string. * `:query-string` - segment of HTTP path after first ? character. * `:query` - the query string parsed into a table. Supports a single string value for every string key, and any query parameters that aren't given a value are mapped to true. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`
(read-response conn buf) -Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`Community Examples
(request method url &keys {:headers headers :body body}) +Read an HTTP response header from a connection. Returns a table with the following keys: * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:head-size` - the number of bytes used by the header. * `:status` - the HTTP status code. * `:message` - the HTTP status message. Note that data is read in chunks and any data after the header terminator is stored in `:buffer.`
(request method url &keys {:headers headers :body body}) -Make an HTTP request to a server. Returns a table containing response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.Community Examples
(router routes) +Make an HTTP request to a server. Returns a table containing response information. * `:head-size` - number of bytes in the http header * `:headers` - table mapping header names to header values. Header names are lowercase. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:status` - HTTP status code as an integer. * `:message` - HTTP status message. * `:body` - Bytes of the response body.
(router routes) -Creates a router middleware. A router will dispatch to different routes based on the URL path.Community Examples
(send-response conn response &opt buf) +Creates a router middleware. A router will dispatch to different routes based on the URL path.
(send-response conn response &opt buf) -Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.Community Examples
(server handler &opt host port) +Send an HTTP response over a connection. Will automatically use chunked encoding if body is not a byte sequence. `response` should be a table with the following keys: * `:headers` - optional headers to write * `:status` - integer status code to write * `:body` - optional byte sequence or iterable (for chunked body) for returning contents. The iterable can be lazy, i.e. for streaming data.
(server handler &opt host port) -Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.Community Examples
(server-handler conn handler) +Makes a simple http server. By default it binds to 0.0.0.0:8000, returns a new server stream. Simply wraps http/server-handler with a net/server.
(server-handler conn handler) -A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.Community Examples
Mapping of HTTP status codes to their status message.Community Examples
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.Community Examples
(add-bindings-as-routes server &opt env) +A simple connection handler for an HTTP server. When a connection is accepted. Call this with a handler function to handle the connect. The handler will be called with one argument, the request table, which will contain the following keys: * `:head-size` - number of bytes in the http header. * `:headers` - table mapping header names to header values. * `:connection` - the connection stream for the header. * `:buffer` - the buffer instance that may contain extra bytes. * `:path` - HTTP path. * `:method` - HTTP method, as a string.
Grammar to parse a URL into domain, port, and path triplet. Only supports the http:// protocol.
(add-bindings-as-routes server &opt env) -Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.Community Examples
(add-route server path docstring schema handler &opt read-mime render-mime) +Add all local functions defined with :path metadata to a server. Will read from the :schema, :doc, :path, and :route-doc metadata to determine how the route behaves.
(add-route server path docstring schema handler &opt read-mime render-mime) -Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.Community Examples
(default-payload-wrapper payload) +Add a single manually route to a server. Prefer using `httpf/add-bindings-as-routes` for the usual case.
(default-payload-wrapper payload) -Add some metadata to all responsesCommunity Examples
(listen server &opt host port n-workers) +Add some metadata to all responses
(listen server &opt host port n-workers) -Start serverCommunity Examples
(json/decode json-source &opt keywords nils) +Create a new server.
(json/decode json-source &opt keywords nils) -Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.Community Examples
(json/encode x &opt tab newline buf) +Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.
(json/encode x &opt tab newline buf) -Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.Community Examples
Dynamic binding to front matter after parsing, compilation, and evaluation, of markup completes.Community Examples
The htmlgen source that can be used to generate a document with htmlgen/html.Community Examples
(add-loader) +Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.
Dynamic binding to front matter after parsing, compilation, and evaluation, of markup completes.
The htmlgen source that can be used to generate a document with htmlgen/html.
(add-loader) -Allow importing and requiring markup as a moduleCommunity Examples
(anchor name & content) +Allow importing and requiring markup as a module
(anchor name & content) -Create an in-page anchor for a local link.Community Examples
(bigger content) -Make span element with bigger fontCommunity Examples
(blockquote content) -Make a block quote elementCommunity Examples
(code content) -Make code element with class mendoza-codeCommunity Examples
(codeblock lang &opt source) +Make code element with class mendoza-code
(codeblock lang &opt source) -Inline code or codeblockCommunity Examples
Make a div element
Make a em element
Make a li element
(markup source &opt env where) -Parse mendoza markup and evaluate it returning an htmlgen document tree.Community Examples
(mdz-loader path &) +Parse mendoza markup and evaluate it returning an htmlgen document tree.
(mdz-loader path &) -Loader for the mdz formatCommunity Examples
Make a ol element
Make a p element
Make a pre element
(section name content) -Create a section. Usually used to embed different parts of the content document into different parts of the main page.Community Examples
(smaller content) +Create a section. Usually used to embed different parts of the content document into different parts of the main page.
(smaller content) -Make span element with smaller fontCommunity Examples
Make a strong element
Make a sub element
Make a sup element
(tag name content) -Wrap some content in an html tag. If you need attributes or other properties, you may want to use raw HTML via the html function.Community Examples
(always x) +Wrap some content in an html tag. If you need attributes or other properties, you may want to use raw HTML via the html function.
Make a td element
Make a th element
Make a tr element
Make a u element
Make a ul element
(always x) -Return a function that discards any arguments and always returns `x`.Community Examples
(antepenultimate xs) +Return a function that discards any arguments and always returns `x`.
(antepenultimate xs) -Get the third-to-last element from an indexed data structure.Community Examples
(binary-search x arr &opt <?) +Get the third-to-last element from an indexed data structure.
(binary-search x arr &opt <?) Returns the index of `x` in a sorted array or tuple or the index of the next item if `x` is not present. This is the correct insert index for `x` within `arr`. If a `<?` comparator is given, the search uses -that to compare elements, otherwise uses `<`.Community Examples
(binary-search-by x arr f) +that to compare elements, otherwise uses `<`.
(binary-search-by x arr f) Returns the index of `x` in an array or tuple which has been sorted by a mapping function `f`, or the index of the next item if `x` is not -present. This is the correct insert index for `x` within `arr`.Community Examples
(caperr & body) +present. This is the correct insert index for `x` within `arr`.
(caperr & body) Captures the standart error output of the variadic `body` and returns it -as a buffer.Community Examples
(capout & body) Captures the standart output of the variadic `body` and returns it as -a buffer.Community Examples
(cond-> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs with condition and operation to which the `val`, is put as first argument. All conditions are tried and for truthy conditions the operation is executed. -Returns the value mutated if any condition is truthy.Community Examples
(cond->> val & clauses) +Returns the value mutated if any condition is truthy.
(cond->> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs of condition and operation to which the `val`, is put as last argument. All conditions are tried and for truthy the operation is ran. -Returns mutated value if any condition is truthy.Community Examples
(dedent & xs) Remove indentation after concatenating the arguments. Works by removing leading whitespace, and then removing that same pattern of whitepsace after -new lines.Community Examples
(defs & bindings) -Defines many constants as in let `bindings`, but without creating new scope.Community Examples
(dfs data visit-leaf &opt node-before node-after get-children seen) +Defines many constants as in let `bindings`, but without creating new scope.
(dfs data visit-leaf &opt node-before node-after get-children seen) Do a depth first, pre-order traversal over a data structure. Also allow for callbacks before and after visiting the children of a node. Also allow for a custom `get-children` function to change traversal as needed. Will detect cycles if an empty table is passed as the `seen` parameter, which is used to cached values -that have been visited.Community Examples
(do-def c d & body) Convenience macro for defining constant named `c` with value `d` before `body` and returning it after evaluating `body`, that presumably modifies -the `c` refered content. For example buffer, table or array.Community Examples
(do-var v d & body) +the `c` refered content. For example buffer, table or array.
(do-var v d & body) Convenience macro for defining varible named `v` with value `d` before `body` -and returning it after evaluating `body`, that presumably modifies `v`.Community Examples
(format-table buf-into data &opt columns header-mapping column-mapping) +and returning it after evaluating `body`, that presumably modifies `v`.
(format-table buf-into data &opt columns header-mapping column-mapping) -Same as print-table but pushes table into a buffer.Community Examples
(gett ds & keys) -Recursive macro (get). Similar to get-in, but keys are variadic argument.Community Examples
(insert-sorted arr <? & xs) +Recursive macro (get). Similar to get-in, but keys are variadic argument.
(insert-sorted arr <? & xs) Insert elements in `arr` such that it remains sorted by the comparator. If -`arr` is not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(insert-sorted-by arr f & xs) +`arr` is not sorted beforehand, the results are undefined. Returns `arr`.
(insert-sorted-by arr f & xs) Insert elements in `arr` such that it remains sorted by the value returned when `f` is called with the element, comparing the values with `<`. If `arr` is -not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(int->string int &opt base) +not sorted beforehand, the results are undefined. Returns `arr`.
(int->string int &opt base) -Stringify an integer in a particular base. Defaults to decimal (base 10).Community Examples
(int/ & xs) +Stringify an integer in a particular base. Defaults to decimal (base 10).
(log level & args) Print to a dynamic binding stream if that stream is set, otherwise do nothing. Evaluate to nil. For example, `(log :err "value error: %V" my-value)` will print -to `(dyn :err)` only if `(dyn :err)` has been set.Community Examples
(make prototype & pairs) +to `(dyn :err)` only if `(dyn :err)` has been set.
(make prototype & pairs) Convenience macro for creating new table from even number of kvs pairs in a variadic `table-or-pairs` arguments and setting its prototype to `prototype`. -Factory function for creating new objects from prototypes.Community Examples
(make-id &opt prefix) +Factory function for creating new objects from prototypes.
(make-id &opt prefix) Create a random, printable keyword id with 10 bytes of entropy -with an optional prefix.Community Examples
(map-keys f data) Returns new table with function `f` applied to `data`'s -keys recursively.Community Examples
(map-keys-flat f data) Returns new table with function `f` applied to `data`'s -keys without recursing.Community Examples
(map-vals f data) -Returns new table with function `f` applied to `data`'s values.Community Examples
(merge-sorted a b &opt <?) +Returns new table with function `f` applied to `data`'s values.
(merge-sorted a b &opt <?) Merges two sorted arrays so that the result remains sorted, using an optional comparator. -If no comparator is given, `<` is used.Community Examples
(merge-sorted-by a b f) +If no comparator is given, `<` is used.
(merge-sorted-by a b f) Merges two sorted arrays so that result remains sorted when `f` is called on each element, -comparing the values with `<`.Community Examples
(penultimate xs) -Get the second-to-last element from an indexed data structure.Community Examples
(print-table data &opt columns header-mapping column-mapping) +Get the second-to-last element from an indexed data structure.
(print-table data &opt columns header-mapping column-mapping) Iterate through the rows of a data structure and print a table in a human readable way, with padding and heading information. Can optionally provide @@ -417,315 +417,315 @@Community ExamplesSpork
for each row. Lastly, a `header-mapping` dictionary can be provided that changes the printed header names by mapping column keys to the desired header name. If no mapping is found, then the column key will be used as -the header name. Returns nil.
(randomize-array arr &opt rng) +the header name. Returns nil.
(randomize-array arr &opt rng) Randomizes array using the fisher-yates shuffle, takes an optional random -number generator.Community Examples
(second xs) -Get the second element from an indexed data structure.Community Examples
(select-keys data keyz) +Get the second element from an indexed data structure.
(select-keys data keyz) -Returns new table with selected `keyz` from dictionary `data`.Community Examples
(set* tgts exprs) +Returns new table with selected `keyz` from dictionary `data`.
(set* tgts exprs) Parallel `set` function. Takes a list of targets and expressions, evaluates all the expressions, and then assigns them to the targets. Each target can be a variable -or a 2-tuple, just like in the normal `set` special form.Community Examples
(string->int str &opt base) +or a 2-tuple, just like in the normal `set` special form.
(string->int str &opt base) Parse an integer in the given base. Defaults to decimal (base 10). Differs -from scan-number in that this does not recognize floating point notation.Community Examples
(table-filter pred dict) +from scan-number in that this does not recognize floating point notation.
(table-filter pred dict) Filter a key-value structure info a table. Semantics are the same as for built-in `filter`, except that `pred` takes two arguments (key and value.) -Does not consider prototypes.Community Examples
(third xs) -Get the third element from an indexed data structure.Community Examples
(trim-prefix prefix str) +Get the third element from an indexed data structure.
(trim-prefix prefix str) -Trim the specified prefix of a string if it has oneCommunity Examples
(trim-suffix suffix str) +Trim the specified prefix of a string if it has one
(trim-suffix suffix str) -Trim the specified suffix of a string if it has oneCommunity Examples
(until cnd & body) +Trim the specified suffix of a string if it has one
(until cnd & body) Repeat `body` while the `cnd` is false. -Equivalent to (while (not cnd) ;body).Community Examples
(vars & bindings) -Defines many variables as in let `bindings`, but without creating new scope.Community Examples
(make-proto stream &opt pack unpack) +Defines many variables as in let `bindings`, but without creating new scope.
(make-proto stream &opt pack unpack) -Create both a send an recv function from a stream, as with `make-send` and `make-recv`.Community Examples
(make-recv stream &opt unpack) +Create both a send an recv function from a stream, as with `make-send` and `make-recv`.
(make-recv stream &opt unpack) -Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.Community Examples
(make-send stream &opt pack) +Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.
(make-send stream &opt pack) -Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.Community Examples
(client &opt host port name) +Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.
(client &opt host port name) -Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".Community Examples
Default host to run server on and connect to.Community Examples
(server &opt host port env cleanup welcome-msg) +Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".
(server &opt host port env cleanup welcome-msg) -Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.Community Examples
(server-single &opt host port env cleanup welcome-msg) +Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.
(server-single &opt host port env cleanup welcome-msg) -Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.Community Examples
(posix/abspath path) +Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(ext path) -Get the file extension for a path.Community Examples
(posix/join & els) -Join path elements together.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/parts path) -Split a path into its parts.Community Examples
(posix/relpath source target) +Split a path into its parts.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(posix/relpath source target) +Get the relative path between two subpaths.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(win32/abspath path) +Get the relative path between two subpaths.
(win32/abspath path) -Coerce a path to be absolute.Community Examples
(win32/abspath? path) -Check if a path is absolute.Community Examples
(win32/basename path) -Gets the base file name of a path.Community Examples
(win32/dirname path) -Gets the directory name of a path.Community Examples
(ext path) -Get the file extension for a path.Community Examples
(win32/join & els) -Join path elements together.Community Examples
(win32/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(win32/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(win32/parts path) -Split a path into its parts.Community Examples
(win32/relpath source target) +Split a path into its parts.
(win32/relpath source target) -Get the relative path between two subpaths.Community Examples
(rawterm/begin &opt on-winch) +Get the relative path between two subpaths.
(rawterm/begin &opt on-winch) -Begin raw terminal functionality. Return a stream that can be read from to get input.Community Examples
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) +Begin raw terminal functionality. Return a stream that can be read from to get input.
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) -Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.Community Examples
(rawterm/ctrl-z) +Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.
(rawterm/ctrl-z) -A handler that a user can use to handle ctrl-z from input to suspend the current process.Community Examples
(rawterm/end) +A handler that a user can use to handle ctrl-z from input to suspend the current process.
(rawterm/getch &opt into) -Get a byte of input from stdin, without blocking if possible. Returns a buffer.Community Examples
(rawterm/isatty) +Get a byte of input from stdin, without blocking if possible. Returns a buffer.
(rawterm/isatty) -Check if the current stdin is a tty.Community Examples
(rawterm/monowidth bytes &opt start-index end-index) +Check if the current stdin is a tty.
(rawterm/monowidth bytes &opt start-index end-index) -Measure the monospace width of a string.Community Examples
(rawterm/rune-monowidth rune) +Measure the monospace width of a string.
(rawterm/rune-monowidth rune) -Get the monospace width of a rune. Returns either 0, 1, or 2.Community Examples
(rawterm/size) +Get the monospace width of a rune. Returns either 0, 1, or 2.
(rawterm/size) -Get the number of rows and columns visible in the terminal as tuple [rows cols]Community Examples
(rawterm/slice-monowidth bytes columns &opt start-index into) +Get the number of rows and columns visible in the terminal as tuple [rows cols]
(rawterm/slice-monowidth bytes columns &opt start-index into) -Get a byte slice that will fit into a number of columns.Community Examples
(compile pattern) +Get a byte slice that will fit into a number of columns.
(compile pattern) -Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.Community Examples
(find reg text &opt start) +Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.
(find reg text &opt start) -Similar to peg/find, but for regexes.Community Examples
(find-all reg text &opt start) +Similar to peg/find, but for regexes.
(find-all reg text &opt start) -Similar to peg/find-all, but for regexes.Community Examples
(match reg text &opt start) +Similar to peg/find-all, but for regexes.
(match reg text &opt start) -Similar to peg/match, but for regexes.Community Examples
Peg used to generate peg source code from a regular expression string.Community Examples
(replace reg rep text &opt start) +Similar to peg/match, but for regexes.
Peg used to generate peg source code from a regular expression string.
(replace reg rep text &opt start) -Similar to peg/replace, but for regexes.Community Examples
(replace-all reg rep text &opt start) +Similar to peg/replace, but for regexes.
(replace-all reg rep text &opt start) -Similar to peg/replace-all, but for regexes.Community Examples
(source pattern) -Compile a subset of regex to PEG source code.Community Examples
(client &opt host port name) +Compile a subset of regex to PEG source code.
(client &opt host port name) -Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.Community Examples
Default host to run server on and connect to.Community Examples
(server functions &opt host port workers-per-connection) +Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.
(server functions &opt host port workers-per-connection) -Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.Community Examples
(make-predicate schema) +Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.
(make-predicate schema) -Generate a function that can be used to validate a data structure. This is the function form of `predicate`.Community Examples
(make-validator schema) +Generate a function that can be used to validate a data structure. This is the function form of `predicate`.
(make-validator schema) -Generate a function that can be used to validate a data structure. This is the function form of `validator`.Community Examples
(predicate pattern) +Generate a function that can be used to validate a data structure. This is the function form of `validator`.
(predicate pattern) -Make a validation predicate given a certain schema.Community Examples
(validator pattern) +Make a validation predicate given a certain schema.
(validator pattern) -Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.Community Examples
The currently running service manager, if there is oneCommunity Examples
The currently running service, if there is oneCommunity Examples
(add-service service-name main-function & args) +Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.
The currently running service manager, if there is one
(add-service service-name main-function & args) -Spawn a serviceCommunity Examples
(all-services) -Get a list of running servicesCommunity Examples
(get-manager) -Get the current manager. If no manager exists, create one.Community Examples
(get-service) +Get the current manager. If no manager exists, create one.
(get-service) -Get the current service. If not in a service, raise an errorCommunity Examples
(make-manager &opt log-dir) +Get the current service. If not in a service, raise an error
(make-manager &opt log-dir) -Group a number of fibers into a single object for structured concurrency. Also includes utilities for running services like servers in the background.Community Examples
(print-all &opt filter-fn) +Group a number of fibers into a single object for structured concurrency. Also includes utilities for running services like servers in the background.
(print-all &opt filter-fn) -Print a table of all running services.Community Examples
(remove-service service-name) +Print a table of all running services.
(remove-service service-name) -Remove a serviceCommunity Examples
(set-title title) -Set a textual description of the service to describe what it is doing currentlyCommunity Examples
(start-service service-name) +Set a textual description of the service to describe what it is doing currently
(start-service service-name) -Start or restart a serviceCommunity Examples
(stop-service service-name &opt reason) +Start or restart a service
(stop-service service-name &opt reason) -Stop a running serviceCommunity Examples
(wait) -Once a number of services have been spawned, call `wait` to block the fiber until the manager is canceled. This lets a manager fiber behave as a service itself.Community Examples
(copy src dest) +Once a number of services have been spawned, call `wait` to block the fiber until the manager is canceled. This lets a manager fiber behave as a service itself.
(copy src dest) Copy a file or directory recursively from one location to another. -Expects input to be unix style pathsCommunity Examples
(copy-file src-path dst-path) +Expects input to be unix style paths
(copy-file src-path dst-path) -Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.Community Examples
(create-dirs dir-path) +Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.
(create-dirs dir-path) -Create all directories in path specified as string including itself.Community Examples
(devnull) +Create all directories in path specified as string including itself.
(devnull) -get the /dev/null equivalent of the current platform as an open fileCommunity Examples
(escape & args) +get the /dev/null equivalent of the current platform as an open file
(escape & args) -Output a string with all arguments correctly quotedCommunity Examples
(exec & args) -Execute command specified by args returning it's exit codeCommunity Examples
(exec-fail & args) +Execute command specified by args returning it's exit code
(exec-fail & args) -Execute command specified by args, fails when command exits with non-zero exit codeCommunity Examples
(exec-slurp & args) +Execute command specified by args, fails when command exits with non-zero exit code
(exec-slurp & args) -Read stdout of command specified by args and return it trimmed in a string.Community Examples
(exec-slurp-all & args) +Read stdout of command specified by args and return it trimmed in a string.
(exec-slurp-all & args) Read stdout and stderr of subprocess and return it trimmed in a struct with :err and :out containing the output as string. -This will also return the exit code under the :status key.Community Examples
(exists? path) +This will also return the exit code under the :status key.
(exists? path) -Check if the given file or directory exists. (Follows symlinks)Community Examples
(list-all-files dir &opt into) +Check if the given file or directory exists. (Follows symlinks)
(list-all-files dir &opt into) -List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.Community Examples
(make-new-file file-path &opt mode) +List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.
(make-new-file file-path &opt mode) -Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).Community Examples
(rm path) +Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).
(rm path) -Remove a directory and all sub directories recursively.Community Examples
(scan-directory dir func) +Remove a directory and all sub directories recursively.
(scan-directory dir func) -Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.Community Examples
(split s) +Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.
(split s) -Split a string into 'sh like' tokens, returns nil if unable to parse the string.Community Examples
(tarray/buffer array|size) +Split a string into 'sh like' tokens, returns nil if unable to parse the string.
(tarray/buffer array|size) -Return typed array buffer or create a new buffer.Community Examples
(tarray/copy-bytes src sindex dst dindex &opt count) +Return typed array buffer or create a new buffer.
(tarray/copy-bytes src sindex dst dindex &opt count) -Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.Community Examples
(tarray/length array|buffer) +Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.
(tarray/length array|buffer) -Return typed array or buffer size.Community Examples
(tarray/new type size &opt stride offset tarray|buffer) +Return typed array or buffer size.
(tarray/new type size &opt stride offset tarray|buffer) -Create new typed array.Community Examples
(tarray/properties array) +Create new typed array.
(tarray/properties array) -Return typed array properties as a struct.Community Examples
(tarray/slice tarr &opt start end) +Return typed array properties as a struct.
(tarray/slice tarr &opt start end) -Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.Community Examples
(tarray/swap-bytes src sindex dst dindex &opt count) +Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.
(tarray/swap-bytes src sindex dst dindex &opt count) -Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.Community Examples
(all-tasks tasker &opt detailed) +Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.
(all-tasks tasker &opt detailed) -Get an array of all task ids for which there is still data on disk. If `detailed` is truthy, return full task metadata instead of ids.Community Examples
(cancel-task tasker task-id) +Get an array of all task ids for which there is still data on disk. If `detailed` is truthy, return full task metadata instead of ids.
(cancel-task tasker task-id) -Cancel a queued or running task.Community Examples
(close-queues tasker) -Prevent any tasks from being added to queues. When an executor finishes it's current job, if there are any, it will terminate. When all executors complete, the call to `run-executors` will complete.Community Examples
Default location of task recordsCommunity Examples
Maximum allowed priority (lower priority tasks will execute first)Community Examples
Minimum allowed priority (lower priority tasks will execute first)Community Examples
(new-tasker &opt task-directory queues queue-size) +Prevent any tasks from being added to queues. When an executor finishes it's current job, if there are any, it will terminate. When all executors complete, the call to `run-executors` will complete.
Maximum allowed priority (lower priority tasks will execute first)
Minimum allowed priority (lower priority tasks will execute first)
(new-tasker &opt task-directory queues queue-size) -Create queues and various settings to run tasks. Create a new tasker table.Community Examples
(queue-task tasker argv &opt note priority qname timeout expiration input) +Create queues and various settings to run tasks. Create a new tasker table.
(queue-task tasker argv &opt note priority qname timeout expiration input) -Add a task specification to a queue. Supply an argv string array that will be used to invoke s a subprocess. The optional `note` parameter is just a textual note for task trackingv. The `priority` parameter should be an integer between 0 and 9 inclusive, default is 4. Lower priority jobs in the same queue will be executed by higher priority. Use input to pass in generic, unstructured input to a task.Community Examples
(run-cleanup tasker) +Add a task specification to a queue. Supply an argv string array that will be used to invoke s a subprocess. The optional `note` parameter is just a textual note for task trackingv. The `priority` parameter should be an integer between 0 and 9 inclusive, default is 4. Lower priority jobs in the same queue will be executed by higher priority. Use input to pass in generic, unstructured input to a task.
(run-cleanup tasker) -Delete old expired jobs saved on diskCommunity Examples
(run-executors tasker &opt workers-per-queue pre-task post-task) +Delete old expired jobs saved on disk
(run-executors tasker &opt workers-per-queue pre-task post-task) -Start a number of executors to run tasks as with `tasker/spawn-executors`, and then wait for all executors to complete.Community Examples
(spawn-executors tasker &opt qnames workers-per-queue pre-task post-task) +Start a number of executors to run tasks as with `tasker/spawn-executors`, and then wait for all executors to complete.
(spawn-executors tasker &opt qnames workers-per-queue pre-task post-task) -Start a number of executors to run tasks. Tasks can be added to a queue by calling queue-task. A single tasker object can make multiple calls to spawn-executors.Community Examples
A tuple of all possible statuses that a task can have.Community Examples
(task-file tasker task-id &opt file-name) +Start a number of executors to run tasks. Tasks can be added to a queue by calling queue-task. A single tasker object can make multiple calls to spawn-executors.
(task-file tasker task-id &opt file-name) -Get a log file for a path. By default, will get a path to out.log.Community Examples
(task-status tasker task-id) +Get a log file for a path. By default, will get a path to out.log.
(task-status tasker task-id) -Look up the status of a given task by id.Community Examples
(add-loader) -Adds the custom template loader to Janet's module/loaders and update module/paths.Community Examples
(compile str) +Adds the custom template loader to Janet's module/loaders and update module/paths.
(compile str) Compile a Temple template into a function which will return a rendered buffer. The resulting function should receive the template arguments in the -&keys format.Community Examples
(create source &opt where) -Compile a template string into a function. Optionally provide a location where the source is from to improve debugging. Returns the template function.Community Examples
(assert x &opt e) +Compile a template string into a function. Optionally provide a location where the source is from to improve debugging. Returns the template function.
(assert x &opt e) -Override's the default assert with some nice error handling.Community Examples
(assert-docs path) +Override's the default assert with some nice error handling.
(assert-docs path) Assert that all symbols, when module on the path is required, -have proper doc stringCommunity Examples
(assert-error msg & forms) -Test passes if forms error.Community Examples
(assert-no-error msg & forms) -Test passes if forms do not error.Community Examples
(capture-stderr & body) Runs the form and captures stderr. Returns tuple with result of the form -and a string with captured stderr.Community Examples
(capture-stdout & body) Runs the form and captures stdout. Returns tuple with result of the form -and a string with captured stdout.Community Examples
(end-suite) -Ends test suite, prints summary and exits if any have failed.Community Examples
(start-suite &opt name) +Ends test suite, prints summary and exits if any have failed.
(start-suite &opt name) -Starts test suite.Community Examples
(suppress-stderr & body) -Suppreses stdout from the bodyCommunity Examples
(suppress-stdout & body) -Suppreses stdout from the bodyCommunity Examples
(timeit form &opt tag) Time the execution of `form` using `os/clock` before and after, and print the result to stdout. returns: result of executing `form`. -Uses `tag` (default "Elapsed time:") to tag the printout.Community Examples
(timeit-loop head & body) +Uses `tag` (default "Elapsed time:") to tag the printout.
(timeit-loop head & body) Similar to `loop`, but outputs performance statistics after completion. Additionally defines a `:timeout` verb to iterate continuously for a given number of seconds. If the first form of `body` is a bytes, it will be taken -as a custom tag.Community Examples
(utf8/decode-rune buf &opt start) -Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].Community Examples
(utf8/encode-rune rune &opt buf) +Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].
(utf8/encode-rune rune &opt buf) -Encode a Unicode codepoint into the end of a buffer.Community Examples
(utf8/prefix->width c) +Encode a Unicode codepoint into the end of a buffer.
(utf8/prefix->width c) -Given the first byte in an UTF-8 sequence, get the number of bytes that the codepoint sequence takes up, including the prefix byte.Community Examples
(zip/add-bytes writer path data &opt comment flags) +Given the first byte in an UTF-8 sequence, get the number of bytes that the codepoint sequence takes up, including the prefix byte.
(zip/add-bytes writer path data &opt comment flags) -Add a byte sequence to the zip writer.Community Examples
(zip/add-file writer path filename &opt comment flags) +Add a byte sequence to the zip writer.
(zip/add-file writer path filename &opt comment flags) -Add a file to the zip writer.Community Examples
(zip/compress bytes &opt level into) +Add a file to the zip writer.
(zip/compress bytes &opt level into) -Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.Community Examples
(zip/decompress bytes &opt into) +Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.
(zip/decompress bytes &opt into) -Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.Community Examples
(zip/extract reader idx-or-filename &opt into flags) +Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.
(zip/extract reader idx-or-filename &opt into flags) -Extract a file from the zip archive, either to memory or to a file on disk.Community Examples
(zip/file-directory? reader idx) +Extract a file from the zip archive, either to memory or to a file on disk.
(zip/file-directory? reader idx) -Check if a file index is a directory.Community Examples
(zip/file-encrypted? reader idx) +Check if a file index is a directory.
(zip/file-encrypted? reader idx) -Check if a file is encrypted inside an archive.Community Examples
(zip/file-supported? reader idx) +Check if a file is encrypted inside an archive.
(zip/file-supported? reader idx) -Check if a file is supported with this verstion of miniz.Community Examples
(zip/get-filename reader idx) +Check if a file is supported with this verstion of miniz.
(zip/get-filename reader idx) -Convert a file index index in the archive to a filename.Community Examples
(zip/locate-file reader path &opt comment flags) +Convert a file index index in the archive to a filename.
(zip/locate-file reader path &opt comment flags) -Get the index of a particular filename in the archive.Community Examples
(zip/read-bytes bytes &opt flags) +Get the index of a particular filename in the archive.
(zip/read-bytes bytes &opt flags) -Read a byte sequence as a zip archive. Returns a new zip reader.Community Examples
(zip/read-file filename &opt flags) +Read a byte sequence as a zip archive. Returns a new zip reader.
(zip/read-file filename &opt flags) -Read a file as a zip archive. Returns a new zip reader.Community Examples
(zip/reader-close reader) +Read a file as a zip archive. Returns a new zip reader.
(zip/reader-close reader) -Close a reader and free related memory.Community Examples
(zip/reader-count reader) +Close a reader and free related memory.
(zip/reader-count reader) -Get the number of files inside the zip archive. The files can be indexedCommunity Examples
(zip/stat reader idx) +Get the number of files inside the zip archive. The files can be indexed
(zip/stat reader idx) Get stat information of file. Returns a new struct with the following fields: @@ -742,17 +742,17 @@Community ExamplesSpork
* :comment * :internal-attr * :external-attr -
(zip/version) -Get the version string of the underlying miniz library.Community Examples
(zip/write-buffer) +Get the version string of the underlying miniz library.
(zip/write-buffer) -Create a new zip archive writer that write to memory.Community Examples
(zip/write-file dest-path) +Create a new zip archive writer that write to memory.
(zip/write-file dest-path) -Create a new zip archive writer that will write into an archive file.Community Examples
(zip/writer-close writer) +Create a new zip archive writer that will write into an archive file.
(zip/writer-close writer) -Close a ZipWriter.Community Examples
(zip/writer-finalizer writer) -Finalize a writer, writing any zip files to disk. Return the writer.Community Examples
(json/decode json-source &opt keywords nils) -Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.Community Examples
(json/encode x &opt tab newline buf) +Returns a janet object after parsing JSON. If keywords is truthy, string keys will be converted to keywords. If nils is truthy, null will become nil instead of the keyword :null.
(json/encode x &opt tab newline buf) -Encodes a janet value in JSON (utf-8). tab and newline are optional byte sequence which are used to format the output JSON. if buf is provided, the formated JSON is append to buf instead of a new buffer. Returns the modifed buffer.Community Examples
math/add math/add-to-mean math/approx-eq math/bernoulli-distribution math/binominal-coeficient math/binominal-distribution math/check-probability math/chi-squared-distribution-table math/cols math/cumulative-std-normal-probability math/det math/dot math/epsilon math/extent math/factor math/factorial math/geometric-mean math/get-only-el math/harmonic-mean math/ident math/interquartile-range math/invmod math/jacobi math/linear-regression math/linear-regression-line math/median math/median-absolute-deviation math/minor math/mode math/mop math/mul math/mulmod math/next-prime math/perm math/permutation-test math/permutations math/poisson-distribution math/powmod math/prime? math/primes math/quantile math/quantile-rank math/quantile-rank-sorted math/quantile-sorted math/quickselect math/relative-err math/root-mean-square math/rows math/sample-correlation math/sample-covariance math/sample-skewness math/sample-standard-deviation math/sample-variance math/scalar math/shuffle-in-place math/size math/sop math/standard-deviation math/standard-normal-table math/sum-compensated math/sum-nth-power-deviations math/swap math/t-test math/t-test-2 math/trans math/variance math/z-score math/zero
(add m a) Add `a` to matrix `m` where it can be matrix or scalar. -Matrix `m` is mutated.Community Examples
(add-to-mean m n v) -Adds new value `v` to mean `m` from `n` values.Community Examples
(approx-eq a e &opt t) +Adds new value `v` to mean `m` from `n` values.
(approx-eq a e &opt t) Approximate equality between actual number `a` and expected number `e`. Default tolerance `t` -is `epsilon`.Community Examples
(bernoulli-distribution p) -Creates Bernoulli distribution from popability `p` in the tuple.Community Examples
(binominal-coeficient n k) +Creates Bernoulli distribution from popability `p` in the tuple.
(binominal-coeficient n k) Computes binominal coeficient from set of size `n` -and sample size `k`.Community Examples
(binominal-distribution t p) Creates binominal distribution from trials `t` -and probability `p` in the tuple.Community Examples
(check-probability p) -Asserts that probability in in the [0 1] range.Community Examples
(cumulative-std-normal-probability z) +Returns numbers of columns of matrix `m`.
(cumulative-std-normal-probability z) -Computes standard normal probability for `y`.Community Examples
(dot mx my) -Computes dot product of matrices or vectors `x` and `y`.Community Examples
(extent xs) -Returns the minimum & maximum number in an `xs` as tuple.Community Examples
(factor n) -Returns an array containing the prime factors of `n`.Community Examples
(geometric-mean xs) -Gets the geometric mean from `xs`.Community Examples
(get-only-el m) Convenience macro for geting first element -from first row of the two dimensional array `m`.Community Examples
(harmonic-mean xs) +from first row of the two dimensional array `m`.
(harmonic-mean xs) -Gets the harmonic mean from `xs`.Community Examples
(ident c) -Creates identity matrix with `c` x `c` size.Community Examples
(interquartile-range xs) +Creates identity matrix with `c` x `c` size.
(interquartile-range xs) -Gets the interquartile range from `xs`.Community Examples
(math/invmod a m) -Modular multiplicative inverse of `a` mod `m`. Both arguments must be integer. The return value has the same type as `m`. If no inverse exists, returns `math/nan` instead.Community Examples
(math/jacobi a m) +Modular multiplicative inverse of `a` mod `m`. Both arguments must be integer. The return value has the same type as `m`. If no inverse exists, returns `math/nan` instead.
(linear-regression coords) +Computes the Jacobi Symbol (a|m).
(linear-regression coords) Computes the slope `:m` and y-intercept `:b` -of the function in the struct from set of coordinates.Community Examples
(linear-regression-line {:m m :b b}) +of the function in the struct from set of coordinates.
(linear-regression-line {:m m :b b}) -Constructs function from struct returned by linear regression.Community Examples
(median xs) +Constructs function from struct returned by linear regression.
(median-absolute-deviation xs) +Gets the median value from `xs`
(median-absolute-deviation xs) -Gets median absolute deviation from `xs`.Community Examples
(minor m x y) -Computes minor matrix of matrix `m` and `x`, `y`.Community Examples
(mop m op a) Mutates every cell of the matrix `m` with `op` -and corresponding cell from matrix arg `a`.Community Examples
(mul m a) Multiply matrix `m` with `a` which can be matrix or vector. -Matrix `m` is mutated.Community Examples
(math/mulmod a b m) -Modular multiplication of `a` and `b` mod `m`. All arguments must be integer. The return value has the same type as `m`.Community Examples
(next-prime n) +Modular multiplication of `a` and `b` mod `m`. All arguments must be integer. The return value has the same type as `m`.
(next-prime n) -Returns the next prime number strictly larger than `n`.Community Examples
(permutation-test xs ys &opt a k) +Computes permanent of the matrix `m`.
(permutation-test xs ys &opt a k) Conducts a permutation test to determine if two data sets `xs` and `ys` are *significantly* different from each other. You can use alternative hypotesis `a`, which defaults to `:two-side`, with `:greater` and `:lesser` being the other two options. The last optional argument is `k` number of values -in permutation distributionCommunity Examples
(permutations s &opt k) -Returns permutations of length `k` from members of `s`Community Examples
(poisson-distribution lambda) +Returns permutations of length `k` from members of `s`
(poisson-distribution lambda) -Creates Poisson distribution from `lambda` in tuple.Community Examples
(math/powmod a b m) +Creates Poisson distribution from `lambda` in tuple.
(math/powmod a b m) -Modular exponentiation of `a` to the power of `b` mod `m`. All arguments must be integer. The return value has the same type as `m`.Community Examples
(prime? n) +Modular exponentiation of `a` to the power of `b` mod `m`. All arguments must be integer. The return value has the same type as `m`.
(prime? n) -A primality test, deterministic for all `n` less than 2^63.Community Examples
(quantile xs p) -Gets the quantile value from `xs` at `p` from unsorted population.Community Examples
(quantile-rank xs p) +Gets the quantile value from `xs` at `p` from unsorted population.
(quantile-rank xs p) -Gets the quantile rank of value `v` from unsorted `xs`.Community Examples
(quantile-rank-sorted xs v) +Gets the quantile rank of value `v` from unsorted `xs`.
(quantile-rank-sorted xs v) -Gets the quantile rank of value `v` from sorted `xs`.Community Examples
(quantile-sorted xs p) +Gets the quantile rank of value `v` from sorted `xs`.
(quantile-sorted xs p) -Gets the quantile value from `xs` at `p` from sorted population.Community Examples
(quickselect arr k &opt left right) +Gets the quantile value from `xs` at `p` from sorted population.
(quickselect arr k &opt left right) Rearrange items in `arr` so that all items in `[left, k]` range are the smallest. The `k`-th element will have the `(k - left + 1)`-th smallest value in `[left, right]`. -Mutates `arr`.Community Examples
(relative-err a e) Gets the relative err between actual number `a` -and expected number `e`.Community Examples
(root-mean-square xs) -Gets the root mean square from `xs`.Community Examples
(sample-correlation xs ys) +Returns numbers of rows of matrix `m`.
(sample-correlation xs ys) -Gets the sample correlation between `xs` and `ys`.Community Examples
(sample-covariance xs ys) +Gets the sample correlation between `xs` and `ys`.
(sample-covariance xs ys) -Gets the sample covariance between `xs` and `ys`.Community Examples
(sample-skewness xs) +Gets the sample covariance between `xs` and `ys`.
(sample-skewness xs) -Gets the sample skeweness from the `xs`.Community Examples
(sample-standard-deviation xs) +Gets the sample skeweness from the `xs`.
(sample-standard-deviation xs) -Gets sample standard deviation from `xs`.Community Examples
(sample-variance xs) +Gets sample standard deviation from `xs`.
(sample-variance xs) -Get the sample variance from `xs`.Community Examples
(scalar c s) -Creates scalar `s` matrix with `c` x `c` size.Community Examples
(shuffle-in-place xs) +Creates scalar `s` matrix with `c` x `c` size.
(shuffle-in-place xs) Generate random permutation of the array `xs` -which is shuffled in place.Community Examples
(size m) -Returns tuple with the matrix `m` size [rows cols].Community Examples
(sop m op & a) Mutates every cell of the matrix `m` with `op` -and variadic args `a`.Community Examples
(standard-deviation xs) -Gets the standard deviation from `ds`.Community Examples
(sum-compensated xs) -Returns sum of the members of `xs` with Kahan-Babushka algorithm.Community Examples
(sum-nth-power-deviations xs n) +Returns sum of the members of `xs` with Kahan-Babushka algorithm.
(sum-nth-power-deviations xs n) -Get the sum of deviations to the n power.Community Examples
(swap arr i j) Swaps members with indices `i` and `j` of arr. -Noop when `i` equals `j`.Community Examples
(t-test xs expv) Computes one sample t-test comparing the mean of `xs` -to known value `expv`.Community Examples
(t-test-2 xs ys &opt d) Computes two sample t-test of two samples `xs` and `ys` -with difference optional `d` which defaults to 0.Community Examples
(z-score x m d) Gets the standard score for number `x` from mean `m` -and standard deviation `d`.Community Examples
(zero c &opt r) Creates vector of length `c`, or matrix if `r` -is provided, and fills it with zeros.Community Examples
misc/always misc/antepenultimate misc/binary-search misc/binary-search-by misc/caperr misc/capout misc/cond-> misc/cond->> misc/dedent misc/defs misc/dfs misc/do-def misc/do-var misc/format-table misc/gett misc/insert-sorted misc/insert-sorted-by misc/int->string misc/int/ misc/log misc/make misc/make-id misc/map-keys misc/map-keys-flat misc/map-vals misc/merge-sorted misc/merge-sorted-by misc/penultimate misc/print-table misc/randomize-array misc/second misc/select-keys misc/set* misc/string->int misc/table-filter misc/third misc/trim-prefix misc/trim-suffix misc/until misc/vars
(always x) -Return a function that discards any arguments and always returns `x`.Community Examples
(antepenultimate xs) +Return a function that discards any arguments and always returns `x`.
(antepenultimate xs) -Get the third-to-last element from an indexed data structure.Community Examples
(binary-search x arr &opt <?) +Get the third-to-last element from an indexed data structure.
(binary-search x arr &opt <?) Returns the index of `x` in a sorted array or tuple or the index of the next item if `x` is not present. This is the correct insert index for `x` within `arr`. If a `<?` comparator is given, the search uses -that to compare elements, otherwise uses `<`.Community Examples
(binary-search-by x arr f) +that to compare elements, otherwise uses `<`.
(binary-search-by x arr f) Returns the index of `x` in an array or tuple which has been sorted by a mapping function `f`, or the index of the next item if `x` is not -present. This is the correct insert index for `x` within `arr`.Community Examples
(caperr & body) +present. This is the correct insert index for `x` within `arr`.
(caperr & body) Captures the standart error output of the variadic `body` and returns it -as a buffer.Community Examples
(capout & body) Captures the standart output of the variadic `body` and returns it as -a buffer.Community Examples
(cond-> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs with condition and operation to which the `val`, is put as first argument. All conditions are tried and for truthy conditions the operation is executed. -Returns the value mutated if any condition is truthy.Community Examples
(cond->> val & clauses) +Returns the value mutated if any condition is truthy.
(cond->> val & clauses) Threading conditional macro. It takes `val` to mutate, and `clauses` pairs of condition and operation to which the `val`, is put as last argument. All conditions are tried and for truthy the operation is ran. -Returns mutated value if any condition is truthy.Community Examples
(dedent & xs) Remove indentation after concatenating the arguments. Works by removing leading whitespace, and then removing that same pattern of whitepsace after -new lines.Community Examples
(defs & bindings) -Defines many constants as in let `bindings`, but without creating new scope.Community Examples
(dfs data visit-leaf &opt node-before node-after get-children seen) +Defines many constants as in let `bindings`, but without creating new scope.
(dfs data visit-leaf &opt node-before node-after get-children seen) Do a depth first, pre-order traversal over a data structure. Also allow for callbacks before and after visiting the children of a node. Also allow for a custom `get-children` function to change traversal as needed. Will detect cycles if an empty table is passed as the `seen` parameter, which is used to cached values -that have been visited.Community Examples
(do-def c d & body) Convenience macro for defining constant named `c` with value `d` before `body` and returning it after evaluating `body`, that presumably modifies -the `c` refered content. For example buffer, table or array.Community Examples
(do-var v d & body) +the `c` refered content. For example buffer, table or array.
(do-var v d & body) Convenience macro for defining varible named `v` with value `d` before `body` -and returning it after evaluating `body`, that presumably modifies `v`.Community Examples
(format-table buf-into data &opt columns header-mapping column-mapping) +and returning it after evaluating `body`, that presumably modifies `v`.
(format-table buf-into data &opt columns header-mapping column-mapping) -Same as print-table but pushes table into a buffer.Community Examples
(gett ds & keys) -Recursive macro (get). Similar to get-in, but keys are variadic argument.Community Examples
(insert-sorted arr <? & xs) +Recursive macro (get). Similar to get-in, but keys are variadic argument.
(insert-sorted arr <? & xs) Insert elements in `arr` such that it remains sorted by the comparator. If -`arr` is not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(insert-sorted-by arr f & xs) +`arr` is not sorted beforehand, the results are undefined. Returns `arr`.
(insert-sorted-by arr f & xs) Insert elements in `arr` such that it remains sorted by the value returned when `f` is called with the element, comparing the values with `<`. If `arr` is -not sorted beforehand, the results are undefined. Returns `arr`.Community Examples
(int->string int &opt base) +not sorted beforehand, the results are undefined. Returns `arr`.
(int->string int &opt base) -Stringify an integer in a particular base. Defaults to decimal (base 10).Community Examples
(int/ & xs) +Stringify an integer in a particular base. Defaults to decimal (base 10).
(log level & args) Print to a dynamic binding stream if that stream is set, otherwise do nothing. Evaluate to nil. For example, `(log :err "value error: %V" my-value)` will print -to `(dyn :err)` only if `(dyn :err)` has been set.Community Examples
(make prototype & pairs) Convenience macro for creating new table from even number of kvs pairs in a variadic `table-or-pairs` arguments and setting its prototype to `prototype`. -Factory function for creating new objects from prototypes.Community Examples
(make-id &opt prefix) +Factory function for creating new objects from prototypes.
(make-id &opt prefix) Create a random, printable keyword id with 10 bytes of entropy -with an optional prefix.Community Examples
(map-keys f data) Returns new table with function `f` applied to `data`'s -keys recursively.Community Examples
(map-keys-flat f data) Returns new table with function `f` applied to `data`'s -keys without recursing.Community Examples
(map-vals f data) -Returns new table with function `f` applied to `data`'s values.Community Examples
(merge-sorted a b &opt <?) +Returns new table with function `f` applied to `data`'s values.
(merge-sorted a b &opt <?) Merges two sorted arrays so that the result remains sorted, using an optional comparator. -If no comparator is given, `<` is used.Community Examples
(merge-sorted-by a b f) +If no comparator is given, `<` is used.
(merge-sorted-by a b f) Merges two sorted arrays so that result remains sorted when `f` is called on each element, -comparing the values with `<`.Community Examples
(penultimate xs) -Get the second-to-last element from an indexed data structure.Community Examples
(print-table data &opt columns header-mapping column-mapping) +Get the second-to-last element from an indexed data structure.
(print-table data &opt columns header-mapping column-mapping) Iterate through the rows of a data structure and print a table in a human readable way, with padding and heading information. Can optionally provide @@ -222,37 +222,37 @@Community ExamplesIndex for each row. Lastly, a `header-mapping` dictionary can be provided that changes the printed header names by mapping column keys to the desired header name. If no mapping is found, then the column key will be used as -the header name. Returns nil.
(randomize-array arr &opt rng) Randomizes array using the fisher-yates shuffle, takes an optional random -number generator.Community Examples
(second xs) -Get the second element from an indexed data structure.Community Examples
(select-keys data keyz) +Get the second element from an indexed data structure.
(select-keys data keyz) -Returns new table with selected `keyz` from dictionary `data`.Community Examples
(set* tgts exprs) +Returns new table with selected `keyz` from dictionary `data`.
(set* tgts exprs) Parallel `set` function. Takes a list of targets and expressions, evaluates all the expressions, and then assigns them to the targets. Each target can be a variable -or a 2-tuple, just like in the normal `set` special form.Community Examples
(string->int str &opt base) +or a 2-tuple, just like in the normal `set` special form.
(string->int str &opt base) Parse an integer in the given base. Defaults to decimal (base 10). Differs -from scan-number in that this does not recognize floating point notation.Community Examples
(table-filter pred dict) +from scan-number in that this does not recognize floating point notation.
(table-filter pred dict) Filter a key-value structure info a table. Semantics are the same as for built-in `filter`, except that `pred` takes two arguments (key and value.) -Does not consider prototypes.Community Examples
(third xs) -Get the third element from an indexed data structure.Community Examples
(trim-prefix prefix str) +Get the third element from an indexed data structure.
(trim-prefix prefix str) -Trim the specified prefix of a string if it has oneCommunity Examples
(trim-suffix suffix str) +Trim the specified prefix of a string if it has one
(trim-suffix suffix str) -Trim the specified suffix of a string if it has oneCommunity Examples
(until cnd & body) Repeat `body` while the `cnd` is false. -Equivalent to (while (not cnd) ;body).Community Examples
(vars & bindings) -Defines many variables as in let `bindings`, but without creating new scope.Community Examples
msg/make-proto msg/make-recv msg/make-send
(make-proto stream &opt pack unpack) -Create both a send an recv function from a stream, as with `make-send` and `make-recv`.Community Examples
(make-recv stream &opt unpack) +Create both a send an recv function from a stream, as with `make-send` and `make-recv`.
(make-recv stream &opt unpack) -Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.Community Examples
(make-send stream &opt pack) +Get a function that, when invoked, gets the next message from a readable stream. Provide an optional unpack function that will parse the received buffer.
(make-send stream &opt pack) -Create a function that when called with a msgs sends that msg. Provide an optional pack function that will convert a message to a string.Community Examples
netrepl/client netrepl/default-host netrepl/default-port netrepl/server netrepl/server-single
(client &opt host port name) -Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".Community Examples
(server &opt host port env cleanup welcome-msg) +Connect to a repl server. The default host is "127.0.0.1" and the default port is "9365".
(server &opt host port env cleanup welcome-msg) -Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.Community Examples
(server-single &opt host port env cleanup welcome-msg) +Start a repl server. The default host is "127.0.0.1" and the default port is "9365". Calling this will start a TCP server that exposes a repl into the given env. If no env is provided, a new env will be created per connection. If env is a function, that function will be invoked with the name and stream on each connection to generate an environment. `cleanup` is an optional function that will be called for each stream after closing if provided. `welcome-msg` is an optional string or function (welcome-msg client-name) to generate a message to print for the client on connection.
(server-single &opt host port env cleanup welcome-msg) -Short-hand for serving up a a repl that has a single environment table in it. `env` must be a proper env table, not a function as is possible in netrepl/server.Community Examples
path/abspath path/abspath? path/basename path/delim path/dirname path/ext path/join path/normalize path/parts path/posix/abspath path/posix/abspath? path/posix/basename path/posix/delim path/posix/dirname path/posix/ext path/posix/join path/posix/normalize path/posix/parts path/posix/relpath path/posix/sep path/relpath path/sep path/win32/abspath path/win32/abspath? path/win32/basename path/win32/delim path/win32/dirname path/win32/ext path/win32/join path/win32/normalize path/win32/parts path/win32/relpath path/win32/sep
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/abspath path) -Coerce a path to be absolute.Community Examples
(posix/abspath? path) -Check if a path is absolute.Community Examples
(posix/basename path) -Gets the base file name of a path.Community Examples
(posix/dirname path) -Gets the directory name of a path.Community Examples
(posix/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(posix/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(posix/relpath source target) +Get the relative path between two subpaths.
(posix/relpath source target) -Get the relative path between two subpaths.Community Examples
(win32/abspath path) +Get the relative path between two subpaths.
(win32/abspath path) -Coerce a path to be absolute.Community Examples
(win32/abspath? path) -Check if a path is absolute.Community Examples
(win32/basename path) -Gets the base file name of a path.Community Examples
(win32/dirname path) -Gets the directory name of a path.Community Examples
(win32/normalize path) -Normalize a path. This removes . and .. in the path, as well as empty path elements.Community Examples
(win32/parts path) +Normalize a path. This removes . and .. in the path, as well as empty path elements.
(win32/relpath source target) -Get the relative path between two subpaths.Community Examples
rawterm/begin rawterm/buffer-traverse rawterm/ctrl-z rawterm/end rawterm/getch rawterm/isatty rawterm/monowidth rawterm/rune-monowidth rawterm/size rawterm/slice-monowidth
(rawterm/begin &opt on-winch) -Begin raw terminal functionality. Return a stream that can be read from to get input.Community Examples
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) +Begin raw terminal functionality. Return a stream that can be read from to get input.
(rawterm/buffer-traverse bytes index delta &opt skip-zerowidth) -Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.Community Examples
(rawterm/ctrl-z) +Move to a new position in a buffer from index by incrementing by `delta` codepoints. Can also skip zero-width codepoints if desired.
(rawterm/ctrl-z) -A handler that a user can use to handle ctrl-z from input to suspend the current process.Community Examples
(rawterm/end) +A handler that a user can use to handle ctrl-z from input to suspend the current process.
(rawterm/getch &opt into) -Get a byte of input from stdin, without blocking if possible. Returns a buffer.Community Examples
(rawterm/isatty) +Get a byte of input from stdin, without blocking if possible. Returns a buffer.
(rawterm/isatty) -Check if the current stdin is a tty.Community Examples
(rawterm/monowidth bytes &opt start-index end-index) +Check if the current stdin is a tty.
(rawterm/monowidth bytes &opt start-index end-index) -Measure the monospace width of a string.Community Examples
(rawterm/rune-monowidth rune) +Measure the monospace width of a string.
(rawterm/rune-monowidth rune) -Get the monospace width of a rune. Returns either 0, 1, or 2.Community Examples
(rawterm/size) +Get the monospace width of a rune. Returns either 0, 1, or 2.
(rawterm/size) -Get the number of rows and columns visible in the terminal as tuple [rows cols]Community Examples
(rawterm/slice-monowidth bytes columns &opt start-index into) +Get the number of rows and columns visible in the terminal as tuple [rows cols]
(rawterm/slice-monowidth bytes columns &opt start-index into) -Get a byte slice that will fit into a number of columns.Community Examples
regex/compile regex/find regex/find-all regex/match regex/peg regex/replace regex/replace-all regex/source
(compile pattern) -Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.Community Examples
(find reg text &opt start) +Compile a subset of regex to a PEG if pattern is a string. If pattern is a PEG, will return the PEG as is.
(find reg text &opt start) -Similar to peg/find, but for regexes.Community Examples
(find-all reg text &opt start) +Similar to peg/find, but for regexes.
(find-all reg text &opt start) -Similar to peg/find-all, but for regexes.Community Examples
(match reg text &opt start) -Similar to peg/match, but for regexes.Community Examples
Peg used to generate peg source code from a regular expression string.Community Examples
(replace reg rep text &opt start) +Similar to peg/match, but for regexes.
(replace reg rep text &opt start) -Similar to peg/replace, but for regexes.Community Examples
(replace-all reg rep text &opt start) +Similar to peg/replace, but for regexes.
(replace-all reg rep text &opt start) -Similar to peg/replace-all, but for regexes.Community Examples
(source pattern) -Compile a subset of regex to PEG source code.Community Examples
rpc/client rpc/default-host rpc/default-port rpc/server
(client &opt host port name) -Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.Community Examples
(server functions &opt host port workers-per-connection) +Create an RPC client. The default host is "127.0.0.1" and the default port is "9366". Returns a table of async functions that can be used to make remote calls. This table also contains a :close function that can be used to close the connection.
(server functions &opt host port workers-per-connection) -Create an RPC server. The default host is "127.0.0.1" and the default port is "9366". Also must take a dictionary of functions that clients can call.Community Examples
schema/make-predicate schema/make-validator schema/predicate schema/validator
(make-predicate schema) -Generate a function that can be used to validate a data structure. This is the function form of `predicate`.Community Examples
(make-validator schema) +Generate a function that can be used to validate a data structure. This is the function form of `predicate`.
(make-validator schema) -Generate a function that can be used to validate a data structure. This is the function form of `validator`.Community Examples
(predicate pattern) +Generate a function that can be used to validate a data structure. This is the function form of `validator`.
(predicate pattern) -Make a validation predicate given a certain schema.Community Examples
(validator pattern) +Make a validation predicate given a certain schema.
(validator pattern) -Make a validation function of one argument. A validation function will throw an error on validation failure, otherwise, it will return the argument.Community Examples
sh/copy sh/copy-file sh/create-dirs sh/devnull sh/escape sh/exec sh/exec-fail sh/exec-slurp sh/exec-slurp-all sh/exists? sh/list-all-files sh/make-new-file sh/rm sh/scan-directory sh/split
(copy src dest) Copy a file or directory recursively from one location to another. -Expects input to be unix style pathsCommunity Examples
(copy-file src-path dst-path) -Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.Community Examples
(create-dirs dir-path) +Copy a file from source to destination. Creates all directories in the path to the destination file if they do not exist.
(create-dirs dir-path) -Create all directories in path specified as string including itself.Community Examples
(devnull) +Create all directories in path specified as string including itself.
(devnull) -get the /dev/null equivalent of the current platform as an open fileCommunity Examples
(escape & args) +get the /dev/null equivalent of the current platform as an open file
(escape & args) -Output a string with all arguments correctly quotedCommunity Examples
(exec & args) -Execute command specified by args returning it's exit codeCommunity Examples
(exec-fail & args) +Execute command specified by args returning it's exit code
(exec-fail & args) -Execute command specified by args, fails when command exits with non-zero exit codeCommunity Examples
(exec-slurp & args) +Execute command specified by args, fails when command exits with non-zero exit code
(exec-slurp & args) -Read stdout of command specified by args and return it trimmed in a string.Community Examples
(exec-slurp-all & args) +Read stdout of command specified by args and return it trimmed in a string.
(exec-slurp-all & args) Read stdout and stderr of subprocess and return it trimmed in a struct with :err and :out containing the output as string. -This will also return the exit code under the :status key.Community Examples
(exists? path) +This will also return the exit code under the :status key.
(exists? path) -Check if the given file or directory exists. (Follows symlinks)Community Examples
(list-all-files dir &opt into) +Check if the given file or directory exists. (Follows symlinks)
(list-all-files dir &opt into) -List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.Community Examples
(make-new-file file-path &opt mode) +List the files in the given directory recursively. Return the paths to all files found, relative to the current working directory if the given path is a relative path, or as an absolute path otherwise.
(make-new-file file-path &opt mode) -Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).Community Examples
(rm path) +Create and open a file, creating all the directories leading to the file if they do not exist, and return it. By default, open as a writable file (mode is `:w`).
(rm path) -Remove a directory and all sub directories recursively.Community Examples
(scan-directory dir func) +Remove a directory and all sub directories recursively.
(scan-directory dir func) -Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.Community Examples
(split s) +Scan a directory recursively, applying the given function on all files and directories in a depth-first manner. This function has no effect if the directory does not exist.
(split s) -Split a string into 'sh like' tokens, returns nil if unable to parse the string.Community Examples
tarray/buffer tarray/copy-bytes tarray/length tarray/new tarray/properties tarray/slice tarray/swap-bytes
(tarray/buffer array|size) -Return typed array buffer or create a new buffer.Community Examples
(tarray/copy-bytes src sindex dst dindex &opt count) +Return typed array buffer or create a new buffer.
(tarray/copy-bytes src sindex dst dindex &opt count) -Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.Community Examples
(tarray/length array|buffer) +Copy count elements (default 1) of src array from index sindex to dst array at position dindex memory can overlap.
(tarray/length array|buffer) -Return typed array or buffer size.Community Examples
(tarray/new type size &opt stride offset tarray|buffer) +Return typed array or buffer size.
(tarray/new type size &opt stride offset tarray|buffer) -Create new typed array.Community Examples
(tarray/properties array) +Create new typed array.
(tarray/properties array) -Return typed array properties as a struct.Community Examples
(tarray/slice tarr &opt start end) +Return typed array properties as a struct.
(tarray/slice tarr &opt start end) -Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.Community Examples
(tarray/swap-bytes src sindex dst dindex &opt count) +Takes a slice of a typed array from start to end. The range is half open, [start, end). Indexes can also be negative, indicating indexing from the end of the end of the typed array. By default, start is 0 and end is the size of the typed array. Returns a new janet array.
(tarray/swap-bytes src sindex dst dindex &opt count) -Swap count elements (default 1) between src array from index sindex and dst array at position dindex memory can overlap.Community Examples
test/assert test/assert-docs test/assert-error test/assert-no-error test/assert-not test/capture-stderr test/capture-stdout test/end-suite test/start-suite test/suppress-stderr test/suppress-stdout test/timeit test/timeit-loop
(assert x &opt e) -Override's the default assert with some nice error handling.Community Examples
(assert-docs path) +Override's the default assert with some nice error handling.
(assert-docs path) Assert that all symbols, when module on the path is required, -have proper doc stringCommunity Examples
(assert-error msg & forms) -Test passes if forms error.Community Examples
(assert-no-error msg & forms) -Test passes if forms do not error.Community Examples
(capture-stderr & body) Runs the form and captures stderr. Returns tuple with result of the form -and a string with captured stderr.Community Examples
(capture-stdout & body) Runs the form and captures stdout. Returns tuple with result of the form -and a string with captured stdout.Community Examples
(end-suite) -Ends test suite, prints summary and exits if any have failed.Community Examples
(start-suite &opt name) +Ends test suite, prints summary and exits if any have failed.
(suppress-stderr & body) -Suppreses stdout from the bodyCommunity Examples
(suppress-stdout & body) -Suppreses stdout from the bodyCommunity Examples
(timeit form &opt tag) Time the execution of `form` using `os/clock` before and after, and print the result to stdout. returns: result of executing `form`. -Uses `tag` (default "Elapsed time:") to tag the printout.Community Examples
(timeit-loop head & body) +Uses `tag` (default "Elapsed time:") to tag the printout.
(timeit-loop head & body) Similar to `loop`, but outputs performance statistics after completion. Additionally defines a `:timeout` verb to iterate continuously for a given number of seconds. If the first form of `body` is a bytes, it will be taken -as a custom tag.Community Examples
utf8/decode-rune utf8/encode-rune utf8/prefix->width
(utf8/decode-rune buf &opt start) -Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].Community Examples
(utf8/encode-rune rune &opt buf) +Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].
(utf8/encode-rune rune &opt buf) -Encode a Unicode codepoint into the end of a buffer.Community Examples
(utf8/prefix->width c) +Encode a Unicode codepoint into the end of a buffer.
(utf8/prefix->width c) -Given the first byte in an UTF-8 sequence, get the number of bytes that the codepoint sequence takes up, including the prefix byte.Community Examples
zip/add-bytes zip/add-file zip/compress zip/decompress zip/extract zip/file-directory? zip/file-encrypted? zip/file-supported? zip/get-filename zip/locate-file zip/read-bytes zip/read-file zip/reader-close zip/reader-count zip/stat zip/version zip/write-buffer zip/write-file zip/writer-close zip/writer-finalize
(zip/add-bytes writer path data &opt comment flags) -Add a byte sequence to the zip writer.Community Examples
(zip/add-file writer path filename &opt comment flags) +Add a byte sequence to the zip writer.
(zip/add-file writer path filename &opt comment flags) -Add a file to the zip writer.Community Examples
(zip/compress bytes &opt level into) -Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.Community Examples
(zip/decompress bytes &opt into) +Compress data and write to a buffer. Different compression levels can be used - higher compression levels trade smaller output with longer compression times. Returns `into`. If `into` not provided, a new buffer is created.
(zip/decompress bytes &opt into) -Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.Community Examples
(zip/extract reader idx-or-filename &opt into flags) +Decompress data and write to a buffer. If an `into` buffer is not provided, a new buffer will be created.
(zip/extract reader idx-or-filename &opt into flags) -Extract a file from the zip archive, either to memory or to a file on disk.Community Examples
(zip/file-directory? reader idx) +Extract a file from the zip archive, either to memory or to a file on disk.
(zip/file-directory? reader idx) -Check if a file index is a directory.Community Examples
(zip/file-encrypted? reader idx) +Check if a file index is a directory.
(zip/file-encrypted? reader idx) -Check if a file is encrypted inside an archive.Community Examples
(zip/file-supported? reader idx) +Check if a file is encrypted inside an archive.
(zip/file-supported? reader idx) -Check if a file is supported with this verstion of miniz.Community Examples
(zip/get-filename reader idx) +Check if a file is supported with this verstion of miniz.
(zip/get-filename reader idx) -Convert a file index index in the archive to a filename.Community Examples
(zip/locate-file reader path &opt comment flags) +Convert a file index index in the archive to a filename.
(zip/locate-file reader path &opt comment flags) -Get the index of a particular filename in the archive.Community Examples
(zip/read-bytes bytes &opt flags) +Get the index of a particular filename in the archive.
(zip/read-bytes bytes &opt flags) -Read a byte sequence as a zip archive. Returns a new zip reader.Community Examples
(zip/read-file filename &opt flags) +Read a byte sequence as a zip archive. Returns a new zip reader.
(zip/read-file filename &opt flags) -Read a file as a zip archive. Returns a new zip reader.Community Examples
(zip/reader-close reader) +Read a file as a zip archive. Returns a new zip reader.
(zip/reader-close reader) -Close a reader and free related memory.Community Examples
(zip/reader-count reader) +Close a reader and free related memory.
(zip/reader-count reader) -Get the number of files inside the zip archive. The files can be indexedCommunity Examples
(zip/stat reader idx) +Get the number of files inside the zip archive. The files can be indexed
(zip/stat reader idx) Get stat information of file. Returns a new struct with the following fields: @@ -165,17 +165,17 @@Community ExamplesIndex * :comment * :internal-attr * :external-attr -
(zip/version) -Get the version string of the underlying miniz library.Community Examples
(zip/write-buffer) +Get the version string of the underlying miniz library.
(zip/write-buffer) -Create a new zip archive writer that write to memory.Community Examples
(zip/write-file dest-path) +Create a new zip archive writer that write to memory.
(zip/write-file dest-path) -Create a new zip archive writer that will write into an archive file.Community Examples
(zip/writer-close writer) +Create a new zip archive writer that will write into an archive file.
(zip/writer-finalizer writer) -Finalize a writer, writing any zip files to disk. Return the writer.Community Examples
utf8/decode-rune utf8/encode-rune utf8/prefix->width
(utf8/decode-rune buf &opt start) -Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].Community Examples
(utf8/encode-rune rune &opt buf) +Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].
(utf8/encode-rune rune &opt buf) -Encode a Unicode codepoint into the end of a buffer.Community Examples
(utf8/prefix->width c) +Encode a Unicode codepoint into the end of a buffer.
(utf8/prefix->width c) -Given the first byte in an UTF-8 sequence, get the number of bytes that the codepoint sequence takes up, including the prefix byte.Community Examples
utf8/decode-rune utf8/encode-rune utf8/prefix->width
(utf8/decode-rune buf &opt start) -Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].Community Examples
(utf8/encode-rune rune &opt buf) +Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].
(utf8/encode-rune rune &opt buf) -Encode a Unicode codepoint into the end of a buffer.Community Examples
(utf8/prefix->width c) +Encode a Unicode codepoint into the end of a buffer.
(utf8/prefix->width c) -Given the first byte in an UTF-8 sequence, get the number of bytes that the codepoint sequence takes up, including the prefix byte.Community Examples
utf8/decode-rune utf8/encode-rune utf8/prefix->width
(utf8/decode-rune buf &opt start) -Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].Community Examples
(utf8/encode-rune rune &opt buf) +Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].
(utf8/encode-rune rune &opt buf) -Encode a Unicode codepoint into the end of a buffer.Community Examples
(utf8/prefix->width c) +Encode a Unicode codepoint into the end of a buffer.
(utf8/prefix->width c) -Given the first byte in an UTF-8 sequence, get the number of bytes that the codepoint sequence takes up, including the prefix byte.Community Examples
utf8/decode-rune utf8/encode-rune utf8/prefix->width
(utf8/decode-rune buf &opt start) -Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].Community Examples
(utf8/encode-rune rune &opt buf) +Read a UTF-8 encoded Unicode codepoint from the buffer which starts at the given index. Returns a tuple [value width], where width = number of bytes consumed. If at the end of buffer or the buffer contains malformed UTF-8, returns [nil 0].
(utf8/encode-rune rune &opt buf) -Encode a Unicode codepoint into the end of a buffer.Community Examples
(utf8/prefix->width c) +Encode a Unicode codepoint into the end of a buffer.
(utf8/prefix->width c) -Given the first byte in an UTF-8 sequence, get the number of bytes that the codepoint sequence takes up, including the prefix byte.Community Examples