syntax: begin-first result expression ...
procedure: boolean->integer a ->
syntax: boolean-true? a ...
procedure: call-at-approximated-interval proc min-interval max-interval [change-factor-slower change-factor-faster] state ... ->
{states ... -> integer} microseconds microseconds rational rational any ... ->
like call-at-interval-w-state but without a continue procedure, automatically adjusting interval after each application of proc
depending on the result of proc: -1 increases the interval, 1 decreases it and 0 does not change it.
procedure: call-at-interval proc interval ->
procedure:{current-interval procedure:continue:{next-interval -> any} -> any} microseconds -> unspecified
call proc after interval of length interval. proc receives the current interval and a procedure to
continue, with the option to change the interval
procedure: call-at-interval-w-state proc interval init ... ->
procedure:{current-interval continue any ...} microseconds any ...
like call-at-interval but accepting unlimited number of additional parameters
that are passed to proc and the continue procedure.
procedure: char-set->vector a ->
procedure: cli-option name [value] ->
creates a string for one generic command-line option in the gnu format -{single-character} or --{word} or --{word}=.
optionally with values.
\"name\"can be a:
character: short option
string: long option
value can be anything, non-strings will be converted to strings in \"display\" format
procedure: cli-option-join options ->
((name value ...)/string ...) -> (string ...)
(("a" 3)) -> -a 3
(("abc" 3)) -> --abc 3
creates a command-line options string, automatically appending - or -- to option names.
- pairs with prefixes that are characters or single char strings become single char options
- pairs with prefixes that are multi char strings become multi char options
- the tail of pairs is string-joined with spaces and used as the value for the option
- strings become keyless arguments
procedure: each-integer count proc [start] ->
integer procedure:{integer ->} ->
call proc \"count\" times
syntax: false-if test consequent
result in false if \"test\" is true, otherwise execute consequent
syntax: false-if-not test consequent
execute consequent if \"test\" is true, otherwise result in false
procedure: guile-exception->key proc ->
guard catches guile exceptions, but it seems impossible to get the key
syntax: identity-if result-if-true else ...
syntax: if-pass a consequent alternative
syntax: if-pass-apply a consequent alternative
syntax: if-predicate-and (predicate ...) subject consequent alternative
syntax: if-predicate-or (predicate ...) subject consequent alternative
procedure: ignore a ... ->
ignores all arguments and returns unspecified
procedure: pass proc obj ->
apply proc with obj, return obj.
example
(+ 2 (pass write (+ 1 3)))
writes 4 to standard output
results in 6
procedure: pass-predicate-and-if predicates subject consequent alternative ->
(procedure ...) any procedure:{any:subject -> any} procedure:{any:subject -> any}
procedure: pass-predicate-or-if predicates subject consequent alternative ->
any/(procedure:{any:subject -> any} ...) any procedure:{any:subject -> any} procedure:{any:subject -> any}
procedure: predicate-and predicates subjects ... ->
any/(procedure:{any:subject -> any} ...) any ... -> boolean
true if every predicate gives true for every subject, false otherwise
procedure: predicate-or predicates subjects ... ->
any/(procedure:{any:subject -> any} ...) any ... -> boolean
true if every predicate gives true for every subject, false otherwise
procedure: procedure->cached-procedure proc [key-f] ->
procedure -> procedure procedure
returns a new procedure with the same signature that calculates each result only once.
calling the procedure again with the same arguments will lead to the cached result to be returned.
the second returned procedure takes no arguments and clears the cache when called.
example 1:
(define my-calculate-cached (procedure->cached-procedure my-calculate))
example 2:
(let-values (((my-calculate-cached my-calculate-cached-reset) (procedure->cached-procedure my-calculate)))
(my-calculate-cached-reset))
procedure: procedure->temporarily-cached-procedure cache-duration proc ->
integer:seconds procedure -> procedure
like procedure ->
cached-procedure but the cache is emptied after cache-duration the next time the procedure is called
procedure: procedure-append proc ... ->
procedure ... -> procedure:{any ... -> (any ...)}
creates a new procedure that applies each appended procedure with given arguments
and returns the results of each call in a list
procedure: procedure-append* proc ... ->
procedure ... -> procedure:{any ... -> unspecified}
like procedure-append but procedure call results must be lists
which are appended
procedure: procedure-append-ignore-result proc ... ->
procedure ... -> procedure:{any ... -> unspecified}
like procedure-append but does not collect results and returns unspecified
syntax: procedure-cond a (predicate handler) ... else
should probably have an else keyword case instead of returning the last expression
procedure: program-name ->
return the file-name of the currently executed program file. uses the first argument of (program-arguments)
procedure: program-path ->
return the full-path of the currently executed program file. uses the first argument of (program-arguments)
procedure: random-ascii-string len ->
results in a string of randomly chosen ascii characters excluding control characters
procedure: random-between min max ->
procedure: random-boolean [percentage] ->
percentage gives the probability of true results
procedure: random-bytevector size ->
procedure: random-chars list-length [char-set state] ->
integer string/vector random-state -> (character ...)
creates a list of random chars from a set of characters.
the default set of characters includes all the code points to which unicode has assigned a character or other meaning
procedure: random-discrete-f probabilities [state] ->
(real ...) [random-state] -> procedure:{ -> real}
return a function that when called returns an index of a
value in probabilities.
each index will be returned with a probability given by the value at the index.
each value is a fraction of the sum of probabilities.
for example, if the values sum to 100, each entry in probabilities is a percentage.
this allows for custom discrete random probability distributions.
example usage:
(define random* (random-discrete-f (list 10 70 20)))
(define samples (list (random*) (random*)))
procedure: random-string [len char-set state] ->
[integer string/vector] -> string
the default set of characters includes all the code points to which unicode has assigned a character or other meaning
procedure: remove-keyword-associations a ->
removes keyword associations from an argument list passed for example to lamdba*
(3 #:a 1 2 #:b 4) -> (3 2)
procedure: repeat f repeat-count state ->
procedure:{ -> any} integer false/repeat-state:(any:last-result integer:count) -> (any:result integer:count)
f is called without arguments and generates new values that are returned again on subsequent calls for repeat-count times.
returned is a new repeat state which is a list with as the first element the value returned by f.
if state is false then a new state object will be created and returned
procedure: rnrs-exception->key proc [return-object?] ->
procedure [boolean] -> symbol
wraps the given procedure so that when called and an exception occurs in it,
the exception is catched and if the exception object passed to raise is a symbol or list
with a symbol as the first argument, the symbol is returned. otherwise the exception
is re-raised or the object returned, depending on the boolean value of the second argument \"return-object?\"
procedure: rnrs-exception->object proc ->
wraps the given procedure so that when called and an exception occurs in it,
the exception is catched and the object passed to raise is returned
procedure: search-env-path a ->
(string ...) -> (string ...)
search for any match of paths \"a\" in the directories in the PATH environment variable and result in the full path.
similar to guiles %search-load-path but does not consider filename extensions
procedure: search-env-path-one a ->
procedure: socket-bind a b [c] d ... ->
variable: sph-other-description
syntax: values->list producer