edward.util

This library provides various generic utility procedures.

Index

Table of contents

String Procedures

Utility procedures which operate on strings.

procedure empty-string?

Return true if the given string str is the empty string.

(empty-string? str)

procedure pad-string

Pad given string str with given padding string pad to length.

(pad-string str pad length)

procedure string->human-readable

Convert string to a human readable representation as mandated by the ed list command.

(string->human-readable str)

procedure path-join

Join a list of path elements (i.e. strings) using / as a path separator.

(path-join . elems)

procedure count-bytes

Return amount of bytes in a string.

(count-bytes str)

IO Procedures

Procedures which deal with input/output.

procedure lines->port

Write lines, i.e. a list of non-newline terminated strings to a given port. Returns the amount of bytes written to the port (including any newline characters).

(lines->port lines port)

procedure port->lines

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

Miscellaneous utility procedures.

procedure inc

Syntactic sugar to increment a number by one.

(inc n)

procedure dec

Syntactic sugar to decrement a number by one.

(dec n)

procedure id

Identity function, always returns the given value.

(id x)

procedure alist-values

Returns all values of an alist, discarding the keys.

(alist-values alist)

procedure println

Like display but prints multiple objects and adds a trailing newline.

(println . objs)

procedure fprintln

Like println but allows specification of a custom output port.

(fprintln port . objs)

procedure user-home

Return path to home directory of current user. This procedure emits an error if the environment variable HOME is unset.

(user-home)