* 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.
* module/rnrs/base.scm (error, assert): Define -- they were missing.
(assertion-violation): Properly treat a #f `who' argument.
* module/rnrs/conditions.scm (condition): Use `assertion-violation'
instead of the undefined `raise'.
(define-condition-type): Fix for multiple fields.
* test-suite/tests/r6rs-conditions.test: Test accessors of a
multiple-field condition. Also import `(rnrs base)' to allow
stand-alone running of the tests; apparently the `@' references
scattered throughout the R6RS modules make the libraries sensitive to
their load order -- for instance, trying to load `(rnrs conditions)'
before `(rnrs base)' is loaded fails.
* module/rnrs/records/inspection.scm: Use `assertion-violation' instead
of an explicit `raise'.
* module/rnrs/records/syntactic.scm (process-fields): Use
`syntax-violation' instead of bogus invocations of `error'.
* module/rnrs/io/ports.scm: (file-options, buffer-mode, eol-style)
(error-handling-mode, make-transcoder, native-transcoder)
(latin-1-codec, utf-8-codec, utf-16-codec)
(call-with-bytevector-output-port, open-file-input-port)
(open-file-output-port, make-custom-textual-output-port)
(flush-output-port, put-char, put-datum, put-string, get-char)
(get-datum, get-line, get-string-all, lookahead-char)
(standard-input-port, standard-output-port, standard-error-port):
Define all of these.
(call-with-port): Don't use `dynamic-wind', as it is against its
specification in R6RS 8.2.6.
* module/rnrs.scm: Export procedures added.
* module/rnrs/io/simple.scm (call-with-input-file)
(call-with-output-file): Define these in terms of R6RS procedures to
get correct exception behavior.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Move the I/O condition types from `(rnrs conditions)', where they were
not exported, to `(rnrs files)', where they are.
* module/rnrs/conditions.scm: Remove definition of I/O condition types.
* module/rnrs/files.scm: Replace references to I/O condition types
inside `(rnrs conditions)' with the actual definitions.
* module/rnrs/io/simple.scm: Don't `@@'-reference the I/O condition types, just
imported them from `(rnrs files)'.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* module/rnrs/io/ports.scm: Change into an R6RS library from a "regular"
Guile module, so the bookkeeping for #:re-export and #:replace is done
automatically and we gain control over the imports from `(guile)'.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* module/rnrs/enums.scm (enum-set-union, enum-set-intersection,
enum-set-difference): Compare enum-set universes with `equal?' to support
sets generated using constructor syntax bound by `define-enumeration'.
* test-suite/tests/r6rs-enums.test (enum-set-union, enum-set-intersection,
enum-set-difference): New test cases for syntactically-generated sets.
Reimplement record-type descriptors as vtables for record structs, saving
us what was an expensive inspection of a record's vtable layout string to
determine its type.
* module/rnrs/records/inspection.scm (record-field-mutable?): Check
mutability using the bit field stored in the record-type descriptor
instead of the record struct's vtable.
* module/rnrs/records/procedural.scm (record-internal?): Reimplement as a
delegation to a check of the passed struct's vtable against
`record-type-descriptor?'.
(record-type-vtable): Modify to include base vtable layout as a prefix
of the record-type-descriptor layout so that all record-type instances
are now also vtables.
(make-record-type-descriptor): Remove field vtable; build up a mutability
bit field to use for fast mutability checks.
(record-accessor, record-mutator): Use field struct and mutability bit
field.
* module/rnrs/syntax-case.scm: Add make-variable-transformer to the
imports. This was causing an unbound variable error even though
(rnrs) had been imported.
* module/rnrs/arithmetic/fixnums.scm (fixnum-width): Make this return an
an exact integer instead of an inexact number.
* module/rnrs/base.scm (assertion-violation): Implement.
* module/rnrs/conditions.scm (simple-conditions): Allow also simple
conditions as argument.
* module/rnrs/enums.scm (define-enumeration): Properly construct empty
enumeration sets.
* module/rnrs/exceptions.scm (guard): Don't restrict the body to a
single expression.
* module/rnrs/records/syntactic.scm (define-record-type0): Expand into a
series of definitions only.
argument to Guile's `member' and `assoc' functions has a different expected
arity.
* module/rnrs/lists.scm (memp, assp): Wrap the predicate function with a
two-argument wrapper before calling Guile's underlying implemenation.
* test-suite/Makefile.am: Add test-suite/tests/r6rs-lists.test to
SCM_TESTS.
* test-suite/tests/r6rs-lists.test: New file.
`for-each' and `map' implementations do not operate on lists and vectors
interchangeably.
* module/rnrs/base.scm (vector-for-each, vector-map): New functions.
* test-suite/Makefile.am: Add test-suite/tests/r6rs-base.test to SCM_TESTS.
* test-suite/tests/r6rs-base.test: New file.
Guile implements this library in terms of SRFI-69, which is a bit vague on
the arity of hash functions, whereas `(rnrs hashtables)' explicitly
specifies unary ones.
* module/rnrs/hashtables.scm (wrap-hash-function): Assume SRFI-69 will pass
the table capacity as the second argument; return the result of proc
modulo the capacity.
* test-suite/tests/r6rs-hashtables.test (make-hashtable): New test case for
hash functions that return large values.
* module/rnrs/io/ports.scm (open-string-input-port):
(open-string-output-port): Ensure that the ports are unicode-capable
by binding %default-port-encoding to "UTF-8".
accessors.
* module/rnrs/conditions.scm (define-condition-type): The generated
accessors should be condition accessors, which know how to unpack a
compound condition; these can then delegate to the appropriate record
accessors.
* test-suite/tests/r6rs-conditions.test: New test case to verify above.
* module/ice-9/boot-9.scm (find-versioned-module): Remove. Still had
some bugs (e.g. for "." in the path and in finding compiled files),
did too much computation and statting, and we don't really want to
promote versioning. Nor do we want to hard-code a particular encoding
of versions in the file-system. Perhaps the real way to do this is to
be extensible somehow.
(try-module-autoload): Just dispatch to primitive-load-path in all cases.
* module/rnrs
* module/rnrs.scm:
* module/rnrs/arithmetic/bitwise.scm:
* module/rnrs/arithmetic/fixnums.scm:
* module/rnrs/arithmetic/flonums.scm:
* module/rnrs/base.scm:
* module/rnrs/conditions.scm:
* module/rnrs/control.scm:
* module/rnrs/enums.scm:
* module/rnrs/eval.scm:
* module/rnrs/exceptions.scm:
* module/rnrs/files.scm:
* module/rnrs/hashtables.scm:
* module/rnrs/io/simple.scm:
* module/rnrs/lists.scm:
* module/rnrs/mutable-pairs.scm:
* module/rnrs/mutable-strings.scm:
* module/rnrs/programs.scm:
* module/rnrs/r5rs.scm:
* module/rnrs/records/inspection.scm:
* module/rnrs/records/procedural.scm:
* module/rnrs/records/syntactic.scm:
* module/rnrs/sorting.scm:
* module/rnrs/syntax-case.scm:
* module/rnrs/unicode.scm: Move these files, eliding the "6/" infix, so
that they are in the normal (unversioned) module path.
* module/rnrs/bytevectors.scm:
* module/rnrs/io/ports.scm: Add #:version (6) to these modules.
* module/6/rnrs.scm: Add versions to the import specs for bytevectors
and ports.
* module/rnrs/arithmetic/6/fixnums.scm: Fix missing imports;
(fixnum-width, greatest-fixnum, least-fixnum): Redefine these as
zero-argument procedures; Fix argument mismatches in several functions.
* test-suite/Makefile.am: Add tests/r6rs-arithmetic-fixnums.test to
SCM_TESTS.
* test-suite/tests/r6rs-arithmetic-fixnums.test: New file.
library.
* module/Makefile.am: Add rnrs/arithmetic/6/fixnums.scm and
rnrs/arithmetic/6/flonums.scm to RNRS_SOURCES.
* module/rnrs/6/base.scm: (div-and-mod, div0, mod0, div0-and-mod0): New
functions; this `div' implementation is not quite right, but we'll come
back to it later.
* module/rnrs/arithmetic/6/fixnums.scm: New file.
* module/rnrs/arithmetic/6/flonums.scm: New file.
* test-suite/Makefile.am: Add tests/r6rs-arithmetic-flonums.test to
SCM_TESTS.
* test-suite/tests/r6rs-arithmetic-flonums.test: New file.
* module/Makefile.am: Add rnrs/6/eval.scm to RNRS_SOURCES.
* module/rnrs/6/eval.scm: New file
* test-suite/Makefile.am: Add tests/r6rs-eval.test to SCM_TESTS.
* test-suite/tests/r6rs-eval.test: New file.
* module/rnrs/6/lists.scm: Import syntax is
`(only (import-set) id-1 ...)', not `(only (import-set) (id-1 ...))';
use `rename' form as wrapper instead of creating separate custom
interface on SRFI-1.
* module/rnrs/6/exceptions.scm: Remove dependency on (rnrs syntax-case);
rewrite guard and guard0 in using syntax-rules in terms of syntax-case.
* module/rnrs/6/syntax-case.scm: Add syntax-violation implementation.
(rnrs records procedural).
* module/rnrs/6/conditions.scm: Fix export of
make-implementation-restriction-violation; remove dependency on
(rnrs syntax-case); remove redundant function
compound-condition-components; rewrite define-condition-type using
syntax-rules instead of syntax-case.
* module/rnrs/records/6/procedural.scm: Remove serious-condition?,
violation? and assertion-violation? predicates, since they're not true
condition predicates.
* test-suite/Makefile.am: Add tests/r6rs-conditions.test to SCM_TESTS.
* test-suite/tests/r6rs-conditions.test: New file.
libraries.
* module/Makefile.am: Add rnrs/6/mutable-pairs.scm and
rnrs/6/mutable-strings.scm to RNRS_SOURCES.
* module/rnrs/6/mutable-pairs.scm: New file.
* module/rnrs/6/mutable-strings.scm: New file.
* module/rnrs/6/exceptions.scm: (guard0, guard): New syntax.
* module/rnrs/records/6/procedural.scm: (r6rs-raise-continuable): Can't
use `raise' here because it's exported by (rnrs exceptions); use plain
old `throw' instead.
* test-suite/Makefile.am: Add tests/r6rs-exceptions.test to SCM_TESTS.
* test-suite/tests/r6rs-exceptions.test: New file.
Implementation and test cases for the R6RS (rnrs record syntactic) library.
* module/Makefile.am: Add rnrs/6/hashtables.scm to RNRS_SOURCES.
* module/rnrs/6/hashtables.scm: New file.
* module/rnrs/records/6/inspection.scm: (record-type-generative?) Record
types are generative iff they have no uid, not vice-versa.
* module/rnrs/records/6/syntactic.scm: Finish `define-record-type'
implementation; add `record-type-descriptor' and
`record-constructor-descriptor' forms.
* test-suite/Makefile.am: Add tests/r6rs-records-syntactic.test to
SCM_TESTS.
* test-suite/tests/r6rs-records-inspection.test: Update tests for
`record-type-generative?' to reflect corrected behavior.
* test-suite/tests/r6rs-records-syntactic.test: New file.