mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 04:10:18 +02:00
Add test for r7rs string-for-each
* test-suite/tests/r7rs.test: As stated. * module/scheme/base.scm: Reindent and add minimal doc.
This commit is contained in:
parent
3243d96bb5
commit
4daf4664cf
2 changed files with 27 additions and 18 deletions
|
@ -407,6 +407,7 @@
|
||||||
|
|
||||||
(define r7:string-for-each
|
(define r7:string-for-each
|
||||||
(case-lambda
|
(case-lambda
|
||||||
|
"Like @code{for-each}, but takes strings instead of lists."
|
||||||
((proc s) (string-for-each proc s))
|
((proc s) (string-for-each proc s))
|
||||||
((proc s1 s2)
|
((proc s1 s2)
|
||||||
(let ((len (min (string-length s1)
|
(let ((len (min (string-length s1)
|
||||||
|
|
|
@ -1773,6 +1773,14 @@
|
||||||
"abcde")
|
"abcde")
|
||||||
v))
|
v))
|
||||||
|
|
||||||
|
(test '(4 3 2 1)
|
||||||
|
(let ((v '()))
|
||||||
|
(string-for-each
|
||||||
|
(lambda (b c) (set! v (cons (- (char->integer b) (char->integer c)) v)))
|
||||||
|
"bdfh"
|
||||||
|
"abcde")
|
||||||
|
v))
|
||||||
|
|
||||||
(test '(0 1 4 9 16) (let ((v (make-list 5)))
|
(test '(0 1 4 9 16) (let ((v (make-list 5)))
|
||||||
(vector-for-each
|
(vector-for-each
|
||||||
(lambda (i) (list-set! v i (* i i)))
|
(lambda (i) (list-set! v i (* i i)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue