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 cellular-automata-basic) | |
(defrecord cellular-automaton [^long nrows ^long ncols data-vector]) | |
(defn random-ca | |
[nrows ncols n] | |
(cellular-automaton. | |
nrows | |
ncols | |
(let [a (longs (make-array Long/TYPE (* nrows ncols)))] |
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 unchecked-remainder-test) | |
(defn create-test-ary [] | |
(let [a (longs (make-array Long/TYPE 100))] | |
(amap a i result | |
(aset result i (long (rand-int 100)))))) | |
(defn ^:static test-map [ary] | |
(amap ary idx result | |
(let [i (unchecked-remainder idx 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
(definterface Foo | |
(^long bar [^long a ^long b])) | |
(defrecord Baz [] | |
Foo | |
(bar [_ a b] (+ a b))) | |
(def x (Baz.)) | |
(bar x 1 2) ; Unable to resolve symbol bar in this context |
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
// ================== Highlights.html | |
<span class="TableContainer"> | |
<span class="HighlightsSummary"></span> | |
<input class="HighlightsInput"></input> | |
<span class="HighlightsColors"> | |
<% (6).times(function(i) { %> | |
<span class="GenericHighlightsColor HighlightsColor<%= i+1 %>"></span> | |
<% }); %> |
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 prim-this-bug) | |
(set! *warn-on-reflection* true) | |
(defprotocol VecMath | |
(add [this other]) | |
(sub [this other])) | |
(defrecord Point [^double x ^double y] | |
VecMath |
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
(let [{type :type many-side :table} (find-join-by (:model db) table :alias (first joins)) | |
attrs (column-seq db many-side req-attrs)] |
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
(defn test-array [n] | |
(let [a (longs (make-array Long/TYPE n))] | |
(amap a i result | |
(aset result i (rand-int 2))))) | |
(test-array 100) ; No matching method found: aset [Thrown class java.lang.IllegalArgumentException] | |
(defn test-array [n] | |
(let [a (longs (make-array Long/TYPE n))] | |
(amap a i result | |
(aset result i (long (rand-int 2)))))) |
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
(def bigv (into [] (range 1000000))) | |
; ~5s | |
(dotimes [_ 10] | |
(time | |
(dotimes [_ 10] | |
(doall (map inc bigv))))) | |
; ~1s | |
(dotimes [_ 10] (time (count (doall (map inc (range 1000000)))))) |
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 cellular-automata-basic) | |
(set! *warn-on-reflection* true) | |
(definterface AutomataOps | |
(^long getCell [^long i ^long j]) | |
(^long sumEightNeighbors [^long i ^long j]) | |
(^long urEightNeighMinmax [^long i ^long j]) | |
(^long rule [^long i ^long j])) |
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 time2 [expr times] | |
`(time (dotimes [_# ~times] ~@expr))) | |
; ------------------------------------- | |
(time2 (+ 1 2) 100) | |
; expands to -> | |
(let* |