0.5.91
9 General Utilities
value
=
(and/c string? immutable?)
value
=
(or/c path? (and/c string-immutable/c path-string?))
Contracts recognizing immutable strings and
path or string values, respectively.
value
trimmed-string-px : pregexp? = #px"^[^\\s]$|^[^\\s].*[^\\s]$"
Matches non-empty strings that neither start nor end with whitespace.
procedure
a : string-immutable/c b : string-immutable/c
Like string-ci<?, but performs additional
normalization on a and b appropriate
for titles, such as ignoring the first word if
it is A, An, or The.
Use this function with sort to alphabetize by title.
procedure
(with-output-to-file/unless-exn path thunk [ #:mode mode-flag #:exists exists-flag #:buffer buffer]) → any/c path : path-string? thunk : (-> any/c) mode-flag : (or/c 'binary 'text) = 'binary
exists-flag :
(or/c 'error 'append 'update 'replace 'truncate 'truncate/replace) = 'error buffer : (or/c 'memory 'file) = 'memory
Like with-output-to-file, but does not open path
for writing unless thunk returns without raising an exception.
In contrast, using with-output-to-file with an exists-flag
like 'replace may delete existing data, even if thunk
raises an exception without writing anything.
The buffer argument, if given, controls where the data is actually written duting the call to thunk. If it is 'memory (the default), an internal Racket pipe is used; otherwise, if it is 'file, with-output-to-file/unless-exn uses a temporary file.
(An additional difference from with-output-to-file is that thunk is currently limited to a single return value.)