This file contains 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
1 Hehe! | |
2 Hehe! | |
3 Hehe! | |
4 Hehe! | |
5 Hehe! | |
6 Hehe! | |
7 Hehe! | |
8 Hehe! | |
9 Hehe! | |
10 Hehe! |
This file contains 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> (require '[zolo.utils.thread :as zthread]) | |
nil | |
user> (def x (atom 0)) | |
#'user/x | |
user> (defn print-x [] | |
(if (> (swap! x inc) 10) | |
(throw (RuntimeException. "OUCH!"))) | |
(println @x "Hehe!")) |
This file contains 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 zolo.utils.thread | |
(:use zolo.utils.clojure) | |
(:require [zolo.utils.logger :as logger]) | |
(:import [java.util.concurrent ThreadFactory ScheduledThreadPoolExecutor TimeUnit])) | |
(defn- random-thread-name [prefix] | |
(str prefix "-" (random-guid-str))) | |
(defn thread-factory [thread-name-prefix] |
This file contains 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 cms.data | |
(:require [cms.domain.author :as au] | |
[cms.domain.article :as ar])) | |
(defn setup [] | |
(au/create "Siva" "[email protected]") | |
(au/create "Amit" "[email protected]") | |
(let [siva (au/find-by-email "[email protected]")] | |
(au/add-article-with-tags siva "Datomic Workshop" "Datomic is cool" :category/tech ["database" "logic"]) |
This file contains 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 cms.datomic.schema | |
(:require [datomic.api :as db])) | |
(def author-schema | |
[;; name | |
{:db/id #db/id[:db.part/db] | |
:db/ident :author/name | |
:db/valueType :db.type/string | |
:db/cardinality :db.cardinality/one | |
:db/doc "A author's name" |
This file contains 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> (println (pp-str m "blah blah" m)) | |
{:a 1, | |
:c {:a 1, :c {:a 1, :b 2}, :b 2}, | |
:b [2 3], | |
:d [{:a 1, :c 3, :b 2} {:a [1 2 3], :b {:a 1, :b 2}}]} | |
"blah blah" | |
{:a 1, | |
:c {:a 1, :c {:a 1, :b 2}, :b 2}, | |
:b [2 3], | |
:d [{:a 1, :c 3, :b 2} {:a [1 2 3], :b {:a 1, :b 2}}]} |
This file contains 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 pp-str [& things] | |
(let [s (with-out-str (pprint things))] | |
(-> s | |
(.substring 0 (-> s .length dec dec)) | |
(.replace "(" " ") | |
(str "\n")))) |
This file contains 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> (println m "blah blah" m) | |
{:a 1, :c {:a 1, :c {:a 1, :b 2}, :b 2}, :b [2 3], :d [{:a 1, :c 3, :b 2} {:a [1 2 3], :b {:a 1, :b 2}}]} blah blah {:a 1, :c {:a 1, :c {:a 1, :b 2}, :b 2}, :b [2 3], :d [{:a 1, :c 3, :b 2} {:a [1 2 3], :b {:a 1, :b 2}}]} |
This file contains 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
{:a 1, | |
:c {:a 1, :c {:a 1, :b 2}, :b 2}, | |
:b [2 3], | |
:d [{:a 1, :c 3, :b 2} {:a [1 2 3], :b {:a 1, :b 2}}]} |
This file contains 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 handle-batch [batch] | |
(blah blah...)) | |
(->> coll | |
(partition-all n) | |
(pmapcat handle-batch)) |
NewerOlder