Overview
--------
The cxp command gives you access to a DSL that shares many similarities with
string diagrams. See graphicallinearalgebra.net for more information (note
that netstrings are formed from a product of the natural number monoid and
the bytestring monoid).
The idea is to break text up into regions (snippets) that can be recomposed
into new files. We treat all data as being composed of bytes so that we can
break it up into netstrings (although cxp may support nitstrings as well in
the future).
In bash you would
cat somefile | cxp $cmd0 $arg0 | cxp $cmd1 $arg1 | ... \
... | cxp $cmdn $argn > otherfile
An alternative way to achieve the same thing is using the following syntax:
cat somefile | cxp $cmd0 $arg0 - ... - $cmdn $argn > otherfile
or even:
cxp read somefile - quote - $cmd0 ... $argn - unquote - write otherfile
Currently implemented commands:
- quote :: Collect stdin and prefix it, stream resulting netstring to stdout.
- (unquote :: Collect stdin drop prefix if any and return that many bytes from rest of stdin.)
- fetch :: give sha256 on stdin and receive cached preimage on stdout (or nothing).
- cache :: give data on stdin and receive sha256 on stdout.
See SPECIFICATION for missing functionality.
Please check out http://git.sr.ht/~ilmu/tala for the next layer of
abstraction (name system built on top of cxp's).
Hacking
-------
First enter a guix shell, then you can try the following:
Currently the way I am working is via repl and buffer and then occasionally
I sbcl --load hack.lisp in a terminal to make the bin and test it in bash.