dt

duct tape for your unix pipes


dt 0.7.0 standard library

*Consume two numbers and produce their product.
+Consume two numbers and produce their sum.
-Consume two numbers and produce their difference.
->Consumes a variable number of values, and binds them as one or more commands.
...Consume a quote, and produce its values.
/Consume two numbers and produce their ratio.
:Consumes a variable number of values, and binds them as one or more commands.
::Consumes a variable number of values, and binds them as one or more commands. Quotes are not expanded.
=>Consumes a variable number of values, and binds them as one or more commands. Quotes are not expanded.
?Consumes a specially-formed quote of quotes. The quote of quotes is evaluated by twos, with the first quote as a predicate and the second as an action to perform. Predicates will be evaluated until a predicate produces true. Only the action following the first true predicate will be executed. If no predicates match, no actions will be performed.
absConsume a number and produce its absolute value.
aliasConsumes two commands, and binds the latter to the former. Any new definitions are preserved in the calling context.
andConsumes two boolean values. If both are true, produces true. Otherwise produces false.
anyConsumes a sequence and a predicate. If the predicate applied to any value in the sequence is true, produces true. Otherwise produces false.
as-quoteConsume a value. If it is already a quote, produce it. Otherwise, produce a quote containing only that value.
assert-trueFIXME
bool?FIXME: Undocumented
cdConsume one string as a filename, and make that the process's current working directory.
charsFIXME: Undocumented
chooseFIXME: Undocumented
clearWhen invoked in a terminal context, clears the screen.
command?FIXME: Undocumented
concatConsume two quotes or two strings and produce their concatenated value.
contains?Consume one string and one string as a substring. Produce true if the substring occurs in the original string, and false otherwise.
defFIXME: Undocumented
def!Consumes one quote and a quoted command or string. The latter quoted command or string becomes a command that executes the first quote. Any new definitions are preserved in the calling context.
def?Consumes a quote or command, and produces true when it is defined, and false otherwise.
defsProduce a list of all defined commands in the current context.
deqConsume a quote, and produce its first value and the quote with the first value removed.
describeConsumes a quoted command or command, and produces its description as a string.
digitsConsume a number and produce a list of its decimal digits.
dir?Consume a string as a filename. Produce true if the filename references a directory, and false otherwise.
divisor?FIXME: Undocumented
doConsumes a quote or command and executes it, producing any output(s) of the quote or command. Any definitions are local only to the quote or command performed.
do!Consumes a quote or command and executes it, producing any output(s) of the quote or command. Any new definitions are preserved in the calling context.
doinConsumes one quote and one quote or command. The latter quote or command is executed inside the first quote, producing any output(s) of the quote or command inside it. Any definitions are local only to the quote or command performed.
doin!Consumes one quote and one quote or command. The latter quote or command is executed inside the first quote, producing any output(s) of the quote or command inside it. Any new definitions are preserved in the calling context.
downcaseConsume a string and produce an identical string in all lowercase.
downcase?FIXME: Undocumented
dropConsume one value and discard it.
dupConsume one value and produce it two times.
dup2Consume two values, and produce them two times.
eachConsume one quote as a list and another quote as commands. Run the commands on each list, any definitions will NOT be preserved in the calling context.
each!Consume one quote as a list and another quote as commands. Run the commands on each list, any definitions will be preserved in the calling context.
empty?FIXME: Undocumented
ends-with?Consume one string and one string as a substring. Produce true if the substring is a suffix of the original string, and false otherwise.
enqConsume a value and a quote, and produce an identical quote with the value prepended.
envProduce a symbol table of all environment variables.
envgetConsume a string as an environment key, and produce its value.
envsetConsume a string as an environment key and a string as its value, and set it in the current environment.
eq?Consumes two values. If they're equal, produces true. Otherwise produces false.
equal?Consumes two values. If they're equal, produces true. Otherwise produces false.
even?FIXME: Undocumented
execConsume a string as an executable name, and produce a symbol table with "status", "stdout" and "stderr" keys.
extractConsume a symbol table and a string as a key, produce an identical symbol table and the value relating to the key.
f64?FIXME: Undocumented
file?Consume a string as a filename. Produce true if the filename references a file, and false otherwise.
filterConsume one quote as a list and another quote as a predicate, produce a list of all values from the original list that return true for the predicate.
float-maxProduce the maximum floating-point value.
float-minProduce the minimum floating-point value.
floorConsume a number and produce its floor.
greater-than?Consumes two numbers. If the top value is greater, produces true. Otherwise produces false.
greater?Consumes two numbers. If the top value is greater, produces true. Otherwise produces false.
gt?Consumes two numbers. If the top value is greater, produces true. Otherwise produces false.
gte?Consumes two numbers. If the top value is greater or equal, produces true. Otherwise produces false.
i64?FIXME: Undocumented
inequal?Consumes two values. If they're not equal, produces true. Otherwise produces false.
insertConsume a symbol table and a quote as a key + value pair. Produce an identical symbol table with the key + value pair added.
int-maxProduce the maximum integer value.
int-minProduce the minimum integer value.
joinConsume a list of strings and a string separator. Produce a string with all strings in the original list joined with the separator.
lastFIXME: Undocumented
lenConsume a quote or string, and produce its length.
lengthConsume a quote or string, and produce its length.
less-than?Consumes two numbers. If the top value is lesser, produces true. Otherwise produces false.
lesser?Consumes two numbers. If the top value is lesser, produces true. Otherwise produces false.
linesFIXME: Undocumented
lsProduce a list of all the files and directories in the process's current working directory.
lt?Consumes two numbers. If the top value is lesser, produces true. Otherwise produces false.
lte?Consumes two numbers. If the top value is lesser or equal, produces true. Otherwise produces false.
mapConsume one quote as a list and another quote as a transform, produce a list of all values from the original list after applying the transformation.
maxFIXME: Undocumented
maximumFIXME: Undocumented
minFIXME: Undocumented
minimumFIXME: Undocumented
mkdirConsume a string as a filename, and create a directory with that name.
modConsume two numbers and produce their remainder.
negateConsume a number and produce its negation.
neq?Consumes two values. If they're not equal, produces true. Otherwise produces false.
nlPrints a newline.
noneFIXME: Undocumented
notConsumes one boolean value and produces its inverse.
not-equal?Consumes two values. If they're not equal, produces true. Otherwise produces false.
nthConsume a quote and an integer, and produce the element at the 0-indexed location specified.
odd?FIXME: Undocumented
orConsumes two boolean values. If either are true, produces true. Otherwise produces false.
otherwiseFIXME: Undocumented
pConsumes one value and prints it.
plConsumes one value, prints it, and prints a newline.
plsFIXME: Undocumented
popConsume a quote, and produce a quote (with the last element removed) and the quote's last element.
printConsumes one value and prints it.
printlnConsumes one value, prints it, and prints a newline.
printlnsFIXME: Undocumented
pruneFIXME: Undocumented
pushConsume a quote and a value, and produce an identical quote with the value appended.
pwdProduce the process's current working directory.
quoteConsume a value, and produce a quote containing only that value.
quote-allGo "up" a context, leaving the program's previous state as a quotation.
quote?FIXME: Undocumented
rangeFIXME: Undocumented
readfConsume a string as a filename, and produce that file's lines as a list of strings.
revConsume a quote or string, and produce its reverse.
rotConsume three values, and produce them rotated once.
splitConsume a string and a string as a separator. Produce a list of terms from the first string split on the separator.
sqrtConsume a number and produce its square root.
stabProduce a new, empty symbol table.
stab?FIXME: Undocumented
starts-with?Consume one string and one string as a substring. Produce true if the substring is a prefix of the original string, and false otherwise.
statusPrints the current status of the program.
stdinRead standard input and produce a list of lines.
string?FIXME: Undocumented
swapConsume two values, and produce them in reverse order.
timesConsume a quotation and an integer, and perform the quotation the specified number of times.
to-stringConsume one value and produce a string representation of it.
trimConsume a string and produce an identical string with all leading and trailing whitespace removed.
typeConsume a value and produce the name (a string) of its type.
undef?FIXME: Undocumented
unlinesFIXME: Undocumented
unquoteConsume a quote, and produce its values.
unwordsFIXME: Undocumented
upcaseConsume a string and produce an identical string in all uppercase.
upcase?FIXME: Undocumented
versionProduces the version of dt currently in use.
whileFIXME: Undocumented
wordsFIXME: Undocumented
writefConsume a string as a filename and a string as file contents. The contents are written to the file.
zipConsume two quotes as lists, and produce a list of pairs of values. The result as short as the shortest list; additional values from a longer list will be discarded.
zip-withConsume two quotes as lists and one quote as a list of commands. Produce a list of values that are the pairwise application of the commands to values in the original list. The result as short as the shortest list; additional values from a longer list will be discarded.