* module/ice-9/boot-9.scm (map): Rewrite to be recursive and pure
instead of iterative and effectful. At best this is faster; at worst
it is slower. In any case it resolves continuation-related issues.
* module/srfi/srfi-1.scm (fold): Specialize the two-arg case.
(map): Rewrite to be recursive.
* test-suite/tests/r5rs_pitfall.test (8.3): Update for new expected map
behavior.
* module/ice-9/boot-9.scm (map):
* module/srfi/srfi-1.scm (map): Simplify the implementations to check
for list? beforehand. It's faster, and it will be needed if we decide
to go recursive.
* module/ice-9/boot-9.scm (for-each):
* module/srfi/srfi-1.scm (for-each): Re-implement one-list case using an
explicit check for list? instead of the tortoise-hare thing. Seems to
be faster!
* module/srfi/srfi-1.scm (check-arg, wrong-type-arg): Refactor arg type
checkers to be macros, and do the minimal amount of work in the
functions themselves. Use these checkers consistently for all
procedure arguments in this module. This catches user errors early;
see bug 33628.
* libguile/srfi-1.h:
* libguile/srfi-1.c (scm_srfi1_drop_right, scm_srfi1_take_right): Remove
these internal functions, replacing with Scheme implementations.
* module/srfi/srfi-1.scm (take-right, drop-right): Add these impls from
the reference code. They do the right thing for improper lists,
according to the spec, but they diverge for circular lists. Oh well.
* test-suite/tests/srfi-1.test ("drop-right", "take-right"): Add more
tests.
* module/srfi/srfi-1.scm (map-in-order): As we are not extending the
core `map' binding, actually make a new `map-in-order' alias here.
Fixes fresh builds.
* module/ice-9/boot-9.scm (map, for-each): Implement in Scheme instead
of C. There are boot versions before `cond' is defined.
(map-in-order): Define this alias here instead of in evalext.h.
* libguile/eval.c: Stub out the map and for-each definitions to just
call into Scheme.
* libguile/evalext.c: Remove map-in-order definition.
* module/srfi/srfi-1.scm: Replace all calls to map1 with calls to map.
(map, for-each): Define implementations here, in Scheme, instead of in
C.
* test-suite/tests/eval.test (exception:wrong-length, "map"): Update the
expected exception for mapping over lists of different lengths.
* libguile/srfi-1.h:
* libguile/srfi-1.c: Remove map and for-each definitions. Remove the
bit that extended the core `map' primitive with another method: the
right way to do that is with modules.
* libguile/srfi-1.c:
* libguile/srfi-1.h (scm_srfi1_member): Move implementation to Scheme.
* module/srfi/srfi-1.scm (member): Implement here, with the inlining
cases for eq? and eqv?. Speeds up a compiled bootstrap of
psyntax.scm, because lset-adjoin inlines to the memq case.
(lset<=): Reindent.
(lset-adjoin, lset-union): If the comparator is eq? or eqv?, just pass
it through to `member', so we inline to memq / memv. Use something
closer to the reference implementations.
* module/srfi/srfi-1.scm (unfold): Make tail-recursive, following a
suggestion by Szavai Gyula.
* test-suite/tests/srfi-1.test ("unfold"): New test prefix.
* libguile/srfi-1.c:
* libguile/srfi-1.h:
* libguile/srfi-60.c:
* libguile/srfi-60.h:
* libguile/ChangeLog-srfi: Move here, from the srfi/ dir. The C API is
internal. Add API to register the extensions, called by init.c.
* libguile/init.c: Verily, register srfi extensions.
* libguile/Makefile.am: Add srfi files.
* module/srfi/srfi-1.scm:
* module/srfi/srfi-60.scm: Update load-extension invocation.
* Makefile.am:
* configure.ac: Remove srfi/ dir.
* test-suite/standalone/Makefile.am:
* test-suite/standalone/test-srfi-1.c: Remove srfi-1 C test, we don't
support this API any more.
This partially reverts commit 6e9f3c2676
(Tue May 3 2005).
* module/srfi/srfi-1.scm (break, break!): New procedures.
* srfi/srfi-1.c (scm_srfi1_break, scm_srfi1_break_x): Rewrite as
proxies to the corresponding Scheme procedures.
* test-suite/standalone/test-srfi-1.c (failure): New function.
(tests): Add `scm_srfi1_break' test. Use `failure'.