/usr/lib/s9fes/string-map.scm is in scheme9 2010.11.13-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ; Scheme 9 from Empty Space, Function Library
; By Nils M Holm, 2010
; See the LICENSE file of the S9fES package for terms of use
;
; (string-map procedure^1 string ...) ==> string
; (string-map! procedure^1 string ...) ==> unspecific
;
; (load-from-library "string-map.scm")
;
; Map a procedure over a string, giving a new string
;
; (string (f (string-ref s i)) ...)
;
; where F is the given PROCEDURE and S is the string to map.
; STRING-MAP is to strings what MAP is to lists.
;
; STRING-MAP! does not create a fresh string, but changes the
; given one in situ.
;
; Example: (string-map char-downcase "HELLO") ==> "hello"
; (let ((s (string-copy "HELLO!")))
; (string-map! char-downcase s)
; s) ==> "hello!"
(define (string-map! f s)
(let ((k (string-length s)))
(do ((i 0 (+ 1 i)))
((>= i k))
(string-set! s i (f (string-ref s i))))))
(define (string-map f s)
(let ((n (string-copy s)))
(string-map! f n)
n))
|