X-Git-Url: http://git.hcoop.net/bpt/guile.git/blobdiff_plain/f82f62944a4e605d385f40b5a4a01e19677bc0b3..dc7a33fa871c42d0474602f3560d3ce350e1f1c3:/doc/ref/api-data.texi diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi index 760318028..c73a703d5 100644 --- a/doc/ref/api-data.texi +++ b/doc/ref/api-data.texi @@ -1,7 +1,7 @@ @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 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. +@c 2008, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc. @c See the file guile.texi for copying conditions. @node Simple Data Types @@ -56,6 +56,7 @@ For the documentation of such @dfn{compound} data types, see @tpindex Booleans The two boolean values are @code{#t} for true and @code{#f} for false. +They can also be written as @code{#true} and @code{#false}, as per R7RS. Boolean values are returned by predicate procedures, such as the general equality predicates @code{eq?}, @code{eqv?} and @code{equal?} @@ -318,7 +319,8 @@ Scheme integers can be exact and inexact. For example, a number written as @code{3.0} with an explicit decimal-point is inexact, but it is also an integer. The functions @code{integer?} and @code{scm_is_integer} report true for such a number, but the functions -@code{scm_is_signed_integer} and @code{scm_is_unsigned_integer} only +@code{exact-integer?}, @code{scm_is_exact_integer}, +@code{scm_is_signed_integer}, and @code{scm_is_unsigned_integer} only allow exact integers and thus report false. Likewise, the conversion functions like @code{scm_to_signed_integer} only accept exact integers. @@ -333,7 +335,7 @@ will become exact fractions.) @deffn {Scheme Procedure} integer? x @deffnx {C Function} scm_integer_p (x) Return @code{#t} if @var{x} is an exact or inexact integer number, else -@code{#f}. +return @code{#f}. @lisp (integer? 487) @@ -346,7 +348,7 @@ Return @code{#t} if @var{x} is an exact or inexact integer number, else @result{} #f (integer? +inf.0) -@result{} #t +@result{} #f @end lisp @end deffn @@ -354,6 +356,24 @@ Return @code{#t} if @var{x} is an exact or inexact integer number, else This is equivalent to @code{scm_is_true (scm_integer_p (x))}. @end deftypefn +@deffn {Scheme Procedure} exact-integer? x +@deffnx {C Function} scm_exact_integer_p (x) +Return @code{#t} if @var{x} is an exact integer number, else +return @code{#f}. + +@lisp +(exact-integer? 37) +@result{} #t + +(exact-integer? 3.0) +@result{} #f +@end lisp +@end deffn + +@deftypefn {C Function} int scm_is_exact_integer (SCM x) +This is equivalent to @code{scm_is_true (scm_exact_integer_p (x))}. +@end deftypefn + @defvr {C Type} scm_t_int8 @defvrx {C Type} scm_t_uint8 @defvrx {C Type} scm_t_int16 @@ -2046,6 +2066,9 @@ name for each character. The short name for the ``delete'' character (code point U+007F) is @code{#\del}. +The R7RS name for the ``escape'' character (code point U+001B) is +@code{#\escape}. + There are also a few alternative names left over for compatibility with previous versions of Guile. @@ -2918,9 +2941,10 @@ The read syntax for strings is an arbitrarily long sequence of characters enclosed in double quotes (@nicode{"}). Backslash is an escape character and can be used to insert the following -special characters. @nicode{\"} and @nicode{\\} are R5RS standard, the -next seven are R6RS standard --- notice they follow C syntax --- and the -remaining four are Guile extensions. +special characters. @nicode{\"} and @nicode{\\} are R5RS standard, +@nicode{\|} is R7RS standard, the next seven are R6RS standard --- +notice they follow C syntax --- and the remaining four are Guile +extensions. @table @asis @item @nicode{\\} @@ -2930,6 +2954,9 @@ Backslash character. Double quote character (an unescaped @nicode{"} is otherwise the end of the string). +@item @nicode{\|} +Vertical bar character. + @item @nicode{\a} Bell character (ASCII 7). @@ -5561,6 +5588,16 @@ Although Guile provides this extended read syntax for symbols, widespread usage of it is discouraged because it is not portable and not very readable. +Alternatively, if you enable the @code{r7rs-symbols} read option (see +@pxref{Scheme Read}), you can write arbitrary symbols using the same +notation used for strings, except delimited by vertical bars instead of +double quotes. + +@example +|foo bar| +|\x3BB; is a greek lambda| +|\| is a vertical bar| +@end example @node Symbol Uninterned @subsubsection Uninterned Symbols