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
class A | |
def m1 | |
p 'm1' | |
end | |
def m2 | |
p 'm2' | |
end | |
end |
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
(ns test3d.core | |
(:import java.applet.Applet | |
java.awt.BorderLayout | |
[javax.media.j3d BranchGroup TransformGroup | |
Transform3D] | |
javax.vecmath.AxisAngle4d | |
[com.sun.j3d.utils | |
applet.MainFrame universe.SimpleUniverse | |
geometry.ColorCube])) |
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
(ns mail | |
(import [org.apache.commons.mail | |
SimpleEmail])) | |
(defn sendmail [& {:keys [from to subject content charset host], | |
:or {charset "iso-2022-jp"}}] | |
(doto (SimpleEmail.) | |
(.setHostName host) | |
(.setCharset charset) | |
(.setContent content (str "text/plain; charset=" charset)) |
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
(ns hoge.core | |
(:gen-class)) | |
(import java.io.File) | |
(def _nil_ nil) | |
(defn -main [& args] | |
(prn (File. _nil_ "fname")) | |
(prn (File. (identity nil) "fname"))) |
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
(ns hoge.core | |
(:import Hoge)) | |
(def _nil_ nil) | |
(Hoge. _nil_) ; => called Hoge(String) | |
(Hoge. (identity nil)) ; => called Hoge(String) | |
(Hoge. (cast Integer nil)) ; => "called Hoge(String)" | |
(Hoge. nil) ; => Thrown class java.lang.IllegalArgumentException. More than one matching method found: Hoge |
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
(defun eshell-swank () | |
(interactive) | |
(require 'compile) | |
(compilation-start "JAVA_OPTS=\"-Dswank.encoding=utf-8-unix\" lein swank")) | |
(global-set-key (kbd "C-c s") 'eshell-swank) |
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
(defn carrier-by-request [{{user-agent "user-agent"} :headers :as req}] | |
(condp #(.startsWith %2 %1) user-agent | |
"DoCoMo" :docomo | |
"KDDI" :au | |
"SoftBank" :softbank)) |
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
(import 'jxl.Workbook | |
'java.io.File) | |
(defn copy [from to] | |
(let [read-book (Workbook/getWorkbook (File. from)) | |
write-book (Workbook/createWorkbook (File. to) read-book)] | |
(doto write-book | |
.write | |
.close))) |
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
(ns hoge | |
(require [net.cgrand.enlive-html :as en])) | |
(declare layout) | |
(def lookup {"layout" #'layout}) | |
(defn parent-template [nodes] | |
(when-let [id (-> nodes | |
(en/select [[:meta (en/attr= :name "parent")]]) |
OlderNewer