Skip to content

Instantly share code, notes, and snippets.

View phoe's full-sized avatar
🤔
:thonk:

Michał "phoe" Herda phoe

🤔
:thonk:
View GitHub Profile
@phoe
phoe / modus-operandi.md
Last active May 5, 2021 11:13
Dear GitHub Trust and Safety Team
@phoe
phoe / forever.md
Last active February 22, 2024 23:50
Forever Stable Branch

Forever Stable Branch

Stable branch, I can see you in the stable branch
See you again, I see you again
In my dreams, in my dreams, in my dreams, in my dreams

Morning light, I remember the morning li-i-i-i-ight
Outside my door (outside my door), I'll see you no more (see you no more)
In my dreams, in my dreams, in my dreams, in my dreams
>

@phoe
phoe / sbcl-private-package.lisp
Created January 26, 2022 13:23
List all SBCL packages, private, and public ones
(defun starts-with (string substring)
(let ((length (length substring)))
(and (<= length (length string))
(string= (subseq string 0 length) substring))))
(defun list-all-sbcl-packages ()
(flet ((sbcl-package-p (package)
(starts-with (package-name package) "SB-")))
(remove-if-not #'sbcl-package-p (list-all-packages))))
@phoe
phoe / README.md
Last active January 9, 2023 01:12
GOOPS-like generic dispatch in CL, a quick sketch

GOOPS has GFs which can have a variable number of arguments while still permitting the programmer to specialize on them. This is a quick draft of a CL version that I've done recently and decided to share for fun and profit.

The main issue here is to avoid the fact that methods which agree on parameter specializers and qualifiers as per CLHS 7.6.3 are gonna get overwritten, and we don't want that. GOOPS-like dispatch must mean a maximum of 0 required arguments in defmethod, which means that we get to specialize on exactly 0 arguments, which means that, trivially, 7.6.3 points 1 and 2 are always going to be true.

Hence, only 7.6.3 point 3 is left for us - and that means qualifiers. I (ab)use those in this example, by using a lax method combination (to still have :before/:after/:around) and passing class names this way. It also means that all method lambda lists are effectively (&amp;rest args) or something similar, since we have no req