Check-in [28f201db00]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:added bytevector-copy*
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 28f201db0063b74096f7f15578a40956c8c05c7d
User & Date: aldo 2016-12-09 16:38:51
Context
2016-12-09
16:39
added file-read file-write bytes-ready to posix check-in: 2e3180323d user: aldo tags: trunk
16:38
added bytevector-copy* check-in: 28f201db00 user: aldo tags: trunk
2016-12-08
01:27
eqv? or zero? instead of eq? somewhere check-in: 27a45ffaf8 user: aldo tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to thunder-utils.sls.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
42
43
44
45
46
47
48









49
50
51
;; Unless required by applicable law or agreed to in writing, software
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.

(library (thunder-utils)
	 (export string-split string-replace)
	 (import (scheme) (srfi s14 char-sets))

	 ;; POSSIBLE THAT NOT EXISTS THIS FUNCTION???
	 ;; s is a string , c is a character-set
	 ;; null strings are discarded from result by default unless #f is specified as third argument
	 (define string-split
	   (case-lambda
................................................................................
	 ;; 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)))))












);library







|







 







>
>
>
>
>
>
>
>
>

<

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

59
;; Unless required by applicable law or agreed to in writing, software
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.

(library (thunder-utils)
	 (export string-split string-replace bytevector-copy*) 
	 (import (scheme) (srfi s14 char-sets))

	 ;; POSSIBLE THAT NOT EXISTS THIS FUNCTION???
	 ;; s is a string , c is a character-set
	 ;; null strings are discarded from result by default unless #f is specified as third argument
	 (define string-split
	   (case-lambda
................................................................................
	 ;; 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)
	     (bytevector-copy* start (- (bytevector-length bv) start))]
	    [(bv start n)
	     (let ([dst (make-bytevector n)])
	       (bytevector-copy! bv start dst 0 n) dst)]))


);library