Skip to content

Instantly share code, notes, and snippets.

@rallentando
rallentando / lisp-electric.el
Last active September 24, 2015 21:08
lisp-electric
;;; lisp-electric.el --- electric commands editing for S-expression
;; メインとなるS式編集用コマンドは以下の3つです。
;;
;; lel-matching-char:
;;
;; "(" か "[" を入力するとそれ自体を挿入し、イベントループに入ります。
;;
;; イベントループ内ではタブかS-タブを入力すると、S式単位で範囲選択が
;; できます。
;;eshell-cmpl
(require 'pcomplete)
(defun pcomplete/sudo()
"Completion rules for the `sudo' command."
(let ((pcomplete-help "complete after sudo"))
(pcomplete-here (eshell-complete-commands-list))))
(defun my-eshell-complete-parse-arguments()
@rallentando
rallentando / ac-filename-completer.el
Created May 9, 2011 15:02
ac-filename-completer.el
(defun ac-get-pre(prefix)
(substring prefix 0 (string-match "[^a-zA-Z0-9]" prefix)))
(defun filename-completer-rxexpand(prefix)
(let ((dlm-list (split-string prefix "[a-zA-Z0-9]+"))
(str-list (split-string prefix "[^a-zA-Z0-9]+")))
(if (string= (car str-list) "")
(setq dlm-list (cons "" dlm-list)))
(concat "\\`"
(mapconcat
@rallentando
rallentando / editable-ls.el
Created May 27, 2011 13:33
editable-ls.el
(require 'eshell)
(require 'cl)
(defun normalize-file-name(filename)
(let ((skip nil))
(mapconcat
'identity
(nreverse
(mapcan
(lambda (str)
@rallentando
rallentando / life-lis.scm
Created May 30, 2011 14:34
life-lis.scm
(use sdl)
(use srfi-1)
(use math.mt-random)
(use gauche.sequence)
(define seed (make <mersenne-twister> :seed (sys-time)))
(define bmp-size 3)
(define field-width 200)
(define field-height 200)
@rallentando
rallentando / life-hash.scm
Created June 6, 2011 15:01
life-hash.scm
(use srfi-42)
(use math.mt-random)
(use util.match)
(use sdl)
(define bmp-size 3)
;; point
(define (make-point x y)
(cons x y))
@rallentando
rallentando / life-vec.scm
Created June 6, 2011 15:01
life-vec.scm
(use sdl)
(use srfi-43)
(use math.mt-random)
(define seed (make <mersenne-twister> :seed (sys-time)))
(define bmp-size 3)
(define field-width 200)
(define field-height 200)
(define field
(define (offsets l)
(list l
(append (drop l 1) (take l 1))
(append (take-right l 1) (drop-right l 1))))
(define (next list-of-lists)
(apply map
(^ lis
(apply map
(^ k
(define (main-loop scr bmp dstrect)
(let loop ((num 0))
(let ((c0 0) ;; ・
(c1 1) ;; →
(c2 -1) ;; ←
(c3 (+ field-width)) ;; ↓
(c4 (+ 1 field-width)) ;;↓→
(c5 (+ -1 field-width)) ;;↓←
(c6 (- field-width)) ;;↑
(c7 (- 1 field-width)) ;;↑→
import Data.List
import Data.IORef
import System.Random
import Control.Monad
import Graphics.Rendering.OpenGL
import Graphics.UI.GLUT
width = 300
height = 300
widthf = 300