1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00
Commit graph

53 commits

Author SHA1 Message Date
Rob Browning
945c97b14d srfi-1 lset-difference!: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_lset-difference_x): delete.
* libguile/srfi-1.h (scm_srfi1_lset-difference_x): delete.
* module/srfi/srfi-1.scm: add lset-difference!.
* test-suite/tests/srfi-1.test: extend lset-difference! tests to cover
lset-difference.
2024-07-30 19:28:37 -05:00
Rob Browning
372a52e6aa srfi-1 length+: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_length_plus): delete.
* libguile/srfi-1.h (scm_srfi1_length_plus): delete.
* module/srfi/srfi-1.scm: add length+.
2024-07-30 19:28:37 -05:00
Rob Browning
c62d2962d4 srfi-1 concatenate concatenate!: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_concatenate, scm_srfi1_concatenate_x): delete.
* libguile/srfi-1.h (scm_srfi1_concatenate, scm_srfi1_concatenate_x): delete.
* module/srfi/srfi-1.scm: add concatenate and concatenate!.
2024-07-30 18:54:45 -05:00
Rob Browning
aa44035ee8 srfi-1 list-copy: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_list_copy): delete.
* libguile/srfi-1.h (scm_srfi1_list_copy): delete.
* module/srfi/srfi-1.scm: add list-copy.
* test-suite/tests/srfi-1.test: ensure copied spine is independent.
2024-07-30 18:54:45 -05:00
Andy Wingo
e9c5a1719b Move copy-tree to (ice-9 copy-tree); deprecate main binding
* doc/ref/api-data.texi (List Constructors):
* doc/ref/api-utility.texi (Copying): Update docs to mention module.
* libguile.h: Remove trees.h inclusion.
* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES):
  (DOT_X_FILES, DOT_DOC_FILES, modinclude_HEADERS): Remove trees.c,
  trees.h, and related files.
* libguile/init.c (scm_i_init_guile): Remove trees.h and the
  scm_init_trees call.
* libguile/trees.c:
* libguile/trees.h: Remove.
* module/Makefile.am (SOURCES): Add ice-9/copy-tree.scm.
* module/ice-9/copy-tree.scm: New file.
* module/ice-9/deprecated.scm (copy-tree*): Export as copy-tree,
  proxying to (ice-9 copy-tree).
* module/system/repl/common.scm:
* module/web/client.scm:
* test-suite/tests/elisp.test:
* test-suite/tests/srfi-1.test:
* module/oop/goops/save.scm: Use (ice-9 copy-tree).
* test-suite/Makefile.am (SCM_TESTS): Add copy-tree.test.
* test-suite/tests/copy-tree.test: New file; test pulled from
  eval.test.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_copy_tree): Deprecate.
2020-09-10 21:57:21 +02:00
Mark H Weaver
a5186f506f SRFI-1 'length+' raises an error unless passed a proper or circular list.
Fixes <http://bugs.gnu.org/17296>.

* libguile/srfi-1.c (scm_srfi1_length_plus): Rewrite to raise an error
  unless passed a proper or circular list, based on code from
  'scm_ilength'.

* test-suite/tests/srfi-1.test (length+): Add tests.
2014-06-01 19:19:40 -04:00
Andy Wingo
e7a81c7acd fix take-right and drop-right for improper lists
* 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-08-12 23:26:15 +02:00
Ludovic Courtès
a6505cb49c SRFI-1: Make `fold-right' tail-recursive.
* module/srfi/srfi-1.scm (fold-right): Make tail-recursive.

* test-suite/tests/srfi-1.test ("fold-right"): New test prefix.
2010-10-08 15:25:56 +02:00
Ludovic Courtès
07076c1e61 SRFI-1: Make `unfold' tail-recursive (fix bug #30071).
* 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-10-08 15:25:56 +02:00
Ludovic Courtès
d7418e60a5 SRFI-1: Rewrite fifth', sixth', etc. in Scheme.
This partially reverts commit 03731332d5
(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-08-27 18:59:42 +02:00
Ludovic Courtès
0b7f2eb8bf Start rewriting SRFI-1 in Scheme.
This partially reverts commit e556f8c3c6
(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.
2010-07-21 01:07:56 +02:00
Andy Wingo
95e5998204 gut trampolines
* libguile/eval.c: Gut the trampoline implementation. We'll be doing
  much more clever things here that will obviate the need for the
  procedure arg of map and for-each to be allocated in many cases...
  trampolines were a noble attempt at optimizing in the wrong place.

* srfi/srfi-1.c (scm_srfi1_lset_difference_x): Validate that we get a
  proc, because the trampoline won't do it for us.

* test-suite/tests/sort.test ("sort"):
* test-suite/tests/srfi-1.test ("count", "fold", "list-index"):
  Change expected exceptions, due to trampoline functions not doing any
  computation.
2009-12-01 21:00:23 +01:00
Neil Jerram
53befeb700 Change Guile license to LGPLv3+
(Not quite finished, the following will be done tomorrow.
   module/srfi/*.scm
   module/rnrs/*.scm
   module/scripts/*.scm
   testsuite/*.scm
   guile-readline/*
)
2009-06-17 00:22:09 +01:00
Ludovic Courtès
0fb11ae432 Fix type-checking of SRFI-1 `partition'. 2008-04-28 18:03:27 +02:00
Kevin Ryde
8ab3d8a068 merge from 1.8 branch 2006-10-09 23:40:48 +00:00
Kevin Ryde
23f2b9a3de merge from 1.8 branch 2006-06-17 23:15:59 +00:00
Kevin Ryde
2d6e3bd4c0 Use the equal proc argument, so we exercise the
srfi-1 version of the code.  Without such an argument srfi-1.c passes
the job to the core scm_delete.
2006-02-04 00:54:24 +00:00
Kevin Ryde
04f53076d9 (lset-difference!): More tests. 2005-11-24 00:00:59 +00:00
Kevin Ryde
4ec555c593 typo in lset-difference! name in with-test-prefix 2005-11-23 23:41:29 +00:00
Kevin Ryde
e4bf1d1181 (lset-difference, lset-difference,
lset-diff+intersection, lset-diff+intersection, lset-intersection):
Exercise equality procedure arg order (already correct in these procs,
but had been wrong in other lset ones).
2005-08-12 01:26:52 +00:00
Marius Vollmer
92205699d0 The FSF has a new address. 2005-05-23 19:57:22 +00:00
Kevin Ryde
a17a869e3f (car+cdr, fold, last, list-index, list-tabulate,
not-pair?, xcons): New tests.
2005-05-07 00:02:02 +00:00
Kevin Ryde
f1f478bf1d (fifth, sixth, seventh, eighth, ninth, tenth): New tests. 2005-05-03 23:25:48 +00:00
Kevin Ryde
b2c82c27f0 (break!, drop-right!, drop-while, take-while,
take-while!, span!, take!): New tests.
2005-05-03 23:13:16 +00:00
Kevin Ryde
7cfb4dd2e8 (concatenate, concatenate!, count, filter-map, lset-adjoin): More tests. 2005-04-23 00:14:42 +00:00
Kevin Ryde
f01b08bf8a (lset-union): More tests. 2005-04-01 23:49:35 +00:00
Kevin Ryde
cfa1ef52a2 (filter-map): More tests. 2005-03-17 23:16:31 +00:00
Kevin Ryde
c3c8306132 (split-at, split-at!): New tests. 2005-03-15 22:00:56 +00:00
Kevin Ryde
ba9fb62d10 (drop-right, partition!, take-right): New tests. 2005-03-15 21:16:32 +00:00
Kevin Ryde
e748b272eb (find, find-tail, lset-union): New tests.
(lset-adjoin): Corrections to some tests.
2005-03-13 23:12:40 +00:00
Kevin Ryde
a115b0feaa (lset-adjoin): Amend tests to expect duplicates among args cast out. 2005-02-17 21:15:46 +00:00
Kevin Ryde
80eba4e572 (reduce, reduce-right): New tests. 2005-02-11 21:40:32 +00:00
Kevin Ryde
eccc026e06 (list=): New tests. 2005-02-03 23:20:08 +00:00
Kevin Ryde
389a4e4715 (remove!): New tests. 2005-01-28 21:49:09 +00:00
Kevin Ryde
d64179499c (remove): New tests. 2005-01-28 21:44:51 +00:00
Kevin Ryde
981b5d1ff0 (lset-adjoin): New tests. 2005-01-28 21:18:01 +00:00
Kevin Ryde
71d0dab137 More of:
(lset=): New tests.
2005-01-27 23:21:06 +00:00
Kevin Ryde
7682257388 (lset=, member): New tests. 2005-01-23 21:36:00 +00:00
Kevin Ryde
f0d1bc09cf (break): New tests. 2004-12-06 00:41:41 +00:00
Kevin Ryde
ee0301df8c (span): New tests. 2004-12-06 00:33:40 +00:00
Kevin Ryde
872223a898 (alist-delete): New tests. 2004-12-06 00:12:00 +00:00
Kevin Ryde
f9a95cfe2a (alist-copy): New tests. 2004-12-05 21:49:48 +00:00
Kevin Ryde
bbd1b480f4 (append-map): New tests. 2004-12-04 23:10:39 +00:00
Kevin Ryde
a52ef9e4a0 (filter-map): New tests. 2004-12-04 22:47:12 +00:00
Kevin Ryde
f39032937e (count): New tests. 2003-12-02 21:17:33 +00:00
Kevin Ryde
813729f6fa Correction to a comment in:
(list-copy): New tests.
2003-08-30 00:02:44 +00:00
Kevin Ryde
b052db6954 (list-copy): New tests. 2003-08-22 22:57:46 +00:00
Kevin Ryde
15d36a3438 (length+): New tests. 2003-07-28 23:51:41 +00:00
Kevin Ryde
c6e9db20c1 (concatenate, concatenate!): New tests. 2003-07-28 23:45:31 +00:00
Kevin Ryde
9a029e414a 2003-07-14 Matthias Koeppe <mkoeppe@mail.math.uni-magdeburg.de>
* tests/srfi-1.test (partition): Add tests.
2003-07-13 23:06:33 +00:00