Skip to content

Instantly share code, notes, and snippets.

@shirok
Created Jul 15, 2012
Embed
What would you like to do?
(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