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
| +justin@fuckmonkey:~/clojure/line-edit$ rlwrap java -jar ~/.m2/repository/org/clojure/clojure/1.8.0/clojure-1.8.0.jar | |
| Clojure 1.8.0 | |
| +user=> (defrecord A [x y]) | |
| user.A | |
| +user=> (.getBasis A) | |
| IllegalArgumentException No matching field found: getBasis for class java.lang.Class clojure.lang.Reflector.getInstanceField (Reflector.java:271) | |
| +user=> | |
| +justin@fuckmonkey:~/clojure/line-edit$ rlwrap java -jar ~/.m2/repository/org/clojure/clojure/1.7.0/clojure-1.7.0.jar | |
| Clojure 1.7.0 | |
| +user=> (defrecord A [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
| kingfisher.core=> (defmacro locals-map [] (into {} (for [[sym val] &env] [(keyword (name sym)) sym]))) | |
| #'kingfisher.core/locals-map | |
| kingfisher.core=> (let [a 0 b 1] (locals-map)) | |
| {:a 0, :b 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
| :justin@fuckmonkey:~$ cat example-of-memoize.clj | |
| (let [f (memoize (fn [x] [x (rand-int 1000)]))] | |
| (->> (range 10) | |
| (cycle) | |
| (take 1000) | |
| (map (fn [n] | |
| (future (Thread/sleep (rand-int 100)) | |
| (f n)))) | |
| (map deref) | |
| (group-by first) |
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
| user=> (crit/bench (condp = 1 1 nil)) | |
| WARNING: Final GC required 8.483608755785822 % of runtime | |
| Evaluation count : 6919395060 in 60 samples of 115323251 calls. | |
| Execution time mean : 6.292270 ns | |
| Execution time std-deviation : 0.118501 ns | |
| Execution time lower quantile : 6.111276 ns ( 2.5%) | |
| Execution time upper quantile : 6.572198 ns (97.5%) | |
| Overhead used : 2.391966 ns | |
| Found 2 outliers in 60 samples (3.3333 %) |
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
| justinsmith@X: ~$ java -jar ~/Downloads/clojure-1.0.0.jar | |
| Clojure 1.0.0- | |
| user=> () | |
| () |
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
| +user=> (crit/bench (-> (.stream (range 100)) (.map (reify java.util.function.Function (apply [this x] (inc x)))) (.collect (java.util.stream.Collectors/toList)))) | |
| Evaluation count : 4354320 in 60 samples of 72572 calls. | |
| Execution time mean : 13.864355 µs | |
| Execution time std-deviation : 226.969932 ns | |
| Execution time lower quantile : 13.507800 µs ( 2.5%) | |
| Execution time upper quantile : 14.308498 µs (97.5%) | |
| Overhead used : 1.804276 ns | |
| Found 1 outliers in 60 samples (1.6667 %) | |
| low-severe 1 (1.6667 %) |
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
| user=> (crit/bench (= :a :a)) | |
| WARNING: Final GC required 7.231393615188381 % of runtime | |
| WARNING: Final GC required 2.197827844386288 % of runtime | |
| Evaluation count : 16534111500 in 60 samples of 275568525 calls. | |
| Execution time mean : 1.394909 ns | |
| Execution time std-deviation : 0.030680 ns | |
| Execution time lower quantile : 1.350542 ns ( 2.5%) | |
| Execution time upper quantile : 1.444246 ns (97.5%) | |
| Overhead used : 2.241525 ns |
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
| kingfisher.core=> (require '[cemerick.pomegranate :as pom]) | |
| nil | |
| kingfisher.core=> (def repos {"clojars" "http://clojars.org/repo"}) | |
| #'kingfisher.core/repos | |
| kingfisher.core=> (pom/add-dependencies :coordinates '[[incanter "1.2.3"]] :repositories repos) | |
| {[incanter/jtransforms "0.9.4"] nil, [net.sf.opencsv/opencsv "2.0.1"] nil, [org.clojure/clojure "1.2.0"] nil, [org.clojure/clojure-contrib "1.2.0"] nil, [swingrepl "1.0.0-20100502.112537-4"] nil, [org.apache.poi/poi "3.6"] #{[commons-logging "1.1" :scope "runtime"] [log4j "1.2.13" :scope "runtime"]}, [incanter/optimization "0.9.4"] nil, [commons-logging "1.1" :scope "runtime"] #{[javax.servlet/servlet-api "2.3" :scope "runtime"] [avalon-framework "4.1.3" :scope "runtime"] [logkit "1.0.1" :scope "runtime"]}, [javax.servlet/servlet-api "2.3" :scope "runtime"] nil, [incanter/jcommon "1.0.16"] nil, [incanter/incanter-processing "1.2.3"] #{[incanter/processing-core "1.1"]}, [incanter/arpack-combo "0.9.4"] nil, [org.clojars.somnium/clojure-db-object "0.1.1-20091229.02 |
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
| +user=> (def x 1) | |
| #'user/x | |
| +user=> (def the-x #'x) | |
| #'user/the-x | |
| +user=> (ns-unmap 'user 'x) | |
| nil | |
| +user=> @the-x ; the var is captured, so we can still use it | |
| 1 | |
| +user=> (def x 2) | |
| #'user/x |
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
| user=> (def tg (.getThreadGroup (Thread/currentThread))) | |
| #'user/tg | |
| user=> (def t (.getParent tg)) | |
| #'user/t | |
| user=> (.getParent t) | |
| nil | |
| user=> ;; t is the top level thread group | |
| user=> (def threads (make-array Thread 4096)) | |
| #'user/threads |