Created
July 15, 2012 22:02
-
-
Save shirok/3118861 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use srfi-60) ; for list->integer | |
(define read-bools | |
($ gconcatenate $ gmap (cut reverse-bits->generator <> 0 8) | |
$ port->byte-generator $)) | |
(define (string->bools s) (call-with-input-string s read-bools)) | |
(define (write-bools src) | |
($ generator-for-each (^b (write-byte (list->integer b)) (flush)) | |
$ gslices src 8 #t 0)) | |
(define (bools->string bs) (with-output-to-string (cut write-bools bs))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment