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
(defprotocol parser_p | |
(next-type [this token]) | |
(next-destination [this token last_op]) | |
(update-out [this dest token]) | |
(update-op [this dest token]) | |
(update [this]) | |
(sort-tokens [this])) | |
(defrecord Parser [tokens out_stack op_stack operators] | |
parser_p |
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
;; This one is inadequate, kept for history, use the one in the second file. | |
(defn sort-hierarchy [coll] | |
(if (every? #(= (count %) 1) coll) | |
[:files (map first coll)] | |
(map (fn [x] | |
[(ffirst x) (sort-hierarchy (map rest x))]) (partition-by first coll)))) | |
(defn hash-hierarchy [coll] | |
(if (= (first coll) :files) |
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
(deftype CFn [f form] | |
clojure.lang.IFn | |
(invoke [this x1] ((.f this) x1)) | |
(invoke [this x1 x2] ((.f this) x1 x2)) | |
(invoke [this x1 x2 x3] ((.f this) x1 x2 x3)) | |
(invoke [this x1 x2 x3 x4] ((.f this) x1 x2 x3 x4)) | |
(invoke [this x1 x2 x3 x4 x5] ((.f this) x1 x2 x3 x4 x5)) | |
(invoke [this x1 x2 x3 x4 x5 x6] ((.f this) x1 x2 x3 x4 x5 x6)) | |
(invoke [this x1 x2 x3 x4 x5 x6 x7] ((.f this) x1 x2 x3 x4 x5 x6 x7)) | |
; and so on.... |
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 subvec-at-val [val v] | |
(let [limit (count v)] | |
(loop [i 0] | |
(if (== i limit) | |
[] | |
(if (= x (v i)) | |
(subvec v i) | |
(recur (inc i))))))) |
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
public class Div { | |
public static double divide_double(double x, double y) { | |
return x / y; | |
} | |
} |
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 diff-by-1 [strings] | |
(let [f (partition-by first (sort-by first strings)) | |
s (partition-by second (sort-by second strings)) | |
l (partition-by last (sort-by last strings)) | |
fs (map #(partition-by second (sort-by second %)) f) | |
fl (map #(partition-by last (sort-by last %)) f) | |
sl (map #(partition-by last (sort-by last %)) s) | |
all (concat fs fl sl)] | |
(remove #(= (count %) 1) (apply concat all)))) |
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
#!/bin/sh | |
LEIN_VERSION="1.6.0-SNAPSHOT" | |
export LEIN_VERSION | |
case $LEIN_VERSION in | |
*SNAPSHOT) SNAPSHOT="YES" ;; | |
*) SNAPSHOT="NO" ;; | |
esac |
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 definvokerecord [invoke_fn & body] | |
`(defrecord | |
~@body | |
clojure.lang.IFn | |
~@(map (fn [n] | |
(let [args (for [i (range n)] (symbol (str "arg" i)))] | |
(if (empty? args) | |
`(~'invoke [this#] | |
(~invoke_fn this#)) | |
`(~'invoke [this# ~@args] |
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 extract-points [iterator] | |
(fn [] | |
(let [points (make-array Double/TYPE 6)] | |
(.currentSegment iterator points) | |
(.next iterator)))) | |
(defn extract-all-points [path_iterator] | |
(doall | |
(take-while (fn [_] (not (.isDone path_iterator))) | |
(repeatedly (extract-points path_iterator)))) |
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
Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError | |
at java.util.IdentityHashMap.get(IdentityHashMap.java:331) | |
at javax.swing.RepaintManager.extendDirtyRegion(RepaintManager.java:576) | |
at javax.swing.RepaintManager.addDirtyRegion0(RepaintManager.java:404) | |
at javax.swing.RepaintManager.addDirtyRegion(RepaintManager.java:468) | |
at javax.swing.JComponent.repaint(JComponent.java:4736) | |
at java.awt.Component.repaint(Component.java:3117) | |
at javax.swing.text.DefaultCaret.repaint(DefaultCaret.java:245) | |
at javax.swing.text.DefaultCaret.changeCaretPosition(DefaultCaret.java:1261) | |
at javax.swing.text.DefaultCaret.handleSetDot(DefaultCaret.java:1170) |
OlderNewer