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 switch-2 (val &body clauses) | |
(let ((break (gensym))) | |
`(macrolet ((break-switch () | |
`(throw ',',break nil))) | |
(catch ',break | |
(case ,val | |
,@(maplist | |
#'(lambda (clauses) | |
`(,(caar clauses) ,@(mapcan #'cdr clauses))) |
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 update/fn-1! (generaized-variable update-fn &rest args) | |
(let ((old-val (gensym))) | |
`(let ((,old-val ,generaized-variable)) | |
(setf ,generaized-variable (funcall ,update-fn ,old-val ,@args)) | |
,old-val))) | |
(defmacro update/fn-2! (generaized-variable update-fn &rest args) | |
`(setf ,generaized-variable (funcall ,update-fn ,generaized-variable ,@args))) | |
(defmacro update/fn-r-1 (generaized-variable update-fn &rest 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
(defvar gauche-apropos-result-list nil) | |
(defun eval-gauche-apropos (str) | |
(process-send-string | |
(scheme-proc) | |
(format "(apropos '%s)\n" str))) | |
(defun gauche-apropos-filter (proc str) | |
(insert 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
(defvar *arch-type* "i386") | |
(defun make-disasm-command (target file) | |
(format "objdump -b binary -m %s -D %s" target file)) | |
(defun make-perl-command (lst tmp-file) | |
(concat | |
"perl -e 'print \"" | |
(apply | |
'concat |
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
;;;; PAIP 2.2 | |
(defparameter *simple-grammar* | |
`((sentence -> (noun-phrase verb-phrase)) | |
(noun-phrase -> (Article Noun)) | |
(verb-phrase -> (Verb noun-phrase)) | |
(Article -> the a) | |
(Noun -> man ball woman table) | |
(Verb -> hit took saw liked))) |
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 postscript-process () | |
(get-buffer-process (get-buffer "*postscript*"))) | |
(defun run-postscript () | |
(interactive) | |
(require 'comint) | |
(switch-to-buffer (make-comint "postscript" "gs"))) | |
(push '("postscript" . utf-8) process-coding-system-alist) |
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-ppcre) | |
(defpackage expect | |
(:use :cl :cl-ppcre) | |
(:export expect expect-strings)) | |
(in-package expect) | |
(defmacro expect (port (&rest options) &body clauses) | |
(let ((ch (gensym "ch")) | |
(str (gensym "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
(defun normalize-curr (curr) | |
(let ((curr (member-if-not | |
(lambda (obj) | |
(= obj ?\ )) | |
curr))) | |
(if (every #'characterp curr) | |
(concatenate 'string (nreverse curr)) | |
(if (stringp (car curr)) | |
(car curr) | |
(error "Invalid element"))))) |
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
class String | |
def tokenize() | |
return self.gsub(/(\(|\))/){|s| " " + s + " " }.split(' '); | |
end | |
end | |
def parse(tokens) | |
if(tokens.length == 0) |
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 dynamic-labels | |
((&rest definitions) &body body) | |
(let ((olds (mapcar #'(lambda (x) | |
(declare (ignore x)) | |
(gensym)) | |
definitions))) | |
`(let ,(mapcar | |
#'(lambda (sym def) | |
`(,sym ,(and (fboundp (car def)) (symbol-function (car def))))) | |
olds |