Skip to content

Instantly share code, notes, and snippets.

View youz's full-sized avatar
🈳
kyomu

Yōsuke Ushiki youz

🈳
kyomu
View GitHub Profile
@znz
znz / gist:104842
Created May 1, 2009 03:12
rcodetoolsの設定例
(setq load-path
(cons "~/.emacs.d/site-lisp/elisp" load-path))
(require 'auto-complete)
(setq-default ac-sources '(ac-source-abbrev ac-source-words-in-buffer))
(global-auto-complete-mode t)
(setq ac-auto-start 3)
(add-hook
'emacs-lisp-mode-hook
(lambda ()
(setq ac-sources '(ac-source-words-in-buffer ac-source-symbols))))
@youz
youz / modanshogi.lisp
Created April 1, 2010 09:11
A CommonLisp Implementation of the programming language "ModanShogi".
;;; ref. http://github.com/yhara/ShogiModan
(eval-when (:compile-toplevel :load-toplevel :execute)
(unless (find-package :modanshogi)
(defpackage :modanshogi
(:use #+:xyzzy :lisp
#-:xyzzy :common-lisp))))
(provide 'modanshogi)
@youz
youz / caret-macro.lisp
Created May 7, 2010 11:37
short aliases for lambda expression
;;; ref. http://blog.practical-scheme.net/gauche/20100428-shorter-names
;;; http://d.hatena.ne.jp/higepon/20100511/1273584001
#+:xyzzy
(require 'cmu_loop)
(defmacro ^ (args . body)
`(lambda ,args ,@body))
(defmacro define-caret-macros (chars)
@youz
youz / gist:467696
Created July 8, 2010 06:18
Tetrlang Interpreter for xyzzy
;;; Tetrlang Interpreter for xyzzy
;;; 元ネタ
;;; わーい、テトリス言語 Tetrlang 完成したよー\(^o^)/
;;; http://d.hatena.ne.jp/athos/20100707/tetrlang
(defpackage :tetrlang
(:use :lisp :editor))
(in-package :tetrlang)
;;; -*- mode:lisp; package:shobon -*-
;;; forked from http://pc12.2ch.net/test/read.cgi/software/1226425897/809
;;;
;;; *usage*
;;; M-x shobon
;;; M-x shobon-toggle-status
;;; M-x shobon-toggle-modeline
(defpackage :shobon
@youz
youz / parens-lang.scm
Created October 4, 2010 15:41
parens language (in scheme)
;;; ref. http://blog.livedoor.jp/dankogai/archives/51524639.html
(define S (lambda (x) (lambda (y) (lambda (z) ((x z) (y z))))))
(define K (lambda (x) (lambda (y) x)))
(define U (lambda (x) ((x S) K)))
(define (%parens base compose)
(lambda (code)
(let r ((c code))
(unless (list? c) (error "proper list required, but got" c))
@youz
youz / parens-lang.arc
Created October 12, 2010 14:39
parens language (in Arc)
;;; ref. http://blog.livedoor.jp/dankogai/archives/51524639.html
(= p[(rfn r(c f)(if c(r cdr.c(f:p c.0))f))_[(_:fn(x)(fn(y)[x._ y._]))[fn(y)_]]])
(((p'(#0=(#1=((())))#2=(#0#(#1#(#0#))#0#)(())#4=(#0##2#(()))#4##4#)) [+ _ 1]) 0)
; -> 65536
;;; ref. http://practical-scheme.net/gauche/man/gauche-refj_16.html#SEC18
(defmacro debug-print (form stream)
`(progn
(format t "~&#?=~S:~S:~S~%"
,(or *load-pathname*
(when (buffer-stream-p stream)
(buffer-name (buffer-stream-buffer stream)))
stream)
,(si:*stream-line-number stream)
@garaemon
garaemon / gist:732160
Created December 7, 2010 18:07
classmethod on CLOS
;; utility functions to define class methods
(defun extract-argument-symbols (args)
(mapcar #'(lambda (x) (if (listp x) (car x) x)) args))
(defun has-class-method-p (method class arguments)
(let ((methods (compute-applicable-methods method (cons class arguments))))
(dolist (m methods)
(let ((specializers (closer-mop:method-specializers m)))
(if (typep (car specializers) 'closer-mop:eql-specializer)
(return-from has-class-method-p t))))
@fogus
fogus / refactor.py
Created December 8, 2010 13:00 — forked from jdp/refactor.py
#!/usr/bin/env python
import sys
import types
import operator
class Runtime:
def __init__(self, env={}, stack=[]):
self.env = {
# Primitive words, not an impressive base but it works