summaryrefslogtreecommitdiff
path: root/module/srfi/srfi-1.scm
AgeCommit message (Collapse)AuthorFilesLines
2014-04-01Optimize two-list srfi-1 mapAndy Wingo1-0/+17
* module/srfi/srfi-1.scm (map): Optimize the two-list variant.
2014-03-31Simplify boot-9 and srfi-1 mapAndy Wingo1-14/+5
* 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.
2014-03-16Optimize srfi-1 for-each with two lists.Andy Wingo1-0/+16
* module/srfi/srfi-1.scm (for-each): Optimize for the two-list case.
2014-03-16More for-each micro-optimizationsAndy Wingo1-17/+5
* 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!
2014-03-02Port unrolled one-argument for-each from boot-9 to srfi-1Andy Wingo1-11/+12
* module/srfi/srfi-1.scm (for-each): Port unrolled one-argument implementation here from the boot-9 version.
2012-01-05Placate a number of `syntax-check' verifications.Ludovic Courtès1-1/+1
- "filesystem" -> "file system" - remove doubled words - use EXIT_* macros instead of literal numbers - update `syntax-check' exclusion files
2011-09-02more define-syntax-rule usageAndy Wingo1-5/+3
* module/ice-9/boot-9.scm: * module/ice-9/control.scm: * module/ice-9/futures.scm: * module/ice-9/optargs.scm: * module/ice-9/poll.scm: * module/ice-9/receive.scm: * module/ice-9/threads.scm: * module/ice-9/vlist.scm: * module/language/assembly/compile-bytecode.scm: * module/language/ecmascript/compile-tree-il.scm: * module/language/tree-il.scm: * module/oop/goops.scm: * module/oop/goops/simple.scm: * module/oop/goops/stklos.scm: * module/srfi/srfi-1.scm: * module/srfi/srfi-35.scm: * module/srfi/srfi-39.scm: * module/srfi/srfi-45.scm: * module/srfi/srfi-67/compare.scm: * module/sxml/match.scm: * module/system/repl/error-handling.scm: * module/system/repl/repl.scm: * module/system/vm/inspect.scm: * module/texinfo.scm: * module/web/server.scm: Use define-syntax-rule, where it makes sense.
2011-08-17check that srfi-1 procedure arguments are proceduresAndy Wingo1-12/+65
* 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.
2011-08-12fix take-right and drop-right for improper listsAndy Wingo1-0/+16
* 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.
2011-05-07fix srfi-1 map-in-order definitionAndy Wingo1-0/+2
* 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.
2011-05-05map and for-each in schemeAndy Wingo1-30/+99
* 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.
2011-05-05srfi-1 `member' in scheme, inlines to memq / memv in some casesAndy Wingo1-23/+52
* 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.
2010-10-08SRFI-1: Rewrite `split-at' and `split-at!' in Scheme.Ludovic Courtès1-0/+28
This partially reverts commit bb560b9c16893f762699ba5a3109c8367fff8dfc (Tue Mar 15 2005). * module/srfi/srfi-1.scm (out-of-range, split-at, split-at!): New procedures. * libguile/srfi-1.c (scm_srfi1_split_at, scm_srfi1_split_at_x): Remove. * libguile/srfi-1.h (scm_srfi1_split_at, scm_srfi1_split_at_x): Ditto.
2010-10-08SRFI-1: Rewrite `filter-map' in Scheme.Ludovic Courtès1-0/+22
This partially reverts commit c16359466bcc3f2ebf6d750c069f787f629fc625 (Thu Mar 17 2005). * libguile/srfi-1.c (scm_srfi1_filter_map): Remove. * libguile/srfi-1.h (scm_srfi1_filter_map): Ditto. * module/srfi/srfi-1.scm (filter-map): New procedure.
2010-10-08SRFI-1: Make `fold-right' tail-recursive.Ludovic Courtès1-8/+12
* module/srfi/srfi-1.scm (fold-right): Make tail-recursive. * test-suite/tests/srfi-1.test ("fold-right"): New test prefix.
2010-10-08SRFI-1: Make `unfold' tail-recursive (fix bug #30071).Ludovic Courtès1-4/+13
* 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.
2010-09-20SRFI-1: Rewrite `alist-copy' in Scheme.Ludovic Courtès1-0/+9
This partially reverts commit b1fff4e793619b20342cba0015b9367680d3a0bd (Sat Apr 2 2005). * libguile/srfi-1.c (scm_srfi1_alist_copy): Remove. * libguile/srfi-1.h (scm_srfi1_alist_copy): Remove declaration. * module/srfi/srfi-1.scm (alist-copy): New procedure.
2010-09-12move srfi-1 and srfi-60 C impl to libguile, without public C apiAndy Wingo1-1/+2
* 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.
2010-09-02SRFI-1: Rewrite `drop-right!', `drop-while', `reduce', etc. in Scheme.Ludovic Courtès1-0/+127
This partially reverts commit e9508fbb7df0b1ead007637f16d80cf831776307 (May 3 2005). * module/srfi/srfi-1.scm (take!, drop-right!, reduce, reduce-right, take-while, take-while!, drop-while, span, span!, lset-adjoin): New procedures. * srfi/srfi-1.c (scm_srfi1_drop_right_x, scm_srfi1_drop_while, scm_srfi1_lset_adjoin, scm_srfi1_reduce, scm_srfi1_reduce_right, scm_srfi1_span, scm_srfi1_span_x, scm_srfi1_take_x, scm_srfi1_take_while, scm_srfi1_take_while_x): Rewrite as proxies to the corresponding Scheme procedures. * benchmark-suite/benchmarks/srfi-1.bm ("drop-while"): New benchmark prefix.
2010-08-27SRFI-1: Rewrite `break' and `break!' in Scheme.Ludovic Courtès1-0/+24
This partially reverts commit 6e9f3c2676c0101590d4229653e9c628cb293064 (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'.
2010-08-27SRFI-1: Rewrite `fifth', `sixth', etc. in Scheme.Ludovic Courtès1-0/+6
This partially reverts commit 03731332d5dc8d650b947f5126427402c2b1d8bb (Tue May 3 2005). * module/srfi/srfi-1.scm (fifth, sixth, seventh, eighth, ninth, tenth): New procedures. * srfi/srfi-1.c (scm_srfi1_fifth, scm_srfi1_sixth, scm_srfi1_seventh, scm_srfi1_eighth, scm_srfi1_ninth, scm_srfi1_tenth): Rewrite as proxies to the corresponding Scheme procedure. * test-suite/tests/srfi-1.test ("eighth")["() -1"]: Change exception type to `exception:wrong-type-arg'. ("fifth")["() -1"]: Likewise. ("ninth")["() -1"]: Likewise. ("seventh")["() -1"]: Likewise. ("sixth")["() -1"]: Likewise. ("tenth")["() -1"]: Likewise.
2010-07-21Start rewriting SRFI-1 in Scheme.Ludovic Courtès1-2/+62
This partially reverts commit e556f8c3c6b74ee6596e8dcbe829109d7745da2c (Fri May 6 2005). * module/srfi/srfi-1.scm (xcons, list-tabulate, not-pair?, car+cdr, last, fold, list-index): New procedures. * srfi/srfi-1.c (srfi1_module): New variable. (CACHE_VAR): New macro. (scm_srfi1_car_plus_cdr, scm_srfi1_fold, scm_srfi1_last, scm_srfi1_list_index, scm_srfi1_list_tabulate, scm_srfi1_not_pair_p, scm_srfi1_xcons): Rewrite as proxies of the corresponding Scheme procedure. * test-suite/tests/srfi-1.test ("list-tabulate")["-1"]: Change exception type to `exception:wrong-type-arg'. * benchmark-suite/benchmarks/srfi-1.bm: New file. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add `benchmarks/srfi-1.bm'. * test-suite/standalone/Makefile.am (test_srfi_1_SOURCES, test_srfi_1_CFLAGS, test_srfi_1_LDADD): New variables. (check_PROGRAMS): Add `test-srfi-1'. (TESTS): Ditto. * test-suite/standalone/test-srfi-1.c: New file.
2009-12-11SRFI-1: Use the built-in optional argument support.Ludovic Courtès1-41/+24
* module/srfi/srfi-1.scm (iota, unfold, unfold-right, alist-delete, alist-delete!): Use `define*' and optional arguments instead of rest arguments.
2009-06-17Complete changing license to LGPLv3+Neil Jerram1-1/+1
(Still guile-readline to do, but that will all be GPLv3+.)
2008-11-01move scm srfi files to module/srfi, and compile them.Andy Wingo1-0/+588
* .gitignore: Add gdb-pre-inst-guile. * configure.in: Add module/srfi/Makefile. * module/Makefile.am: Add srfi/. * module/srfi/: SRFI scheme files moved here, and compiled. * srfi/Makefile.am: Remove the bits about the scheme files.