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
(println | |
(map #(cond (zero? (mod % (* 3 5))) "FizzBuzz" | |
(zero? (mod % 3)) "Fizz" | |
(zero? (mod % 5)) "Buzz" | |
:else %) | |
(range 1 101))) |
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> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | |
<title>Rorschach Mask</title> | |
<script type="text/javascript" src="rorschach.js"></script> | |
</head> | |
<body> | |
<div align="center"><b>Rorschach Mask</b></div> |
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
;; fill-queue による非同期フックの実験 | |
;; 指定したファイルの最終更新日時が変わったらキューにそのファイル名をプッシュする | |
(ns watch-file-status | |
(:use [clojure.contrib.seq :only (fill-queue)]) | |
(:import [java.io File] | |
[java.util Date] | |
[java.text SimpleDateFormat])) |
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
;; c.c.combinatorics/subsetsを使って、べき集合(Powerset)を作る | |
(use '[clojure.contrib.combinatorics :only (subsets)]) | |
(subsets '()) | |
;(()) | |
(subsets '(1)) | |
;(() (1)) |
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
(ns intro-seq.core | |
(:use [clojure.contrib seq])) | |
;; Clojure初心者向けに覚えておくと便利なシーケンス操作関数の使用例を列挙する | |
;; 1.2でclojure.coreに移動し、廃止予定(DEPRECATED.)になってるのもある | |
;; 全部で18個(DEPRECATEDは8個) | |
;; 使用頻度高そう系(4個) |
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
;; 順列生成アルゴリズム | |
;; 『群論の味わい』p.69より | |
(ns steinhaus | |
(:use [clojure.contrib.seq :only (rec-cat)])) | |
(defn- insert-at [item n coll] | |
(concat (take n coll) (vector item) (drop n coll))) | |
(defn stein-rec [max] |
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
; int-calc.clj | |
(ns int-calc | |
(:use [clojure.contrib.command-line :only (with-command-line)])) | |
(with-command-line *command-line-args* | |
"clj int-calc.clj [-p|-mi|-ml] [-modulo n] nums.." | |
[[plus? p? "plus" true] | |
[minus? mi? "minus"] | |
[multiply? ml? "multiply"] | |
[modulo "mod 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
<html> | |
<title>10分で書くベイジアンフィルタ</title> | |
<script type="text/javascript"> | |
<!--// | |
function run() { | |
var hash = splitWord(form.classA.value); | |
var str = ""; | |
var sum = 0; | |
for (key in hash) { | |
str += key + ": " + hash[key] + ";¥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
(ns mathew12 | |
(:use [clojure.contrib.seq-utils :only (includes? indexed)])) | |
(def m12 [0 1 2 3 4 5 6 7 8 9 10 11]) | |
; 実験 | |
(comment | |
(map (fn [m i] (vector m i)) m12 (vec (range 0 11))) | |
(indexed m12) |