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
| (defmacro sq (variable value &optional (documentation nil documentation-p)) | |
| "REPL-friendly alternative-to/merger-of setq and defparameter." | |
| (assert (and variable (symbolp variable))) | |
| (alexandria:once-only (value) | |
| `(cond | |
| ((boundp ',variable) | |
| ,@(when documentation-p | |
| `((setf (documentation ',variable 'variable) ,documentation))) | |
| (setf ,variable ,value)) | |
| (t |
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
| (defpackage :99-bottles | |
| (:use :cl) | |
| (:export #:print-song)) | |
| (in-package :99-bottles) | |
| (defun wrap (number) | |
| (if (minusp number) | |
| (+ number 100) | |
| number)) |
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
| (defvar *uncurry* nil "When bound and non-nil, curried functions can be uncurried") | |
| (makunbound '*uncurry*) | |
| (defun curry (function &rest args) | |
| (lambda (&rest more-args) | |
| (if (and (boundp '*uncurry*) *uncurry*) | |
| (if more-args | |
| (error "No more args expected") | |
| function) | |
| (apply function (append args more-args))))) |
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
| (defmacro definline (name args &body body) | |
| `(progn | |
| (defmacro ,name ,args ,@body) | |
| (setf ,name (lambda ,args (,name ,@args))))) | |
| CL-USER> (definline myor (a b) `(or ,a ,b)) | |
| #<anonymous interpreted function 40500011FC> | |
| CL-USER> (myor t (error "boom!")) | |
| T | |
| CL-USER> (apply myor '(nil t)) |
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
| ;; Simple and rough substitute for defadvice :around on SBCL. Should | |
| ;; be easy to port by substituting something appropriate for | |
| ;; sb-introspect:function-lambda-list | |
| ;; Its easy to get confused with wrapped functions - if you redefine a | |
| ;; function while it is wrapped, it will still seem to be wrapped | |
| ;; (entry in the hash table for the name) but won't be. | |
| (defvar *wrapped-functions* (make-hash-table)) |
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
| ;; Naive and inefficient en/decoding of IPv6 addresses according to RFC-1924 | |
| ;; Parsting/emitting hex-encoded IPv6 addresses in the usual format not implemented | |
| (defparameter *digits* "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~") | |
| (defun ip-encode (address) | |
| (loop with value = address | |
| with chars | |
| as (quotient remainder) = (multiple-value-list (floor value 85)) | |
| do (setf value quotient) |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>lisp-exploration</title> | |
| <!-- 2016-07-12 Tue 14:15 --> | |
| <meta charset="utf-8"> | |
| <meta name="generator" content="Org-mode"> | |
| <style type="text/css"> | |
| <!--/*--><![CDATA[/*><!--*/ | |
| .title { text-align: center; } |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>exploration</title> | |
| <!-- 2016-07-11 Mon 09:04 --> | |
| <meta charset="utf-8"> | |
| <meta name="generator" content="Org-mode"> | |
| <style type="text/css"> | |
| <!--/*--><![CDATA[/*><!--*/ | |
| .title { text-align: center; } |
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
| ;; This demonstrates a segfault (maybe counting the nodes doesn't | |
| ;; cause it, just makes the occasional fault more likely due to | |
| ;; spending time with the tree in each thread) | |
| (ql:quickload :plump) | |
| (ql:quickload :bordeaux-threads) | |
| (defun thrash (&key | |
| (num-threads 100) | |
| (lockedp nil) |
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
| // ==UserScript== | |
| // @name Remove signup form | |
| // @namespace http://ubermonkey.net/ | |
| // @version 0.1 | |
| // @description Unbreak boutiquepaws | |
| // @author spacebat | |
| // @include /^https:\/\/www\.boutiquepaws\.com\.au\// | |
| // @grant GM_log | |
| // ==/UserScript== |