This file contains 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; Syntax: Common-Lisp -*- | |
;; | |
;; 第1回 Scheme コードバトン (CL fork) | |
;; | |
;; ■ これは何か? | |
;; 「Scheme のコードをバトンのように回していき面白い物ができあがるのを楽しむ遊びです。」のCL版です。 | |
;; 次回 Shibuya.lisp で成果を発表します。 | |
;; Scheme 初心者のコードを書くきっかけに、中級者には他人のコードを読む機会になればと思います。 | |
;; | |
;; ■ 2 つのルール |
This file contains 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 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 | |
;;; -*- mode: scheme; coding: utf-8 -*- | |
(use srfi-1) | |
(use gauche.threads) | |
(define-class <thread-ring-element> () | |
((thread) | |
(mutex) | |
(next :init-keyword :next))) |
This file contains 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
#!/bin/sh | |
# swank-clojure easy wrapper | |
# This requires lein deps or mvn deps. | |
DEST=$1 | |
if [ -z ${DEST} ]; then | |
DEST=. | |
fi | |
cd ${DEST} | |
if [ -f project.clj ]; then |
This file contains 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: clojure; coding: utf-8-unix -*- | |
;; clojure.contrib.http.agentの動作検証用スクリプト | |
(ns http-agent-test.core | |
(:use [clojure.contrib.http.agent :as ha :only [http-agent stream status]] | |
[clojure.java.io :as io :only [output-stream copy]])) | |
(defn get-agent [url file] | |
(ha/http-agent url | |
:handler | |
(fn [this] |
This file contains 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: scheme; coding: utf-8 -*- | |
(use util.match) | |
(define (which-win hand-left hand-right) | |
(match (list hand-left hand-right) | |
[(or ('g 'g) ('p 'p) ('c 'c)) #f] | |
[(or ('g 'p) ('p 'c) ('c 'g)) hand-right] | |
[(or ('p 'g) ('c 'p) ('g 'c)) hand-left] | |
[else (errorf "Unknown hand: left ~a, right ~a" hand-left hand-right)])) | |
;; gosh> (janken 'g 'p) | |
;; p |
This file contains 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
(require '[clojure.java.jdbc :as sql]) | |
(defmacro with-connections | |
"" | |
[bindings & body] | |
(cond (empty? bindings) `(do ~@body) | |
(symbol? (bindings 0)) `(sql/with-connection ~(bindings 1) | |
(let [~(bindings 0) (sql/connection)] | |
(with-connections ~(subvec bindings 2) ~@body))))) |
This file contains 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
diff --git a/lib/rfc/http.scm b/lib/rfc/http.scm | |
index e9f3fa4..b7eb9a0 100644 | |
--- a/lib/rfc/http.scm | |
+++ b/lib/rfc/http.scm | |
@@ -50,6 +50,7 @@ | |
(use srfi-13) | |
(use rfc.822) | |
(use rfc.uri) | |
+ (use rfc.base64) | |
(use gauche.net) |
This file contains 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 | |
;;; -*- mode: scheme; coding: utf-8 -*- | |
(use srfi-13) | |
(use srfi-14) | |
(use parser.peg) | |
(use gauche.generator) | |
(use gauche.sequence) | |
;; Fetch a record each time |
This file contains 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 | |
;;; -*- mode: scheme; coding: utf-8 -*- | |
(use srfi-1) | |
(use gauche.net) | |
(use gauche.uvector) | |
;; gosh echo.scm <num> | |
(define (main args) | |
(let* ((server (make-server-socket 'inet 9999 :reuse-addr? #t :backlog SOMAXCONN)) | |
(procs (list-tabulate (x->integer (cadr args)) |
OlderNewer