This library provides various generic utility procedures.
Utility procedures which operate on strings.
Return true if the given string str
is the empty string.
(empty-string? str)
Pad given string str
with given padding string pad
to length
.
(pad-string str pad length)
Convert string to a human readable representation as mandated by the ed list command.
(string->human-readable str)
Join a list of path elements (i.e. strings) using /
as a path separator.
(path-join . elems)
Return amount of bytes in a string.
(count-bytes str)
Converts list of lines to newline-separated string.
(lines->string buffer)
Procedures which deal with input/output.
Write given data to a given file, returns #t
if write was
successful, #f
otherwise. If the file doesn't exist it is created,
otherwise it is truncated.
(write-file filename data)
Read from given port
as a list of lines. Returns pair of retrieved
lines and total amount of bytes read from the port (including
newlines).
(port->lines port)
Miscellaneous utility procedures.
Syntactic sugar to increment a number by one.
(inc n)
Syntactic sugar to decrement a number by one.
(dec n)
Identity function, always returns the given value.
(id x)
Returns all values of an alist
, discarding the keys.
(alist-values alist)
Like display
but prints multiple objects and adds a trailing newline.
(println . objs)
Like println but allows specification of a custom output port
.
(fprintln port . objs)
Call proc
for each element in lst
starting at the start
index.
For each element, the procedure proc
is passed both the index as
well as the element value itself as a procedure parameter.
(for-each-index proc cont-proc lst start)
Return sublist
with start
inclusive and end
exclusive.
(sublist lst start end)
Return path to home directory of current user.
This procedure emits an error if the environment variable HOME
is unset.
(user-home)