I hereby claim:
- I am phoe on github.
- I am phoe (https://keybase.io/phoe) on keybase.
- I have a public key whose fingerprint is DF25 B517 A75E 2BBC 08CC B16B 2463 9CD1 4EE8 FB35
To claim this, I am signing this object:
On why stateful code is bad | |
=========================== | |
STUDENT: Sir, can I ask a question? | |
TEACHER: Yes! | |
STUDENT: How do you put an elephant inside a fridge? | |
TEACHER: I don't know. | |
STUDENT: It's easy, you just open the fridge and put it in. I have another question! | |
TEACHER: Ok, ask. | |
STUDENT: How to put a donkey inside the fridge? |
I hereby claim:
To claim this, I am signing this object:
(defclass foo-class (standard-class) ;; we first create a metaclass | |
()) ;; no slots required | |
(defmethod initialize-instance :before ((class foo-class) &key my-argument) | |
(print my-argument)) ;; when we first define the class, just print the arguments | |
(defmethod reinitialize-instance :before ((class foo-class) &key my-argument) | |
(print my-argument)) ;; when we later redefine the class, just print the arguments again | |
(defmethod validate-superclass ((class foo-class) (super standard-class)) |
#| | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; CFFI LZMA Wrapper | |
;; © Michał "phoe" Herda 2017 | |
;; public domain | |
;; Use the attached lzma.so file, which is a x64 Linux shared | |
;; object. To compile the shared library file yourself: | |
;; 1. Install the official LZMA SDK from Igor Pavlov. |
(let* ((list (list 1 2 3 4 5 6 7 8 9 0)) | |
(first list) | |
(second (cdr list))) | |
(do ((left list (cdr left)) | |
(right (cdr list) (cdr right))) | |
((and (null (cdr left)) | |
(null (cdr right)))) | |
(setf (cdr left) (cddr left) | |
(cdr right) (cddr right))) | |
(values first second)) |
;; thanks, beach! | |
(defun split-list-if (predicate list) | |
"Destructively splits the provided list into two lists: one contains the | |
elements of the original list that satisfy the predicate, the other contains | |
elements that do not satisfy the predicate. The order of the original elements | |
is preserved." | |
(loop with result1 = '() | |
with result2 = '() | |
with rest = list |
;; unfinished - I'll think of finishing this some other time mayhaps | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;; BKNR.MULTISTORE | |
;;;; © Michał "phoe" Herda 2017 | |
;;;; bknr.multistore.lisp | |
(defpackage #:bknr.multistore | |
(:shadowing-import-from #:closer-mop | |
#:standard-generic-function #:defmethod #:defgeneric |
(defun pprint-plist (*standard-output* list) | |
"Pretty-prints a plist with newlines after each key-value pair. | |
This will break if not called at toplevel, but works well enough for my use case." | |
(pprint-logical-block (*standard-output* list :prefix "(" :suffix ")") | |
(loop for cell on list by #'cddr | |
do (write (first cell)) | |
(write-char #\Space) | |
(write (second cell)) | |
(when (cddr cell) | |
(terpri *standard-output*) |
(defun trim-number-to-string (n) | |
(let* ((string (format "%3d" n)) | |
(length (length string)) | |
(substring (substring string (- length 3) length))) | |
(format " %s" (propertize substring 'face 'linum)))) | |
(setf linum-format 'trim-number-to-string) |
00003b(:emacs-rex (swank:connection-info) "GATEWAY/INSTALL" t 1) | |
000A5A(:return (:ok (:pid 15237 :style :spawn :encoding (:coding-systems ("utf-8-unix" "iso-latin-1-unix")) :lisp-implementation (:type "SBCL" :name "sbcl" :version "1.3.14.debian" :program nil) :machine (:instance "origin" :type "X86-64" :version "Quad-Core AMD Opteron(tm) Processor 2374 HE") :features (:lparallel :lparallel.with-cltl2 :lparallel.with-cas :lparallel.with-stealing-scheduler cl-postgres.features:sbcl-ipv6-available cl-postgres.features:sbcl-available :flexi-streams :cl-ppcre :cl-who :esrap.can-handle-left-recursion :esrap.multiple-transforms :esrap.function-terminals :esrap.expression-start-terminals :esrap.lookbehind :esrap.lookahead :custom-hash-table-native :global-vars :split-sequence :declare-types :named-readtables :closer-mop :postmodern-use-mop :postmodern-thread-safe cffi-features:flat-namespace cffi-features:x86-64 cffi-features:unix :cffi cffi-sys::flat-namespace :fast-io-sv :fast-io :sbcl-uses-sb-rotate-byte :cl-fad : |