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 with-collects ((&rest syms) &body body) | |
(labels | |
((collector-expander (sym gtail) | |
`(,sym (arg) | |
(if (null ,sym) | |
(progn | |
(setf ,sym (cons arg nil)) | |
(setf ,gtail ,sym) | |
arg) | |
(let ((last (cons arg 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
(defvar *test-function-table* (make-hash-table)) | |
;; clause -> ((arg1 arg2 ... ) result) = ((arg1 arg2 ... ) :eq result) | |
;; clause -> ((arg1 arg2 ... ) :not result) | |
;; clause -> ((arg1 arg2 ... ) :test test-fn) | |
(defparameter *test-report-function* | |
#'(lambda (fn-name args expected actual) | |
(format t "TEST FAILED. Form: (~A ~{~A~^ ~}), Expected: ~A, Actual: ~A~%" | |
fn-name args expected actual))) |
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
(asdf:oos 'asdf:load-op :cl+ssl) | |
(in-package :asdf-install) | |
(setf (symbol-function 'make-stream-from-url-old) | |
#'make-stream-from-url) | |
(setf (symbol-function 'url-host-old) | |
#'url-host) | |
(setf (symbol-function 'url-port-old) |
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
(asdf:oos 'asdf:load-op :kmrcl) | |
(defun |#`-reader| (stream ch numarg) | |
(declare (ignore ch numarg)) | |
(let (acc-fmt acc-args) | |
(loop | |
:for curr = (read-char stream) | |
:until (char= curr #\`) | |
:do | |
(if (char= curr #\\) |
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
(defclass template () | |
((template :initarg :template :initform (error "template string is required")) | |
(template-format-string) | |
(dollar-symbols))) | |
(defun parse-template-string (str) | |
(let (strs syms) | |
(with-input-from-string (s str) | |
(loop :named loop | |
:for ch = (read-char s nil 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
(defmacro define-insertion-template (name template) | |
(destructuring-bind (vars fmt) | |
(parse-template template) | |
(let* ((syms (mapcar | |
(lambda (v) | |
`(,v ,(gensym))) | |
(remove-duplicates vars)))) | |
`(defun ,name () | |
(interactive) | |
(let ,(mapcar 'second syms) |
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
(require 'cl) | |
;;; syntax-table | |
(defvar shorthand-syntax-table | |
(make-syntax-table)) | |
(defmacro with-shorthand-syntax (&rest body) | |
`(with-syntax-table shorthand-syntax-table | |
,@body)) | |
(defmacro sh:syntax (&rest body) |
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
(in-package :asdf-install) | |
(defun make-ssl-stream (sock-stream) | |
(let ((pkg (find-package 'CL+SSL))) | |
(when pkg | |
(funcall (find-symbol "MAKE-SSL-CLIENT-STREAM" pkg) | |
sock-stream)))) | |
(defun ssl-library-loaded? () | |
(find-package 'CL+SSL)) |
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
;;;; SRFI-42 Eager Comprehensions ( 先行評価的内包表記 ) in Common Lisp | |
(defpackage srfi-42 | |
(:use :cl) | |
(:export )) | |
(in-package :srfi-42) | |
;;; Qualifiers |
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 case+ (form test &body clauses) | |
(let ((gtest (gensym)) | |
(gform (gensym))) | |
(labels | |
((clause->or (clause) | |
(if (listp (car clause)) | |
`((or | |
,@(mapcar | |
#'(lambda (x) | |
`(funcall ,gtest ,gform ,x)) |