Skip to content

Instantly share code, notes, and snippets.

View athos's full-sized avatar
🤷‍♂️
I know the value and cost of nothing

Shogo Ohta athos

🤷‍♂️
I know the value and cost of nothing
View GitHub Profile
(ns repeating-decimal)
(defn repeating-decimal [n]
(loop [rem 1 rems #{} divs [] i 0]
(let [div (int (/ (* rem 10) n))
rem (mod (* rem 10) n)]
(if (and (not= rem 0) (contains? rems rem))
[n divs]
(when (not= rem 0)
(recur rem (conj rems rem) (conj divs div) (inc i)))))))
@athos
athos / agenda.org
Last active August 29, 2015 14:18 — forked from tnoda/agenda.org

gen-class 勉強会 プログラム

No.タイトル担当レベル
1Java のクラスの作り方@tnoda\_未経験者
2Docstring 逐条講義@tnoda\_ビギナー
3gen-class の内部実装の話@athos0220上級者
4アノテーションの使い方@tnoda\_中級者
5gen-class クイズ@tnoda\_中級者
@athos
athos / tramp.clj
Last active December 16, 2015 07:08
(declare odd?)
(defn even? [x]
(if (== 0 x)
true
#(odd? (- x 1))))
(defn odd? [x]
(if (== 1 x)
true
(defmacro hash-map-by-names [names]
(zipmap (map keyword names) names))
(def x 100)
(def y 200)
(let [y 2
z 3]
(hash-map-by-names [x y])) ; {:y 2, :x 100}
@athos
athos / echo.html
Created February 18, 2011 14:39 — forked from mzp/echo.html
<html>
<head>
<style type="text/css">
.log {
color: red;
}
</style>
<script>
ws = new WebSocket("ws://localhost:8080");
ws.onopen = function (e) {
;; 第1回 Scheme コードバトン
;;
;; ■ これは何か?
;; Scheme のコードをバトンのように回していき面白い物ができあがるのを楽しむ遊びです。
;; 次回 Shibuya.lisp で成果を発表します。
;; Scheme 初心者のコードを書くきっかけに、中級者には他人のコードを読む機会になればと思います。
;;
;; ■ 2 つのルール
;;
;; (1)自分がこれだと思える変更をコードに加えて2日以内に次の人にまわしてください。