summaryrefslogtreecommitdiff
path: root/doc/ref/api-data.texi
AgeCommit message (Collapse)AuthorFilesLines
2013-03-12Add 'round-ash', a rounding arithmetic shift operatorMark H Weaver1-12/+30
* libguile/numbers.c (left_shift_exact_integer, floor_right_shift_exact_integer, round_right_shift_exact_integer): New static functions. (scm_round_ash): New procedure. (scm_ash): Reimplement in terms of 'left_shift_exact_integer' and 'floor_right_shift_exact_integer'. * libguile/numbers.h: Add prototype for scm_round_ash. Rename the second argument of 'scm_ash' from 'cnt' to 'count'. * test-suite/tests/numbers.test (round-ash, ash): Add new unified testing framework for 'ash' and 'round-ash'. Previously, the tests for 'ash' were not very comprehensive; for example, they did not include a single test where the number to be shifted was a bignum. * doc/ref/api-data.texi (Bitwise Operations): Add documentation for 'round-ash'. Improve documentation for `ash'.
2013-03-10excise use of "iff" in the manualJason Earl1-19/+19
* doc/ref/api-compound.texi: * doc/ref/api-control.texi: * doc/ref/api-data.texi: * doc/ref/api-macros.texi: * doc/ref/api-modules.texi: * doc/ref/api-procedures.texi: * doc/ref/api-scheduling.texi: * doc/ref/api-smobs.texi: * doc/ref/api-undocumented.texi: * doc/ref/api-utility.texi: * doc/ref/compiler.texi: * doc/ref/intro.texi: * doc/ref/scheme-using.texi: * doc/ref/sxml.texi: * doc/ref/web.texi: Change uses of "iff" to "if, otherwise". Fixes bug 10302.
2013-02-25Revert "random-state-from-platform: simplify pid conditional, and clarify docs."Mark H Weaver1-3/+3
This reverts commit 08904661a2b1c6d461b2f5abfe3226a4023453fb.
2013-02-24random-state-from-platform: simplify pid conditional, and clarify docs.Mark H Weaver1-3/+3
* libguile/random.c (random_state_of_last_resort): Simplify optional inclusion of PID in the random state. Clarify in the comments that the PID is only included where scm_getpid is present. * doc/ref/api-data.texi (Random): Clarify that 'random-state-from-platform' includes the PID in the random state only if scm_getpid is present.
2013-02-18Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-12/+16
Conflicts: libguile/array-handle.c libguile/deprecated.h libguile/inline.c libguile/inline.h module/ice-9/deprecated.scm module/language/tree-il/peval.scm
2013-02-18deprecate generalized vectors in favor of arraysAndy Wingo1-10/+12
* libguile/generalized-arrays.h: * libguile/generalized-arrays.c (scm_c_array_length): (scm_array_length): New functions. * module/ice-9/deprecated.scm: * libguile/generalized-vectors.c: * libguile/generalized-vectors.h: * libguile/deprecated.h: * libguile/deprecated.c (scm_generalized_vector_p) (scm_generalized_vector_length, scm_generalized_vector_ref) (scm_generalized_vector_set_x, scm_generalized_vector_to_list): Deprecate. * libguile/uniform.c (scm_uniform_vector_to_list): Use scm_array_to_list. * module/ice-9/boot-9.scm (case): Arrays are generalized vectors. * module/srfi/srfi-4/gnu.scm (define-any->vector): Use the array functions instead of the generalized-vector functions. * test-suite/tests/arrays.test: Remove generalized-vector->list test; covered by array->list test. * test-suite/tests/bitvectors.test: * test-suite/tests/bytevectors.test: * test-suite/tests/srfi-4.test: Adapt to test using array interfaces instead of generalized-vector interfaces. * doc/ref/api-compound.texi: Remove generalized vector docs. * doc/ref/api-data.texi: * doc/ref/srfi-modules.texi: Adapt.
2013-02-02Add scm_from_ptrdiff_t and scm_to_ptrdiff_t.Mark H Weaver1-2/+4
* libguile/numbers.h (scm_from_ptrdiff_t, scm_to_ptrdiff_t): New macros (function aliases). * doc/ref/api-data.texi: Add docs.
2013-01-15add scm_from_port_string and friendsAndy Wingo1-0/+13
* doc/ref/api-data.texi (Conversion to/from C): * libguile/strings.h: * libguile/strings.c (scm_from_port_string, scm_from_port_stringn): (scm_to_port_string, scm_to_port_stringn): New functions. * guile-readline/readline.c (internal_readline): * libguile/strports.c (scm_strport_to_string): * libguile/read.c (scm_read_number, scm_read_mixed_case_symbol): (scm_read_number_and_radix, scm_read_character): Use the new functions.
2013-01-11Change iconv procedures to take optional instead of keyword argAndy Wingo1-10/+16
* module/ice-9/iconv.scm (call-with-encoded-output-string): (string->bytevector, bytevector->string): Take an optional instead of a keyword argument. * doc/ref/api-data.texi (Representing Strings as Bytes): Adapt docs to change, and fix a number of errors. Thanks to Ludovic Courtès for the pointers. * test-suite/tests/iconv.test ("wide non-ascii string"): Add a test for the 'substitute path.
2013-01-11add bytevector->string and string->bytevector in new (ice-9 iconv) moduleAndy Wingo1-4/+76
* module/Makefile.am: * module/ice-9/iconv.scm: New module implementing procedures to encode and decode representations of strings as bytes. * test-suite/Makefile.am: * test-suite/tests/iconv.test: Add tests. * doc/ref/api-data.texi: Add docs.
2012-10-12In string-split, add support for character sets and predicates.Daniel Hartwig1-5/+17
* libguile/srfi-13.c (string-split): Add support for splitting on character sets and predicates, like string-index and others. * test-suite/tests/strings.test (string-split): Add tests covering the new argument types. * doc/ref/api-data.texi (string-split): Update. Signed-off-by: Mark H Weaver <mhw@netris.org>
2012-03-04Remove documentation of internal static string comparison functionsMark H Weaver1-10/+0
* doc/ref/api-data.texi (String Comparison): Remove documentation for scm_i_string{,_ci}_{equal,less,leq,gr,geq}_p, which are not only internal functions but static, and thus unusable by external code.
2012-02-04Improve consistency of definitions of C functions in manual.Bake Timmons1-6/+6
* doc/ref/api-compound.texi * doc/ref/api-evaluation.texi * doc/ref/api-foreign.texi * doc/ref/api-io.texi * doc/ref/posix.texi * doc/ref/srfi-modules.texi: Add missing parentheses and commas to definitions of C functions. * doc/ref/api-data.texi: Change from @deffn to @deftypefn for C function with arguments not of SCM type.
2012-02-04Make notation for Scheme repeated arguments more consistent in manual.Bake Timmons1-75/+82
* doc/ref/api-compound.texi * doc/ref/api-control.texi * doc/ref/api-data.texi * doc/ref/api-debug.texi * doc/ref/api-evaluation.texi * doc/ref/api-macros.texi * doc/ref/api-memory.texi * doc/ref/api-modules.texi * doc/ref/api-procedures.texi * doc/ref/api-regex.texi * doc/ref/api-scheduling.texi * doc/ref/api-utility.texi * doc/ref/goops.texi * doc/ref/match.texi * doc/ref/misc-modules.texi * doc/ref/posix.texi * doc/ref/r6rs.texi * doc/ref/scheme-using.texi * doc/ref/srfi-modules.texi * doc/ref/sxml-match.texi: Make notation for Scheme repeated arguments more consistent in manual.
2012-02-02Make consistent the usage of variable names in the function definitions ↵Bake Timmons1-9/+9
found in the Texinfo docs. * doc/r5rs/r5rs.texi: * doc/ref/api-compound.texi: * doc/ref/api-data.texi: * doc/ref/api-debug.texi: * doc/ref/api-evaluation.texi: * doc/ref/api-io.texi: * doc/ref/api-modules.texi: * doc/ref/api-procedures.texi: * doc/ref/api-scheduling.texi: * doc/ref/api-smobs.texi: * doc/ref/compiler.texi: * doc/ref/misc-modules.texi: * doc/ref/posix.texi: * doc/ref/scheme-using.texi: * doc/ref/srfi-modules.texi: * doc/ref/vm.texi: * doc/ref/web.texi: * doc/sources/env.texi: Make usage of variable names of function definitions more consistent.
2012-02-01Update srfi-14 character sets to Unicode 6.1Mike Gran1-1/+1
* libguile/srfi-14.i.c (cs_lower_case_ranges, cs_lower_case) (cs_upper_case_ranges, cs_upper_case, cs_letter_ranges, cs_letter) (cs_digit_ranges, cs_digit, cs_letter_plus_digit_ranges, cs_letter_plus_digit) (cs_graphic_ranges, cs_graphic, cs_printing_ranges, cs_printing) (cs_punctuation_ranges, cs_punctuation, cs_symbol_ranges, cs_symbol) (cs_designated_ranges, cs_designated): modified * doc/ref/api-data.texi: modified
2012-01-21Add `random-state-from-platform' and `scm_i_random_bytes_from_platform'Mark H Weaver1-19/+13
* libguile/random.c (scm_random_state_from_platform): New procedure. (scm_i_random_bytes_from_platform): New internal function. * libguile/random.h (scm_random_state_from_platform, scm_i_random_bytes_from_platform): Add prototypes. * doc/ref/api-data.texi (Random): Add documentation.
2012-01-20add when, unlessAndy Wingo1-5/+5
* module/ice-9/boot-9.scm (when, unless): New forms. * doc/ref/api-control.texi (Conditionals): Add docs. Rename this node from "if cond case". * doc/ref/r6rs.texi: * doc/ref/scheme-ideas.texi: * doc/ref/srfi-modules.texi: Update referrers.
2012-01-04Fix docs of string mutators to do so on a mutable stringMark H Weaver1-1/+1
* doc/ref/api-data.texi (String Modification): Change (define y "abcdefg") => (define y (string-copy "abcdefg")) before mutating the string bound to y in the example code.
2011-11-20Allow overlapping regions to be passed to `bytevector-copy!'.Ludovic Courtès1-1/+2
Reported by Dmitry Chestnykh <dmitry@codingrobots.com>. Fixes <http://debbugs.gnu.org/10070>. * libguile/bytevectors.c (scm_bytevector_copy_x): Use `memmove', not `memcpy'. * test-suite/tests/bytevectors.test ("2.2 General Operations")["bytevector-copy! overlapping"]: New test. * doc/ref/api-data.texi (Bytevector Manipulation): Mention possible overlapping.
2011-10-09New functions scm_is_exact and scm_is_inexactMike Gran1-0/+13
* doc/ref/api-data.texi (Exact and Inexact Numbers): doc for scm_is_exact and scm_is_inexact * libguile/numbers.c (scm_is_exact, scm_is_inexact): new functions * libguile/numbers.h: declarations for scm_is_exact and scm_is_inexact * test/suite/standalone/test-conversion.c (test_is_exact, test_is_inexact): new tests
2011-04-21Clarify units of string length in decription of scm_from_stringnMark H Weaver1-1/+1
* doc/ref/api-data.texi (Conversion to/from C): In description of scm_from_stringn, clarify that the length is specified in bytes.
2011-04-19Clarify the units of returned lengths in string conversion functionsMark H Weaver1-6/+9
* doc/ref/api-data.texi (Conversion to/from C): In descriptions of scm_to_stringn and scm_to_{latin1,utf8,utf32}, clarify that the returned length is in units of bytes or code points, not characters. Also change NULL to @code{NULL} in a few places.
2011-04-09Fix the R6RS exact-integer-sqrt and import into core guileMark H Weaver1-0/+12
* libguile/numbers.c (scm_exact_integer_sqrt): New C procedure to compute exact integer square root and remainder. (scm_i_exact_integer_sqrt): New Scheme procedure `exact-integer-sqrt' from the R6RS, imported into core guile. * libguile/numbers.h: Add prototypes. * module/rnrs/base.scm: Remove broken stub implementation, which would fail badly when applied to large integers. * doc/ref/api-data.texi: Add documentation. * doc/ref/r6rs.texi: Change documentation for `exact-integer-sqrt' to a stub that xrefs the core docs, as is done for other operations available in core. * test-suite/tests/numbers.test: Add tests. * NEWS: Add news entries.
2011-04-06Doc fix: quotient/remainder/modulo do not require exact argumentsMark H Weaver1-2/+2
* doc/ref/api-data.texi (Arithmetic): `floor-remainder' is equivalent to the R5RS `modulo' when the arguments are integers. Previously, equivalence was claimed only for exact integers. Similarly for `truncate-quotient' and `truncate-remainder' compared with the R5RS `quotient' and `remainder'.
2011-03-17scm_{to,from}_locale_string use current locale, not current portsAndy Wingo1-12/+12
* libguile/strings.c (scm_to_locale_stringn, scm_from_locale_stringn): Use the encoding of the current locale, not of the current i/o ports. Also use the current conversion strategy. * doc/ref/api-data.texi (Conversion to/from C): Update docs.
2011-03-09Add scm_from_latin1_keyword and scm_from_utf8_keywordMark H Weaver1-4/+16
* libguile/keywords.c (scm_from_latin1_keyword, scm_from_utf8_keyword): New functions appropriate for use when keyword name is a constant. (scm_from_locale_keyword, scm_from_locale_keywordn): Change formal parameter from `str' to `name'. * libguile/keywords.h: Add prototypes for new functions. Change formal parameter of scm_from_locale_keyword* from `str' to `name'. * doc/ref/api-data.texi: Document new functions. Remind users that scm_from_locale_keyword should not be used when the name is a C string constant. Change formal parameter from `str' to `name'.
2011-03-08Improve docs of string and symbol conversions from C stringsMark H Weaver1-4/+28
* doc/ref/api-data.texi (Conversion to/from C): Document scm_from_latin1_string, scm_from_utf8_string, and scm_from_utf32_string. Remind readers that these functions should be used to convert C string constants, and that scm_from_locale_string is _not_ appropriate for that purpose. (Symbol Primitives): Document scm_from_latin1_symbol and scm_from_utf8_symbol. Remind readers that these functions should be used when the specified names are C string constants, and that scm_from_locale_symbol is _not_ appropriate for that purpose.
2011-02-15Fix minor errors in docs of division operatorsMark H Weaver1-3/+4
* doc/ref/api-data.texi (Arithmetic): The R5RS `quotient', `remainder', and `modulo' operators are exact-integer-only operators. `modulo' is equivalent to `floor-remainder', not `floor-quotient'.
2011-02-14Add four new sets of fast quotient and remainder operatorsMark H Weaver1-2/+146
* libguile/numbers.c (scm_floor_divide, scm_floor_quotient, scm_floor_remainder, scm_ceiling_divide, scm_ceiling_quotient, scm_ceiling_remainder, scm_truncate_divide, scm_truncate_quotient, scm_truncate_remainder, scm_round_divide, scm_round_quotient, scm_round_remainder): New extensible procedures `floor/', `floor-quotient', `floor-remainder', `ceiling/', `ceiling-quotient', `ceiling-remainder', `truncate/', `truncate-quotient', `truncate-remainder', `round/', `round-quotient', and `round-remainder'. * libguile/numbers.h: Add function prototypes. * test-suite/tests/numbers.test: Add tests. * doc/ref/api-data.texi (Arithmetic): Add documentation. * NEWS: Add NEWS entry.
2011-02-14Make divide functions return values via (SCM *) output argumentsMark H Weaver1-17/+18
* libguile/numbers.c (scm_euclidean_divide, scm_centered_divide): Change API to return two values via output arguments of type (SCM *), instead of packing into a values object. (scm_i_euclidean_divide, scm_i_centered_divide): New internal wrappers that call the above functions and pack the result into a values object. * libguile/numbers.h: Change prototypes to reflect new API. * doc/ref/api-data.h (Arithmetic): Update manual.
2011-02-13Misc textual editingNeil Jerram1-5/+5
* doc/ref/api-scheduling.texi (Asyncs): "queueing" -> "queuing". * benchmark-suite/lib.scm, doc/sources/unix.texi (Unix conventions), test-suite/lib.scm: "postpend" -> "append". * doc/ref/api-compound.texi (Array Syntax, Dictionary Types), doc/ref/api-control.texi (Catch), doc/ref/api-data.texi (Complex Numbers, Conversion, Random, Symbol Props, Symbol Uninterned), doc/ref/api-options.texi (Build Config, Common Feature Symbols), doc/ref/api-regex.texi (Match Structures), doc/ref/api-undocumented.texi, doc/ref/compiler.texi (Tree-IL, GLIL), doc/ref/data-rep.texi (Immediate objects), doc/ref/goops.texi (Slot Description Example), doc/ref/history.texi (A Scheme of Many Maintainers, Status), doc/ref/libguile-program.texi (Available Functionality), doc/ref/misc-modules.texi (Formatted Output), doc/ref/mod-getopt-long.texi (getopt-long Reference), doc/ref/posix.texi (Network Socket Address, Network Sockets and Communication), doc/ref/srfi-modules.texi (SRFI-1 Association Lists, SRFI-10, SRFI-19 String to date, SRFI-27 Random Sources), doc/ref/vm.texi (Instruction Set, Top-Level Environment Instructions, Procedure Call and Return Instructions), doc/sources/unix.texi (Unix conventions): Correct spacing after "i.e." and "e.g.".
2011-02-13Avoid uses of "resp. signed"Neil Jerram1-14/+28
* doc/ref/api-data.texi (Bytevectors as Integers, Bytevectors and Integer Lists): Split signed and unsigned deffns.
2011-02-13docs: fix typos in manual, and a couple in code comments.Ralf Wildenhues1-2/+2
* doc/ref/api-data.texi: Use \sqrt{2} consistently rather than \sqrt2. Add @: for correct spacing after "i.e.".
2011-02-09docs: fix typos in manual, and a couple in code comments.Ralf Wildenhues1-9/+9
* doc/ref/api-binding.texi, doc/ref/api-compound.texi, doc/ref/api-control.texi, doc/ref/api-debug.texi, doc/ref/api-io.texi, doc/ref/api-macros.texi, doc/ref/api-procedures.texi, doc/ref/api-scheduling.texi, doc/ref/api-undocumented.texi, doc/ref/api-utility.texi, doc/ref/compiler.texi, doc/ref/goops.texi, doc/ref/libguile-concepts.texi, doc/ref/misc-modules.texi, doc/ref/posix.texi, doc/ref/r6rs.texi, doc/ref/slib.texi, doc/ref/srfi-modules.texi, doc/ref/sxml-match.texi, doc/ref/tools.texi, doc/ref/vm.texi, doc/ref/web.texi, doc/sources/env.texi, doc/sources/jimb-org.texi, doc/sources/scheme-concepts.texi, doc/sources/unix.texi, module/ice-9/optargs.scm: Fix typos. * doc/r4rs/r5rs.texi: Likewise. Do not capitalize code symbols even at the start of a sentence. * doc/ref/api-data.texi: Likewise. Also, remove executable bit.
2011-02-02Support non-real complex numbers with inexact zero imaginary partMark H Weaver1-8/+12
Add the ability to represent non-real complex numbers whose imaginary part is an _inexact_ zero (0.0 or -0.0), per R6RS. Previously, such numbers were immediately changed into inexact reals. * libguile/numbers.c: Remove from the list of `General assumptions' in numbers.c that objects satisfying SCM_COMPLEXP() have a non-zero complex component. This is no longer true. Also add a warning about another unrelated assumption that is not entirely correct (that floor(r) == r implies that mpz_set_d will DTRT; it won't if r is infinite). (icmplx2str): Always print the imaginary part, even if it is zero. Also handle a negative zero imaginary part more gracefully. It now prints 0.0-0.0i, where previously it would print 0.0+-0.0i. (mem2ureal): Replace scm_from_double (0.0) with flo0. (scm_c_make_rectangular): Always create non-real complex numbers. Previously it would create inexact reals if the specified imaginary part was zero. (scm_make_rectangular): If the imaginary part is an _exact_ 0, return the real part unchanged (possibly exact), otherwise return a non-real complex number (possibly with an inexact zero imaginary part). Previously, it would return an inexact real number whenever the imaginary part was any kind of zero. (scm_make_polar): If the magnitude is an exact 0, return an exact 0. If the angle is an exact 0, return the magnitude unchanged (possibly exact). Otherwise return a non-real complex number (possibly with an inexact zero imaginary part). Previously, it would return a real number whenever the imaginary part was any kind of zero. (scm_imag_part): Return an exact 0 if applied to a real number. Previously it would return an inexact zero if applied to an inexact real number. (scm_inexact_to_exact): Accept complex numbers with inexact zero imaginary part. In that case, simply use the real part and ignore the imaginary part. Essentially we coerce the inexact zero imaginary part to an exact 0. * test-suite/tests/numbers.test: Add many test cases, and modify existing tests as needed to reflect these changes. Also add a new internal predicate: `almost-real-nan?' which tests for a non-real complex number with zero imaginary part whose real part is a NaN. * doc/ref/api-data.texi (Complex Numbers): Update description of complex numbers to reflect these changes: non-real complex numbers in Guile need not have non-zero imaginary part. Also, each part of a complex number may be any inexact real, not just rationals as was previously stated. Explicitly mention that each part may be an infinity, a NaN, or a signed zero. (Complex Number Operations): Change the formal parameter names of `make-polar' from `x' and `y' to `mag' and `ang'. * NEWS: Add news entries.
2011-02-01Improve discussion of exactness propagation in manualMark H Weaver1-4/+9
* doc/ref/api-data.texi (Exact and Inexact Numbers): Improve the discussion of exactness propagation. Mention that there are exceptions to the rule that calculations involving inexact numbers must product an inexact result.
2011-01-31Rename {euclidean,centered}_quo_rem to {euclidean,centered}_divideMark H Weaver1-2/+2
* libguile/numbers.c (euclidean_quo_rem): Rename to euclidean_divide. (centered_quo_rem): Rename to {euclidean,centered}_divide. * libguile/numbers.h: Rename euclidean_quo_rem to euclidean_divide and centered_quo_rem to centered_divide. * doc/ref/api-data.texi: Rename euclidean_quo_rem to euclidean_divide and centered_quo_rem to centered_divide.
2011-01-30Add two new sets of fast quotient and remainder operatorsMark H Weaver1-0/+79
* libguile/numbers.c (scm_euclidean_quo_and_rem, scm_euclidean_quotient, scm_euclidean_remainder, scm_centered_quo_and_rem, scm_centered_quotient, scm_centered_remainder): New extensible procedures `euclidean/', `euclidean-quotient', `euclidean-remainder', `centered/', `centered-quotient', `centered-remainder'. * libguile/numbers.h: Add function prototypes. * module/rnrs/base.scm: Remove incorrect stub implementations of `div', `mod', `div-and-mod', `div0', `mod0', and `div0-and-mod0'. Instead do renaming imports of `euclidean-quotient', `euclidean-remainder', `euclidean/', `centered-quotient', `centered-remainder', and `centered/', which are equivalent to the R6RS operators. * module/rnrs/arithmetic/fixnums.scm (fxdiv, fxmod, fxdiv-and-mod, fxdiv0, fxmod0, fxdiv0-and-mod0): Remove redundant checks for division by zero and unnecessary complexity. (fx+/carry): Remove unneeded calls to `inexact->exact'. * module/rnrs/arithmetic/flonums.scm (fldiv, flmod, fldiv-and-mod, fldiv0, flmod0, fldiv0-and-mod0): Remove redundant checks for division by zero and unnecessary complexity. Remove unneeded calls to `inexact->exact' and `exact->inexact' * test-suite/tests/numbers.test: (test-eqv?): New internal predicate for comparing numerical outputs with expected values. Add extensive test code for `euclidean/', `euclidean-quotient', `euclidean-remainder', `centered/', `centered-quotient', `centered-remainder'. * test-suite/tests/r6rs-arithmetic-fixnums.test: Fix some broken test cases, and remove `unresolved' test markers for `fxdiv', `fxmod', `fxdiv-and-mod', `fxdiv0', `fxmod0', and `fxdiv0-and-mod0'. * test-suite/tests/r6rs-arithmetic-flonums.test: Remove `unresolved' test markers for `fldiv', `flmod', `fldiv-and-mod', `fldiv0', `flmod0', and `fldiv0-and-mod0'. * doc/ref/api-data.texi (Arithmetic): Document `euclidean/', `euclidean-quotient', `euclidean-remainder', `centered/', `centered-quotient', and `centered-remainder'. (Operations on Integer Values): Add cross-references to `euclidean/' et al, from `quotient', `remainder', and `modulo'. * doc/ref/r6rs.texi (rnrs base): Improve documentation for `div', `mod', `div-and-mod', `div0', `mod0', and `div0-and-mod0'. Add cross-references to `euclidean/' et al. * NEWS: Add NEWS entry.
2011-01-30Infinities and NaNs are no longer rationalMark H Weaver1-34/+39
* libguile/numbers.c (scm_rational_p): Return #f for infinities and NaNs, per R6RS. Previously it returned #t for real infinities and NaNs. They are still considered real by scm_real `real?' however, per R6RS. Also simplify the code. (scm_real_p): New implementation to reflect the fact that the rationals and reals are no longer the same set. Previously it just called scm_rational_p. (scm_integer_p): Simplify the code. * test-suite/tests/numbers.test: Add test cases for `rational?' and `real?' applied to infinities and NaNs. * doc/ref/api-data.texi (Real and Rational Numbers): Update docs to reflect the fact that infinities and NaNs are no longer rational, and that `real?' no longer implies `rational?'. Improve discussion of infinities and NaNs. * NEWS: Add NEWS entries, and combine with an earlier entry about infinities no longer being integers.
2011-01-28domain of inf?, finite?, nan? is the real numbersAndy Wingo1-5/+6
* libguile/numbers.c (scm_inf_p, scm_finite_p, scm_nan_p): The domain of these functions is the real numbers. Error on other input. * doc/ref/api-data.texi (Reals and Rationals): Update the documentation accordingly. * test-suite/tests/numbers.test ("finite?", "inf?"): Update tests.
2011-01-28Implement `finite?' in core and fix R6RS `finite?' and `infinite?'Mark H Weaver1-1/+8
* libguile/numbers.c (scm_finite_p): Add new predicate `finite?' from R6RS to guile core, which returns #t if and only if its argument is neither infinite nor a NaN. Note that this is not the same as (not (inf? x)) or (not (infinite? x)), since NaNs are neither finite nor infinite. * test-suite/tests/numbers.test: Add test cases for `finite?'. * module/rnrs/base.scm: Import `inf?' as `infinite?' instead of reimplementing it. Previously, the R6RS implementation of `infinite?' did not detect non-real complex infinities, nor did it throw exceptions for non-numbers. (Note that NaNs _are_ considered numbers by scheme, despite their name). Import `finite?' instead of reimplementing it. Previously, the R6RS implementation of `finite?' returned #t for both NaNs and non-real complex infinities, in violation of R6RS. * NEWS: Add NEWS entries, and reorganize existing numerics-related entries together under one subheading. * doc/ref/api-data.texi (Real and Rational Numbers): Add docs for `finite?' and scm_finite_p.
2011-01-26Additional documentation for symbol manipulation functions.Julian Graham1-1/+31
* doc/ref/api-data.texi (Symbol Primitives): Document `symbol', `list->symbol', and `symbol-append'.
2011-01-26Add `scm_{to,from}_utf32_string'.Ludovic Courtès1-6/+13
* libguile/strings.c (scm_from_utf32_string, scm_from_utf32_stringn, scm_to_utf32_string, scm_to_utf32_stringn): New functions. * libguile/strings.h (scm_from_utf32_string, scm_from_utf32_stringn, scm_to_utf32_string, scm_to_utf32_stringn): New declarations. * doc/ref/api-data.texi (Conversion to/from C): Document `scm_{to,from}_{utf8,utf32}_stringn'.
2011-01-23infinities are no longer integersAndy Wingo1-8/+4
* libguile/numbers.c (scm_is_integer): Infinities are not integers, per the R6RS. (scm_even_p, scm_odd_p): Passing an infinity to even? or odd? is an error. * test-suite/tests/numbers.test ("integer?"): Adapt test. ("expt"): Add tests for +inf.0 and -inf.0 exponents. * NEWS: Add NEWS entries.
2011-01-21document hungry-eol-escapesAndy Wingo1-0/+17
* doc/ref/api-data.texi (String Syntax): Document hungry-eol-escapes. * doc/ref/api-evaluation.texi (Scheme Read): * doc/ref/api-options.texi (Runtime Options): Update read-options 'help output.
2011-01-04Improve doc of `string-index', `string-index-right', and `string-rindex'.Ludovic Courtès1-1/+7
Suggested by Noah Lavine <noah.b.lavine@gmail.com>. * doc/ref/api-data.texi (String Searching): Mention the return value of `string-index', `string-index-right', and `string-rindex' when no match is found. * libguile/srfi-13.c (scm_string_index, scm_string_index_right, scm_string_rindex): Adjust docstring accordingly.
2010-11-19fix string-filter and string-delete argument orderAndy Wingo1-4/+4
* libguile/srfi-13.h: * libguile/srfi-13.c (scm_string_filter, scm_string_delete): Swap char_pred and s argument order, to comply with SRFI-13. There is a back-compat shim that will detect programs that used the old, erroneous interface, while giving a warning. * doc/ref/api-data.texi: Update docs.
2010-10-31Add ref to new location for regex docNeil Jerram1-4/+6
* doc/ref/api-data.texi: Add ref to new location for regex doc. Also correct other refs to say section rather than chapter.
2010-10-31Promote regex doc out of the `Simple Data Types' sectionNeil Jerram1-532/+0
Because that probably isn't where people will look for it. Thanks to Noah Lavine for the idea. * doc/ref/api-regex.texi (Regular Expressions): New file, containing the regex doc (promoted one level) that used to be in api-data.texi. * doc/ref/guile.texi (API Reference): Include new file, and add menu entry for the new section. * THANKS: Add Noah.