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

Remove `fold' from (sxml fold).

* module/sxml/fold.scm: Use (srfi srfi-1).
  (fold): Remove.
  (fold-values): Update docstring accordingly.

* test-suite/tests/sxml.fold.test: Use (srfi srfi-1).
This commit is contained in:
Ludovic Courtès 2010-04-08 23:55:41 +02:00
parent e39d0b7668
commit 6c76da4c32
2 changed files with 4 additions and 12 deletions

View file

@ -1,6 +1,6 @@
;;;; (sxml fold) -- transformation of sxml via fold operations ;;;; (sxml fold) -- transformation of sxml via fold operations
;;;; ;;;;
;;;; Copyright (C) 2009 Free Software Foundation, Inc. ;;;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
;;;; Written 2007 by Andy Wingo <wingo at pobox dot com>. ;;;; Written 2007 by Andy Wingo <wingo at pobox dot com>.
;;;; ;;;;
;;;; This library is free software; you can redistribute it and/or ;;;; This library is free software; you can redistribute it and/or
@ -28,8 +28,8 @@
;;; Code: ;;; Code:
(define-module (sxml fold) (define-module (sxml fold)
#:use-module (srfi srfi-1)
#:export (foldt #:export (foldt
fold
foldts foldts
foldts* foldts*
fold-values fold-values
@ -50,15 +50,6 @@
(foldt fup fhere kid)) (foldt fup fhere kid))
tree)))) tree))))
(define (fold proc seed list)
"The standard list fold.
@var{proc} is of type a -> b -> b. @var{seed} is of type b. @var{list}
is of type [a]."
(if (null? list)
seed
(fold proc (proc (car list) seed) (cdr list))))
(define (foldts fdown fup fhere seed tree) (define (foldts fdown fup fhere seed tree)
"The single-threaded tree fold originally defined in SSAX. "The single-threaded tree fold originally defined in SSAX.
@xref{sxml ssax,,(sxml ssax)}, for more information." @xref{sxml ssax,,(sxml ssax)}, for more information."
@ -89,7 +80,7 @@ tree rewrites. Originally defined in Andy Wingo's 2007 paper,
tree))))) tree)))))
(define (fold-values proc list . seeds) (define (fold-values proc list . seeds)
"A variant of @ref{sxml fold fold,,fold} that allows multi-valued "A variant of @ref{SRFI-1 Fold and Map, fold} that allows multi-valued
seeds. Note that the order of the arguments differs from that of seeds. Note that the order of the arguments differs from that of
@code{fold}." @code{fold}."
(if (null? list) (if (null? list)

View file

@ -24,6 +24,7 @@
(define-module (test-suite sxml-fold) (define-module (test-suite sxml-fold)
#:use-module (test-suite lib) #:use-module (test-suite lib)
#:use-module ((srfi srfi-1) #:select (fold))
#:use-module (sxml fold)) #:use-module (sxml fold))
(define atom? (@@ (sxml fold) atom?)) (define atom? (@@ (sxml fold) atom?))