Skip to content

Instantly share code, notes, and snippets.

🤷‍♂
I know the value and cost of nothing

Ohta Shogo athos

🤷‍♂
I know the value and cost of nothing
Block or report user

Report or block athos

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@athos
athos / gist:120598
Created May 30, 2009
this script enables gosh to call the external commands as a function without any definitions.
View gist:120598
#!/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))]
@athos
athos / Portfile
Created Jul 10, 2009
a MacPorts Portfile for tmux 0.9
View Portfile
# $Id: $
PortSystem 1.0
name tmux
version 0.9
categories sysutils
maintainers athos
description terminal multiplexer
long_description \
View breakpoint.scm
(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)
View scheme_baton.clj
;; 第1回 Scheme コードバトン
;;
;; ■ これは何か?
;; Scheme のコードをバトンのように回していき面白い物ができあがるのを楽しむ遊びです。
;; 次回 Shibuya.lisp で成果を発表します。
;; Scheme 初心者のコードを書くきっかけに、中級者には他人のコードを読む機会になればと思います。
;;
;; ■ 2 つのルール
;;
;; (1)自分がこれだと思える変更をコードに加えて2日以内に次の人にまわしてください。
@athos
athos / my-do.scm
Created May 24, 2010
destructive version of `do' macro
View my-do.scm
;; 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 ()
View hanoi.erl
-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],
View brainfuck.scm
;; 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))
View tco.scm
;; 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)
View echo.html
<html>
<head>
<style type="text/css">
.log {
color: red;
}
</style>
<script>
ws = new WebSocket("ws://localhost:8080");
ws.onopen = function (e) {
@athos
athos / gist:895752
Created Mar 31, 2011
an idea of alternative macros for letfn (I hate its too deep indents)
View gist:895752
(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)))
You can’t perform that action at this time.