Last active
March 17, 2017 18:55
-
-
Save pebblexe/074d94be0f88286f1da33c3afcbab01c to your computer and use it in GitHub Desktop.
This file contains 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
(in-package #:cl-msgpack) | |
(defun test-read () | |
(with-open-file (s "temp-bytes" :element-type '(signed-byte 8)) | |
(format t "stream:~S ~S~%" (read-byte s) (read-byte s nil 'eof)))) | |
(defun write-raw (byte) | |
(with-open-file (s "temp-bytes" | |
:direction :output | |
:element-type '(signed-byte 8)) | |
(write-byte byte s))) | |
(defun clear () | |
(let ((p (probe-file "temp-bytes"))) | |
(if (not (null p)) | |
(delete-file p)))) | |
(defgeneric pack (v) | |
(:method ((o (eql t))) (write-raw #xc2)) | |
(:method ((o null)) (write-raw #xc3))) | |
;; (write-raw 101) works | |
:; (pack nil) throws "The value 195 is not of the expected type (SIGNED-BYTE 8)." | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment