aboutsummaryrefslogtreecommitdiff
path: root/doc/ref/general/util.texi
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--doc/ref/general/util.texi (renamed from doc/ref/guile/util.texi)84
1 files changed, 35 insertions, 49 deletions
diff --git a/doc/ref/guile/util.texi b/doc/ref/general/util.texi
index 1d35e0bf..1d6a4e7a 100644
--- a/doc/ref/guile/util.texi
+++ b/doc/ref/general/util.texi
@@ -1,5 +1,8 @@
-@node General Utilities
-@section General Utilities
+@node Miscellaneous utilities
+@section Miscellaneous utilities
+
+A kitchen sink utility library. Note should be taken that some core
+procedures and forms are replaced, but all in compatible ways.
Provided by the module @code{(hnh util)}.
@@ -34,8 +37,8 @@ our extra specialized @var{when}}, but binds the return of
@defmacx for (key ...) in collection body ...
Syntactic sugar over @code{map}.
@example
-for x in collection
- body ...
+(for x in collection
+ body ...)
@end example
expands into
@example
@@ -44,6 +47,17 @@ expands into
If keys are a list, an match-lambda is used instead.
@xref{Pattern Matching,,,guile}
+
+@defun break args ...
+Abandon the entire loop. Returing what was given to @code{break}.
+@end defun
+
+@defun continue [arg]
+Abandon the current iteration of the loop. If an argument is given,
+it's used as the result in the resulting list, otherwise @code{#f} is
+used.
+@end defun
+
@end defmac
@@ -322,6 +336,9 @@ Converts @var{any} to a string, as per @var{display}.
@defmac let-env bindings body ...
Similar to @var{let}, but sets environment variables for the code in
body. Restores the old values once we leave.
+
+A variable can also be removed from the environment, by setting its
+value to @code{#f}.
@end defmac
@defmac with-locale1 category locale thunk
@@ -338,51 +355,20 @@ innermost.
then @code{with-throw-handler} is used instead of @code{catch}.
@end defmac
-@subsection UUID generation
+@defun uniq lst
+@defunx univ lst
+@defunx unique lst
+@defunx uniqx comp lst
+Squash repeated equivalent elements in a list into single instances,
+similar to the POSIX command uniq(1). The three variants uses
+@code{eq?}, @code{eqv?}, and @code{equal?} respectively.
-Provided by module @code{(hnh util uuid)}.
-
-@defun uuid-v4
-Generates a UUID-v4 string.
-@end defun
-
-@defun uuid
-Generates an implementation defined (but guaranteed valid) UUID.
+@code{uniqx} also takes @var{comp}, which is sholud be a binary
+procedure returning if the elements are equal.
@end defun
-@subsection IO
-
-Provided by module @code{(hnh util io)}.
-
-@defun open-input-port path
-@defunx open-output-port path
-Like @code{open-*-file}, but ``-'' gives @code{standard-@{input,output@}}.
-@end defun
-
-@defun read-lines port
-Return a list of all lines read from port.
-@end defun
-
-@defun with-atomic-output-to-file filename thunk
-Same functionality as the regular @var{with-output-to-file}, but
-with the difference that either everything is written, or nothing
-is written, and if anything is written it's all written atomicaly at
-once (the original file will never contain an intermidiate state).
-Does NOT handle race conditions between threads.
-
-propagates the return value of @var{thunk} upon successfully writing
-the file, and @code{#f} otherwise.
-@end defun
-
-@defun call-with-tmpfile proc [#:tmpl ``/tmp/file-XXXXXXX'']
-@end defun
-
-@defun ->port port-or-strings
-If @var{port-or-string} is a port, return it directly. If it's a
-string, instead return an input string containing the strings content.
-@end defun
-
-@c Is this even a procedure?
-@defun read-file path
-Open file at path, and return its content as a string.
-@end defun
+@defmac begin1 forms ...
+Port of Common Lisp's @code{begin1} form. Like @code{begin} runs each
+form in its body in order, but returns the first result instead of the
+last.
+@end defmac