Created
June 15, 2015 00:05
-
-
Save jyc/881c44396f1ecd252915 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
| (bitmatch (u8vector 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1) | |
| (((a double big) (b double big) (c boolean) (d boolean)) | |
| (vector a b c d))) | |
| Press ENTER or type command to continue | |
| ; outputs #(0.0 0.0 1 1) | |
| (write (bitmatch (u8vector 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1) | |
| (((a double big) (b double big) (c 8) (d 8)) | |
| (vector a b c d)))) | |
| ; if we take the same thing but change c and d to booleans of 8 bits... | |
| (write (bitmatch (u8vector 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1) | |
| (((a double big) (b double big) (c 8 boolean) (d 8 boolean)) | |
| (vector a b c d)))) | |
| ; ... we get Error: bitstring-malformed-pattern | |
| ; the documentation says that 8 bits should be the default, but if we remove them... | |
| (write (bitmatch (u8vector 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1) | |
| (((a double big) (b double big) (c boolean) (d boolean)) | |
| (vector a b c d)))) | |
| ; ... we get Error: unbound variable: boolean |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment