1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-08 10:50:21 +02:00

Add `(srfi srfi-88)'.

This commit is contained in:
Ludovic Courtès 2008-04-26 19:34:37 +02:00
parent e9680652d6
commit efbc70de56
10 changed files with 188 additions and 7 deletions

View file

@ -1,3 +1,9 @@
2008-04-26 Ludovic Courtès <ludo@gnu.org>
* srfi-modules.texi (SRFI-88): New section.
* api-data.texi (Keyword Read Syntax): Add reference to
`SRFI-88'.
2008-04-17 Neil Jerram <neil@ossau.uklinux.net>
* posix.texi (File System): New doc for file-exists?.

View file

@ -5042,9 +5042,8 @@ of the form @code{:NAME} are read as symbols, as required by R5RS.
@cindex SRFI-88 keyword syntax
If the @code{keyword} read option is set to @code{'postfix}, Guile
recognizes the @uref{http://srfi.schemers.org/srfi-88/srfi-88.html,
SRFI-88 read syntax} @code{NAME:}. Otherwise, tokens of this form are
read as symbols.
recognizes the SRFI-88 read syntax @code{NAME:} (@pxref{SRFI-88}).
Otherwise, tokens of this form are read as symbols.
To enable and disable the alternative non-R5RS keyword syntax, you use
the @code{read-set!} procedure documented in @ref{User level options

View file

@ -1,6 +1,6 @@
@c -*-texinfo-*-
@c This is part of the GNU Guile Reference Manual.
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 2007
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008
@c Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
@ -45,6 +45,7 @@ get the relevant SRFI documents from the SRFI home page
* SRFI-60:: Integers as bits.
* SRFI-61:: A more general `cond' clause
* SRFI-69:: Basic hash tables.
* SRFI-88:: Keyword objects.
@end menu
@ -3215,6 +3216,56 @@ Answer a hash value appropriate for equality predicate @code{equal?},
@code{hash} is a backwards-compatible replacement for Guile's built-in
@code{hash}.
@node SRFI-88
@subsection SRFI-88 Keyword Objects
@cindex SRFI-88
@cindex keyword objects
@uref{http://srfi.schemers.org/srfi/srfi-88.html, SRFI-88} provides
@dfn{keyword objects}, which are equivalent to Guile's keywords
(@pxref{Keywords}). SRFI-88 keywords can be entered using the
@dfn{postfix keyword syntax}, which consists of an identifier followed
by @code{:} (@pxref{Reader options, @code{postfix} keyword syntax}).
SRFI-88 can be made available with:
@example
(use-modules (srfi srfi-88))
@end example
Doing so installs the right reader option for keyword syntax, using
@code{(read-set! keywords 'postfix)}. It also provides the procedures
described below.
@deffn {Scheme Procedure} keyword? obj
Return @code{#t} if @var{obj} is a keyword. This is the same procedure
as the same-named built-in procedure (@pxref{Keyword Procedures,
@code{keyword?}}).
@example
(keyword? foo:) @result{} #t
(keyword? 'foo:) @result{} #t
(keyword? "foo") @result{} #f
@end example
@end deffn
@deffn {Scheme Procedure} keyword->string kw
Return the name of @var{kw} as a string, i.e., without the trailing
colon. The returned string may not be modified, e.g., with
@code{string-set!}.
@example
(keyword->string foo:) @result{} "foo"
@end example
@end deffn
@deffn {Scheme Procedure} string->keyword str
Return the keyword object whose name is @var{str}.
@example
(keyword->string (string->keyword "a b c")) @result{} "a b c"
@end example
@end deffn
@c srfi-modules.texi ends here