dt

duct tape for your unix pipes


dt 1.0.0 standard library

do( -- ? ) Execute an action.
push( [] -- [] ) Push a value into a quote as its new last value.
version( -- ) Produce the version of dt in use.
status( -- ) Print the state of the process: all available values.
deq( [] -- [] ) Dequeue the first value from a quote.
%( -- ) Modulo two numeric values. In standard notation: a % b = c
chars( -- [] ) Splits a string into individual characters, where a character is a single byte. (Not friendly to UTF-8 runes.)
pipe-thru-argspipe-thru-args
repl-preluderepl-prelude
dup( -- ) Duplicate the most recent value.
*( -- ) Multiply two numeric values.
eprintlns( [] -- ) Print the values of the most recent quote, each followed by a newline, to standard error.
swap( -- ) Swap the two most recent values.
len( -- ) The length of a string or quote. (Always 1 for single values.)
quote( -- [] ) Quote a value.
gte?( -- ) Determine if a number is greater-than/equal-to another. In standard notation: a ≧ b
readf( -- ) Read a file's contents as a string.
join( [] -- ) Join strings with a delimiter.
ep( -- ) Print the most recent value to standard error.
to-float( -- ) Coerce a value to a floating-point number.
run-argsrun-args
doin( -- ) Execute an action in a context.
even?( -- ) Determine if a number is even.
neq?( -- ) Determine if two values are unequal.
divisor?( -- ) Determine if a number a is evenly divisible by number b.
first( [] -- ) The first element of a quote.
do?( -- ? ) Conditionally execute an action.
enl( -- ) Print a newline to standard error.
parse-csv( -- [[]] ) Naive conversion of a raw string in comma-separated value (CSV) format to a quote of lines of cells
.s( -- ) Print the state of the process: all available values.
drop( -- ) Drop the most recent value.
+( -- ) Add two numeric values.
to-bool( -- ) Coerce a value to a boolean.
inspire( -- ) Get inspiration.
pl( -- ) Print the most recent value and a newline to standard output.
println( -- ) Print the most recent value and a newline to standard output.
assert-true( -- ) Naive assertion that requires a condition to be truthy. If falsy, it will print a message to standard error and fail with an exit code of 1.
def!( -- ) Defines a new command. If nested, any commands or variables defined will be available in the calling scope.
map( -- ) Apply an action to all values in a quote.
upcase( -- ) Convert a string to its uppercase form.
undef?( -- ) Determine whether a command is undefined.
each( [] -- ) Perform a given action with each value in a quote.
lte?( -- ) Determine if a number is less-than/equal-to another. In standard notation: a ≦ b
last( [] -- ) The last element of a quote.
cwd( -- ) Produce the current working directory.
writef( -- ) Write a string as a file. If a file previously existed, it will be overwritten.
def?( -- ) Determine whether a command is defined.
to-quote( -- [] ) Coerce value to a quote. To quote a quote, use quote.
while( -- ? ) Perform an action while the condition is truthy.
alias( -- ) Alias a new command from another, copying the description of the previous command.
abs( -- ) Determine the absolute value of a number.
defs( -- [] ) Produce a quote of all defined commands.
not( -- ) Determine the inverse truthiness of a value.
read-lines( -- [] ) Read strings, separated by newlines, from standard input until EOF. (For example: until ctrl+d in a unixy system, or until a pipe is closed.)
rot( -- ) Rotate the three most recent values.
red( -- ) Print a control character for red to standard output and standard error.
args( -- [] ) Produce the arguments provided to the process when it was launched.
interactive?( -- ) Determine if the input mode is interactive (a TTY) or not.
do!( -- ? ) Execute an action. If nested, any commands or variables defined will be available in the calling scope.
concat( [] [] -- [] ) Concatenate two quotes. Values are coerced into quotes. (For String concatenation, see join.)
unwords( [] -- ) Joins strings with spaces.
to-string( -- ) Coerce a value to a string.
nand( -- ) Determine if two values are not both truthy.
main-replmain-repl
do!?( -- ? ) Conditionally execute an action. If nested, any commands or variables defined will be available in the calling scope.
rand( -- ) Produces a random integer.
read-line( -- ) Read a string from standard input until newline.
quote-all( ? -- [] ) Quote all current context.
print-versionprint-version
words( -- [] ) Splits a string on spaces.
epls( [] -- ) Print the values of the most recent quote, each followed by a newline, to standard error.
--version--version
downcase( -- ) Convert a string to its lowercase form.
ls( -- [] ) Produce a quote of files and directories in the process's working directory.
appendf( -- ) Write a string to a file. If a file previously existed, the new content will be appended.
or( -- ) Determine if either of two values are truthy.
unlines( [] -- ) Joins strings with newlines.
exit( -- ) Exit with the specified exit code.
pwd( -- ) Print the current working directory to standard output.
cd( -- ) Change the process's working directory.
to-def( -- ) Coerce a value to a deferred command. (Read as "definition" or "deferred".)
evaleval
eq?( -- ) Determine if two values are equal. Works for most types with coersion.
any?( -- ) Determine whether any value in a quote passes a condition. Stops at the first truthy result.
def( -- ) Define a command.
gt?( -- ) Determine if a number is greater than another. In standard notation: a > b
unquote( -- ? ) Unpack a quote.
repl-greetrepl-greet
pls( [] -- ) Print the values of the most recent quote, each followed by a newline, to standard output.
anything?( -- ) True if any value is present.
:( ... [] -- ) Bind variables to a quote of names.
lt?( -- ) Determine if a number is less than another. In standard notation: a < b
def-usage( -- ) Define the usage notes of a given command.
ends-with?( -- ) Determine if a string ends with a suffix.
exec( -- ) Execute a child process (from a String). When successful, returns stdout as a string. When unsuccessful, prints the child's stderr to stderr, and returns boolean false.
to-cmd( -- ) Coerce a value to a command.
shebang-argsshebang-args
starts-with?( -- ) Determine if a string starts with a prefix.
norm( -- ) Print a control character to reset any styling to standard output and standard error.
eprintln( -- ) Print the most recent value and a newline to standard error.
pop( [] -- [] ) Pop the last value from a quote.
odd?( -- ) Determine if a number is odd.
print( -- ) Print the most recent value to standard output.
procname( -- ) Produce the name of the current process. This can be used, for example, to get the name of a shebang script.
split( -- [] ) Split a string on all occurrences of a delimiter.
green( -- ) Print a control character for green and bold (for the colorblind) to standard output and standard error.
rev( -- ) Reverse a quote or string. Other types are unmodified.
epl( -- ) Print the most recent value and a newline to standard error.
times( -- ? ) Perform a given action n times.
handle-flagshandle-flags
quit( -- ) Quit. Prints a warning if there are any values left on stack.
to-int( -- ) Coerce a value to an integer.
printlns( [] -- ) Print the values of the most recent quote, each followed by a newline, to standard output.
handle-flaghandle-flag
/( -- ) Divide two numeric values. In standard notation: a / b = c
lines( -- [] ) Splits a string on newlines.
-( -- ) Subtract two numeric values. In standard notation: a - b = c
contains?( -- ) With Strings, determine if a string contains a substring. With quotes, determine if a quote contains a value.
eprint( -- ) Print the most recent value to standard error.
...( -- ? ) Unpack a quote.
print-helpprint-help
usage( -- ) Print the usage notes of a given command.
and( -- ) Determine if two values are both truthy.
nor( -- ) Determine if neither of two values are truthy.
filter( -- ) Require some condition of all values in a quote. Truthy results are preserved, and falsy results are not.
--help--help
replrepl
p( -- ) Print the most recent value to standard output.
nl( -- ) Print a newline to standard output.
enq( [] -- [] ) Enqueue a value into a quote as its new first value.
define( -- ) Define a command with a description.