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 compile-and-load (path) | |
(compile-file path) | |
(load path)) | |
;;; clozure common lisp | |
(setf ccl:*compile-code-coverage* t) | |
(compile-and-load "path/to/source") | |
;;(run-test) |
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 eratosthenes (n) | |
(loop | |
:for lst = (loop :for i from 2 to n :collect i) then lst | |
:for x = (car lst) | |
:while lst | |
:collect x | |
:do | |
(setf lst | |
(delete-if | |
#'(lambda (n) (zerop (mod n x))) |
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
;; Common Lisp (CCLのCommon Lispパッケージ) のシンボル名一覧 計 978 個 (シンボルの長さ順) | |
* (length = 1, fboundp => T, boundp => T) | |
+ (length = 1, fboundp => T, boundp => T) | |
- (length = 1, fboundp => T, boundp => T) | |
/ (length = 1, fboundp => T, boundp => T) | |
< (length = 1, fboundp => T, boundp => NIL) | |
= (length = 1, fboundp => T, boundp => NIL) | |
> (length = 1, fboundp => T, boundp => NIL) | |
T (length = 1, fboundp => NIL, boundp => 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
(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 |
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
(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
(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 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
;;;; 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))) |