test
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
handbrake_path = "/Volumes/HandBrake-0.9.8-MacOSX.6_CLI_x86_64/HandBrakeCLI" | |
preset = "--preset=\"iPhone & iPod Touch\"" | |
native_language = "--native-language eng" | |
subtitle = "--subtitle 2 --subtitle-burn 2" | |
input_base_dir = "/Users/yasuhisa/Desktop" | |
output_base_dir = "/Users/yasuhisa/Desktop" | |
cdr_id = 1 | |
(1..4).each {|chapter| | |
opts = ["-i", "#{input_base_dir}/FRIENDS_1_#{cdr_id}.cdr", |
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
(defmacro memoize-fn [name args body] | |
`(let [mem# (atom {})] | |
(fn ~args | |
(if-let [e# (find @mem# ~args)] | |
(val e#) | |
(let [ret# ~body] | |
(swap! mem# assoc ~args ret#) | |
ret#))))) | |
(->> (range 35) |

- tnoda-clojure • Crunching Numbers with Clojure - 11 Tips to Boost Your Performance
- clojurewest2012-slides/Solano-Gómez-Crunching-Numbers-with-Clojure.pdf at master · strangeloop/clojurewest2012-slides · GitHub
個人的にはコレクションと配列との使用メモリ量比較が参考になりました.1M 個の long を格納するとして,vector だと 30MB, vector-of だと 9MB, 配列だと 8MB というのは覚えておいて損は無さそうです.案外 vector はメモリを食いません.
(defn current-total-memory-usage []
test
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
#_(defdeps | |
[[org.clojure/clojure "1.5.1"] | |
[info.yasuhisay/clj-utils "0.1.1"] | |
[org.clojure/tools.cli "0.2.1"]]) | |
(ns info.yasuhisay.dep-util | |
(:use [clojure.string :only (split)]) | |
(:use [clj-utils.random :only (shuffle-with-random)]) | |
(:require [clojure.tools.cli :as cli])) |
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
(import edu.stanford.nlp.trees.PennTreeReader) | |
(let [filename "/Users/yasuhisa/Desktop/PENN_TREEBANK3/PARSED/MRG/WSJ/00/WSJ_0001.MRG"] | |
(with-open [rdr (clojure.java.io/reader filename)] | |
(let [ptr (new PennTreeReader rdr) | |
trees (loop [result []] | |
(if-let [t (.readTree ptr)] | |
(recur (conj result t)) | |
result))] | |
(for [^LabeledScoredTreeNode t trees] |
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
;; Clojureでのhashcodeの例 | |
(hash "hoge") ; 3208229 | |
;; clojureのvectorはよい | |
(hash [1 2 3]) ; 30817 | |
;; javaの配列は毎回hashcodeが変わってしまうので注意 | |
(hash (int-array [1 2 3])) ; 1628598432 | |
(hash (int-array [1 2 3])) ; 1172445666 | |
;; feature hashingの例 |
git clone [email protected]:syou6162/hoge.git
git add ...
git ci "Save WIP"
git push origin HEAD:WIP-foo
git branch WIP-foo origin/WIP-foo # remoteにしかないからlocalにブランチを作る
git diff --no-prefix develop WIP-foo > p