Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | use memv instead of memq for string-replace |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
d53b96b8b6f6b8c6fb474ba013e12d9d |
User & Date: | aldo 2017-12-06 16:55:40 |
Context
2017-12-06
| ||
16:56 | use memv instead of memq for string-replace (comment fix) check-in: 4405ad641b user: aldo tags: trunk | |
16:55 | use memv instead of memq for string-replace check-in: d53b96b8b6 user: aldo tags: trunk | |
15:53 | added support for list of chars in string-split, added nest check-in: 37a97684bf user: aldo tags: trunk | |
Changes
Changes to thunder-utils.sls.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
;; POSSIBLE THAT THIS NOT EXIST?
;; if x is a character: (eqv? s[i] x) => s[i] = y
;; if x is a list: (memq s[i] x) => s[i] = y
(define (string-replace s x y)
(list->string
(let ([cmp (if (list? x) memq eqv?)])
(map (lambda (z) (if (cmp z x) y z)) (string->list s)))))
;; WHY THERE NOT EXISTS BYTEVECTOR-COPY WITH src-start and n? F*** YOU
(define bytevector-copy*
(case-lambda
[(bv) (bytevector-copy bv)]
[(bv start)
|
| |
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
;; POSSIBLE THAT THIS NOT EXIST?
;; if x is a character: (eqv? s[i] x) => s[i] = y
;; if x is a list: (memq s[i] x) => s[i] = y
(define (string-replace s x y)
(list->string
(let ([cmp (if (list? x) memv eqv?)])
(map (lambda (z) (if (cmp z x) y z)) (string->list s)))))
;; WHY THERE NOT EXISTS BYTEVECTOR-COPY WITH src-start and n? F*** YOU
(define bytevector-copy*
(case-lambda
[(bv) (bytevector-copy bv)]
[(bv start)
|