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
(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
(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
(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
(defmacro named-let (name binds &body body) | |
`(labels | |
((,name ,(mapcar #'car binds) | |
,@body)) | |
(,name ,@(mapcar #'second binds)))) |
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
#include <stdio.h> | |
#include <jni.h> | |
int main(){ | |
JNIEnv *env; | |
JavaVM *jvm; | |
int res; | |
jclass clazz; | |
jmethodID mid; | |
jmethodID mid_to_str; |
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
(defparameter *self* nil) | |
;; `class-name` property list -> { :metaclass-symbol, :member-variables, :class-variables, :attributes} | |
(defmacro class (name super &body body) | |
(let ((member-vars (collect-member-vars name body)) | |
(class-vars (collect-class-vars name body)) | |
(metaclass-name (get-metaclass-symbol name))) | |
(multiple-value-bind (methods inits attributes) (parse-body body) | |
;; method -> (def name (args) 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
(defpackage net.phorni.unit-test | |
(:use :cl) | |
(:shadow cl:assert) | |
(:nicknames :utest) | |
(:export test-error | |
assert | |
define-condition | |
do-as-test | |
*unit-test-error-port* | |
*default-assert-error-message* |
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
(defun defmethods-args-expander (args specifiers) | |
(when (< (length args) (length specifiers)) | |
(error "Too many specifiers")) | |
(labels | |
((inner (ar sr acc) | |
(if (null ar) | |
(nreverse acc) | |
(inner (cdr ar) | |
(cdr sr) |
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 promise () | |
((action :initarg :action :initform (error "Required :action")) | |
(is-called-p :initform nil) | |
(result :initform nil))) | |
(defmacro delay (action) | |
`(make-instance 'promise :action (lambda () ,action))) | |
(defun force (promise) |