Skip to content

Instantly share code, notes, and snippets.

(optima:match message-type ((guard x (eql x (getf msg-type :subscribed))) (format t "do something?")))
Non-linear pattern: (STRUCTURE CL-WAMP::GUARD
(CL-WAMP::X CL-WAMP::X)
(EQL (AND
CL-WAMP::X
(STRUCTURE
GETF
(CL-WAMP::MSG-TYPE
CL-WAMP::MSG-TYPE)
(defvar msg-type '(:hello 1
:welcome 2
:abort 3
:challenge 4
:authenticate 5
:goodbye 6
:error 8
:publish 16
:published 17
:subscribe 32
(defun write-raw-bytes (bytes)
(with-open-file (s "temp-bytes"
:direction :output
:if-exists :append
:element-type '(unsigned-byte 8))
(loop for byte in bytes do (write-byte byte s))))
Name service error in "getaddrinfo": -2 (Name or service not known)
[Condition of type SB-BSD-SOCKETS:HOST-NOT-FOUND-ERROR]
There is no applicable method for the generic function:
#<STANDARD-GENERIC-FUNCTION CCL::SOCKADDR #x30200040291F>
when called with arguments:
(NIL)
[Condition of type NO-APPLICABLE-METHOD-EXISTS]
on #<BASIC-FILE-CHARACTER-INPUT-STREAM ("/home/k/quicklisp/dists/quicklisp/software/alexandria-20170227-git/sequences.lisp"/4 UTF-8) #x302001E7D9DD>, near position 8041 :
Bad file descriptor during read
[Condition of type CCL::SIMPLE-STREAM-ERROR]
There is no applicable method for the generic function:
#<STANDARD-GENERIC-FUNCTION CCL::SOCKADDR #x30200044D97F>
when called with arguments:
(NIL)
[Condition of type NO-APPLICABLE-METHOD-EXISTS]
(defun check-int32 (x)
(<= (* -1 #x80000000) x -1))
(defgeneric pack (v)
(:method ((o (eql t))) (write-raw-byte #xc2))
(:method ((o null)) (write-raw-byte #xc3))
(:method ((o #'check-int32)) (write-raw-bytes #xd2)))
(defmethod pack (((<= (-1 * #x80000000) n -1)))
(list
#xd2
(ldb (byte 8 24) n)
(ldb (byte 8 16) n)
(ldb (byte 8 8) n)
(ldb (byte 8 0) n)))
(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))