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 gosh | |
(use gauche.process) | |
(use srfi-1) | |
(use srfi-13) | |
(define (tree-filter f tree) | |
(define (rec t s) | |
(cond [(null? t) s] | |
[(pair? t) (rec (car t) (rec (cdr t) s))] |
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
# $Id: $ | |
PortSystem 1.0 | |
name tmux | |
version 0.9 | |
categories sysutils | |
maintainers athos | |
description terminal multiplexer | |
long_description \ |
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
(define-module breakpoint | |
(use gauche.parameter) | |
(export bp bp-enabled? inspect set!-inspect resume reset)) | |
(select-module breakpoint) | |
(define %inspect #f) | |
(define %set!-inspect #f) | |
(define %cont #f) |
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
;; 第1回 Scheme コードバトン | |
;; | |
;; ■ これは何か? | |
;; Scheme のコードをバトンのように回していき面白い物ができあがるのを楽しむ遊びです。 | |
;; 次回 Shibuya.lisp で成果を発表します。 | |
;; Scheme 初心者のコードを書くきっかけに、中級者には他人のコードを読む機会になればと思います。 | |
;; | |
;; ■ 2 つのルール | |
;; | |
;; (1)自分がこれだと思える変更をコードに加えて2日以内に次の人にまわしてください。 |
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
;; destructive version of `do' macro | |
;; (my-do ([x 1 y] [y 1 (+ x y)]) | |
;; ((> x 30) #f) | |
;; (print x)) | |
;; | |
;; is expanded as below: | |
;; | |
;; (let ([x 1] [y 1]) | |
;; (let loop () |
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
-module(hanoi). | |
-compile(export_all). | |
hanoi(N) -> | |
hanoi(N, a, c, [], fun lists:reverse/1). | |
hanoi(0, _, _, Moves, K) -> | |
K(Moves); | |
hanoi(N, From, To, Moves, K) -> | |
[Temp] = [a,b,c] -- [From, To], |
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
;; delayed tree structure for representing brainfuck's ``memory'' | |
(define (make-tree n) | |
(define (rec start n) | |
(delay | |
(if (= n 1) | |
0 | |
(let* ([n/2 (ceiling (/ n 2))] | |
[n-n/2 (- n n/2)]) | |
(list (- n/2 1) (rec start n/2) (rec (+ start n/2) n-n/2)))))) | |
(rec 0 n)) |
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
;; from http://d.hatena.ne.jp/wasabiz/20110118/1295335821 | |
;; 「Pythonで末尾再帰最適化をする。」のScheme版 | |
(define (TCO proc) | |
(let ([first? #t] [continue (list 'CONTINUE)] [args #f]) | |
(lambda args* | |
(if first? | |
(begin | |
(set! first? #f) | |
(let loop ([result (apply proc args*)]) | |
(if (eq? result 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
<html> | |
<head> | |
<style type="text/css"> | |
.log { | |
color: red; | |
} | |
</style> | |
<script> | |
ws = new WebSocket("ws://localhost:8080"); | |
ws.onopen = function (e) { |
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
(letfn [(kons [x y] | |
(cons x y))] | |
(kons 1 nil)) | |
(defmacro letfn1 [name args & form] | |
(let [fbody (butlast form) | |
body (last form)] | |
`(letfn [(~name ~args ~@fbody)] | |
~body))) |
OlderNewer