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
;; どんな人でも瞬時に凄腕ハッカーになれる方法・・・ for #xyzzy | |
;; | |
;; * M-x hacker-typer で開始 | |
;; 何かキー入力するたびにすごい勢いでコードを書いていく | |
;; * C-g で終了 | |
;; * ハックするコードは *hacker-typer-dir* と *hacker-typer-file-pattern* | |
;; で指定 | |
;; | |
;; http://duiker101.tk/hackertyper/ | |
;; http://developer.cybozu.co.jp/akky/2011/04/post-a879.html |
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
; -*- mode: lisp; package: power-usage -*- | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; | |
;; 続きは GitHub で。 | |
;; https://github.com/miyamuko/power-usage | |
;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
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 define-tco-function (name (&rest lambda-list) &body body) | |
(let ((continue (gensym "continue")) | |
(vals (mapcar #'(lambda (x) (if (consp x) (car x) x)) | |
(remove-if (lambda (x) (member x lambda-list-keywords)) | |
lambda-list)))) | |
`(defun ,name ,lambda-list | |
(macrolet ((,name (&rest args) | |
(list 'progn | |
(list 'multiple-value-setq ',vals (cons 'values args)) | |
(list 'go ',continue)))) |
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
#!/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 |
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
;; 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)))) |
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
;;; 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) |
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
;;; 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 |
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
;;; 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)) |
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
;;; -*- 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 |
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
;;; Tetrlang Interpreter for xyzzy | |
;;; 元ネタ | |
;;; わーい、テトリス言語 Tetrlang 完成したよー\(^o^)/ | |
;;; http://d.hatena.ne.jp/athos/20100707/tetrlang | |
(defpackage :tetrlang | |
(:use :lisp :editor)) | |
(in-package :tetrlang) |