domain refactor

domain refactor

error: pathspec 'src/clj/swarmpit/docker/domain.clj' did not match any file(s) known to git

--- src/clj/swarmpit/docker/domain.clj
+++ src/clj/swarmpit/docker/domain.clj
@@ -0,0 +1,190 @@
+(ns swarmpit.docker.domain
+  (:require [clojure.string :as str]))
+
+;;; Service domain
+
+(defn ->service-mode
+  [service]
+  (if (= (:mode service) "global")
+    {:Global {}}
+    {:Replicated
+     {:Replicas (:replicas service)}}))
+
+(defn ->service-ports
+  [service]
+  (->> (:ports service)
+       (filter #(and (> (:hostPort %) 0)
+                     (> (:containerPort %) 0)))
+       (map (fn [p] {:Protocol      (:protocol p)
+                     :PublishedPort (:hostPort p)
+                     :TargetPort    (:containerPort p)}))
+       (into [])))
+
+(defn ->service-variables
+  [service]
+  (->> (:variables service)
+       (filter #(not (and (str/blank? (:name %))
+                          (str/blank? (:value %)))))
+       (map (fn [p] (str (:name p) "=" (:value p))))
+       (into [])))
+
+(defn ->service-volumes
+  [service]
+  (->> (:volumes service)
+       (map (fn [v] {:ReadOnly (:readOnly v)
+                     :Source   (:containerPath v)
+                     :Target   (:hostPath v)
+                     :Type     "volume"
+                     :VolumeOptions
+                               {:DriverConfig {}}}))
+       (into [])))
+
+(defn ->service
+  "Map swarmpit service domain to docker service domain"
+  [service]
+  {:Name (:serviceName service)
+   :TaskTemplate
+         {:ContainerSpec
+          {:Image  (:image service)
+           :Mounts (->service-volumes service)
+           :Env    (->service-variables service)}}
+   :Mode (->service-mode service)
+   :EndpointSpec
+         {:Ports (->service-ports service)}})
+
+(defn <-service-ports
+  [service]
+  (->> (get-in service [:Spec :EndpointSpec :Ports])
+       (map (fn [p] {:containerPort (:TargetPort p)
+                     :protocol      (:Protocol p)
+                     :hostPort      (:PublishedPort p)}))
+       (into [])))
+
+(defn <-service-volumes
+  [service]
+  (->> (get-in service [:Spec :TaskTemplate :ContainerSpec :Mounts])
+       (map (fn [v] {:containerPath (:Source v)
+                     :hostPath      (:Target v)
+                     :readOnly      (:ReadOnly v)}))
+       (into [])))
+
+(defn <-service-variables
+  [service]
+  (->> (get-in service [:Spec :TaskTemplate :ContainerSpec :Env])
+       (map (fn [p]
+              (let [variable (str/split p #"=")]
+                {:name  (first variable)
+                 :value (second variable)})))
+       (into [])))
+
+(defn <-service
+  "Map docker service domain to swarmpit service domain"
+  [service]
+  (let [image (get-in service [:Spec :TaskTemplate :ContainerSpec :Image])
+        image-info (str/split image #"@")
+        image-name (first image-info)
+        image-digest (second image-info)]
+    (array-map
+      :id (get service :ID)
+      :version (get-in service [:Version :Index])
+      :createdAt (get service :CreatedAt)
+      :updatedAt (get service :UpdatedAt)
+      :image image-name
+      :imageDigest image-digest
+      :serviceName (get-in service [:Spec :Name])
+      :mode (str/lower-case (name (first (keys (get-in service [:Spec :Mode])))))
+      :replicas (get-in service [:Spec :Mode :Replicated :Replicas])
+      :ports (<-service-ports service)
+      :volumes (<-service-volumes service)
+      :variables (<-service-variables service))))
+
+(defn <-services
+  [services]
+  (->> services
+       (map <-service)
+       (into [])))
+
+;;; Network domain
+
+(defn ->network
+  "Map swarmpit network domain to docker network domain"
+  [network]
+  {:Name     (:name network)
+   :Driver   (:driver network)
+   :Internal (:internal network)})
+
+(defn <-network-configs
+  [network]
+  (->> (get-in network [:IPAM :Config])
+       (map (fn [n] {:subnet  (:Subnet n)
+                     :range   (:IPRange n)
+                     :gateway (:Gateway n)}))
+       (into [])))
+
+(defn <-network
+  "Map docker network domain to swarmpit network domain"
+  [network]
+  (let [config (first (get-in network [:IPAM :Config]))]
+    (array-map
+      :id (get network :Id)
+      :name (get network :Name)
+      :created (get network :Created)
+      :driver (get network :Driver)
+      :internal (get network :Internal)
+      :subnet (:Subnet config)
+      :gateway (:Gateway config))))
+
+(defn <-networks
+  [networks]
+  (->> networks
+       (map <-network)
+       (into [])))
+
+;;; Node domain
+
+(defn <-node
+  "Map docker node domain to swarmpit node domain"
+  [node]
+  (array-map
+    :id (get node :ID)
+    :name (get-in node [:Description :Hostname])
+    :role (get-in node [:Spec :Role])
+    :availability (get-in node [:Spec :Availability])
+    :state (get-in node [:Status :State])
+    :leader (get-in node [:ManagerStatus :Leader])))
+
+(defn <-nodes
+  [nodes]
+  (->> nodes
+       (map <-node)
+       (into [])))
+
+;;; Task domain
+
+(defn <-task
+  "Map docker task domain to swarmpit task domain"
+  [task services nodes]
+  (let [image (get-in task [:Spec :ContainerSpec :Image])
+        image-info (str/split image #"@")
+        image-name (first image-info)
+        image-digest (second image-info)
+        service (get services (:ServiceID task))
+        node (get nodes (:NodeID task))]
+    (array-map
+      :id (get task :ID)
+      :name (str service "." (get task :Slot))
+      :version (get-in task [:Version :Index])
+      :createdAt (get task :CreatedAt)
+      :updatedAt (get task :UpdatedAt)
+      :image image-name
+      :imageDigest image-digest
+      :state (get-in task [:Status :State])
+      :desiredState (get task :DesiredState)
+      :service service
+      :node node)))
+
+(defn <-tasks
+  [tasks services nodes]
+  (->> tasks
+       (map #(<-task % services nodes))
+       (into [])))


add a sync-table function which knows how to sync details for a single Table.

--- src/metabase/driver/generic_sql/sync.clj
+++ src/metabase/driver/generic_sql/sync.clj
@@ -76,3 +76,11 @@
                     (sync-fields table)
                     (log/debug "Synced" table-name)))))
         dorun))))
+
+(defn sync-table
+  [{:keys [db] :as table}]
+  (with-jdbc-metadata @db
+    (fn [_]
+      (update-table-row-count table)
+      (sync-fields table)
+      (log/debug "Synced" (:name table)))))


Add com.nomistech.clojure-the-language.agent-test.

error: pathspec 'test/com/nomistech/clojure_the_language/agent_test.clj' did not match any file(s) known to git

--- test/com/nomistech/clojure_the_language/agent_test.clj
+++ test/com/nomistech/clojure_the_language/agent_test.clj
@@ -0,0 +1,26 @@
+(ns com.nomistech.clojure-the-language.agent-test
+  (:require [midje.sweet :refer :all]))
+
+(fact
+  (let [a (agent 0)]
+    @a)
+  => 0)
+
+(fact
+  (let [a (agent 0)]
+    (send a + 2)
+    (send a + 3)
+    (await a)
+    @a)
+  => 5)
+
+(defn non-negative [] (agent 0 :validator #(>= % 0)))
+
+(fact "On agents in a failed state, attempts to dispatch new actions fail."
+  (let [a (non-negative)]
+    (send a dec)
+    (Thread/sleep 100)
+    (try (send a dec)
+         (catch Exception _
+           :exception-thrown)))
+  => :exception-thrown)


Add clojure day 2

Add clojure day 2

error: pathspec 'clojure/day2/day2.clj' did not match any file(s) known to git

--- clojure/day2/day2.clj
+++ clojure/day2/day2.clj
@@ -0,0 +1,8 @@
+; Implement an unless with an else condition using macros.
+
+(defmacro unless [test body & [elsebody]]
+        (list 'if (list 'not test) body elsebody))
+
+; Write a type using defrecord that implements a protocol.
+(defprotocol Quack (quack [this] "Method to quack") )
+(defrecord Duck [name] Quack (quack [this] (str (:name this) " Quaaaaaack!")))


Test ensure owner handles nil owner (service account)

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/physion/ovation-webapi.git/'


provide required values in mutation

provide required values in mutation

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/starcity-properties/odin.git/'


refac(handler): remove unnused 'adhoc-wrapper' function (#124)

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/B2W-BIT/restQL-server.git/'


restore date conversion in mock info

restore date conversion in mock info

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/clojurecup/cc2014-frontend.git/'


Remove lein-immutant plugin too

Remove lein-immutant plugin too

Should have been in previous commit

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/partner-works.git/'


Version 62

Version 62

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/tobias/clojars-web.git/'


bump to 0.1.9-SNAPSHOT

bump to 0.1.9-SNAPSHOT

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/michaelsbradleyjr/shen.clj.git/'


Renaming the project to "io.screen6/cardinality".

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/screen6/cardinality.git/'


Version 1.15.6-SNAPSHOT

Version 1.15.6-SNAPSHOT


Version 1.14.0-SNAPSHOT

Version 1.14.0-SNAPSHOT


Update deps

Update deps

Including clojure to 1.8.0 and Datomic to 0.9.5394 (which necessitated
bringing in the dynamodb lib since Datomic no longer bundles it).

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-mail-works.git/'


Bump version to 0.3.6.

Bump version to 0.3.6.

Warning: these version numbers are pretty much arbitrary.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/croeder/clojure-koans-work.git/'


version bump

version bump

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/CraZySacX/swarmhandler.git/'


Version 116-SNAPSHOT

Version 116-SNAPSHOT


Release

Release

--- project.clj
+++ project.clj
@@ -1,6 +1,6 @@
 ;; Copyright © 2015, JUXT LTD.

-(defproject yada "1.1.24"
+(defproject yada "1.1.25"
   :description "A powerful Clojure web library, full HTTP, full async"
   :url "http://github.com/juxt/yada"
   :license {:name "The MIT License"


placeholder: records in Clojure

placeholder: records in Clojure

error: pathspec 'clojure/records.clj' did not match any file(s) known to git

--- clojure/records.clj
+++ clojure/records.clj
@@ -0,0 +1,17 @@
+;; Define a record structure
+(defrecord Person [first-name last-name age occupation])
+
+;; Positional constructor - generated
+(def kelly (->Person "Kelly" "Keen" 32 "Programmer"))
+
+(println kelly)
+
+;; Map constructor - generated
+(def kelly (map->Person
+             {:first-name "Kelly"
+              :last-name "Keen"
+              :age 32
+              :occupation "Pro Cyclist"}))
+
+(println kelly)
+(println (:occupation kelly))


Initial work on new kernel

Initial work on new kernel

fatal: unable to access 'https://github.com/ChallenHB/samsara.git/': The requested URL returned error: 403


first crack at a lein project.clj - for nrepl integration

error: pathspec 'dada2-web/project.clj' did not match any file(s) known to git

--- dada2-web/project.clj
+++ dada2-web/project.clj
@@ -0,0 +1,28 @@
+(defproject org.dada2/web "1.0.0-SNAPSHOT" ; version "1.0.0-SNAPSHOT"
+  :dependencies [
+                 [org.dada/dada2-core "1.0-SNAPSHOT"]
+                 [com.vaadin/vaadin-server "7.1.0.beta1"]
+                 [com.vaadin/vaadin-client-compiled "7.1.0.beta1"]
+                 [com.vaadin/vaadin-client "7.1.0.beta1"]
+                 [com.vaadin/vaadin-themes "7.1.0.beta1"]
+                 [com.vaadin/vaadin-push "7.1.0.beta1"]
+                 [javax.servlet/servlet-api "2.4" :scope "provided"]
+                 [org.clojure/clojure "1.5.1"]
+                 [org.clojure/tools.nrepl "0.2.3"]
+                 ]
+  :plugins [[lein-servlet "0.2.0"]]
+  :servlet {:deps [[lein-servlet/adapter-jetty7 "0.2.0"]] :config {:engine :jetty :host "0.0.0.0" :port 8080}}
+  :aot :all
+  :repl-options {:init-ns org.dada2.web.content :host "0.0.0.0" :port 7888}
+  :warn-on-reflection true
+  :global-vars {*warn-on-reflection* true *assert* false}
+  :source-paths ["src/main/clojure"]
+  :test-paths ["test" "src/test/clojure"]
+  :resource-paths ["src/main/resource"]
+  :compile-path "target/classes"
+  :target-path "target/"
+  :javac-options ["-target" "1.6" "-source" "1.6" "-Xlint:-options"]
+  :omit-source true
+  :jvm-opts ["-Xmx1g"]
+  :parent [org.dada/dada "1.0-SNAPSHOT" :relative-path "../pom.xml"]
+  )


add 003.clj

add 003.clj

error: pathspec '003.clj' did not match any file(s) known to git

--- 003.clj
+++ 003.clj
@@ -0,0 +1,12 @@
+(defn square [x] (* x x))
+(defn defactor [n]
+  (defn hlp [n divisor factor]
+    (if (> (square divisor) n)
+      (cons n factor)
+      (if (= 0 (mod n divisor))
+        (hlp (/ n divisor) divisor (cons divisor factor))
+        (hlp n (+ divisor 1) factor))))
+  (hlp n 2 '()))
+
+(println (defactor 13195))
+(println (defactor 600851475143))


Removed debug info

Removed debug info

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/acessocard/microscope.git/'


show correct time zone on webcam page

show correct time zone on webcam page

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/20centaurifux/my-website.git/'


datamunging (clojure)

datamunging (clojure)

error: pathspec 'src/main/clojure/datamunging/datamunging0.clj' did not match any file(s) known to git

--- src/main/clojure/datamunging/datamunging0.clj
+++ src/main/clojure/datamunging/datamunging0.clj
@@ -0,0 +1,3 @@
+(ns datamunging.datamunging0)
+
+(print (slurp "/Users/dima/IdeaProjects/katas/src/main/scala/ru/katas/n4/weather.dat"))


Add lazytest.contexts

Add lazytest.contexts

error: pathspec 'src/main/clojure/com/stuartsierra/lazytest/contexts.clj' did not match any file(s) known to git

--- src/main/clojure/com/stuartsierra/lazytest/contexts.clj
+++ src/main/clojure/com/stuartsierra/lazytest/contexts.clj
@@ -0,0 +1,51 @@
+(ns com.stuartsierra.lazytest.contexts
+  (:use [com.stuartsierra.lazytest.arguments
+         :only (get-arg get-options or-nil standard-metadata
+                        firsts seconds)]))
+
+(defrecord Context [parents before after])
+
+(defn context?
+  "True if x is a Context object."
+  [x]
+  (isa? (type x) Context))
+
+(defn new-context
+  "Creates a new Context object.  parents is a vector of parent
+  contexts.  before and after are functions."
+  ([parents before after]
+     (new-context parents before after nil))
+  ([parents before after metadata]
+     {:pre [(or-nil vector? parents)
+            (every? context? parents)
+            (or-nil fn? before)
+            (or-nil fn? after)
+            (or-nil map? metadata)]
+      :post [(context? %)]}
+     (Context. parents before after nil metadata)))
+
+(defmacro context [bindings & bodies]
+  {:pre [(vector? bindings)
+         (even? (count bindings))]}
+  (let [locals (firsts bindings)
+        contexts (seconds bindings)
+        [before-body divider after-body] (partition-by #(= :after %) bodies)
+        before-fn `(fn ~locals ~@before-body)
+        after-fn (when after-body
+                   (let [[state & after-body] after-body]
+                     (assert (symbol? state))
+                     `(fn ~(apply vector state locals) ~@after-body)))]
+    `(new-context ~contexts ~before-fn ~after-fn)))
+
+(defmacro defcontext
+  [name & decl]
+  (let [[docstring decl] (get-arg string? decl)
+        [options decl] (get-options decl)
+        bindings (:bindings options [])]
+    `(def ~name (with-meta (context ~bindings ~@decl)
+                  (standard-metadata &form docstring name)))))
+
+(let [c (context [] 1)]
+  (assert (fn? (:before c)))
+  (assert (= 1 ((:before c))))
+  (assert (nil? (:after c))))


braveclojure:: understanding macros, and clojures read-macroexpand-eval phases

error: pathspec 'src/clojure_learning/understanding-clojure-macros.clj' did not match any file(s) known to git

--- src/clojure_learning/understanding-clojure-macros.clj
+++ src/clojure_learning/understanding-clojure-macros.clj
@@ -0,0 +1,203 @@
+;; The key to Clojure enlightenment is that Clojure evaluates data structures.
+;; all the Clojure code you write that actually does anything consists of representations of lists!
+(def addition-list (list + 1 2)) ; --> returns a list of: (+ 1 2) -> passed to eval
+(eval addition-list) ; 3
+(eval 'addition-list) ; (PLUS 1 2)
+
+;; You enter reader forms, or textual representations of data structures.
+;; In the example below, you're entering a form which consists of a list data structure
+;; that contains three more forms: the str symbol and two strings.
+
+(str "To understand what recursion is," " you must first understand recursion")
+;; "To understand what recursion is, you must first understand recursion"
+
+;; After you hit enter, Clojure reads the forms and internally produces the corresponding data structures.
+;; It then evaluates the data structures. The textual representation of the result is then printed and you get:
+
+
+;; Clojure code consists of textual representations of data structures called reader forms.
+;; You'll notice that all your code that actually does stuff — function calls, if's, def's, etc — consists of list reader forms.
+;; The reader transforms these reader forms into the actual internal data structures.
+
+(read-string "(+ 1 2)")
+
+(#(+ 1 %) 3)
+; => 4
+
+;; Well, try this out:
+
+(read-string "#(+ 1 %)")
+; => (fn* [p1__423#] (+ 1 p1__423#))
+
+;; Whoa! What just happened?
+;; This is not the one-to-one mapping that we're used to.
+;; Reading #(+ 1 %) somehow resulted in a list consisting of the fn* symbol, a vector containing a symbol, and a list containing three elements.
+
+;; To answer my own question: the reader used a reader macro to transform #(+ 1 %).
+;; Reader macros are not to be confused with macros, which you'll read about later in this chapter.
+;; Rather, reader macros are sets of rules for transforming text into data structures.
+
+(read-string "#(+ 1 %)"); (fn* [p1__6236#] (+ 1 p1__6236#))
+
+;; Reader macros often allow us to represent data structures in more compact ways.
+;; The example below shows the quote reader macro, which expands to the quote special form:
+
+(read-string "'(a b c)")
+; => (quote (a b c))
+
+;; When the reader encounters the single quote, ', it expands it to a list whose first member is the symbol quote
+;; and whose second member is the data structure following the single quote.
+
+;; The CLOJURE READER transforms text-representation into DATA-STRUCTURES.
+
+;;;;;;;;;;;;
+;; EvALUATOR:
+;; Clojure Evaluator evaluates data-structures.
+;; Clojure: Strings, numbers, false, true, nil and keywords ALL evaluate to themselvs.
+(eval (read-string "\"t\"")) ; "t"
+(eval "t") ; "t"
+
+(eval (read-string "true")) ; true
+(eval (read-string "false")) ; false
+(eval true) ; true
+
+;; Whenever Clojure evaluates these data structures, the result is the data structure itself.
+
+;; Symbols in clojure are ALSO data-structures, else clojure wouldn't know how to evaluate them.
+(let [x 4]
+  (+ x 1)); 5
+
+;; clojure evaluator resolves the "x" to the bound value of 4.
+
+;; The "closest" binding takes precedence:
+(let [x 10]
+  (let [x 1]
+    (+ 1 x))) ; 2
+
+;; In general, Clojure resolves a symbol by:
+
+;;     Looking up whether the symbol names a special form. If it doesn't…
+;;     Trying to find a local binding. If it doesn't…
+;;     Trying to find a mapping introduced by def. If it doesn't…
+;;     Throwing an exception
+
+;; Lists:: if the data-structure is an empty list -> evaluator evals to an empty list : else it evaluates to a CALL to
+;; the first element in the list
+(eval (read-string "()")) ; ()
+(eval (read-string "(+)")) ; 0
+(eval (read-string "(+ 1)")) ; 1
+(eval (read-string "(1)")) ; --> throws exception: Long -> cannot be cast to IFunc
+
+;; the last expression is like doing:
+(1 2 3) -> throws exception -> long cannot be cast to ifunc
+(eval ()) ; ()
+
+(eval (read-string "(+ 1 2)")) ; 3
+(eval (+ 1 2))
+;; the reader reads the reader-form and PRODUCES a clojure-data-structure ->
+;; which is then passsed to Evaluator which evaluates the expression
+;; if the first element in the clojure data-structure is a function -> resolved by evaluator
+;; then it is called with the arguments following the first-element.
+;; When you code Clojure -> you code in fact pretty much data-structures
+;; when an element is passed to a function, the Evaluator FIRST evaluates EACH element in the list
+;; eagerly -> and then it passes the evaluated-result as the function argument.
+
+;; Each element/arg of the function is eagerly evaluated BEFORE being passed to the function
+;; this is NOT the case with clojure-special forms! which do NOT evaluate ALL arguments being special...
+(eval (read-string "(if true (println \"evaluating first if true\") (println \"NOT evaluated for clojure-IF-special form\"))"))
+;; here ONLY the first form is evaluated -> the second NOT being evaluated
+;; this is NOT the same behavior for FUNCTIONS, which evaluate all arguments!!!
+
+
+(eval (read-string "(if (< 1 2) (println \"evaluating first if true\") (println \"NOT evaluated for clojure-IF-special form\"))"))
+
+;; the quote reader-macro always evaluates the ' to the quote expanded macro as the data-structure.
+'(a b c); (a b c)
+(read-string "'(a b c)") ; (quote (a b c))
+
+;; what happens is:
+;; in general, Clojure would try to resolve the [a] symbol and then call it because it's the first element of a list.
+;; The [quote] special form TELLS the EVALUATOR:
+;;  --> "instead of evaluating my next data structure like normal, just return the data structure itself."
+
+
+;; AND MACROs!!!!
+;; Clojure programs are comprised of data structures...
+;; THE SAME data structures that Clojure is capable of manipulating...
+;; wouldn't it be AWESOME if you could USE Clojure to MANIPULATE the data structures that comprise a Clojure program?
+;; Yes, yes it would! And guess what: you can do this with macros! Did your head just explode? Mine did!
+
+;; Note the following example is NOT a macro, however this is the behavior that macros implement
+;; they allow you do manipulate clojure data-structures, write however you want the textual representation,
+;; and then using the macro power they will re-structure the data-structures BEFORE being evaluated!
+
+;; take this infix operation
+(read-string "(1 + 2)") ; (1 + 2)
+(let [infix (read-string "(1 + 2)")]
+  (list (second infix) (first infix) (last infix))) ; (+ 1 2)
+
+;; now this: (+ 1 2) can be easily evaluated by the Evaluator
+
+;; Macros allow you to manipulate lists before Clojure evaluates them, except more conveniently.
+;; They work very similarly to functions.
+;; They take arguments and return a value, just like a function would.
+;; Macro bodies behave exactly like function bodies.
+
+;; The difference is all in the way functions and macros are evaluated.
+
+;;
+(defmacro ignore-last
+  [form-func]
+  (butlast form-func))
+
+(ignore-last (+ 1 2 (println "this will not be printed!"))) ; 3
+;; clearly this isnt a function call, since the function in any scenario could NOT manipulate
+;; the function arguments.
+;; First, when you call a function, each of its operands is evaluated before
+;; being passed to the function as an argument.
+;; By contrast, when you call a macro, the operands are NOT EVALUATED.
+;; In particular, symbols are not resolved — they are passed as symbols.
+
+;; take this example:
+(ignore-last (+ 1 2 10)) ; 3
+;; here the macro received the LIST un-evaluated, hence NOT the value 13 but the (+ 1 2 10)
+
+;; one more important thing about macros: THE RETURNED EXPRESSION(may be a data-structure) of a FUNCTION is NOT Evaluated!!!
+;; however the returned expression from a macro IS EvALUATED!!!
+;; in order to inspect the data-structure the macro built, before passing it to the Evaluator, the
+;; function [macroexpand] helps here. however the form must be quoted!
+(macroexpand '(ignore-last (+ 1 2 10))) ; (+ 1 2)
+
+;; the best way to understand where the macros come in picture, is to visualize an intermediary step between
+;; the Reader and the Evaluator. This step can be called the: macroexpansion phase.
+(when :in-doubt "some") ; "some"
+(macroexpand '(when :in-doubt "some")) ; (if :in-doubt (do "some"))
+
+;; taken a textual-representation:
+;; (when :in-doubt "some")
+
+;; -> goes to the Reader, which parses the textual-representation, and produces a clojure data-structure
+;; (when :in-doubt "some")
+
+;; -> the returned Reader form data-structure, is passed over to the MacroExpander, which
+;; produces a new data-structure, that clojure's Evaluator can evaluate
+;; (if :in-doubt (do "some"))
+
+;; -> the returned macro-expanded data-structure is passed to the Evaluator safely to be evaluated.
+;; producing a final value.
+
+;; You can use Clojure to extend itself so that you write your program however you please. Macros thus enable syntax abstraction.
+
+;; Taken the THRED-FIRST [->] macro:
+;; This is a syntactical abstraction because it lets you write code in a syntax that's different
+;; from Clojure's built-in syntax, but which is preferable for human consumption.
+
+(require 'clojure.java.io)
+(defn read-resource
+  [path]
+  (-> path
+      clojure.java.io/resource
+      slurp
+      read-string))
+
+(doc slurp) ; opens a reader on the file-in-stream and read all the contents into a string


fix formatting

fix formatting

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-notification-works.git/'


Clean up

Clean up

fatal: unable to access 'https://github.com/mtravers/incidents.git/': The requested URL returned error: 403


Add project description and project URL.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/julianespinel/directory.git/'


not really using a main

not really using a main


bump version to 3.5.4

bump version to 3.5.4

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/B2W-Digital/pdg-core.git/'


placeholder: iteration in Clojure

placeholder: iteration in Clojure

error: pathspec 'clojure/iteration.clj' did not match any file(s) known to git

--- clojure/iteration.clj
+++ clojure/iteration.clj
@@ -0,0 +1,26 @@
+(dotimes [i 3]
+  (prn i))
+
+(println)
+(doseq [n (range 3)]
+  (prn n))
+(println)
+(doseq [n (range 3 6)]
+  (prn n))
+
+(println)
+(doseq [letter [:a :b :c]
+        number (range 3)]
+  (prn [letter number]))
+(println)
+(doseq [letter [:a :b :c]
+        number (range 3 6)]
+  (prn [letter number]))
+(println)
+(doseq [letter [:a :b :c]
+        number (range 5)]
+  (prn [letter number]))
+
+(println (for [letter [:a :b]
+      number (range 3)]
+  [letter number]))


add file listing

add file listing

fatal: unable to access 'https://github.com/jeelabs/jet.git/': The requested URL returned error: 403


Test cleanuo

Test cleanuo

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/shaunstanislaus/cljs2go.git/'


Changed samsara/ring-buffer to use immutable fields.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/ChallenHB/samsara.git/'


Start playing with numbers.

Start playing with numbers.

error: pathspec 'src/cljs/primes/numbers.cljs' did not match any file(s) known to git

--- src/cljs/primes/numbers.cljs
+++ src/cljs/primes/numbers.cljs
@@ -0,0 +1,93 @@
+;; Copyright (c) 2014 David Goldfarb. All rights reserved.
+;;; Contact info: deg@degel.com
+;;;
+;;; The use and distribution terms for this software are covered by the Eclipse
+;;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can
+;;; be found in the file epl-v10.html at the root of this distribution.
+;;; By using this software in any fashion, you are agreeing to be bound by the
+;;; terms of this license.
+;;;
+;;; You must not remove this notice, or any other, from this software.
+
+
+(ns degel.primes.numbers
+  ;; [TODO] Until reader version collision fixed.
+  #_
+  (:require [degel.cljutil.utils :as utils]))
+
+
+;; Taken from http://clj-me.cgrand.net/index.php?s=Primes. There, called lazy-primes3
+(defn primes []
+  (letfn [(enqueue [sieve n step]
+            (let [m (+ n step)]
+              (if (sieve m)
+                (recur sieve m step)
+                (assoc sieve m step))))
+          (next-sieve [sieve candidate]
+            (if-let [step (sieve candidate)]
+              (-> sieve
+                  (dissoc candidate)
+                  (enqueue candidate step))
+              (enqueue sieve candidate (+ candidate candidate))))
+          (next-primes [sieve candidate]
+            (if (sieve candidate)
+              (recur (next-sieve sieve candidate) (+ candidate 2))
+              (cons candidate
+                    (lazy-seq (next-primes (next-sieve sieve candidate)
+                                           (+ candidate 2))))))]
+    (cons 2 (lazy-seq (next-primes {} 3)))))
+
+
+;; Based on code from
+;; http://angeleah.com/blog/2012/11/07/finding-prime-factors-using-clojure.html
+(defn factors
+  ([n] (factors n 2))
+  ([n candidate]
+     (cond (< n candidate)           []
+           (zero? (rem n candidate)) (cons candidate (factors (/ n candidate) candidate))
+           :else                     (factors n (+ 1 candidate)))))
+
+
+
+;;;; ================================================================
+
+;;; [TODO] This is copied from degel-utils until I get the reader
+;;; dependency fixed.  Update changes from here back to utils too.
+
+(defn group-results
+  "Group a set of results by clustering and counting adjacent results with matching key.
+  That is (group-results identity [:a :a :a :b :b :a :a :a :b :b :b :b]) =>
+          ([:a 3] [:b 2] [:a 3] [:b 4])"
+  [keyfn results]
+  (map (juxt first count)
+       (partition-by identity
+                     (map keyfn results))))
+
+
+(defn group-values-by-keys
+  "Organize a sequence of items, each of which contains a key and a value.
+   All the values with a common key are grouped together into a sequence that is
+   the value of that key in the returned map.
+
+   Perhaps best explained by an example:
+
+   ex: `(group-values-by-keys [[:o 1] [:e 2] [:o 3] [:e 4] [:o 5] [:e 6]] first second)`
+
+   -> ` {:e (2 4 6), :o (1 3 5)}`"
+  [l f-key f-val]
+  (into {} (map (juxt (comp f-key first) #(map f-val %))
+                (partition-by f-key (sort-by f-key l)))))
+
+;;;; ================================================================
+
+
+
+(defn signature [n]
+  (let [by-prime (group-results identity (factors n))]
+    (sort > (map second by-prime))))
+
+(defn signatures [thru-n]
+  (map (juxt signature identity) (range 2 thru-n)))
+
+(defn group-signatures [thru-n]
+  (group-values-by-keys (signatures thru-n) first second))


cleanup

cleanup

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/wilkerlucio/youtube-looper.git/'


more notes

more notes

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/michaelsbradleyjr/transwarp.git/'


organize meta preds into their own section


Fix for loading local.clj

Fix for loading local.clj

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/dominikzarzecki/meteor-impacts-timelapse.git/'


reorg

reorg


expand comments

expand comments


Euler 10 as example

Euler 10 as example

error: pathspec 'examples/euler10.clj' did not match any file(s) known to git

--- examples/euler10.clj
+++ examples/euler10.clj
@@ -0,0 +1,19 @@
+#!/usr/bin/env inlein
+
+;; Solution to problem 10 in Project Euler. If you're unfamiliar with primes and
+;; the theory around it, I heavily recommend learning about how it works. See
+;; for example https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes for a good
+;; start.
+
+'{:dependencies [[org.clojure/clojure "1.8.0"]
+                 [com.hypirion/primes "0.2.1"]]}
+
+(require '[com.hypirion.primes :as p])
+
+(when-not (first *command-line-args*)
+  (println "Usage:" (System/getProperty "$0") "n")
+  (println "    computes the sum of the primes below n")
+  (System/exit 1))
+
+(let [n (Long/parseLong (first *command-line-args*))]
+  (println (reduce + (p/take-below n))))


Split run from -main

Split run from -main

This allows -main to call System/exit but run to be used from the REPL where you don't want that.


starting macro

starting macro

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/physion/ovation-webapi.git/'


Record notes on route clustering stuff.

Record notes on route clustering stuff.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/cstorey/nrod.git/'


compile and uberjar work, but not test

compile and uberjar work, but not test

error: pathspec 'dada2-core/project.clj' did not match any file(s) known to git

--- dada2-core/project.clj
+++ dada2-core/project.clj
@@ -0,0 +1,17 @@
+(defproject dada2-core "1.0.0-SNAPSHOT"
+  :description "dada :: dada2-core"
+  :dependencies [
+                 [org.clojure/clojure "1.5.1"]
+                 [org.clojure/math.numeric-tower "0.0.2"]
+                 [org.clojure/tools.logging "0.2.4"]
+                 ]
+  :aot :all
+  :source-path "src/main/clojure"
+  :test-path "src/test/clojure"
+  :compile-path "target/classes"
+  :target-path "target/"
+  :warn-on-reflection true
+  :global-vars {*warn-on-reflection* true *assert* false}
+  :hooks [leiningen.util.injected]
+)
+


simplify3d.clj: new file

simplify3d.clj: new file

error: pathspec 'clojure/org/gavrog/clojure/simplify3d.clj' did not match any file(s) known to git

--- clojure/org/gavrog/clojure/simplify3d.clj
+++ clojure/org/gavrog/clojure/simplify3d.clj
@@ -0,0 +1,22 @@
+(ns org.gavrog.clojure.simplify3d
+  (:use (org.gavrog.clojure
+          delaney
+          fundamental)))
+
+(defn merge-volumes [ds]
+  (let [idx (last (indices ds))]
+    (collapse ds idx (for [[D i] (inner-edges ds) :when (= i idx)
+                           E [D (s ds i D)]]
+                       E))))
+
+(defn merge-facets [ds]
+  (let [[i j] (drop (dec (dim ds)) (indices ds))]
+    (collapse ds i (for [D (orbit-reps ds [i j]) :when (= 2 (r ds i j D))
+                         E (orbit-elements ds [i j] D)]
+                     E))))
+
+(defn contract-edges [ds]
+  (-> ds dual merge-volumes dual))
+
+(defn squish-digons [ds]
+  (-> ds dual merge-facets dual))


handle CLI processing

handle CLI processing

error: pathspec 'src/aspire/cli.clj' did not match any file(s) known to git

--- src/aspire/cli.clj
+++ src/aspire/cli.clj
@@ -0,0 +1,27 @@
+(ns aspire.cli
+  (:require [clojure.tools.cli :as cli]
+            [aspire.util :as a-util]
+            [aspire.conf :as a-conf]))
+
+(def cli-options
+  (concat
+   (a-conf/conf-opts a-conf/configs)
+   [["-h" "--help" "Print this help message" :flag true]
+    ["-i" "--init-sql"
+     "Initialize the SQL DB, and then exit"
+     :flag true]
+    ["-z" "--zero-out"
+     "Print out SQL to drop the Aspire tables from the DB, and then exit"
+     :flag true]
+    ["-v" "--verbose" "Print info to stdout while running" :flag true]]))
+
+(defn get-opts
+  "Get and process all the CLI arguments, handle --help and --verbose. Return ONLY the options."
+  [args]
+  (let [[opts args usage] (apply cli/cli args cli-options)]
+    (when (:help opts)
+      (println usage)
+      (System/exit 0))
+    (when (:verbose opts)
+      (alter-var-root #'a-util/*isverbose* (constantly true)))
+    opts))


Create org.clojars.* group upon user creation.

fatal: unable to access 'https://github.com/clojars/clojars-web.git/': The requested URL returned error: 403


A few tweaks from Ben's suggestions

A few tweaks from Ben's suggestions

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-notification-works.git/'


Removed the copyright notice.

Removed the copyright notice.

--- src/clj/backtype/storm/daemon/supervisor.clj
+++ src/clj/backtype/storm/daemon/supervisor.clj
@@ -1,7 +1,3 @@
-;; Copyright (c) 2013 Yahoo! Inc. All Rights Reserved.
-;; Copyrights licensed under the Eclipse Public License.
-;; See the accompanying LICENSE.html file for terms.
-
 (ns backtype.storm.daemon.supervisor
   (:import [backtype.storm.scheduler ISupervisor])
   (:use [backtype.storm bootstrap])


levenstein-distance:: implemented the padding smarter function

error: pathspec 'src/clojure_learning/levenstein_distance.clj' did not match any file(s) known to git

--- src/clojure_learning/levenstein_distance.clj
+++ src/clojure_learning/levenstein_distance.clj
@@ -0,0 +1,207 @@
+(ns clojure-learning.levenstein-distance)
+(require '[clojure.set :as s])
+
+(defn str-remove-first-occurence [target-str subject]
+  (let [string->coll #(map str %)
+        contained? #(some (partial = %1) (string->coll %2))
+        remove-from #(reduce
+                      (fn [changes-map x]
+                        (if (and (= %2 x)
+                                 (not (:already-seen changes-map)))
+                          (assoc changes-map :already-seen true)
+                          (assoc changes-map :changes
+                              (conj (:changes changes-map) x))))
+                      {:already-seen false :changes []}
+                      %1)]
+    (if (contained? subject target-str)
+      [subject (apply str
+                  (:changes (remove-from (string->coll target-str) subject)))]
+      [nil target-str])))
+
+(str-remove-first-occurence "claudiu" "c") ;; ["c" "laudiu"]
+(str-remove-first-occurence "bmw" "i") ;; [nil "bmw"]
+(str-remove-first-occurence "xyyyx" "x") ;; ["x" "yyyx"]
+(str-remove-first-occurence "yyyx" "y") ;; ["x" "yyyx"]
+;; that is to remove only the first-occurence, not all!
+
+(defn remove-first-occurence [target-tups subject-tup]
+  (letfn [(contained? [target-tups [subj-idx subj]]
+           ((comp not nil?)
+            (some
+              (fn [[idx x]] (and (= subj x) (= subj-idx idx)))
+              target-tups)))
+
+          (remove-from [target-tups [subj-idx subj]]
+            (reduce
+              (fn [changes-map [target-idx target :as target-tup]]
+                  (if (and (= subj target)
+                           (= subj-idx target-idx)
+                           (not (:already-seen changes-map)))
+                    (assoc changes-map :already-seen true)
+                    (assoc changes-map :but-removed
+                      (conj (:but-removed changes-map) target-tup))))
+             {:already-seen false :but-removed []}
+             target-tups))]
+    (if (contained? target-tups subject-tup)
+      [subject-tup (:but-removed (remove-from target-tups subject-tup))]
+      [nil target-tups])))
+
+(remove-first-occurence [[0 "c"] [1 "l"] [2 "a"]]  [0 "l"])
+; [nil, [[0 "c"] [1 "l"] [2 "a"]]]
+
+(remove-first-occurence [[0 "c"] [1 "l"] [2 "a"]]  [1 "l"])
+; [[1 "l"], [[0 "c"] [2 "a"]]]
+
+
+(defn count-diffs [this-word that-word]
+  (letfn [(str->indexed-tuple [this]
+           (map-indexed (fn [idx x] [idx (str x)]) this))
+
+          (compute-insertions [this-word that-word]
+                  (if (>= (count this-word) (count that-word)) 0
+                    (- (count that-word) (count this-word))))
+
+          (compute-diffs
+            [[[idx c :as this-char-tup] & tail-words] that-tuples changes]
+            "destructuring coll of froms, and also each-tuple[idx c]"
+            (if (nil? this-char-tup) changes
+              (let [[removed-subj remained-words-tups] (remove-first-occurence
+                                                          that-tuples
+                                                          this-char-tup)]
+                (if (nil? removed-subj)
+                  (recur tail-words remained-words-tups (inc changes))
+                  (recur tail-words remained-words-tups changes)))))]
+
+    ; (+ (compute-insertions this-word that-word)
+      ;  (count-diffs- this-word that-word 0))
+   {:insertions (compute-insertions this-word that-word)
+    :diffs (compute-diffs
+                (str->indexed-tuple this-word)
+                (str->indexed-tuple that-word)
+            0)}))
+
+
+(map-indexed (fn [i x] [i (str x)]) "claudiu")
+
+(count-diffs "closure" "clojure") ;; ["j"] => 1 OK
+(count-diffs "xyx" "xyyyx")      ;; 2 NOK-3
+(count-diffs "kitten" "sitting") ;; 3 OK
+(count-diffs "" "123456")        ;; 6 OK
+(count-diffs "Clojure" "Clojure") ;; 0 OK
+(count-diffs [1 2 3 4] [0 2 3 4 5]) ;; 2 OK
+(count-diffs "ttttattttctg"
+             "tcaaccctaccat") ;; 10 OK
+(count-diffs "gaattctaatctc"
+             "caaacaaaaaattt") ;; 9 OK
+(count-diffs "abcd" "ad")   ;; 2 NOK-3
+
+(count-diffs "cclaudiu" "ccaudiu") ;; 1 insertion
+
+;;;;;;;;;;;;
+;; new version following the wiki-Levenstein-distance
+;; https://en.wikipedia.org/wiki/Levenshtein_distance
+;;;;;;;;;;;;
+(def sit (map str "sitting"))
+(def kit (map str "kitten"))
+(defn lev [froms tos]
+  ())
+
+(defn structure-asc [this that]
+  (if (> (count this) (count that)) [that this] [this that]))
+
+(defn pad-minimized->to [this that]
+  (letfn [(str->coll [some] (vec (map str some)))
+          (structure-asc [this that]
+                  (if (> (count this) (count that)) [that this] [this that]))
+          (diff-sizes? [this that]
+            (> 0 (apply - (map count (structure-asc this that)))))
+          (matching-heads? [[head-x & _] [head-y & _]] (= head-x head-y))
+          (matching-tails? [[head-x & tail-x] [head-y & tail-y]]
+            (let [[last-x & _](reverse tail-x)
+                  [last-y & _] (reverse tail-y)]
+                 (= last-x last-y)))
+          (identify-necessary-padding [this that]
+            (apply - (map count (reverse (structure-asc this that)))))
+          (pad-> [this that position]
+            (let [[smaller bigger] (structure-asc this that)
+                  paddings (repeat (identify-necessary-padding this that) :missing)]
+             (if (:to-head position)
+                (conj []
+                  (vec (concat paddings smaller))
+                  bigger)
+                (conj []
+                  (vec (concat smaller paddings))
+                  bigger))))]
+    (let [this-coll (str->coll this)
+          that-coll (str->coll that)]
+         (if (and (matching-heads? this-coll that-coll)
+                  (matching-tails? this-coll that-coll)
+                  (diff-sizes? this-coll that-coll))
+             (concat [(first this-coll)]
+                     (first (pad-minimized->to (vec (butlast (rest this-coll)))
+                                               (vec (butlast (rest that-coll)))))
+                     [(last this-coll)])
+          (if (and (matching-heads? this-coll that-coll)
+                   (diff-sizes? this-coll that-coll))
+              (pad-> this-coll that-coll {:to-head false})
+              (if (and (matching-tails? this-coll that-coll)
+                       (diff-sizes? this-coll that-coll))
+                  (pad-> this-coll that-coll {:to-head true})
+                  (if (diff-sizes? this-coll that-coll)
+                    (pad-> this-coll that-coll {:to-head false})
+                    [this-coll that-coll])))))))
+
+(pad-minimized->to (map str "cosar") (map str "claudiu"))
+(pad-minimized->to "bmw" "claudiu")
+(pad-minimized->to "acel" "lacel")
+;; [[:missing "a" "c" "e" "l"]  ["l" "a" "c" "e" "l"]]
+
+(vec (map str (vec (butlast (rest ["x" "y" "x"])))))
+(vec (butlast (rest ["x" "y" "y" "y" "x"])))
+(pad-minimized->to "kitten" "sitting")
+;; [["k" "i" "t" "t" "e" "n" :missing] ["s" "i" "t" "t" "i" "n" "g"]]
+
+(pad-minimized->to "xyx" "xyyyx")
+(pad-minimized->to "y" "yyy")
+
+(def with-pads (pad-minimized->to "kitten" "sitting"))
+(eval with-pads)
+
+(defn levenstein-distance [from to]
+  ; (filter
+        ; (fn [[each-from each-to]]
+        ;   (not= each-from each-to))
+        (partition 2 (apply interleave
+                        (pad-minimized->to from to))))
+
+["x" ["y" [[:missing] ["y"]] "y"] "x"]
+
+
+(defn structure-asc [this that]
+        (if (> (count this) (count that)) [that this] [this that]))
+(defn diff-sizes? [this that]
+  (> 0 (apply - (map count (structure-asc this that)))))
+(defn matching-heads? [[head-x & _] [head-y & _]] (= head-x head-y))
+(defn identify-necessary-padding [this that]
+  (apply - (map count (reverse (structure-asc this that)))))
+(defn pad-> [this that position]
+  (let [[smaller bigger] (structure-asc this that)
+        paddings (repeat (identify-necessary-padding this that) :missing)]
+   (if (:to-head position)
+      (conj []
+        (vec (concat paddings smaller))
+        bigger)
+      (conj []
+        (vec (concat smaller paddings))
+        bigger))))
+
+(pad-> ["y"] ["y" "y" "y"] {:to-head false})
+(last ["y"])
+(reverse nil)
+
+(defn matching-tails? [[head-x & tail-x] [head-y & tail-y]]
+  (let [[last-x & _](reverse tail-x)
+        [last-y & _] (reverse tail-y)]
+       (= last-x last-y)))
+(matching-tails? "y" "yyy")
+(matching-heads? "y" "yyy")


feat(headers): set headers blacklist through env or config file (#166)

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/B2W-BIT/restQL-server.git/'


Add a temp migration script to create a bookmark for each uncompleted follow-up with some options.

error: pathspec 'src/oc/storage/util/migrate_bookmarks.clj' did not match any file(s) known to git

--- src/oc/storage/util/migrate_bookmarks.clj
+++ src/oc/storage/util/migrate_bookmarks.clj
@@ -0,0 +1,108 @@
+(ns oc.storage.util.migrate-bookmarks
+  "Get all the existing uncompleted follow-ups and create a bookmark for every one of them.
+   To perform a dry run and simulate the update run:
+
+  lein run -m oc.storage.util.migrate-bookmark
+
+  To actually update the entries:
+
+  lein run -m oc.storage.util.migrate-bookmark -f
+
+  Use -s/--self-only to create bookmarks only for self created follow-ups."
+  (:require [clojure.string :as s]
+            [rethinkdb.query :as r]
+            [clojure.walk :refer (keywordize-keys)]
+            [clojure.tools.cli :refer (parse-opts)]
+            [defun.core :refer (defun-)]
+            [oc.lib.db.migrations :as m]
+            [clj-http.client :as http]
+            [cheshire.core :as json]
+            [clj-time.core :as t]
+            [clj-time.format :as f]
+            [oc.lib.db.pool :as db]
+            [oc.lib.db.common :as db-common]
+            [oc.storage.resources.common :as common]
+            [oc.storage.resources.entry :as entry]
+            [oc.storage.resources.org :as org]
+            [oc.storage.config :as c])
+  (:gen-class))
+
+(def temp-index-name "org-uuid-status-follow-ups-completed?-multi")
+
+(defn- create-temp-index [conn]
+  (println (m/create-compound-index conn entry/table-name temp-index-name
+    (r/fn [row] (r/map (r/get-field row "follow-ups")
+                   (r/fn [follow-up-row]
+                     [(r/get-field row "org-uuid")
+                      (r/get-field row "status")
+                      (r/get-field follow-up-row "completed?")])))
+    {:multi true})))
+
+(defn- delete-temp-index [conn]
+  (println (m/remove-index conn entry/table-name temp-index-name)))
+
+(defn- entries-for-org [conn org-uuid]
+  (db-common/read-resources conn entry/table-name temp-index-name [[org-uuid :published false]] [:uuid :follow-ups :bookmarks]))
+
+(defn index-of
+  "Given a collection and a function return the index that make the function truely."
+  [s f]
+  (loop [idx 0 items s]
+    (cond
+      (empty? items) nil
+      (f (first items)) idx
+      :else (recur (inc idx) (rest items)))))
+
+(defn- migrate-follow-ups-for-entry [conn e self-only? dry-run?]
+  (let [follow-ups (:follow-ups e)
+        new-bookmarks (remove nil? (mapv #(when (and (not (:completed? %))
+                                           (or (not self-only?)
+                                               (and self-only?
+                                                    (= (-> % :assignee :user-id) (-> % :author :user-id)))))
+                                    (:assignee %))
+                            follow-ups))
+        updated-bookmarks (clojure.set/union (set (map :user-id new-bookmarks)) (:bookmarks e))
+        updated-follow-ups (mapv #(if (and (not (:completed? %))
+                                             (or (not self-only?)
+                                                 (and self-only?
+                                                      (= (-> % :assignee :user-id) (-> % :author :user-id)))))
+                                      (assoc % :completed? true)
+                                      %)
+                              follow-ups)]
+    (println "  Updating entry:" (:uuid e))
+    (println "    Adding bookmarks for:" updated-bookmarks)
+    (println "    Updating follow-ups:")
+    (doseq [f updated-follow-ups]
+      (println "     -" (:uuid f) "completed?" (:completed? f) "self?" (= (-> f :assignee :user-id) (-> f :author :user-id))))
+    (when-not dry-run?
+      (println "  Actually updating entry:" (:uuid e))
+      (entry/update-entry-no-user! conn (:uuid e) (merge e {:follow-ups updated-follow-ups
+                                                            :bookmarks updated-bookmarks})))))
+
+(defn- exit [status msg]
+  (println msg)
+  (System/exit status))
+
+(def cli-options
+  [["-f" "--force-update"]
+   ["-s" "--self-only"]])
+
+(defn -main [& args]
+  (let [{:keys [options arguments errors summary]} (parse-opts args cli-options)]
+    (println "Running bookmarks migration with options: dry-run" (not (:force-update options)) "self-only" (:self-only options))
+    (let [conn (db/init-conn c/db-options)]
+      (try
+        (create-temp-index conn)
+        (let [orgs (org/list-orgs conn)]
+          (doseq [o orgs]
+            (let [entries (entries-for-org conn (:uuid o))]
+              (println "Org:" (:uuid o) "-" (:name o))
+              (doseq [e entries]
+                (migrate-follow-ups-for-entry conn e (:self-only options) (not (:force-update options)))))))
+        (delete-temp-index conn)
+        (exit 0 "\n")
+
+        (catch Exception e
+          (println e)
+          (delete-temp-index conn)
+          (exit 1 "Bookmark migration exception."))))))


Add Clojure implementation

Add Clojure implementation

error: pathspec 'fibo.clj' did not match any file(s) known to git

--- fibo.clj
+++ fibo.clj
@@ -0,0 +1,7 @@
+(defn fibo
+  ([]
+   (fibo 1 1))
+  ([a b]
+   (lazy-seq (cons a (fibo b (+ a b))))))
+
+(println (take 20 (fibo)))


unique-key handling for high-level upsert

error: pathspec 'src/er_cassandra/model/unique_key.clj' did not match any file(s) known to git

--- src/er_cassandra/model/unique_key.clj
+++ src/er_cassandra/model/unique_key.clj
@@ -0,0 +1,148 @@
+(ns er-cassandra.model.unique-key
+  (:require
+   [clojure.set :as set]
+   [clojure.core.match :refer [match]]
+   [manifold.deferred :as d]
+   [cats.core :as m]
+   [cats.monad.either :as either]
+   [cats.monad.deferred :as dm]
+   [qbits.alia :as alia]
+   [qbits.alia.manifold :as aliam]
+   [qbits.hayt :as h]
+   [er-cassandra.key :as k]
+   [er-cassandra.record :as r]
+   [er-cassandra.record-either :as re]
+   [er-cassandra.model.types :as t]
+   [er-cassandra.model.util :refer [combine-responses create-lookup-record]])
+  (:import [er_cassandra.model.types Model]))
+
+(defn applied?
+  [lwt-response]
+  (get lwt-response (keyword "[applied]")))
+
+(defn applied-or-owned?
+  [^Model model insert-uber-key lwt-insert-response ]
+  (if (applied? lwt-insert-response)
+    true
+    (let [owner-uber-key (k/extract-key-value
+                          (get-in model [:primary-table :key])
+                          lwt-insert-response)]
+      (= insert-uber-key owner-uber-key))))
+
+(defn acquire-unique-key
+  "acquire a single unique key.
+   returns a Deferred[Right[:ok <keydesc> info]] if the key was acquired
+   successfully, a Deferred[Right[:fail <keydesc> reason]]"
+
+  [session ^Model model unique-key-table uber-key-value key-value]
+  (let [uber-key (t/uber-key model)
+        key (:key unique-key-table)
+        unique-key-record (create-lookup-record
+                           uber-key uber-key-value
+                           key key-value)
+        key-desc {:uber-key uber-key :uber-key-value uber-key-value
+                  :key key :key-value key-value}]
+
+    (m/with-monad dm/either-deferred-monad
+      (m/mlet [insert-response (re/insert session
+                                          (:name unique-key-table)
+                                          unique-key-record
+                                          {:if-not-exists true})
+
+               inserted? (m/return (applied? insert-response))
+
+               owned? (m/return
+                       (applied-or-owned?
+                        model
+                        (t/extract-uber-key-value model unique-key-record)
+                        insert-response))
+
+               live-ref? (if-not owned?
+                           (re/select-one session
+                                          (get-in model [:primary-table :name])
+                                          (get-in model [:primary-table :key])
+                                          (t/extract-uber-key-value
+                                           model
+                                           insert-response))
+                           (m/return nil))
+
+               ;; TODO - check that primary record has a live forward reference,
+               ;;        or lookup is really stale despite primary existing
+
+               stale-update-response (if (and (not owned?)
+                                              (not live-ref?))
+                                       (re/update
+                                        session
+                                        (:name unique-key-table)
+                                        (:key unique-key-table)
+                                        unique-key-record
+                                        {:only-if
+                                         (t/extract-uber-key-equality-clause
+                                          model
+                                          insert-response)})
+                                       (m/return nil))
+
+               updated? (m/return (applied? stale-update-response))]
+
+              (m/return
+               (cond
+                 inserted? [:ok key-desc :inserted]    ;; new key
+                 owned?    [:ok key-desc :owned]       ;; ours already
+                 updated?  [:ok key-desc :updated]     ;; ours now
+                 live-ref? [:fail key-desc :notunique] ;; not ours
+                 :else     [:fail key-desc :notunique] ;; someone else won
+                 ))))))
+
+(defn remove-unique-key
+  "remove a single unique key"
+  [session ^Model model unique-key-table uber-key-value key-value]
+  (let [uber-key (t/uber-key model)
+        key (:key unique-key-table)]
+    (m/with-monad dm/either-deferred-monad
+      (m/mlet [delete-result (re/delete session
+                                        (:name unique-key-table)
+                                        key
+                                        key-value
+                                        {:only-if
+                                         (k/key-equality-clause
+                                          uber-key
+                                          uber-key-value)})
+               deleted? (m/return (applied? delete-result))]
+              (m/return
+               (cond
+                 deleted? [:ok :deleted]
+                 :else    [:ok :stale]))))))
+
+(defn acquire-singular-unique-key
+  "attempt to acquire a singular unique key, returning a
+   Deferred[Right[[:ok key info]]] or a Deferred[Right[[:fail key reason]]]"
+  [session ^Model model unique-key-table owner-record]
+  (let [uber-key-value (t/extract-uber-key-value model owner-record)
+        key-value (k/extract-key-value (:key unique-key-table) owner-record)]
+    (acquire-unique-key session model unique-key-table uber-key-value key-value)))
+
+(defn acquire-unique-key-collection
+  "attempt to acquire a set of unique keys. returns a
+   Deferred[Right[[ [:ok key info] | [:fail key reason] ]]]"
+  [session ^Model model unique-key-table owner-record]
+  (let [uber-key-value (t/extract-uber-key-value model owner-record)
+        key-value-coll (k/extract-key-value-collection
+                        (:key unique-key-table)
+                        owner-record)
+        responses (mapv (partial acquire-unique-key
+                                 session
+                                 model
+                                 unique-key-table
+                                 uber-key-value)
+                        key-value-coll)]
+    (combine-responses responses)))
+
+
+(defn acquire-unique-keys
+  "attempts to acquire unique keys for an owner... returns
+   a Deferred[Right[[:ok updated-owner-record :failed-keys]]] with an updated
+   owner record containing only the keys that could be acquired"
+  [session ^Model model owner-record]
+  (m/with-monad dm/either-deferred-monad
+    (m/mlet [r owner-record]
+            (m/return r))))


Bump aleph version (#182)

Bump aleph version (#182)

--- ext/aleph/project.clj
+++ ext/aleph/project.clj
@@ -7,5 +7,5 @@
   :license {:name "The MIT License"
             :url "https://opensource.org/licenses/MIT"}
   :pedantic? :abort
-  :dependencies [[aleph "0.4.1" :exclusions [io.aleph/dirigiste]]
+  :dependencies [[aleph "0.4.3" :exclusions [io.aleph/dirigiste]]
                  [yada/core ~VERSION]])


add async demo, ported from bhauman's old blog

credit: https://github.com/bhauman/async-explore

fixed issues with new cljs

error: pathspec 'src/demos/async_page.cljs' did not match any file(s) known to git

--- src/demos/async_page.cljs
+++ src/demos/async_page.cljs
@@ -0,0 +1,97 @@
+(ns demos.async-page
+  (:require [cljs.core.async :as async
+             :refer [<! >! chan close! sliding-buffer put!]]
+            [crate.core :as crate]
+            [jayq.core :as jq :refer [$ css inner html on]]
+            [clojure.string :as string])
+  (:require-macros [cljs.core.async.macros :as m :refer [go alt!]]))
+
+(defn log [arg]
+  (.log js/console arg))
+
+(defn click-chan [selector value]
+  (let [rc (chan (sliding-buffer 1))]
+    (on ($ "body") :click selector
+        {}
+        (fn [e]
+          (jq/prevent e)
+          (put! rc value)))
+    rc))
+
+(defn fields-value-map [form-selector fields]
+  (into {}
+        (map
+         (fn [fld]
+           [fld (jq/val ($ (str form-selector " input[name=" (name fld) "]")))] )
+         fields)))
+
+(defn form-submit-chan [form-selector fields]
+  (let [rc (chan)]
+    (on ($ "body") :submit form-selector {}
+        (fn [e]
+          (jq/prevent e)
+          (put! rc (fields-value-map form-selector fields))))
+    rc))
+
+(defn validate-edit-form [fields]
+  (if (string/blank? (:message fields))
+    [[:message "can't be blank"]]
+    []))
+
+(defn app-view [state]
+  [:div.app {}
+   [:h1.message (:message state)]
+   [:a.edit {:href "#"} "edit"]])
+
+(defn form-errors-view [[[_ er] & xs]]
+  [:div.alert {} er])
+
+(defn edit-view [state]
+  [:div.app {}
+   [:h4.message "Edit"]
+   [:form.edit-form
+    (if (< 0 (count (:form-errors state)))
+      (form-errors-view (:form-errors state)))
+    [:input.edit-message  {:type "text" :value (:message state) :name "message"}]
+    [:p
+     [:input {:type "submit" :value "Save" :class "btn btn-primary"}]
+     [:a {:href "#" :class " cancel-edit btn"} "cancel"]]]])
+
+(defn app-and-edit-view [state]
+  [:div.app-edit
+   (app-view state)
+   (edit-view state)])
+
+(defn render-app [state view-func]
+  (let [elem ($ ".container")]
+    (log elem)
+    (inner elem
+          (crate/html (view-func state)))))
+
+(defn app-loop [start-state]
+  (let [edit-click       (click-chan ".app a.edit" :edit)
+        edit-form-submit (form-submit-chan ".app form.edit-form" [:message])
+        cancel-edit-form (click-chan ".app form a.cancel-edit" :cancel)
+        do-edit-form (fn [state]
+                       (go
+                        (loop [form-state state]
+                          (render-app form-state app-and-edit-view)
+                          (let [[form-result ch] (alts! [edit-form-submit cancel-edit-form])]
+                            (if (= ch cancel-edit-form)
+                              state
+                              (let [errors (validate-edit-form form-result)]
+                                (if (< 0 (count errors))
+                                  (recur (-> form-state (merge form-result)
+                                             (assoc :form-errors errors)))
+                                  (merge state form-result)
+                                  )))))))]
+    (go ;; main loop
+     (loop [state start-state]
+       (render-app state app-view)
+       (<! edit-click)
+       (recur (<! (do-edit-form state)))))))
+
+(defn setup []
+  (.log js/console "Hello"))
+
+(app-loop {:message "hey there" :count 0})


More forgiving schema.

More forgiving schema.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/couragelabs/coachbot.git/'


Updated Clojure to version 1.8 and bumped jvm-runner project version from 0.1.1 to 0.1.2

fatal: unable to access 'https://github.com/lteacher/codewars-runner-cli.git/': The requested URL returned error: 403


add nrepl for state injection

add nrepl for state injection

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/starcity-properties/odin.git/'


Iruzkin kopurua eta gogokoak liburua aldatu ez, datuak  itzuli

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/lnmnd/magnet.zer.git/'


Base skel for Pedestal component added

Base skel for Pedestal component added

error: pathspec 'src/clj/hellhound/components/pedestal.clj' did not match any file(s) known to git

--- src/clj/hellhound/components/pedestal.clj
+++ src/clj/hellhound/components/pedestal.clj
@@ -0,0 +1,12 @@
+(ns hellhound.components.pedestal
+  "This namespace contains the Pedestal component which is one of
+  the most important components in the HellHound ecosystem.
+  `Pedestal` component is responsible for creating a pedestal service
+  by reading the configuration and service map from environment config
+  file or from the given input."
+  (:require [hellhound.components.protocols :as protocols]))
+
+(defrecord Pedestal []
+  protocols/Lifecycle
+  (start [this])
+  (stop [this]))


Set prefetch count for electorate-create events


Add an audio chunker that yields chunks whenever it is triggered

error: pathspec 'src/main/audio_utils/triggered_chunker.cljs' did not match any file(s) known to git

--- src/main/audio_utils/triggered_chunker.cljs
+++ src/main/audio_utils/triggered_chunker.cljs
@@ -0,0 +1,55 @@
+(ns audio-utils.triggered-chunker
+  (:require [audio-utils.util :refer [aatom aswap! << >>]]
+            [audio-utils.worker :as w]))
+
+(defprotocol ITriggeredChunker
+  (process-samples [this samples])
+  (deliver-chunks [this])
+  (reset-chunks [this])
+  (trigger [this capture?]))
+
+(defrecord TriggeredChunker [next chunks capturing?]
+  w/IWorkerAudioNode
+  (connect [this destination]
+    (reset! next destination))
+
+  (disconnect [this]
+    (reset! next nil))
+
+  (process-audio [this data]
+    (when (<< capturing?)
+      (js/console.log "TRIGGERED CHUNKER: PROCESS AUDIO"
+                      data
+                      (<< capturing?))
+      (let [n-channels (count data)
+            n-samples  (count (first data))]
+        (dotimes [n n-samples]
+          (let [samples (mapv #(nth % n) data)]
+            (process-samples this samples))))))
+
+  ITriggeredChunker
+  (process-samples [this samples]
+    (dotimes [channel (count samples)]
+      (let [sample (samples channel)]
+        (aswap! chunks update channel conj sample))))
+
+  (deliver-chunks [this]
+    (some-> @next (w/process-audio (<< chunks))))
+
+  (reset-chunks [this]
+    (let [n-channels   (count (<< chunks))
+          empty-chunks (into [] (repeat n-channels []))]
+      (>> chunks empty-chunks)))
+
+  (trigger [this capture?]
+    (js/console.log "TRIGGERED CHUNKER: TRIGGER: capture?" capture?)
+    (when-not capture?
+      (deliver-chunks this)
+      (reset-chunks this))
+    (>> capturing? capture?)))
+
+(defn triggered-chunker
+  []
+  (map->TriggeredChunker {:next       (atom nil)
+                          :chunks     (aatom [])
+                          :capturing? (aatom false)}))


Add a UUID wrapper

Add a UUID wrapper

error: pathspec 'src/detritus/uuid.clj' did not match any file(s) known to git

--- src/detritus/uuid.clj
+++ src/detritus/uuid.clj
@@ -0,0 +1,9 @@
+(ns detritus.uuid
+  (:import java.util.UUID))
+
+(defn ->uuid
+  ([n m]
+     (UUID. (long n) (long m))))
+
+(defn ->random-uuid []
+  (UUID/randomUUID))


add auth namespace with token helper functions

error: pathspec 'src/gangway/auth.clj' did not match any file(s) known to git

--- src/gangway/auth.clj
+++ src/gangway/auth.clj
@@ -0,0 +1,45 @@
+(ns gangway.auth
+  (:require [clojure.string :refer [split]]
+            [clojure.pprint :refer [pprint]]))
+
+(defn request->auth-token
+  "Retrieves the authentication token from an incoming
+   request.
+
+   Params:  ctx - Liberator Context
+   Returns: string"
+  [ctx]
+  (let [auth (get-in ctx [:request :headers "authorization"])]
+    (if (nil? auth)
+      (str "")
+      (second (split
+           (get-in ctx [:request :headers "authorization"])
+           #"\s+")))))
+
+(defn gen-token
+  "Generates a random token of a specified length consisting
+   of numbers, letters, and symbols.
+
+   Params:  length - int
+   Returns: string"
+  [length]
+  (apply str
+    (take length
+      (repeatedly
+        #(rand-nth "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()-_")))))
+
+(defn validate-token
+  "Validates a token from an incoming request,
+   designed to be used in the authorized? section
+   of a liberator resource.
+
+   TODO: Check if the incoming token exists in Datomic,
+         don't hard code this.
+
+   Params:  ctx - Liberator Context
+   Returns: boolean"
+  [ctx]
+  (let [token (request->auth-token ctx)]
+    (if (= token (str "T0_V&(1AZ#U1$X3EXQL@K!OJ568G4&3DL55!5MU16E#E6TY%KV!3O1QB&L2!QSXT"))
+      true
+      false)))


Liburuak orokorrean, ez azkenak

Liburuak orokorrean, ez azkenak

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/lnmnd/magnet.bez.git/'


Zuzenean bidali

Zuzenean bidali


egileak eta etiketak eremuak kendu

egileak eta etiketak eremuak kendu


default-value-callback

default-value-callback

error: pathspec 'src/er_cassandra/model/callbacks/default_value_callback.clj' did not match any file(s) known to git

--- src/er_cassandra/model/callbacks/default_value_callback.clj
+++ src/er_cassandra/model/callbacks/default_value_callback.clj
@@ -0,0 +1,9 @@
+(ns er-cassandra.model.callbacks.default-value-callback
+  (:require
+   [clojure.string :as str]))
+
+(defn create-default-value-callback
+  [col default-val]
+  (fn [r]
+    (let [v (get r col)]
+      (assoc r col (or v default-val)))))


Style weenie: one-legged if's should be whens.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/mtravers/incidents.git/'


cond is now working

cond is now working

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/parenode/clojure-cup-2015.git/'


Revert "Revert "i18nize message signature""

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-notification-works.git/'


Problem 0034. Could be better...

Problem 0034. Could be better...

error: pathspec 'src/project_euler/problem_0034.clj' did not match any file(s) known to git

--- src/project_euler/problem_0034.clj
+++ src/project_euler/problem_0034.clj
@@ -0,0 +1,48 @@
+(ns project-euler.problem_0034
+  (:require [clojure.math.combinatorics :as combo]
+            [clojure.set]
+            ))
+
+;; 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
+
+;; Find the sum of all numbers which are equal to the sum of the factorial of their digits.
+
+;; Note: as 1! = 1 and 2! = 2 are not sums they are not included.
+
+(defn factorial [n] (reduce *' (range 1 (inc n))))
+
+(def fact (vec (map factorial (range 10))))
+
+(defn next-digit
+  [r-min r-max]
+  (->> (range 10)
+       (filter #(<= r-min (fact %) r-max))
+       )
+  )
+
+(defn n-digits-solutions
+  [n r-min r-max]
+  (if (== 0 n)
+    [[]]
+    (mapcat
+     (fn [d] (map #(conj % d) (n-digits-solutions (dec n) (- r-min (fact d)) (- r-max (fact d)))))
+     (next-digit r-min r-max)
+     )))
+
+(defn solution []
+  (->> (range 2 6)
+       (mapcat (fn [n] (n-digits-solutions n (Math/pow 10 (dec n)) (dec (Math/pow 10 n)))))
+       (map (fn [ds] [ds (reduce #(+ %1 (fact %2)) 0 ds)]))
+       (mapcat (fn [[ds f-sum]] (->> (combo/permutations ds)
+                                 (map (fn [pds] (reduce #(+ %2 (* 10 %1)) 0 pds)))
+                                 (filter #(= % f-sum))
+                                 )))
+       (set)
+       (reduce +)
+       )
+  )
+
+(solution)
+
+;;-> 40730
+


simplify coffeescript build

simplify coffeescript build

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/JetBrains/imperative-nodejs.git/'


make badge stay above group image

make badge stay above group image

--- src/braid/ui/styles/sidebar.cljs
+++ src/braid/ui/styles/sidebar.cljs
@@ -14,7 +14,8 @@
      :border-color "#B53737 !important"
      :position "absolute"
      :bottom (rem -0.5)
-     :right (rem -0.5)}]])
+     :right (rem -0.5)
+     :z-index 101}]])

 (def sidebar
   [:.sidebar


adding async router

adding async router

error: pathspec 'src/cljc/ow/starbuck/router.cljc' did not match any file(s) known to git

--- src/cljc/ow/starbuck/router.cljc
+++ src/cljc/ow/starbuck/router.cljc
@@ -0,0 +1,35 @@
+(ns ow.starbuck.router
+  #?(:cljs (:require-macros [cljs.core.async.macros :refer [go-loop]]))
+  (:require #?(:clj  [clojure.core.async.impl.protocols :as ap]
+               :cljs [cljs.core.async.impl.protocols :as ap])
+            #?(:clj  [clojure.core.async :refer [go-loop] :as a]
+               :cljs [cljs.core.async :as a])
+            [ow.clojure :as owc]
+            [ow.starbuck.routing :as r]))
+
+(defrecord Router [config input-ch])
+
+(defn- safe-route [config msg]
+  ;;; to prevent go-loop from aborting due to exception in router
+  (try
+    (r/route config msg)
+    (catch Exception e
+      (println "EXCEPTION (ROUTING):" e))
+    (catch Error e
+      (println "ERROR (ROUTING):" e))))
+
+(defn router [config input-ch]
+  (map->Router {:config config
+                :input-ch input-ch}))
+
+(defn start [{:keys [config input-ch] :as this}]
+  (go-loop [msg (a/<! input-ch)]
+    (when-not (or (nil? msg)
+                  (= msg ::stop))
+      (safe-route config msg)
+      (recur (a/<! input-ch))))
+  this)
+
+(defn stop [{:keys [input-ch] :as this}]
+  (a/put! input-ch ::stop)
+  this)


fix path printing

fix path printing

--- sidecar/src/figwheel_sidecar/config_check/type_check.clj
+++ sidecar/src/figwheel_sidecar/config_check/type_check.clj
@@ -1,12 +1,21 @@
 (ns figwheel-sidecar.config-check.type-check
   (:require
    [clojure.pprint :as pprint]
+
+   [fipp.visit :refer [visit]]
+   [fipp.edn :as fedn]
    [fipp.engine :refer [pprint-document]]
+
    [figwheel-sidecar.config-check.ansi :refer [color]]
    [clj-fuzzy.metrics :as metrics]
    [clojure.walk :as walk]
    [clojure.string :as string]
    [clojure.set :refer [difference]]))
+
+(def edn-printer (fedn/map->EdnPrinter {}))
+
+(defn fipp-format-data [data]
+  (visit edn-printer data))

 (defn log [x] (prn x) x)

@@ -131,23 +140,17 @@

 #_(required-keys 'FigOpts :hello :goodbye)

-(defn doc-type? [x]
+#_(defn doc-type? [x]
   (and (map? x)
        (= #{:content :example} (set (keys x)))
        (let [{:keys [example content]} x]
          (or (fn? example)
              (string? example)))))

-(defn doc-key-val [root k d]
-  (cond
-    (string?   d) [[root :doc-key k d]]
-    (doc-type? d) [[root :doc-key k (:content d)]
-                   [root :doc-key-example k (:example d)]]))
-
 (defn doc
   ([root type-doc kd]
    (cons [root :doc-type type-doc]
-         (mapcat (fn [[k d]] (doc-key-val root k d)) kd)))
+         (mapv (fn [[k d]] [root :doc-key k d]) kd)))
   ([root type-doc]
    (doc root type-doc [])))

@@ -1178,17 +1181,26 @@

 (defn print-path [[x & xs] leaf-node edn]
   (if (and x (get edn x))
-    [:group (if (and (not (map? edn)) (integer? x))
-              "[{"
-              (str (pr-str x ) " {"))
-     [:nest 2
-      :line
-      (print-path xs leaf-node (get edn x))
-      ]
-     (if (and (not (map? edn)) (integer? x))
-       "}]"
-       "}")]
+    (let [v (get edn x)]
+      [:group
+       (str (if (map? edn)
+              (str (pr-str x) " ")
+              "")
+            (if (and (not (map? v)) (integer? (first xs)))
+              "["
+              "{"))
+       (if (map? v)
+         [:nest 2
+          :line
+          (print-path xs leaf-node v)]
+         (print-path xs leaf-node v))
+       (if (and (not (map? v)) (integer? (first xs)))
+         "]"
+         "}")])
     leaf-node))
+
+#_(pprint-document (print-path2 [:cljsbuild :builds 0 :css-dirs] [:group "hey"] {:cljsbuild {:builds [{:css-dirs []}]}})
+                 {:width 20})

 (defn print-path-error
   ([{:keys [path orig-config] :as error} leaf-node document]
@@ -1323,14 +1335,32 @@
   #_(doall (*schema-rules* [:doc-key 'Rap]))
   )

+(defn print-key-doc [k key-doc]
+  (cond
+    (string? key-doc) key-doc
+    (map? key-doc)
+    (if (:example key-doc)
+      (let [example (:example key-doc)
+            example (if (fn? example) (example) example)]
+        [:group
+         (color (:content key-doc) :underline)
+         :break
+         :break
+         [:nest 2
+          (pr-str k)
+          " "
+          (fipp-format-data example)]
+         ])
+      (color (:content key-doc) :underline) )
+    :else ""))
+
 (defn document-key [parent-type k]
   (let [{:keys [ky] :as p} (docs-for parent-type k)]
     (if ky
       [:group
        "-- Docs for key " (color (pr-str k) :bold) " --"
        :break
-       (color ky
-                       :underline)
+       (print-key-doc k ky)
        :break]
       "")))


Problem 2 of day 6

Problem 2 of day 6

error: pathspec '2016/day6/signals2.clj' did not match any file(s) known to git

--- 2016/day6/signals2.clj
+++ 2016/day6/signals2.clj
@@ -0,0 +1,13 @@
+(use 'clojure.java.io)
+(use 'clojure.string)
+
+(defn most-frequent [coll]
+  (first (first (sort-by val (frequencies coll)))))
+
+(defn -main []
+  (with-open [rdr (reader "./data.txt")]
+    (let [lines (map trim (line-seq rdr))]
+      (println (apply str
+                      (map-indexed (fn [idx _]
+                                     (most-frequent (map #(first (drop idx %)) lines)))
+                                   (first lines)))))))


fix(request): pass statement forward if statement meta is empty

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/B2W-Digital/pdg-core.git/'


handle auth middleware headers being automatically downcased

--- src/metabase/middleware/auth.clj
+++ src/metabase/middleware/auth.clj
@@ -8,7 +8,7 @@

 (def SESSION_COOKIE "metabase.SESSION_ID")
-(def SESSION_HEADER "X-METABASE-SESSION")
+(def SESSION_HEADER "x-metabase-session")

 (defn wrap-sessionid
@@ -18,7 +18,7 @@
    http headers for `X-METABASE-SESSION`.  If neither is found then then no keyword is bound to the request."
   [handler]
   (fn [{:keys [cookies headers] :as request}]
-    (if-let [session-id (or (get-in cookies [SESSION_COOKIE :value]) (get-in headers [SESSION_HEADER :value]))]
+    (if-let [session-id (or (get-in cookies [SESSION_COOKIE :value]) (headers SESSION_HEADER))]
       ;; alternatively we could always associate the keyword and just let it be nil if there is no value
       (handler (assoc request :metabase-sessionid session-id))
       (handler request))))
@@ -57,4 +57,4 @@
       (binding [*current-user-id* current-user-id
                 *current-user* (if-not current-user-id (atom nil)
                                                        (delay (sel-current-user current-user-id)))]
-        (handler request)))))+        (handler request)))))


(fix search link)

(fix search link)

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/fhirbase/fhirplace.git/'


Minor documentation tweak.

Minor documentation tweak.

--- src/clj/freefrog/governance.clj
+++ src/clj/freefrog/governance.clj
@@ -241,6 +241,8 @@
   [circle role-name accountability]
   (remove-from circle role-name :accountabilities accountability))

+;; ## General purpose utility functions ##
+
 (defn update-subcircle
   "Generalizes any circle manipulation to unlimited subcircles. The path given
    is a series of role names starting from (but not including) the anchor


OK, wrapping up basic upload support for now.

Currently we implemented upload support, in a very clunky way, but it
got us going just somewhat. Next step is to implement JSON and CSV fully
and release 0.1.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/screen6/bigquery-clj.git/'


Gah, indenting.

Gah, indenting.


auto license

auto license

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/jchli/jepsen-aurora.git/'


xymon.clj: event->disable: removed ttl (bad) default value

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/jamtur01/riemann.git/'


solved

solved

error: pathspec 'src/4clojure/perfect_squares.clj' did not match any file(s) known to git

--- src/4clojure/perfect_squares.clj
+++ src/4clojure/perfect_squares.clj
@@ -0,0 +1,67 @@
+;; Filter Perfect Squares
+;; http://www.4clojure.com/problem/74
+
+;; Difficulty:	Medium
+;; Topics:
+
+
+;; Given a string of comma separated integers, write a function which returns a new comma separated string that only contains the numbers which are perfect squares.
+
+
+;; (defn __ [s]
+;;   (-> (re-seq #"\d+" s)
+;;       (map #(Integer/parseInt %))))
+;;       (filter #(let [n (Math/sqrt %)] (= (Math/floor n) n)))))
+
+;;   (map #(Integer/parseInt %) (re-seq #"\d+" s)))
+
+;; (= (Math/floor (Math/sqrt 3)) (Math/sqrt 3))
+
+
+(defn __ [s]
+  (apply str
+         (interpose ","
+                    (filter #(let [n (Math/sqrt %)] (= (Math/floor n) n))
+                            (map #(Integer/parseInt %)
+                                 (re-seq #"\d+" s))))))
+
+
+
+;; (-> (re-seq #"\d+" "4,5,6,7,8,9") map)
+
+(= (__ "4,5,6,7,8,9") "4,9")
+
+(= (__ "15,16,25,36,37") "16,25,36")
+
+;; (join " " [1 2 3 4])
+
+
+;; 4Clojure copy paste
+(fn [s]
+  (apply str
+         (interpose ","
+                    (filter #(let [n (Math/sqrt %)] (= (Math/floor n) n))
+                            (map #(Integer/parseInt %)
+                                 (re-seq #"\d+" s))))))
+
+
+;; _artem_uv's solution:
+(fn [x] (clojure.string/join #"," (filter #(= % (* (int (Math/sqrt %)) (int (Math/sqrt %)))) (map #(Integer/parseInt %) (clojure.string/split x #",")))))
+
+;; _pcl's solution:
+(fn [strs]
+  (apply str
+    (interpose ","
+      (filter
+        #(= 0.0 (mod (Math/sqrt %) 1))
+        (map #(Integer/parseInt %) (.split strs ","))))))
+
+;; aceeca1's solution:
+(fn [x] (apply str (interpose "," (filter (fn [x] (some #{x} (map-indexed * (range x)))) (read-string (str "(" x ")"))))))
+
+;; adereth's solution:
+(fn [s]
+  (let [nums (map #(Integer/parseInt %) (.split s ","))
+        p2 #(* % %)
+        sqs (filter (fn [n] (= n (p2 (int (Math/sqrt n))))) nums)]
+    (apply str (interpose \, sqs))))


abstractions

abstractions

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/clojure-ml/cml.git/'


start tree-query

start tree-query

error: pathspec 'src/com/billpiel/mem_tracer/util/tree_query.clj' did not match any file(s) known to git

--- src/com/billpiel/mem_tracer/util/tree_query.clj
+++ src/com/billpiel/mem_tracer/util/tree_query.clj
@@ -0,0 +1,66 @@
+(ns com.billpiel.mem-tracer.util.tree-query
+  (require [clojure.zip :as z]))
+
+(def ^:dynamic *get-tags-mz* nil)
+
+(defn right-sib-zips [z] (if-let [r (z/right z)]
+                           (lazy-cat [r]
+                                     (right-sib-zips r))
+                           []))
+
+(defn children-zips [z] (if-let [d (z/down z)]
+                          (lazy-cat [d]
+                                    (right-sib-zips d)) []))
+
+(defn set-zip-children
+  [z c]
+  (z/edit z #(z/make-node z
+                          %
+                          c)))
+
+(defn get-tags
+  [node pred-map]
+  (for [[kw pred] pred-map :when (pred node)]
+    kw))
+
+(defn get-tags'
+  [node pred-map]
+  ((or *get-tags-mz* get-tags)
+   node
+   pred-map))
+
+(defn get-children-tags
+  [zipr]
+  (let [kids (children-zips zipr)]
+    (apply concat (for [child-zip kids
+                        desc-tags (get-children-tags child-zip)]
+                    (map (fn [tag-trail] (conj tag-trail (get-tags' child-zip))))))))
+
+(defn tag*
+  [zipr pred-map & {:keys [parent-tags]}]
+  (let [this-tags (get-tags' (z/node zipr) pred-map)
+        parent-tags' (conj parent-tags)
+        children-tags (get-children-tags zipr)
+])
+  (z/edit zipr (fn [z] (with-meta z
+                         {:tags (get-tags' (z/node z) pred-map)
+                          :parent-tags []
+                          :parent-tag-set #{}
+                          :children []
+                          :children-set #{}}))))
+
+(defn tag
+  [zipr pred-map]
+  (binding [*get-tags-mz* (memoize get-tags)]
+    (tag* zipr
+          pred-map)))
+
+#_ (do
+
+
+     (def z1 (z/zipper map? :children #(assoc % :children %2)
+                       {:a 1 :children [{:a 2} {:a 3 :children []} {:a 4}]}))
+
+
+
+     (comment))


don't need magic code anymore when we haves the legit codes

--- test/metabase/test_data/load.clj
+++ test/metabase/test_data/load.clj
@@ -167,8 +167,6 @@
 (defn- add-metadata! []
   (dorun
    (map (fn [[table-kw {:keys [fields]}]]
-          (let [fields (conj fields {:name :id
-                                     :special-type :id})]
-            (dorun (map (partial set-special-type! table-kw)
-                        fields))))
+          (dorun (map (partial set-special-type! table-kw)
+                      fields)))
         data/test-data)))


cleanup

cleanup


add hide-fee to SDR payment

add hide-fee to SDR payment

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/starcity-properties/odin.git/'


add comment to explain hairy implementation


use ln again

use ln again


error: pathspec 'src/hurvinek/middleware.clj' did not match any file(s) known to git

--- src/hurvinek/middleware.clj
+++ src/hurvinek/middleware.clj
@@ -0,0 +1,23 @@
+;
+;  (C) Copyright 2016  Pavel Tisnovsky
+;
+;  All rights reserved. This program and the accompanying materials
+;  are made available under the terms of the Eclipse Public License v1.0
+;  which accompanies this distribution, and is available at
+;  http://www.eclipse.org/legal/epl-v10.html
+;
+;  Contributors:
+;      Pavel Tisnovsky
+;
+
+(ns hurvinek.middleware
+    "Definition(s) of middleware used by this app with the cooperation with Clojure Ring.")
+
+(defn inject-configuration
+    "Inject configuration structure into the request parameter.
+     It means that the process request->hurvinek->response could be implemented
+     in functional way."
+    [handler configuration]
+    (fn [request]
+        (handler (assoc request :configuration configuration))))
+


add tests for conexp.fca.graph

add tests for conexp.fca.graph

error: pathspec 'src/test/clojure/conexp/fca/graph_test.clj' did not match any file(s) known to git

--- src/test/clojure/conexp/fca/graph_test.clj
+++ src/test/clojure/conexp/fca/graph_test.clj
@@ -0,0 +1,89 @@
+;; Copyright ⓒ the conexp-clj developers; all rights reserved.
+;; The use and distribution terms for this software are covered by the
+;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
+;; which can be found in the file LICENSE at the root of this distribution.
+;; By using this software in any fashion, you are agreeing to be bound by
+;; the terms of this license.
+;; You must not remove this notice, or any other, from this software.
+
+(ns conexp.fca.graph-test
+  (:require [clojure.test :refer :all]
+            [conexp.base :exclude [transitive-closure] :refer :all]
+            [conexp.fca.graph :refer :all]
+            [conexp.util.graph :refer :all]
+            [conexp.fca.lattices :as lat]
+            [ubergraph.core :as uber]))
+
+;;; helper function
+
+(defn assert-equal-graphs
+  ([graphs]
+   (doseq [g (drop 1 graphs)]
+     (assert-equal-graphs (first graphs) g)))
+  ([g1 g2]
+   (if (= g1 g2) (is true)                                  ; if equal: count as valid test
+                 (do (println "graphs that do not match:")  ; else: print graphs and ...
+                     (uber/pprint g1)
+                     (uber/pprint g2)
+                     (is (= g1 g2))))))                     ; ...do the test to report the fail
+
+;;;
+
+(def lat1
+  (lat/make-lattice [1 2 3] [[1 1] [2 2] [3 3]
+                             [1 2] [2 3] [1 3]]))
+
+(def lat2
+  (lat/make-lattice [1 2 3 4] [[1 1] [2 2] [3 3] [4 4]
+                               [1 2] [1 3] [1 4] [2 4] [3 4]]))
+
+
+(deftest test-lattice<->graph
+  (assert-equal-graphs [
+                        (lattice->graph lat1)
+                        (add-loops (uber/digraph [1 2] [2 3] [1 3]))
+                        (uber/digraph [1 1] [2 2] [3 3] [1 2] [2 3] [1 3])
+                        (lattice->graph (graph->lattice (uber/digraph [1 2] [2 3] [1 3])))
+                        ])
+  (assert-equal-graphs [
+                        (lattice->graph lat2)
+                        (add-loops (uber/digraph [1 2] [1 3] [1 4] [2 4] [3 4]))
+                        (uber/digraph [1 1] [2 2] [3 3] [4 4] [1 2] [1 3] [1 4] [2 4] [3 4])
+                        (lattice->graph (graph->lattice (uber/digraph [1 2] [1 3] [1 4] [2 4] [3 4])))
+                        ])
+  (is (thrown? IllegalArgumentException (graph->lattice (uber/digraph [1 2] [2 3]))))
+  (is (graph->lattice-nc (uber/digraph [1 2] [2 3]))))      ;note that no Exception is thrown
+
+
+(deftest test-comparability
+  (assert-equal-graphs (comparability [1 2 3] (fn [a b] (contains? #{[1 1] [1 2] [2 3]} [a b])))
+                       (uber/graph [1 1] [1 2] [2 3]))
+  (assert-equal-graphs (co-comparability [1 2 3] (fn [a b] (contains? #{[1 1] [1 2] [2 3]} [a b])))
+                       (uber/graph [1 3] [2 2] [3 3]))
+  (assert-equal-graphs (comparability #{} (fn [_ _] (assert false "should not be called")))
+                       (uber/graph))
+  (assert-equal-graphs (co-comparability #{} (fn [_ _] (assert false "should not be called")))
+                       (uber/graph))
+  (assert-equal-graphs (comparability #{1} (fn [_ _] true))
+                       (uber/graph [1 1]))
+  (assert-equal-graphs (comparability #{1} (fn [_ _] false))
+                       (uber/graph))
+  (assert-equal-graphs (co-comparability #{1} (fn [_ _] true))
+                       (uber/graph))
+  (assert-equal-graphs (co-comparability #{1} (fn [_ _] false))
+                       (uber/graph [1 1])))
+
+
+(deftest test-strictness
+  (let [less (strict (fn [x y] (<= x y)))
+        le (non-strict <)]
+    (is (less 1 2))
+    (is (not (less 1 1)))
+    (is (not (less 1 0)))
+    (is (le 1 2))
+    (is (le 1 1))
+    (is (not (le 1 0)))))
+
+;;;
+
+nil