This file contains 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
type token = T_w | T_W | T_v | EOF;; | |
let rec scan s i = ( | |
let length = String.length s in | |
if i >= length then length, EOF else | |
match s.[i] with | |
| 'W' -> i + 1, T_W | |
| 'w' -> i + 1, T_w | |
| 'v' -> i + 1, T_v | |
| '\xef' -> (* W : EF BC B7, v : EF BD 96, w : EF BD 97 *) |
This file contains 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 shecomma-reader (stream sub-character n) | |
(declare (ignore sub-character)) | |
(let ((a (gensym "A")) | |
(f (read stream nil nil))) | |
`(lambda (&rest ,a) | |
(apply ,(case n | |
(0 `(quote ,f)) | |
(1 f) | |
(t `(function ,f))) | |
,a)))) |
This file contains 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 Filter | |
class << self | |
def filters | |
@filters ||= {} | |
end | |
def add(name, &code) | |
filters[name] = code | |
end | |
end |
This file contains 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
;;; -*- Mode: Lisp; Encoding: Shift_JIS -*- | |
;;; 英数字を180度回転した文字を表示するプログラム | |
;;; 元ネタ: http://id.fnshr.info/2013/01/25/upsidedowntext/ | |
(provide "flippy") | |
(in-package "user") | |
(defvar *flippy-alist* nil) |
This file contains 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
(provide "haiyore") | |
(defpackage :haiyore | |
(:use :lisp :editor)) | |
(in-package :haiyore) | |
(defvar *timer* nil) | |
(defvar *mlf* nil) |
This file contains 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
;; youz's solution to Analyze a Tic-Tac-Toe Board | |
;; https://4clojure.com/problem/73 | |
;;; inspired by https://gist.github.com/1024984 | |
(fn [a x b] | |
(ffirst | |
(remove #(or (some #{:e} %) (a not= %)) | |
`(~@b ~@(a map list b) ~(x b [0 1 2]) ~(x b [2 1 0]))))) | |
apply #(map get % %2) |