* end of clojure data-structures * completed with impl a function: [pos] as exercise

--- src/clojure_learning/with-clojure-playing.clj
+++ src/clojure_learning/with-clojure-playing.clj
@@ -154,175 +154,342 @@

 (def partial-add (partial +))
 (partial-add 1 2)
-;; Anything you type in here will be executed
-;; immediately with the results shown on the
-;; right.
-
-(defn foo [x]  (* x x))
-(def squared (foo 4))
-
-(def a-vec-1 (vec (take 20(range 40 65))))
-(get a-vec-1 0)
-(nth a-vec-1 0)
-(a-vec-1 0)
-
-(def nested-vec [[1 2 3]
-                 [4 5 6]
-                 [7 8 9]])
-(get-in nested-vec [1 2])
-
-
-(require 'clojure.repl)
-(assoc-in nested-vec [1 2] 81)
-(doc update-in)
-(update-in nested-vec [1 2] * 44)
-; take the old-value -> itentified by the position of keys -> feed its corresponding
-; value as argument to the function
-
-(defn my-map
-  "recursively traverses the collection applying the provided function returning a new collection of transformed items"
-  [a-func & container]
-  (loop [tail-items (vec container)
-         acc-items []]
-      (if (empty? tail-items)
-        acc-items
-
-        (recur (pop tail-items) (conj acc-items (a-func (peek tail-items)))))
-  )
-
-)
-
-(doc my-map)
-
-(def other-nums (my-map #(str "prefix: " %1) "cc" "dd"))
-(println other-nums)
-
-(next [1 2 3])
-(pop [1 2 3])
-
-
-;; Lists and all about them :)
-;; a persistentList is a LINKED LIST internally, where each node knows its distance from the end.
-;; any element CAN ONLY be found in a clojure-list starting from the begg of the list and walking fw till end.
-;; any element can ONLY be removed or inserted at the start of the list(the leftmost position)
-;; rarely provide any value added over vectors -> hence are not so used.
-
-;; both: [cons] + [conj] add something to the begg of the list.
-
-(cons 1 [2 3 4]); (1 2 3 4)
-(conj [2 3 4] 1); [2 3 4 1]
-;; on vectors as seen [cons] + [conj] both add one element but: [cons] acts like [unshift] from JS
-;; in that it ADDS the element on the start and returns a SEQUENCE instead of the vector itself
-;; [conj] works as expected: for vectors it adds on top of the stack, for lists at the begg of the list
-;; explain: [cons] on vector adding on the begg of the data-structure??? maybe because clojure evals first the
-;; arguments and the operand-in this case the function cons -> and it knows the function will pre-generate
-;; a sequence on the eval of args step; that sequence is used instead to "now normally" prepend the element
-;; on the begg of the list.
-
-
-(conj '(2 3 4) 1); (1 2 3 4)
-(cons 1 '(2 3 4)); (1 2 3 4)
-;; therefore [conj] & [cons] work the SAME on PersistentLists, however they diff in the order of args passed
-
-(doc cons)
-
-;; USE [cons] only FOR SEQUENCES, lazy sequences, ranges! do not use [cons] for vectors(at it returns a sequence back)
-;; and do not use [cons] for persistentLists because the result is not guaranteed that it will behave consistently
-
-(pop []); throws IllegalStateException: cannot pop empty vector
-(pop '()); throws IllegalStateException: cannot pop empty list
-(next []); nil
-(next '()); nil
-(rest []); ()
-(rest '()); ()
-
-
-(contains? [1 2 3] 2)
-(contains? '(1 2 3) 2); IllegalArgumentException: contains? not supported on persistentLists
-
-;; dont use lists to find items by index! because clojure starts from the begg in finding the item -> O(n)
-;; practical reason why:
-((list 1 2 3) 0); ; classCastException
-
-(cons 1 nil)
-
-(cons 1 '(2 3 4)); (1 2 3 4)
-(pop '(1 2 3 4)); (2 3 4)??? wtf": pop poppes an element from the start of the list
-(peek '(1 2 3 4)); 1
-;; [pop] + [peek] of PersistentStack funcs operate on lists from the begginging!!!
-
-
-;; because any persistentList implements the PersistentStack which provides the: [peek] + [pop] funcs
-(peek '(1 2 3)); 1
-(pop '(1 2 3)); (2 3)
-;; as seen the peek is the same as: [first]; while [next] & [rest] is the same as [pop]
-
-(next '(1 2 3)); (2 3)
-;; same as [rest]
-(rest '(1 2 3)); (2 3)
-;; the differences come when the collection is empty, or has 1 element
-(pop '(1)); ()
-(rest '(1)); ()
-(next '(1)); nil
-
-(pop '()); illegalStateException:: cannot pop empty list
-(next '()); nil
-(rest '()); ()
-
-(pop []); illegalStateException:: cannot pop an empty vector
-(next []); nil
-(rest []); ()
-
-;; its OK that the vectors + lists share the same behavior, for these 3 funcs, however the vectors works from top of the stack
-;; while the lists work this funcs from the start of the list(leftmost)
-
-(cons 1 [2 3 4]); (1 2 3 4) --> returns a seq back, and as seq work by adding items to the start of the list
-
-(into [] (rest [1 2 3])); [2 3]
-
-(pop [1]); []
-;; IMPORTANT: for vectors! use always ONLY: [conj] + [pop];
-;; DON'T USE [cons] + [next] + [rest] as they all return a sequence back -> and the results are based on the SEQ
-;; NOT based on the initial vector passed; there's a "cast" into based on the func type: cons + next + rest ->
-;; the type of collection is identified(seq, hashes, vectors) -> and then converted to certain type
-;; then the operation is performed
-
-(first {:one 1 :two 2}); [:one 1]
-(vector? (first {:one "one" :two "two"})); true
-(seq {:one 1 :two 2}); ([:one 1] [:two 2])
-
-(doseq [[each-key each-val] {:one 1 :two 2}]
-  (println (str "each key: " each-key ", each val: " each-val)) )
-
-(source doseq)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; QUEUEs: FIFO as oposed to vectors which behave MORE like STACKs(LIFO)
-;; peek -> peeks the first element from queue without removing
-;; conj -> adds on element at the top of the queue
-;; pop -> return a new queue with the leftmost(first) element removed from queue
-(def my-queue (conj clojure.lang.PersistentQueue/EMPTY "one" "two" "three"))
-(peek my-queue); "one"
-(def new-queue (conj my-queue "four"))
-(count my-queue); 3
-(count new-queue); 4
-(sequential? my-queue); true
-
-(def init-queue (pop new-queue))
-(count init-queue); 3
-(= my-queue init-queue); false
-(identical? my-queue init-queue); false
-eval my-queue
-(doc mapcat)
-
-;; queues are not a common behavior thus clojure did NOT incorporate naturally in its language, but provides a simple way
-;; to start build one from the [clojure.lang.PersistentQueue/EMPTY];
-
-(= [1 2 3] [1 2 3]); true
-(= '(1 2 3) '(1 2 3)); true
-
-
-;; DO NOT BE TEMPTED TO use [rest] for QUEUES!!! instead of [pop]; always use POP.
-;; why? because [rest] indeed removes the first element from queue -> BUT IT is a list/seq like operation
-;; and hence the data-structure(queue) is translated to a 'seq' before -> and in return of [rest] -> we get
-;; a seq back NOT a queue.
+;; Anything you type in here will be executed
+;; immediately with the results shown on the
+;; right.
+
+(defn foo [x]  (* x x))
+(def squared (foo 4))
+
+(def a-vec-1 (vec (take 20(range 40 65))))
+(get a-vec-1 0)
+(nth a-vec-1 0)
+(a-vec-1 0)
+
+(def nested-vec [[1 2 3]
+                 [4 5 6]
+                 [7 8 9]])
+(get-in nested-vec [1 2])
+
+
+(require 'clojure.repl)
+(assoc-in nested-vec [1 2] 81)
+(doc update-in)
+(update-in nested-vec [1 2] * 44)
+; take the old-value -> itentified by the position of keys -> feed its corresponding
+; value as argument to the function
+
+(defn my-map
+  "recursively traverses the collection applying the provided function returning a new collection of transformed items"
+  [a-func & container]
+  (loop [tail-items (vec container)
+         acc-items []]
+      (if (empty? tail-items)
+        acc-items
+
+        (recur (pop tail-items) (conj acc-items (a-func (peek tail-items)))))
+  )
+
+)
+
+(doc my-map)
+
+(def other-nums (my-map #(str "prefix: " %1) "cc" "dd"))
+(println other-nums)
+
+(next [1 2 3])
+(pop [1 2 3])
+
+
+;; Lists and all about them :)
+;; a persistentList is a LINKED LIST internally, where each node knows its distance from the end.
+;; any element CAN ONLY be found in a clojure-list starting from the begg of the list and walking fw till end.
+;; any element can ONLY be removed or inserted at the start of the list(the leftmost position)
+;; rarely provide any value added over vectors -> hence are not so used.
+
+;; both: [cons] + [conj] add something to the begg of the list.
+
+(cons 1 [2 3 4]); (1 2 3 4)
+(conj [2 3 4] 1); [2 3 4 1]
+;; on vectors as seen [cons] + [conj] both add one element but: [cons] acts like [unshift] from JS
+;; in that it ADDS the element on the start and returns a SEQUENCE instead of the vector itself
+;; [conj] works as expected: for vectors it adds on top of the stack, for lists at the begg of the list
+;; explain: [cons] on vector adding on the begg of the data-structure??? maybe because clojure evals first the
+;; arguments and the operand-in this case the function cons -> and it knows the function will pre-generate
+;; a sequence on the eval of args step; that sequence is used instead to "now normally" prepend the element
+;; on the begg of the list.
+
+
+(conj '(2 3 4) 1); (1 2 3 4)
+(cons 1 '(2 3 4)); (1 2 3 4)
+;; therefore [conj] & [cons] work the SAME on PersistentLists, however they diff in the order of args passed
+
+(doc cons)
+
+;; USE [cons] only FOR SEQUENCES, lazy sequences, ranges! do not use [cons] for vectors(at it returns a sequence back)
+;; and do not use [cons] for persistentLists because the result is not guaranteed that it will behave consistently
+
+(pop []); throws IllegalStateException: cannot pop empty vector
+(pop '()); throws IllegalStateException: cannot pop empty list
+(next []); nil
+(next '()); nil
+(rest []); ()
+(rest '()); ()
+
+
+(contains? [1 2 3] 2)
+(contains? '(1 2 3) 2); IllegalArgumentException: contains? not supported on persistentLists
+
+;; dont use lists to find items by index! because clojure starts from the begg in finding the item -> O(n)
+;; practical reason why:
+((list 1 2 3) 0); ; classCastException
+
+(cons 1 nil)
+
+(cons 1 '(2 3 4)); (1 2 3 4)
+(pop '(1 2 3 4)); (2 3 4)??? wtf": pop poppes an element from the start of the list
+(peek '(1 2 3 4)); 1
+;; [pop] + [peek] of PersistentStack funcs operate on lists from the begginging!!!
+
+
+;; because any persistentList implements the PersistentStack which provides the: [peek] + [pop] funcs
+(peek '(1 2 3)); 1
+(pop '(1 2 3)); (2 3)
+;; as seen the peek is the same as: [first]; while [next] & [rest] is the same as [pop]
+
+(next '(1 2 3)); (2 3)
+;; same as [rest]
+(rest '(1 2 3)); (2 3)
+;; the differences come when the collection is empty, or has 1 element
+(pop '(1)); ()
+(rest '(1)); ()
+(next '(1)); nil
+
+(pop '()); illegalStateException:: cannot pop empty list
+(next '()); nil
+(rest '()); ()
+
+(pop []); illegalStateException:: cannot pop an empty vector
+(next []); nil
+(rest []); ()
+
+;; its OK that the vectors + lists share the same behavior, for these 3 funcs, however the vectors works from top of the stack
+;; while the lists work this funcs from the start of the list(leftmost)
+
+(cons 1 [2 3 4]); (1 2 3 4) --> returns a seq back, and as seq work by adding items to the start of the list
+
+(into [] (rest [1 2 3])); [2 3]
+
+(pop [1]); []
+;; IMPORTANT: for vectors! use always ONLY: [conj] + [pop];
+;; DON'T USE [cons] + [next] + [rest] as they all return a sequence back -> and the results are based on the SEQ
+;; NOT based on the initial vector passed; there's a "cast" into based on the func type: cons + next + rest ->
+;; the type of collection is identified(seq, hashes, vectors) -> and then converted to certain type
+;; then the operation is performed
+
+(first {:one 1 :two 2}); [:one 1]
+(vector? (first {:one "one" :two "two"})); true
+(seq {:one 1 :two 2}); ([:one 1] [:two 2])
+
+(doseq [[each-key each-val] {:one 1 :two 2}]
+  (println (str "each key: " each-key ", each val: " each-val)) )
+
+(source doseq)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; QUEUEs: FIFO as oposed to vectors which behave MORE like STACKs(LIFO)
+;; peek -> peeks the first element from queue without removing
+;; conj -> adds on element at the top of the queue
+;; pop -> return a new queue with the leftmost(first) element removed from queue
+(def my-queue (conj clojure.lang.PersistentQueue/EMPTY "one" "two" "three"))
+(peek my-queue); "one"
+(def new-queue (conj my-queue "four"))
+(count my-queue); 3
+(count new-queue); 4
+(sequential? my-queue); true
+
+(def init-queue (pop new-queue))
+(count init-queue); 3
+(= my-queue init-queue); false
+(identical? my-queue init-queue); false
+eval my-queue
+(doc mapcat)
+
+;; queues are not a common behavior thus clojure did NOT incorporate naturally in its language, but provides a simple way
+;; to start build one from the [clojure.lang.PersistentQueue/EMPTY];
+
+(= [1 2 3] [1 2 3]); true
+(= '(1 2 3) '(1 2 3)); true
+
+
+;; DO NOT BE TEMPTED TO use [rest] for QUEUES!!! instead of [pop]; always use POP.
+;; why? because [rest] indeed removes the first element from queue -> BUT IT is a list/seq like operation
+;; and hence the data-structure(queue) is translated to a 'seq' before -> and in return of [rest] -> we get
+;; a seq back NOT a queue.
+
+;;;;;;;;;;; Clojure SETS ;;;;;;;;;;;;;
+;; immutable unsorted collections
+;;
+;; lookup by using set-coll as a function
+(#{:a :b :c :d} :a); :a
+
+;; lookup by using :key of the set-coll as a function
+(:a #{:a :b :c}); :a
+
+;; lookup by using the abstract get passing the :key
+(get #{:a :c :d} :a); :a
+
+;; lookup for not-found, and specify a default :key
+(get #{:a :c :d} :z :not-found); :not-found
+
+(get #{:a :c :d} :z); :nil
+
+([1 2 3] 0); 1
+
+;; as said earlier, trying to find an element within a vector using the [contains?] function
+;; will not produce the expect result, contains takes a :key/index instead of the value;
+;; however clojure provides the [some predicate coll] function that returns the first
+;; element that evaluates to true;
+(doc some)
+(some #{3} [1 2 3]); 3
+;; a common clojure idiom for replicating the [contains?] behavior for vectors
+;; the set-predicate in this case, finds if any of truthy values in the set are contained in the collection
+
+;; clojure-sorted-sets have one thing to mention about:
+;; as in java they should all be of the same type!!! if mixing the :key with numbers, say -> ClassCastException is
+;; being threw!
+(def my-sorted-set (sorted-set :c :a :b)); #{:a :b :c}
+(conj my-sorted-set "not keyword"); ClassCastException is thrown!
+
+;; because the internal comparator is comparing by 1 type, and they are not the same type
+;; however we can provide the comparator to use
+(def my-sorted-set-comp (sorted-set-by #((comp > str) %1 %2) "ab" "cc" "dd" :d))
+(println my-sorted-set-comp); #{:d dd cc ab} --> as you see there's no ClassCastException
+                            ; for diff types when a comparator is provided in place
+
+(doc sorted-set-by)
+;; internally set behaves as the hash, but values are bound to the corresponding :keys; each :key = each value
+;; however a cross check is made for each :key while insertion.
+
+;; import a function into the current namespace via:
+(ns other
+  (:require clojure.set))
+
+;; or require the function on the fly:
+(require 'clojure.set)
+
+;; clojure purely inherits the mathematical principles of sets: Intersection, Union, Difference
+(clojure.set/intersection #{1 2 3 4}
+                          #{3 4 5 6}); #{4 3}
+(clojure.set/union #{1 2 3}
+                   #{3 4 5 6}); #{1 4 6 3 2 5}
+(clojure.set/difference #{1 2 3 4}
+                        #{3 4 5 6}); #{1 2}
+;; one would expect that [clojure.set/difference] would give a result: #{1 2 5 6}
+;; however [difference] func returns something like the collection A - collection B;
+
+;;;;;;;;;;;;;;;;; Hashes ;;;;;;;;;;;;;;;;;;
+;; many of the clojure collection act as FUNCTIONS of their KEYS.
+;; --> hash-map collection can be invoked as a function passing as arg the KEY to lookup
+;; --> Keys can be used as well as functions that lookup themselvs in the hash-map container passed as argument.
+;; strange but nice :)
+(def my-hash-map {:a 2
+                  :b 4
+                  :c 5})
+;; hash-map collection as afunction
+(my-hash-map :a); 2
+
+;; hash-map key as a function
+(:c my-hash-map); 5
+
+(get my-hash-map :b); 4
+(get my-hash-map :z :not-found); returns nil or default: :not-found
+
+;; hash-map uses as we would expect the [seq] function as "iterator", which returns a sequence of MapEntrys tuples(in a vector)
+(seq my-hash-map); ([:a 2] [:b 4]...)
+
+;; ' means do not evalute!!! use as a string literal
+(use 'clojure.repl)
+(use 'clojure.java.javadoc)
+;; using the doseq sequence abstraction, we can iterate through, by destructuring each MapEntry into a bound key-value synonyms
+;;
+(doseq [[mk mv] my-hash-map]
+  (println (str "my map with key: " mk ", value: " mv))); as expected...
+;; internally the [doseq] function abstraction starts iterating through the hash-map-entries
+;; and we destructure EACH map-entry into a valuable synonyms
+(doc doseq)
+
+(into {} (seq my-hash-map)); {:a 2, :b 4, :c 5}
+
+;; even if our pairs are NOT vectors we can transform them to be:
+(def a-vec-of-lists '[(:a 1) (:b 2)])
+(into {} (map vec a-vec-of-lists)); {:a 1, :b 2}
+;; hey [map] func, take the [vec] function which accepts 1 arg, and while each iteration
+;; apply me the [vec] function over the iterated-list-pair
+
+(apply hash-map [:a 1 :b 2]); {:b 2, :a 1}
+(zipmap [:a :b] [1 2]); {:b 2, :a 1}
+;; zipmap takes exactly 2 arguments and pairs them to return a map back
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Exercise_1: build a function that given an element -> would return the positional index of it in the container
+;; should work a a sequence abstraction, disregarding the container type: if hash-map || hash-set -> :key
+;; else if sequence -> index. <<---- DONE!
+(defn pos
+  "for the given item-arg -> pos returns the index for sequences || unsorted sets/hash-maps containers
+     pos :a [:b :c :a] -> 2
+     pos :z #{:a :b: :z} -> :z
+     pos :foo {:bar 2 :foo 3} -> :foo"
+  [item container]
+    (cond
+       (set? container)
+          (item container)
+        (map? container)
+          (when (not (nil? (some #(identical? item %1) (keys container))))
+            item)
+        :else
+          (let [seq-container (seq container)]      ; one-time transformation
+              (loop [init-ret-val 0
+                     popped-container seq-container]
+                (cond (empty? popped-container)
+                        nil
+                      (= item (first popped-container))
+                        init-ret-val
+                :else
+                      (recur (inc init-ret-val) (rest popped-container)))))))
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; TESTING the [pos] custom built function:
+(pos :a {:b 2, :z 1, :a 3}); :a
+(pos :a #{:b 2 :a 3}); :a
+(pos 2 [1 2 3 4]); 1
+(pos "cc" '("aa" "bb" "cc" "dd")); 2
+
+(pos :m {:b 2, :z 1, :a 3}); nil
+(pos :c {}); nil
+(pos :c #{}); nil
+(pos 333 [1 2 3]); nil
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(cond (set? #{:b 2 :a 3}) "set"); set
+(get #{:b :a 3} :a); :a
+
+(:a #{:a}); :a
+(some #(identical? :h %1) (keys {:a 2 :z 22 :b 3})); nil
+(when (zero? (some #(compare :a %1) (keys {:a 2 :b 3})))
+  :z)
+
+(cond
+   (zero? (some #(compare :b %1) (keys {:a 2 :b 3})))
+      :b
+   :else
+     (cond (nil? nil)
+           nil)
+      :else :z); nil
+
+(some #(= :a %1) [1 2 3])
+(= :a "b")
+
+(vector? [1])
+(keys {:a 2 :v 3})
+(map? {})
+(zero? (some #(compare :z %1) (keys {:a 2 :b 3})))


Improve fn names and refactoring :nail_care:

--- src/com/wsscode/pathom/connect/run_graph.cljc
+++ src/com/wsscode/pathom/connect/run_graph.cljc
@@ -144,20 +144,33 @@
 (defn merge-node-provides [out target-node-id {::keys [provides]}]
   (update-in out [::nodes target-node-id ::provides] merge-io provides))

+(defn collapse-dynamic-nodes
+  "Collapses new-node into collapse-node-id. This function is intended to be used
+  to merge two dynamic nodes. When this happens, the requires and provides of both
+  nodes will get merged, new-node is gonna be removed from the graph and new provides
+  get propagated back."
+  [{::keys [root] :as out}
+   env
+   new-node
+   collapse-node-id]
+  (-> out
+      (merge-node-requires collapse-node-id new-node)
+      (merge-node-provides collapse-node-id new-node)
+      (merge-node-requires root new-node)
+      (remove-node new-node)
+      (propagate-provides {::node-id collapse-node-id})
+      (simplify-branch env)))
+
 (defn add-branch-node
+  "Given a branch node is the root, this function will add the new node as part
+  of that branch node. If the node is a repeating dynamic node it will cause the new node
+  to be collapsed into the already existent dynamic node."
   [{::keys [root] :as out}
    {::keys [branch-type] :as env}
    {::keys [node-id]}]
-  (let [node          (get-node out node-id)
-        merge-node-id (find-dynamic-node-to-merge out env node)]
-    (if merge-node-id
-      (-> out
-          (merge-node-requires merge-node-id node)
-          (merge-node-provides merge-node-id node)
-          (merge-node-requires root node)
-          (remove-node node)
-          (propagate-provides {::node-id merge-node-id})
-          (simplify-branch env))
+  (let [node (get-node out node-id)]
+    (if-let [collapse-node-id (find-dynamic-node-to-merge out env node)]
+      (collapse-dynamic-nodes out env node collapse-node-id)
       (-> out
           (update-in [::nodes root branch-type] conj node-id)
           (merge-node-provides root node)
@@ -175,18 +188,18 @@
   [{::keys [root] :as out} env node branch-node]
   (let [root-next      (get-in out [::nodes root ::run-next])
         optimize-next? (optimize-merge? out node)
-        or-node        (cond-> branch-node
+        branch-node    (cond-> branch-node
                          optimize-next?
                          (assoc ::run-next root-next))
-        or-node-id     (::node-id or-node)]
+        branch-node-id (::node-id branch-node)]
     (-> out
-        (assoc-in [::nodes or-node-id] or-node)
-        (update-in [::nodes root] assoc ::after-node or-node-id)
+        (assoc-in [::nodes branch-node-id] branch-node)
+        (update-in [::nodes root] assoc ::after-node branch-node-id)
         (cond-> optimize-next?
                 (-> (update-in [::nodes root] dissoc ::run-next)
                     (update-in [::nodes root] reset-provides env)
-                    (update-in [::nodes root-next] assoc ::after-node or-node-id)))
-        (assoc ::root or-node-id)
+                    (update-in [::nodes root-next] assoc ::after-node branch-node-id)))
+        (assoc ::root branch-node-id)
         (add-branch-node env node))))

 (defn compute-root-branch
@@ -224,7 +237,8 @@
          ::provides (-> out get-root-node ::provides)
          ::run-or   [(::root out)]}))))

-(defn compute-root-and [out env node]
+(defn compute-root-and
+  [out env node]
   (if (= (::root out) (::node-id node))
     out
     (compute-root-branch out (assoc env ::branch-type ::run-and) node
@@ -235,7 +249,8 @@
            ::provides provides
            ::run-and  [(::root out)]})))))

-(defn create-sym-node
+(defn create-resolver-node
+  "Create a new node representative to run a given resolver."
   [out
    {::keys                           [run-next provides input]
     :com.wsscode.pathom.connect/keys [attribute sym index-resolvers]
@@ -260,12 +275,15 @@
         run-next
         (assoc ::run-next run-next)))))

-(defn extend-node-run-next [{::keys [index-syms] :as out} {::keys [run-next run-next-stack] :as env}]
+(defn extend-resolver-run-next
+  "Extend "
+  [{::keys [index-syms] :as out}
+   {::keys [run-next run-next-trail] :as env}]
   (if run-next
     (if-let [node-ids (seq (get index-syms (pc-sym env)))]
       (reduce
         (fn [out node-id]
-          (if (contains? run-next-stack node-id)
+          (if (contains? run-next-trail node-id)
             out
             (let [node      (get-in out [::nodes node-id])
                   new-out   (compute-root-and (assoc out ::root (::run-next node)) env {::node-id run-next})
@@ -343,8 +361,8 @@
             (dissoc out ::root)
             (-> env
                 (dissoc pc-attr)
-                (update ::run-next-stack p.misc/sconj (::root out))
-                (update ::attr-deps-stack p.misc/sconj (pc-attr env))
+                (update ::run-next-trail p.misc/sconj (::root out))
+                (update ::attr-deps-trail p.misc/sconj (pc-attr env))
                 (assoc ast-node (eql/query->ast (vec missing))
                   ::run-next (::root out)
                   ::provides (::provides root-node))))]
@@ -370,13 +388,12 @@

 (defn resolver-input-paths
   [out
-   {::keys [available-data run-next attr-deps-stack]
+   {::keys [available-data run-next]
     :as    env}
    inputs resolvers]
   (let [missing (into #{} (remove #(contains? available-data %)) inputs)
         env     (assoc env ::input (into {} (map #(hash-map % {})) inputs))]
-    (if (or (contains? inputs (pc-attr env))
-            (contains? attr-deps-stack (pc-attr env)))
+    (if (contains? inputs (pc-attr env))
       out
       (as-> out <>
         (dissoc out ::root)
@@ -387,10 +404,10 @@
               out
               (let [env (assoc env pc-sym resolver)]
                 (if-let [sym-node-id (get-resolver-extension-node-id out env)]
-                  (-> (extend-node-run-next out env)
+                  (-> (extend-resolver-run-next out env)
                       (update-in [::nodes sym-node-id ::requires] merge-io {(pc-attr env) {}})
                       (update-in [::nodes sym-node-id ::provides] merge-io {(pc-attr env) {}}))
-                  (let [node (create-sym-node out env)]
+                  (let [node (create-resolver-node out env)]
                     (-> out
                         (include-node node)
                         (cond-> (and run-next (not= run-next (::node-id node)))
@@ -444,14 +461,15 @@

 (defn compute-attribute-graph
   [{::keys [unreachable-attrs] :as out}
-   {::keys                           [available-data]
+   {::keys                           [available-data attr-deps-trail]
     :com.wsscode.pathom.connect/keys [index-oir]
     {attr :key}                      :edn-query-language.ast/node
     :as                              env}]
   (let [env (assoc env pc-attr attr)]
     (cond
       (or (contains? available-data attr)
-          (contains? unreachable-attrs attr))
+          (contains? unreachable-attrs attr)
+          (contains? attr-deps-trail attr))
       out

       (contains? index-oir attr)


don't ask for -target of nil and let the browser do its thing

--- frontend/history.cljs
+++ frontend/history.cljs
@@ -87,30 +87,26 @@
   (let [dom-helper (goog.dom.DomHelper.)]
     (events/listen top-level-node "click"
                    #(let [-target (.. % -target)
-                          _ (set! js/window.teste %)
                           target (if (= (.-tagName -target) "A")
                                    -target
                                    (.getAncestorByTagNameAndClass dom-helper -target "A"))
-                          new-window? (or (new-window-click? %) (= (.-target target) "_blank"))
                           location (when target (str (.-pathname target) (.-search target) (.-hash target)))
                           new-token (when (seq location) (subs location 1))]
                       (when (and (seq location)
                                  (= (.. js/window -location -hostname)
-                                    (.-hostname target)))
+                                    (.-hostname target))
+                                 (not (or (new-window-click? %) (= (.-target target) "_blank"))))
                         (.stopPropagation %)
                         (.preventDefault %)
-                        (cond
-                          new-window?
-                            (do (utils/mlog "new window at" location)
-                                (window/open location))
-                          (and (route-fragment location)
-                               (path-matches? (.getToken history-imp) new-token))
-                            (do (utils/mlog "scrolling to hash for" location)
-                                ;; don't break the back button
-                                (.replaceToken history-imp new-token))
-                          :else
-                            (do (utils/mlog "navigating to" location)
-                                (.setToken history-imp new-token))))))))
+                        (if (and (route-fragment location)
+                                 (path-matches? (.getToken history-imp) new-token))
+
+                          (do (utils/mlog "scrolling to hash for" location)
+                              ;; don't break the back button
+                              (.replaceToken history-imp new-token))
+
+                          (do (utils/mlog "navigating to" location)
+                              (.setToken history-imp new-token))))))))

 (defn new-history-imp [top-level-node]
   ;; need a history element, or goog will overwrite the entire dom


create bucket if doesn't exists

create bucket if doesn't exists

--- src/vignette/storage/s3.clj
+++ src/vignette/storage/s3.clj
@@ -104,13 +104,15 @@
           (create-stored-object stream meta-data file-name)))))
   (put-object [this resource bucket path]
     (let [file (file-stream resource)
-          mime-type (content-type resource)]
+          mime-type (content-type resource)] {
+      (if (perf/timing :s3-get (s3/bucket-exists? creds bucket))
+        (perf/timing :s3-put (s3/create-bucket creds bucket)))
       (when-let [response (perf/timing :s3-put (s3/put-object (add-timeouts :put (:creds this))
                                                               bucket
                                                               path
                                                               file
                                                               {:content-type mime-type}))]
-        response)))
+        response)}))
   (delete-object [this bucket path])
   (object-exists? [this bucket path]
     (s3/object-exists? (add-timeouts :head (:creds this))


Log if there are no plugins to load

Log if there are no plugins to load

--- src/yetibot/core/loader.clj
+++ src/yetibot/core/loader.clj
@@ -85,7 +85,7 @@
 ;; https://github.com/yetibot/yetibot/issues/1038
 (defn load-plugins []
   (let [{plugins :value} (plugins-config)]
-    (when plugins
+    (if plugins
       ;; load the plugins 1 by 1 without concurrency
       (run!
        (fn [[_ {:keys [artifact version] :as plugin}]]
@@ -93,7 +93,8 @@
                 \newline
                 (add-dependencies :coordinates [[(symbol artifact) version]]
                                   :repositories default-repositories)))
-       plugins))))
+       plugins)
+      (info "There are no plugins configured to load"))))

 (defn load-all
   "Load all plugins, observers, and commands.


add examples for EN amount of money

add examples for EN amount of money

--- resources/duckling/corpus/en.finance.clj
+++ resources/duckling/corpus/en.finance.clj
@@ -54,4 +54,7 @@
 )

 ;around $200
-;between $200 and $300+;between $200 and $300
+;around 200-500 dollars
+;up to 1000
+;~50-100


Get ready to play simple version.

Get ready to play simple version.

--- src/african_polyphony_and_polyrhythm/talk.clj
+++ src/african_polyphony_and_polyrhythm/talk.clj
@@ -98,6 +98,7 @@
         (big (big tete)) (big (big ta)) (big (big ha)) (big (big tulule)) (big (big bongo))
         (big (big (big tete))) (big (big (big ta))) (big (big (big ha)))]
        (map rand-variations)
+       ;(map first)
        (reduce with)))

 (def inverse-pentatonic (comp (partial + 12) pentatonic -))


implement wire stuff for transit

implement wire stuff for transit

--- src/clj/puppetlabs/trapperkeeper/rpc/wire.clj
+++ src/clj/puppetlabs/trapperkeeper/rpc/wire.clj
@@ -11,8 +11,17 @@

 (def transit-serializer
   (reify RPCSerializer
-    (encode [this data] "HI")
-    (decode [this data] "HI")))
+
+    (encode [this data]
+      (let [out (ByteArrayOutputStream.) ;; grow as needed
+            writer (transit/writer out :json)]
+        (transit/write writer data)
+        out))
+
+    (decode [this data]
+      (let [in (ByteArrayInputStream. (.toByteArray data))
+            reader (transit/reader in :json)]
+        (transit/read reader)))))

 (def json-serializer
   (reify RPCSerializer
@@ -33,8 +42,14 @@

 (def transit-wire
   (reify RPCWire
-    (build-response [this data] "TODO")
-    (parse-request [this request] "TODO")))
+    (build-response [this data]
+      (-> (encode transit-serializer data)
+          response
+          (header "content-type" "application/octet-stream")))
+
+    (parse-request [this request]
+      (let [parsed (decode transit-serializer (:body request))]
+        (assoc parsed :svc-id (keyword (:svc-id parsed)))))))

 (def json-wire
   (reify RPCWire


Name spacing metadata comms group-id

Name spacing metadata comms group-id

--- src/kixi/datastore/metadatastore/inmemory.clj
+++ src/kixi/datastore/metadatastore/inmemory.clj
@@ -66,7 +66,7 @@
         (let [new-data (atom {})]
           (info "Starting InMemory Metadata Store")
           (c/attach-event-handler! communications
-                                   :metadatastore
+                                   :kixi.datastore/metadatastore
                                    :kixi.datastore/file-metadata-updated
                                    "1.0.0"
                                    (comp response-event (partial update-metadata-processor new-data) :kixi.comms.event/payload))


:eyes:

:eyes:

--- src/main/clj/agency/irl/instagrammer/core.clj
+++ src/main/clj/agency/irl/instagrammer/core.clj
@@ -118,7 +118,8 @@

     (unsubscribe/all-sync)

-    (let [geo-sub (subscribe/geo :lng 0 :lat 0 :radius 100)
+    (let [geo-sub-1 (subscribe/geo :lng 74.0059 :lat 40.7127 :radius 5000)
+          geo-sub-2 (subscribe/geo :lat 40.7127 :lng 74.0059 :radius 5000)
           tag-sub (subscribe/tag :tag "yolo")]))


Cassaforte 2.0.0-beta8

Cassaforte 2.0.0-beta8

Note: there is a [breaking public API change](http://blog.clojurewerkz.org/blog/2014/10/13/cassaforte-2-dot-0-0-beta8-is-released/) that
may affect some migrations but otherwise it's the most solid Cassaforte release to date.

May be worth bumping Joplin to `0.2.0` after merging this.

--- joplin.cassandra/project.clj
+++ joplin.cassandra/project.clj
@@ -6,5 +6,5 @@
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.6.0"]
-                 [clojurewerkz/cassaforte "2.0.0-beta6"]
+                 [clojurewerkz/cassaforte "2.0.0-beta8"]
                  [joplin.core "0.1.14-SNAPSHOT"]])


releasing v0.3.0

releasing v0.3.0

--- ingestion-api/project.clj
+++ ingestion-api/project.clj
@@ -1,4 +1,4 @@
-(defproject ingestion-api "0.3.0-SNAPSHOT"
+(defproject ingestion-api "0.3.0"
   :description "Ingestion APIs for Samsara's analytics"
   :url "https://samsara.github.com/"
   :license {:name "Apache License 2.0"


Fix react warning

Fix react warning

--- src/cljs/elevent_client/pages/statistics.cljs
+++ src/cljs/elevent_client/pages/statistics.cljs
@@ -13,12 +13,13 @@
   (let [event-id (atom 0)]
     (fn []
       (let [events
-            (filter (fn [[event-name event-id]]
-                      (get-in (:EventPermissions (:permissions @state/session))
-                              [event-id :EditEvent]))
-                    (d/q '[:find ?name ?id
-                           :where [?id :Name ?name]]
-                         @api/events-db))
+            (doall
+              (filter (fn [[event-name event-id]]
+                        (get-in (:EventPermissions (:permissions @state/session))
+                                [event-id :EditEvent]))
+                      (d/q '[:find ?name ?id
+                             :where [?id :Name ?name]]
+                           @api/events-db)))

             attendees
             (d/q '[:find [?check-in-time ...]


(maint) delete extraneous arguments to factsets endpoint

The factsets endpoint has some non-functioning url arguments copied from the facts
endpoint in error. This patch deletes them.

--- src/com/puppetlabs/puppetdb/http/factsets.clj
+++ src/com/puppetlabs/puppetdb/http/factsets.clj
@@ -53,16 +53,7 @@
   [query-app]
   (app
     []
-    (verify-accepts-json query-app)
-
-    [fact value &]
-    (comp query-app
-          (partial http-q/restrict-fact-query-to-name fact)
-          (partial http-q/restrict-fact-query-to-value value))
-
-    [fact &]
-    (comp query-app
-          (partial http-q/restrict-fact-query-to-name fact))))
+    (verify-accepts-json query-app)))

 (defn factset-app
   [version]


First stab at hybrid blocks heuristics

First stab at hybrid blocks heuristics

--- src/edu/berkeley/ai/domains/hybrid_blocks.clj
+++ src/edu/berkeley/ai/domains/hybrid_blocks.clj
@@ -2,7 +2,13 @@
  (:import [java.util HashMap HashSet])
  (:use clojure.test )
  (:require [edu.berkeley.ai [util :as util] [envs :as envs]]
-           [edu.berkeley.ai.envs.hybrid-strips :as hs])
+           [edu.berkeley.ai.envs.hybrid-strips :as hs]
+           [edu.berkeley.ai.angelic :as angelic]
+	   [edu.berkeley.ai.angelic.hybrid
+            [continuous-lp-states :as cls]
+            [fixed-lp-valuations :as hflv]
+            [dnf-lp-valuations :as hdlv]]
+    )
  )

 ;; Idea for heuristic: have "goal-cx", "goal-ty" variables for each block appearing in goal
@@ -14,6 +20,9 @@
 ;; Would be easier if we had state abstraction hierarchy, since we wouldn't have to explicitly
 ;; constrain goal positions (would be handled by "finish").

+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;                           Domain helpers
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (let [f (util/path-local "hybrid_blocks.pddl")]
   (defn make-hybrid-blocks-strips-domain []
@@ -61,7 +70,11 @@
   (apply concat
 	 (for [[b ons] f, on ons]
 	   (process-goal-stack b on))))
-
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;                              Public Interface
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (defn make-hybrid-blocks-strips-env
   "Stacks is a forest of block info items (Table goes from -1 to 0 h, implicit).
@@ -103,6 +116,7 @@

+
 (comment
   (make-hybrid-blocks-strips-env 2 2 [1 1] '[[a 0 0.1 0.2 0.1] [b 0.3 0.2 0.3 0.2]] '[[a [[b]]]])

@@ -125,6 +139,136 @@

+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;                               Heuristic
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; Defines a simple heuristic that only takes the total distance blocks
+; need to move into account, as well as an approximation of get and put costs.
+
+(def *hb-holding-movement-reward* -2)
+(def *hb-get-reward*              -1)
+(def *hb-put-reward*              -1)
+
+(derive ::HybridBlocksActDescriptionSchema ::angelic/Description)
+
+(defmethod angelic/parse-description :hybrid-blocks-act [desc domain params]
+  {:class ::HybridBlocksActDescriptionSchema})
+
+
+(derive ::HybridBlocksActDescription ::angelic/Description)
+
+(defmethod angelic/instantiate-description-schema ::HybridBlocksActDescriptionSchema [desc instance]
+  (let [goal-atoms (util/safe-get instance :goal-atoms)]
+    (assoc desc
+      :class
+        ::HybridBlocksActDescription
+      :goal
+        (envs/get-goal instance)
+      :goal-ons
+        (set (for [a goal-atoms]
+               (do (assert (= (first a) 'on))
+                   a)))
+      :goal-blocks
+         (into {}
+           (for [b (set (apply concat (map rest goal-atoms)))]
+             [b [(util/symbol-cat b "fx") (util/symbol-cat b "fy")]])))))
+
+
+(defmethod angelic/ground-description ::HybridBlocksActDescription [desc var-map] desc)
+
+
+(defn hb-discrete-reward
+  "Take a set of goal 'on' atoms, a set of state 'on' atoms, and possibly
+   a true 'holding' atom, and return a reward for get and put actions."
+  [goal-ons state-ons state-holding]
+  (when state-holding (assert (= (first state-holding) 'holding)))
+  (+
+    (* (count (util/difference-coll goal-ons state-ons))
+       (+ *hb-get-reward* *hb-put-reward*))
+    (cond (not state-holding)
+             0
+          (some #(= (second state-holding) (second %)) goal-ons)
+             (- *hb-get-reward*)
+          :else
+             *hb-put-reward*)))
+
+(defn hb-clause-discrete-reward
+  [desc clause]
+  (hb-discrete-reward
+   (util/safe-get desc :goal-ons)
+   (filter #(= (first %) 'on) (keys clause))
+   (first (filter #(= (first %) 'holding) (keys clause)))))
+
+(defn transform-hb-clp
+  "Add heuristic terms to the CLP, corresponding to all of the necessary
+   on relations holding.  Basic idea: add new variables for x and y positions
+   of all blocks mentioned, constrain them to match the on relation, and then
+   charge for sum of absolute values of distances from current locations.
+   goal-blocks maps block names to usable [final-x final-y] variable names."
+  [clp goal-blocks goal-ons extra-reward]
+  (cls/update-lp-state
+   (reduce
+    (fn [[clp [_ b c]]]
+      (let [[bx by] (util/safe-get goal-blocks b)
+            [cx cy] (util/safe-get goal-blocks c)]
+        (cls/constrain-lp-state-lez
+         (cls/constrain-lp-state-gez
+          (cls/constrain-lp-state-eqz clp
+           {by 1, ['blockh b] -1, cy -1})
+          {bx 1, ['blocklw b] -1, cx -1, ['blocklw c] 1})
+         {bx 1, ['blockrw b] +1, cx -1, ['blockrw c] -1})))
+    (reduce cls/add-lp-state-param clp (apply concat (vals goal-blocks)))
+    goal-ons)
+    (into {}
+      (cons [nil extra-reward]
+        (apply concat
+         (for [[b [bx by]] goal-blocks]
+           [[{bx 1 ['blockcx b] -1}
+             *hb-holding-movement-reward*]
+            [{by 1 ['blockty b] -1}
+             *hb-holding-movement-reward*]]))))))
+
+(defmethod angelic/progress-valuation [::angelic/PessimalValuation ::HybridBlocksActDescription]
+  [val desc]  val)
+
+(defmethod angelic/progress-valuation [::hflv/HybridFixedLPValuation ::HybridBlocksActDescription] [val desc]
+  (let [discrete-reward (hb-clause-discrete-reward desc (util/safe-get val :discrete-state))
+        goal-blocks (util/safe-get desc :goal-blocks)
+        goal-ons (util/safe-get desc :goal-ons)]
+    (angelic/make-conditional-valuation
+     (:goal desc)
+     (apply max
+       Double/NEGATIVE_INFINITY
+       (for [c (util/safe-get val :continuous-lp-state)
+             :let [rew (last (cls/solve-lp-state (transform-hb-clp c goal-blocks goal-ons discrete-reward)))]
+             :when rew]
+         rew)))))
+
+(defmethod angelic/progress-valuation [::hdlv/HybridDNFLPValuation ::HybridBlocksActDescription] [val desc]
+  (let [goal-blocks (util/safe-get desc :goal-blocks)
+        goal-ons (util/safe-get desc :goal-ons)]
+    (angelic/make-conditional-valuation
+     (:goal desc)
+     (apply max
+       Double/NEGATIVE_INFINITY
+       (for [[d c] (util/safe-get val :clause-lp-set)
+             :let [rew (last (cls/solve-lp-state
+                              (transform-hb-clp c goal-blocks goal-ons
+                                                (hb-clause-discrete-reward desc d))))]
+             :when rew]
+         rew)))))
+
+
+(defn make-flat-hybrid-blocks-heuristic [env]
+  (let [d (angelic/ground-description (angelic/instantiate-description-schema (angelic/parse-description [:hybrid-blocks-act] nil nil) env) {})]
+    (fn [s] (angelic/valuation-max-reward (angelic/progress-valuation (angelic/state->valuation   ::hflv/HybridFixedLPValuation s) d)))))
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;                              Visualization
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

@@ -212,6 +356,7 @@
 ;			 as)))
 	       (dec n-steps))))))

+

 (comment


fix for edn reader

fix for edn reader

--- src/main/clojure/clojure/tools/reader/edn.clj
+++ src/main/clojure/clojure/tools/reader/edn.clj
@@ -116,6 +116,7 @@
   (let [ch (read-char rdr)]
     (if-not (nil? ch)
       (let [token (if (or (macro-terminating? ch)
+                          (not-constituent? ch)
                           (whitespace? ch))
                     (str ch)
                     (read-token rdr ch false))


add return type in doc generator if present (close #32)

--- cljs-api-parser/src/core.clj
+++ cljs-api-parser/src/core.clj
@@ -237,6 +237,7 @@
 (defn parse-common
   [form ns- repo]
   (let [name- (second form)
+        return-type (-> name- meta :tag)
         m (meta form)
         lines [(:line m) (:end-line m)]
         num-lines (inc (- (:end-line m) (:line m)))
@@ -245,6 +246,7 @@
         github-link (get-github-file-link repo filename lines)]
     {:ns ns-
      :name name-
+     :return-type return-type
      :full-name (str ns- "/" name-)
      :source source
      :filename filename
@@ -342,6 +344,7 @@
     (keep identity
       [(cljsdoc-section "Name" (:full-name item))
        (cljsdoc-section "Type" (:fn-or-macro item))
+       (cljsdoc-section "Return" (:return-type item))
        (cljsdoc-section "Docstring" (:docstring item))
        (cljsdoc-section "Signature" (join "\n" (:signatures item)))
        (cljsdoc-section "Filename" (:filename item))


Use exit status 0 for command line argument errors

--- clojure/src/biotool/core.clj
+++ clojure/src/biotool/core.clj
@@ -273,12 +273,16 @@
     (timbre/info "Program started")
     (timbre/info "Command line: " (string/join " " *command-line-args*)))

+
+(def exit-success 0)
+(def exit-failure-cli 2) ; Command line argument error
+
 (defn -main
   "Orchestrate the computation"
   [& args]
   (let [{:keys [options arguments errors summary]} (parse-opts args cli-options)]
     (cond
-      (:help options) (exit 0 (usage summary))
-      errors (exit 1 (error-msg errors)))
+      (:help options) (exit exit-success (usage summary))
+      errors (exit exit-failure-cli (error-msg errors)))
     (init-logging (:log options))
     (process-fasta-files (:minlen options) arguments)))


Updated titan deps.

Updated titan deps.

--- components/titan/project.clj
+++ components/titan/project.clj
@@ -3,9 +3,9 @@
             :modules {:parent "../.."}
             :description "A titan component"
             :dependencies [[gorillalabs.tesla/core :version]
-                           [gorillalabs/titanium "1.0.2"]
-                           [gorillalabs/titan-cassandra "1.1.0g"]
-                           [gorillalabs/titan-lucene "1.1.0g"]
+                           [gorillalabs/titanium "1.0.5"]
+                           [gorillalabs/titan-cassandra "1.1.1"]
+                           [gorillalabs/titan-lucene "1.1.1"]
                            [org.xerial.snappy/snappy-java "1.1.2.4"] ;; keep this version
                            [commons-codec "1.10"]  ;; keep this version
                            [commons-lang "2.6"]  ;; keep this version


Noting that there's probably a better way to do this

--- jvm-runner/src/clojure/codewars/runners/java.clj
+++ jvm-runner/src/clojure/codewars/runners/java.clj
@@ -30,6 +30,8 @@
   (let [class-loader
         (URLClassLoader/newInstance
          (into-array [(io/as-url dir)]))]
+    ;; TODO: Classes don't reload
+    ;; Try this: http://tutorials.jenkov.com/java-reflection/dynamic-class-loading-reloading.html
     (Class/forName (name class-name) true class-loader)))

 (defn- run-junit-tests


Added [Back] link to all pages (w/o the front page of course)

--- src/hurvinek/html_renderer.clj
+++ src/hurvinek/html_renderer.clj
@@ -66,6 +66,16 @@
              [:li [:a {:href first-link} first-name]]
              [:li [:a {:href second-link} second-name]]]))

+(defn render-back-link
+    "Render link to go back."
+    [link]
+    [:div {:class "container-fluid"}
+        [:br]
+        [:br]
+        [:br]
+        [:a {:href link} "Back"]
+    ])
+
 (defn render-front-page
     "Render front page of this application."
     [url-prefix title]
@@ -101,6 +111,7 @@
                 [:div {:class "container-fluid"}
                     [:h2 "Help"]
                 ]
+                (render-back-link url-prefix)
                 (render-html-footer)
             ] ; </div class="container">
         ] ; </body>
@@ -124,6 +135,7 @@
                         [:tr [:td "Components"] [:td (:components db-stat)]]
                     ]
                 ]
+                (render-back-link url-prefix)
                 (render-html-footer)
             ] ; </div class="container">
         ] ; </body>
@@ -141,6 +153,7 @@
                 [:div {:class "container-fluid"}
                     [:h2 "Export database"]
                 ]
+                (render-back-link url-prefix)
                 (render-html-footer)
             ] ; </div class="container">
         ] ; </body>
@@ -164,6 +177,7 @@
                             [:td [:a {:href (str "product?product-id=" (:id product))} (:description product)]]])
                     ]
                 ]
+                (render-back-link url-prefix)
                 (render-html-footer)
             ] ; </div class="container">
         ] ; </body>
@@ -187,6 +201,7 @@
                             [:td [:a {:href (str "chapter?product-id=" product-id "&chapter-id=" (:id chapter) "&action=rename-chapter")} "rename"]]
                             [:td [:a {:href (str "chapter?product-id=" product-id "&chapter-id=" (:id chapter) "&action=grouplist")} "group list"]]])
                 ]]
+                (render-back-link (str url-prefix "select-product"))
                 (render-html-footer)
             ] ; </div class="container">
         ] ; </body>
@@ -209,8 +224,9 @@
                             [:td [:a {:href (str "group?product-id=" product-id "&chapter-id=" chapter-id "&group-id=" (:id group))} (:name group)]]
                         ])
                 ]]
-                (render-html-footer)
-            ] ; </div class="container">
-        ] ; </body>
-    ))
-
+                (render-back-link (str "product?product-id=" product-id))
+                (render-html-footer)
+            ] ; </div class="container">
+        ] ; </body>
+    ))
+


fix: use boolean fn for option keys in template-data

Fixes #106

--- src/leiningen/new/re_frame.clj
+++ src/leiningen/new/re_frame.clj
@@ -51,31 +51,31 @@
    :sanitized (name-to-path name)

    ;; css
-   :garden? (helpers/invoke-option garden/option options)
-   :less?   (helpers/invoke-option less/option options)
+   :garden? (helpers/option? garden/option options)
+   :less?   (helpers/option? less/option options)

    ;; debug
-   :re-frisk? (helpers/invoke-option "+re-frisk" options)
+   :re-frisk? (helpers/option? "+re-frisk" options)
    :10x?      (helpers/option? "+10x" options)

-   ;; devlopment
-   :cider?   (helpers/invoke-option cider/option options)
-   :test?    (helpers/invoke-option test/option options)
+   ;; development
+   :cider?   (helpers/option? cider/option options)
+   :test?    (helpers/option? test/option options)

    ;; full-stack
-   :handler?    (helpers/invoke-option handler/option options)
+   :handler?    (helpers/option? handler/option options)
    :prep-garden (when (helpers/option? garden/option options)
                   ["garden" "once"])
    :prep-less   (when (helpers/option? less/option options)
                   ["less" "once"])

    ;; misc.
-   :re-com?     (helpers/invoke-option re-com/option options)
+   :re-com?     (helpers/option? re-com/option options)
    :re-pressed? (helpers/option? "+re-pressed" options)
    :breaking-point? (helpers/option? "+breaking-point" options)

    ;; routing
-   :routes? (helpers/invoke-option routes/option options)})
+   :routes? (helpers/option? routes/option options)})


More absolute URLs

More absolute URLs

--- src/circle/web/views/common.clj
+++ src/circle/web/views/common.clj
@@ -68,7 +68,7 @@
               <script src=\"http://html5shiv.googlecode.com/svn/trunk/html5.js\"></script>
               <![endif]-->"
     (css "http://fonts.googleapis.com/css?family=PT+Sans" :rel "stylesheet" :type "text/css" :media "screen")
-    (include-js "/js/jquery_minimized_core.js" "js/wufoo.js")
+    (include-js "/js/jquery_minimized_core.js" "/js/wufoo.js")
     [:title "Circle - Continuous Integration made easy"]]
    [:body
     [:div#notthefooter


remove unneeded block-rate

remove unneeded block-rate

--- src/cljs/pain_tetris/turns.cljs
+++ src/cljs/pain_tetris/turns.cljs
@@ -11,8 +11,6 @@
                 :height 20})

 (defonce block-speed (atom 1))
-(defonce drop-rate (atom 5))
-
 (defonce timer (atom nil))
 (defonce turn-counter (atom 0))
 (defonce drop-side (atom :top))
@@ -66,9 +64,7 @@
       (swap! points (partial + (* (count rows-full)
                                   (count rows-full))))
       (when (> rows-full 0)
-        (if (even? rows-full)
-          (swap! drop-rate inc)
-          (swap! block-speed inc)))
+        (swap! block-speed inc))
       (swap! grid (partial g/clear-full-rows))
       (swap! grid #(m/gravity % @gravity-direction))
       (swap! turn-counter inc))


add fuck-given end-point

add fuck-given end-point

--- src/clojure_web_app/handler.clj
+++ src/clojure_web_app/handler.clj
@@ -20,6 +20,8 @@
     ((:headers request) "x-forwarded-for")
     (:remote-addr request)))

+(def fucks-given 0)
+
 (defroutes app-routes
            (GET "/rest/print-query-params" [& args] (response args))
            (GET "/rest/fuel-near-me" [lat lon limit distance fuel]
@@ -28,6 +30,9 @@
                  (response (service/nearby-fuel-prices lat lon limit distance fuel location)))))
            (GET "/rest/my-location" []
              (fn [request] (response (service/location-by-ip (get-ip-from request)))))
+           (GET "/rest/fuck", [] (fn [req]
+                                   (do (def fucks-given (inc fucks-given))
+                                       {:status 201 :body {:fucksGiven fucks-given}})))
            (GET "/" [] (clojure.java.io/resource "public/index.html"))
            (route/not-found (clojure.java.io/resource "public/404.html")))


Removing some more obsolete dependencies

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/contrib/gui/util.clj
+++ src/conexp/contrib/gui/util.clj
@@ -9,17 +9,12 @@
 ;; this file contains contributions by Immanuel Albrecht

 (ns conexp.contrib.gui.util
-  (:import [javax.swing JFrame JMenuBar JMenu JMenuItem Box JToolBar JPanel
-                        JButton ImageIcon JSeparator JTabbedPane JSplitPane
-                        JLabel JTextArea JScrollPane SwingUtilities BorderFactory
-                        AbstractButton SwingConstants JFileChooser JOptionPane
-                        ImageIcon JComponent]
+  (:import [javax.swing JFrame JPanel JButton ImageIcon JTabbedPane
+                        JLabel BorderFactory AbstractButton JFileChooser
+                        JOptionPane JComponent]
            [javax.swing.filechooser FileNameExtensionFilter]
-           [javax.imageio ImageIO]
-           [java.awt GridLayout BorderLayout Dimension Image Font Color
-                     Graphics Graphics2D BasicStroke FlowLayout]
-           [java.awt.event KeyEvent ActionListener ActionEvent MouseAdapter MouseEvent]
-           [java.awt.image BufferedImage]
+           [java.awt Color Dimension Graphics Graphics2D BasicStroke FlowLayout]
+           [java.awt.event ActionListener ActionEvent MouseAdapter MouseEvent]
            [javax.swing.event ChangeListener ChangeEvent]
            [java.io File])
   (:use [conexp.base :only (defvar, defmacro-, first-non-nil, illegal-argument)])


Some aliases

Some aliases

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/fca/implications.clj
+++ src/conexp/fca/implications.clj
@@ -207,6 +207,8 @@
          (if next
            (recur implications next)
            (difference implications background-knowledge))))))
+
+(defalias canonical-base stem-base)

 (defn pseudo-intents
   "Returns the pseudo intents of the given context ctx."
@@ -401,6 +403,8 @@
         :when (>= (confidence impl context) minconf)]
     impl))

+(defalias luxenburger-base luxenburger-basis)
+
 ;;;

 (defn- frequent-pseudoclosed-itemsets


Handle requests which either:  - Prefix match a normalized `uri`  - Exactly match the raw `uri`.

--- metrics-clojure-ring/src/metrics/ring/expose.clj
+++ metrics-clojure-ring/src/metrics/ring/expose.clj
@@ -85,9 +85,10 @@
 (defn expose-metrics-as-json
   ([handler] (expose-metrics-as-json handler "/metrics"))
   ([handler uri]
-   (let [uri (sanitize-uri uri)]
+   (let [request-uri (:uri request)]
      (fn [request]
-       (if (.startsWith (:uri request) uri)
+       (if (or (.startsWith request-uri (sanitize-uri uri))
+               (= request-uri uri))
          (metrics-json request)
          (handler request))))))


Small update to be able to test REST API properly

--- src/emender_jenkins/results.clj
+++ src/emender_jenkins/results.clj
@@ -305,7 +305,8 @@
           jobs          (read-building-jobs-from-jenkins url job-list-part)]
           (reset! currently-building-jobs-jenkins-response jobs)
           (reset! currently-building-jobs
-              (if jobs (create-currently-building-jobs-response jobs) nil))))
+              (if jobs (create-currently-building-jobs-response jobs) nil))
+          jobs))

 (defn get-job-name-from-queue-info
     "Read job name from the structure about one item in Jenkins build queue."
@@ -344,7 +345,8 @@
           jobs  (read-queue-info-from-jenkins url)]
           (reset! jobs-in-queue-jenkins-response jobs)
           (reset! jobs-in-queue
-              (if jobs (create-jobs-in-queue-response jobs) nil))))
+              (if jobs (create-jobs-in-queue-response jobs) nil))
+          jobs))

 (defn prepare-jobs-in-queue
     [jobs-in-queue]


remove reopened, again

remove reopened, again

--- src/gh_waiting_room/service.clj
+++ src/gh_waiting_room/service.clj
@@ -53,9 +53,7 @@
       (case (:action issue)
         "created" (do (update-gh-issues)
                       (create-issue-comment @db (:id issue) (:number issue)))
-        "reopened" (do (update-gh-issues)
-                       (create-issue-comment @db (:id issue) (:number issue)))
-        ;; for closed
+        ;; for closed and reopened
         (when (some #(= (:id %) (:id issue)) (viewable-issues @db))
           (update-gh-issues)))))
   {:status 200})


Fix several mistakes in information model

--- src/onyx/information_model.cljc
+++ src/onyx/information_model.cljc
@@ -47,8 +47,7 @@
             :onyx/min-peers
             {:doc "The minimum number of peers that will be concurrently assigned to execute this task before it begins. If the number of peers working on this task falls below its initial count due to failure or planned departure, the choice of `:onyx/flux-policy` defines the strategy for what to do."
              :type :integer
-             :restrictions ["Value must be greater than 0."
-                            "`:onyx/flux-policy` must also be defined in this catalog entry."]
+             :restrictions ["Value must be greater than 0."]
              :optional? true}

             :onyx/n-peers
@@ -56,8 +55,7 @@
              :type :integer
              :restrictions ["Value must be greater than 0."
                             "`:onyx/min-peers` cannot also be defined for this catalog entry."
-                            "`:onyx/max-peers` cannot also be defined for this catalog entry."
-                            "`:onyx/flux-policy` must also be defined in this catalog entry."]
+                            "`:onyx/max-peers` cannot also be defined for this catalog entry."]
              :optional? true}

             :onyx/language
@@ -90,6 +88,7 @@
             {:doc "When `:onyx/language` is set to `:clojure`, this is a fully qualified, namespaced keyword pointing to a function that takes the Event map and returns a Record implementing the Plugin interfaces. When `:onyx/language` is set to `:java`, this is a keyword pointing to a Java class that is constructed with the Event map. This class must implement the interoperability interfaces."
              :type :keyword
              :choices :any
+             :restrictions ["Namespaced keyword required unless :onyx/language :java is set, in which case a non-namespaced keyword is required."]
              :required-when ["`:onyx/type` is set to `:input`"
                              "`:onyx/type` is set to `:output`"]}

@@ -127,14 +126,16 @@
             :onyx/group-by-key
             {:doc "The key, or vector of keys, to group incoming segments by. Keys that hash to the same value will always be sent to the same virtual peer."
              :type [:any [:any]]
-             :optionally-allowed-when ["`:onyx/type` is set to `:function`"]
-             :restrictions ["Cannot be defined when `:onyx/group-by-fn` is defined."]}
+             :optionally-allowed-when ["`:onyx/type` is set to `:function` or `:output`"]
+             :restrictions ["Cannot be defined when `:onyx/group-by-fn` is defined."
+                            "`:onyx/flux-policy` must also be defined in this catalog entry."]}

             :onyx/group-by-fn
             {:doc "A fully qualified, namespaced keyword that points to a function on the classpath. This function takes a single argument, a segment, as a parameter. The value that the function returns will be hashed. Values that hash to the same value will always be sent to the same virtual peer."
              :type :keyword
-             :optionally-allowed-when ["`:onyx/type` is set to `:function`"]
-             :restrictions ["Cannot be defined when `:onyx/group-by-key` is defined."]}
+             :optionally-allowed-when ["`:onyx/type` is set to `:function` or `:output`"]
+             :restrictions ["Cannot be defined when `:onyx/group-by-key` is defined."
+                            "`:onyx/flux-policy` must also be defined in this catalog entry."]}

             :onyx/bulk?
             {:doc "Boolean value indicating whether the function in this catalog entry denoted by `:onyx/fn` should take a single segment, or the entire batch of segments that were read as a parameter. When set to `true`, this function's return value is ignored. The segments are identically propogated to the downstream tasks."
@@ -147,7 +148,8 @@
             {:doc "The policy that should be used when a task with grouping enabled loses a peer. Losing a peer means that the consistent hashing used to pin the same hashed values to the same peers will be altered. Using the `:kill` flux policy will kill the job. This is useful for jobs that cannot tolerate an altered hashing strategy. Using `:continue` will allow the job to continue running. With `:kill` and `:continue`, new peers will never be added to this job. The final policy is `:recover`, which is like `:continue`, but will allow peers to be added back to this job to meet the `:onyx/min-peers` number of peers working on this task concurrently."
              :type :keyword
              :choices [:kill :continue :recover]
-             :optionally-allowed-when ["`:onyx/type` is set to `:function`"
+             :restrictions ["`:onyx/min-peers` or `:onyx/n-peers` must also be defined for this catalog entry. If `:recover` is used, then `:onyx/max-peers` or `:onyx/n-peers`` must also be defined. "]
+             :optionally-allowed-when ["`:onyx/type` is set to `:function` or `:output`"
                                        "`:onyx/group-by-key` or `:onyx/group-by-fn` is set."]}

             :onyx/uniqueness-key


add #'windows-os? #'linux-os? and #'mac-os? system helper fns

--- src/overtone/helpers/system.clj
+++ src/overtone/helpers/system.clj
@@ -22,3 +22,18 @@
   []
   (map (memfn getPath)
        (seq (.getURLs (.getClassLoader clojure.lang.RT)))))
+
+(defn windows-os?
+  "Returns true if the current os is windows based"
+  []
+  (= :windows (get-os)))
+
+(defn linux-os?
+  "Returns true if the current os is mac based"
+  []
+  (= :linux (get-os)))
+
+(defn mac-os?
+  "Returns true if the current os is bac based"
+  []
+  (= :mac (get-os)))


Update langohr library to 3.7.0

Update langohr library to 3.7.0

- The 3.1.0 version is over 2 years old. It was recommended by the core
  rabbitmq team to update this.

[#136507413]

--- src/rabbitmq-broker/project.clj
+++ src/rabbitmq-broker/project.clj
@@ -2,7 +2,7 @@
   :description "Pivotal CF RabbitMQ service broker"
   :dependencies [[org.clojure/clojure     "1.6.0"]
                  ;; RabbitMQ client (including HTTP API)
-                 [com.novemberain/langohr "3.1.0" :exclusions [clj-http]]
+                 [com.novemberain/langohr "3.7.0" :exclusions [clj-http]]
                  ;; HTTP client which uses HTTPCore 4.2.x, compatible
                  ;; with Spring 3 and CF Java client.
                  [clj-http                "1.0.1"]


make type editable

make type editable

--- src/semtag_web/client/view.cljs
+++ src/semtag_web/client/view.cljs
@@ -47,8 +47,9 @@
   [:td.editable {:title (string/join ", " tags) :data-field "tags"}
     (interpose ", " (map link-tag tags))])

-(defn- td-model [model]
-   [:td [:a {:href (path-to "/" model)} model]])
+(defn- td-type [type]
+   [:td.editable {:title type :data-field "type"}
+     [:a {:href (path-to "/" type)} type]])

 ;;; partials
 (defpartial default-row [row fields]
@@ -76,7 +77,7 @@

 (defpartial tag-search-row [row & fields]
   [:tr {:data-id (:id row)}
-   (td-model (:type row))
+   (td-type (:type row))
    (td-name (:name row))
    (td-url (:url row))
    (td-desc (:desc row))
@@ -90,7 +91,7 @@

 (defpartial model-stats-row [row & fields]
   [:tr
-   (td-model (name (:name row)))
+   (td-type (name (:name row)))
    [:td (:count row)]
    [:td (:name-percent row)]
    [:td (:url-percent row)]
@@ -108,7 +109,7 @@
     [:tr {:data-id (:id row)}
      [:td attr]
      (case attr
-       :type (td-model (:value row))
+       :type (td-type (:value row))
        :url (td-url (:value row))
        :name (td-name (:value row))
        :tags (td-tags (:value row))


Rename main API function.

Rename main API function.

In previous commits, the main API function was `rand-words` (note the
plural). This name is inconsistent with other API functions, for
example, `rand-digit`, which returns a single randomly selected digit.
This commit makes the function name singular and, thus, consistent with
the other API functions.

--- src/test_utils/word_source.cljs
+++ src/test_utils/word_source.cljs
@@ -36,7 +36,7 @@

 (def read-latin-words (memoize read-latin-words-from))

-(defn rand-words
-  ([] (rand-words (read-latin-words "latin-words.md") rand-nth))
+(defn rand-word
+  ([] (rand-word (read-latin-words "latin-words.md") rand-nth))
   ([words rand-f] (rand-f words)))


Simplify, improve readability of generated code.

--- resources/templates/fixture-definition.clj
+++ resources/templates/fixture-definition.clj
@@ -50,22 +50,17 @@
    :name "{{model}}"}{% else %}([]
    ({{model|sanitize}} :{{modes.0.name|sanitize}}))
   ([mode]
-   ;; Set up channel definitions functions for channels used by any mode
-   (let [build-channel (fn [c offset fine-offset]
-                         (case c{% for ch in channels %}
-                           :{{ch.name|sanitize}} {% channel ch %} {% endfor %}))]
-     ;; Define the channels actually used by the chosen mode
-     (assoc (case mode{% for m in modes %}
-                  :{{m.name|sanitize}}
-                  {{open-curly}}{% if m.has-pan-channel %}:pan-center 128 :pan-half-circle 128 ; TODO: Fix these values
-                   {% endif %}{% if m.has-tilt-channel %}:tilt-center 128 :tilt-half-circle 128 ; TODO: Fix these values
-                   {% endif %}:channels [{% for ch in m.channels %}{% if not forloop.first %}
-                              {% endif %}(build-channel :{{ch.1|sanitize}} {{ch.0}} {{ch.2|default:"nil"}}){% endfor %}]{% if m.heads|not-empty %}
-                   :heads [{% for head in m.heads %}{% if not forloop.first %}
-                           {% endif %}{{open-curly}}{% if m.heads|length > 1 %}:x 0 :y 0 :z 0 ; TODO: specify actual location! (and perhaps rotation?)
-                            {% endif %}{% if head.has-pan-channel %}:pan-center 128 :pan-half-circle 128 ; TODO: Fix these values
-                            {% endif %}{% if head.has-tilt-channel %}:tilt-center 128 :tilt-half-circle 128 ; TODO: Fix these values
-                            {% endif %}:channels [{% for ch in head.channels %}{% if not forloop.first %}
-                                       {% endif %}(build-channel :{{ch.1|sanitize}} {{ch.0}} {{ch.2|default:"nil"}}){% endfor %}]}{% endfor %}]{% endif %}}{% endfor %})
-            :name "{{model}}"
-            :mode mode))){% endif %})
+   (merge {:name "{{model}}"
+           :mode mode}
+          (case mode{% for m in modes %}
+                :{{m.name|sanitize}}
+                {{open-curly}}{% if m.has-pan-channel %}:pan-center 128 :pan-half-circle 128 ; TODO: Fix these values
+                 {% endif %}{% if m.has-tilt-channel %}:tilt-center 128 :tilt-half-circle 128 ; TODO: Fix these values
+                 {% endif %}:channels [{% for ch in m.channels %}{% if not forloop.first %}
+                            {% endif %}{% channel-by-name ch.1 ch.0 ch.2 %}{% endfor %}]{% if m.heads|not-empty %}
+                 :heads [{% for head in m.heads %}{% if not forloop.first %}
+                         {% endif %}{{open-curly}}{% if m.heads|length > 1 %}:x 0 :y 0 :z 0 ; TODO: specify actual location! (and perhaps rotation?)
+                          {% endif %}{% if head.has-pan-channel %}:pan-center 128 :pan-half-circle 128 ; TODO: Fix these values
+                          {% endif %}{% if head.has-tilt-channel %}:tilt-center 128 :tilt-half-circle 128 ; TODO: Fix these values
+                          {% endif %}:channels [{% for ch in head.channels %}{% if not forloop.first %}
+                                     {% endif %}{% channel-by-name ch.1 ch.0 ch.2 %}{% endfor %}]}{% endfor %}]{% endif %}}{% endfor %}))){% endif %})


Adds tests for nested 'keys' specs

Adds tests for nested 'keys' specs

--- test/expound/problems_test.cljc
+++ test/expound/problems_test.cljc
@@ -56,6 +56,11 @@
             [0])))))

 (s/def :highlighted-value/nested-map-of (s/map-of keyword? (s/map-of keyword? keyword?)))
+
+(s/def :highlighted-value/city string?)
+(s/def :highlighted-value/address (s/keys :req-un [:highlighted-value/city]))
+(s/def :highlighted-value/house (s/keys :req-un [:highlighted-value/address]))
+
 (deftest highlighted-value1
   (testing "special replacement chars are not used"
     (is (= "\"$ $$ $1 $& $` $'\"\n^^^^^^^^^^^^^^^^^^"
@@ -87,4 +92,27 @@
             (first
              (:expound/problems
                (problems/annotate
-                (s/explain-data :highlighted-value/nested-map-of {1 {:a :b}})))))))))
+                (s/explain-data :highlighted-value/nested-map-of {1 {:a :b}}))))))))
+
+  (testing "nested keys specs"
+    (is (= "{:address {:city 1}}\n                 ^"
+           (problems/highlighted-value1
+            {}
+            (first
+             (:expound/problems
+               (problems/annotate
+                (s/explain-data :highlighted-value/house {:address {:city 1}})))))))
+    (is (= "{:address {\"city\" \"Denver\"}}\n          ^^^^^^^^^^^^^^^^^"
+           (problems/highlighted-value1
+            {}
+            (first
+             (:expound/problems
+               (problems/annotate
+                (s/explain-data :highlighted-value/house {:address {"city" "Denver"}})))))))
+    (is (= "{\"address\" {:city \"Denver\"}}\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
+           (problems/highlighted-value1
+            {}
+            (first
+             (:expound/problems
+               (problems/annotate
+                (s/explain-data :highlighted-value/house {"address" {:city "Denver"}})))))))))


Fix a couple of false positives in server test

--- test/frereth_cp/server_test.clj
+++ test/frereth_cp/server_test.clj
@@ -454,8 +454,8 @@
                     (pprint @client-agent)))))))
         (println "Made it to the bottom of the server handshake main try/catch")
         (catch Exception ex
+          (is (not ex))
           (println "Unhandled exception in the main server handshake test try/catch")
-          (println ex)
           (println (log/exception-details ex)))
         (finally
           (println "Triggering server event loop exit")
@@ -463,6 +463,7 @@
           (println "Server stopped successfully"))))
     (println "Got to the bottom of the server handshake test successfully")
     (catch Exception ex
+      (is (not ex))
       (println "Unhandled exception at top-level of the server handshake test")
       (println ex)
       (println (log/exception-details ex)))))


set :init-ns

set :init-ns

--- build.boot
+++ build.boot
@@ -8,7 +8,8 @@

 (task-options!
  repl {:server true
-       :port 44444})
+       :port 44444
+       :init-ns 'user})

 (deftask develop
   "Setup for development"


implement functions: take-while, remove

implement functions: take-while, remove

--- practice/alfa.clj
+++ practice/alfa.clj
@@ -92,6 +92,33 @@
     (if (= (count i) 0)
       res
       (recur (rest i) (conj res (f (first i)))))))
+
+;;take-while
+(defn take-while' [f col]
+  (if (= (count col) 0)
+    '()
+    (distinct (flatten (concat (filter f (list (first col))) (take-while' f (rest col)))))))
+
+(defn take-while'' [f col]
+  (loop [i col
+         res '()]
+    (if (= (count i) 0)
+      res
+      (recur (rest i) (distinct (flatten (concat res (filter f (list (first i))))))))))
+
+;;remove
+(defn remove' [f col]
+  (if (= (count col) 0)
+    '()
+    (concat (if-not (f (first col)) (list (first col)) '()) (remove' f (rest col)))))
+
+(defn remove'' [f col]
+  (loop [i col
+         res '()]
+    (if (= (count i) 0)
+      res
+      (recur (rest i) (concat res (if-not (f (first i)) (list (first i)) '()))))))
+

 ;; Reimplementing Clojure in pure recursion
 ;; last, butlast, keep, map, take, take-while, remove, drop, drop-while, distinct, range, for


:lipstick: Minor naming changes on common pages tests file.

--- backend/tests/uxbox/tests/test_common_pages.clj
+++ backend/tests/uxbox/tests/test_common_pages.clj
@@ -247,7 +247,7 @@
         (t/is (= [id3 id1 id2] (get-in res [:objects uuid/zero :shapes])))))
     ))

-(t/deftest process-changes-move-objects
+(t/deftest process-change-move-objects
   (let [frame-a-id (uuid/custom 1)
         frame-b-id (uuid/custom 2)
         group-a-id (uuid/custom 3)
@@ -391,10 +391,10 @@
         (t/is (= data res))))))

-(t/deftest process-changes-move-objects-3
+(t/deftest process-change-move-objects-regression
   (let [shape-2-id (uuid/custom 1 2)
         shape-3-id (uuid/custom 1 3)
-        frame-id (uuid/custom 1 1)
+        frame-id   (uuid/custom 1 1)
         changes [{:type :add-obj
                   :id frame-id
                   :frame-id uuid/zero
@@ -426,7 +426,7 @@
                  (get-in data [:objects shape-3-id :frame-id])))))))

-(t/deftest process-changes-move-objects-2
+(t/deftest process-change-move-objects-2
   (let [shape-1-id (uuid/custom 1 1)
         shape-2-id (uuid/custom 1 2)
         shape-3-id (uuid/custom 1 3)


:bug: Fix files query (invalid pages aggregate ordering).

--- backend/src/uxbox/services/queries/project_files.clj
+++ backend/src/uxbox/services/queries/project_files.clj
@@ -26,15 +26,17 @@

 (su/defstr sql:generic-project-files
   "select pf.*,
-          array_agg(pp.id) as pages
+          array_agg(pp.id) over pages_w as pages
      from project_files as pf
     inner join projects as p on (pf.project_id = p.id)
     inner join project_users as pu on (p.id = pu.project_id)
      left join project_pages as pp on (pf.id = pp.file_id)
     where pu.user_id = $1
       and pu.can_edit = true
-    group by pf.id")
-
+      and pf.deleted_at is null
+   window pages_w as (partition by pf.id order by pp.created_at
+                      range BETWEEN UNBOUNDED PRECEDING
+                                AND UNBOUNDED FOLLOWING)")

 ;; --- Query: Project Files


CIRCLE-3781 add explanation text to team page (#1810)

* add explanation text to team page

* div -> p

--- src-cljs/frontend/components/pages/team.cljs
+++ src-cljs/frontend/components/pages/team.cljs
@@ -13,7 +13,7 @@
             [frontend.components.pieces.table :as table]
             [frontend.components.templates.main :as main-template]
             [frontend.models.user :as user]
-            [frontend.utils :as utils :refer [valid-email?] :refer-macros [component element html]]
+            [frontend.utils :as utils :refer [valid-email? prettify-vcs_type] :refer-macros [component element html]]
             [frontend.utils.github :as gh-utils]
             [frontend.utils.legacy :refer [build-next]]
             [goog.string :as gstr]
@@ -323,9 +323,18 @@
                                                          {:event-type :invite-teammates-clicked
                                                           :properties {:view :team}}))}
                                           "Invite Teammates")]]))}
-                  (if (:users selected-org)
-                    (table (select-keys selected-org [:users :projects]))
-                    (spinner))))
+                  [:div
+                   [:p
+                    (gstr/format
+                      "These are all the users that follow %s projects.
+                      Some users might be following only open-source projects.
+                      If you want to invite someone not listed here, please
+                      make sure they have the right permissions on %s first."
+                      org-name
+                      (prettify-vcs_type vcs-type))]
+                   (if (:users selected-org)
+                     (table (select-keys selected-org [:users :projects]))
+                     (spinner))]))
               (no-org-selected available-orgs (user/bitbucket-authorized? user)))]]))))))

 (defn page [app owner]


Fix design settings

Fix design settings

--- src/clj/collect_earth_online/db/projects.clj
+++ src/clj/collect_earth_online/db/projects.clj
@@ -323,7 +323,7 @@
         survey-questions     (tc/clj->jsonb (:surveyQuestions params))
         survey-rules         (tc/clj->jsonb (:surveyRules params))
         project-options      (tc/clj->jsonb (:projectOptions params default-options))
-        design-settings      (merge (tc/clj->jsonb (:designSettings params default-settings))
+        design-settings      (merge (:designSettings params default-settings)
                                     ;; Test data
                                     #_{:user-assignment {:user-method "equal"
                                                          :users       [4581 1]}}
@@ -358,7 +358,7 @@
                                                       survey-rules
                                                       token-key
                                                       project-options
-                                                      design-settings))]
+                                                      (tc/clj->jsonb design-settings)))]
     (try
       ;; Create or copy plots
       (if (and (pos? project-template) use-template-plots)


Fix `reset` button

Fix `reset` button

--- src/cljs/subman/components/search_input.cljs
+++ src/cljs/subman/components/search_input.cljs
@@ -21,8 +21,10 @@
   (dom/span #js {:className "input-group-addon no-border-radius"}
             (if (= "" (:search-query app))
               (dom/i #js {:className "fa fa-search"})
-              (dom/a #js {:onClick   #(om/update! app
-                                                  :search-query "")
+              (dom/a #js {:onClick   (fn [e]
+                                       (.preventDefault e)
+                                       (om/update! app
+                                                  :search-query ""))
                           :href      "#"
                           :className "clear-input-btn"}
                      (dom/i #js {:className "fa fa-chevron-left"})))))


More experiments with the way data is enqueued.

--- src/dsbdp/local_data_processing_pipeline.clj
+++ src/dsbdp/local_data_processing_pipeline.clj
@@ -37,13 +37,13 @@
 ;                  "LinkedBlockingQueue_add-counted_remove"))]
 ;                  "OneToOneConcurrentArrayQueue3_add-counted-yield_remove-yield"))]
 ;                  "OneToOneConcurrentArrayQueue3_add-counted_remove-yield"))]
-;                  "OneToOneConcurrentArrayQueue3_add-counted_remove"))]
+                  "OneToOneConcurrentArrayQueue3_add-counted_remove"))]
 ;                  "ArrayBlockingQueue_offer-counted"))]
 ;                  "ArrayBlockingQueue_offer-counted-yield"))]
 ;                  "LinkedTransferQueue_transfer"))]
 ;                  "LinkedTransferQueue_tryTransfer-counted-no-timeout"))]
 ;                  "LinkedTransferQueue_transfer-counted-yield"))]
-                  "LinkedTransferQueue_tryTransfer-counted-10ms"))]
+;                  "LinkedTransferQueue_tryTransfer-counted-10ms"))]
     (println "Using queue-setup:" setup)
     setup))


fix: size calculation when assoc'ing existing key

--- sample/src/sample/btree.clj
+++ sample/src/sample/btree.clj
@@ -240,8 +240,9 @@
                  (->B+TreeLeafNode b (- partition-size (rem size 2)) m2)]))

             (ins [{:keys [b m size] :as n} k v]
-              (let [nm (assoc m k v)]
-                (->B+TreeLeafNode b (inc size) nm)))]
+              (let [nsize (if (contains? m k) size (inc size))
+                    nm (assoc m k v)]
+                (->B+TreeLeafNode b nsize nm)))]

       (let [nn (ins this k v)]
         (if (>= (-> nn :size) b)


Replace top-level `:tags` with `[:swagger :tags]` path in documentation

--- modules/reitit-swagger/src/reitit/swagger.cljc
+++ modules/reitit-swagger/src/reitit/swagger.cljc
@@ -29,7 +29,6 @@
   | --------------|-------------|
   | :swagger      | map of any swagger-data. Must have `:id` (keyword or sequence of keywords) to identify the api
   | :no-doc       | optional boolean to exclude endpoint from api docs
-  | :tags         | optional set of string or keyword tags for an endpoint api docs
   | :summary      | optional short string summary of an endpoint
   | :description  | optional long description of an endpoint. Supports http://spec.commonmark.org/

@@ -52,7 +51,7 @@
                :handler reitit.swagger/swagger-spec-handler}}]

        [\"/plus\"
-        {:get {:tags #{:math}
+        {:get {:swagger {:tags \"math\"}
                :summary \"adds numbers together\"
                :description \"takes `x` and `y` query-params and adds them together\"
                :parameters {:query {:x int?, :y int?}}


CIRCLE-2614 Logged out users can't see web notifications banner (#1626)

--- src-cljs/frontend/components/header.cljs
+++ src-cljs/frontend/components/header.cljs
@@ -323,7 +323,8 @@
                      (feature/enabled? :offer-linux-trial)
                      (not (get-in app state/dismissed-trial-offer-banner)))
             (om/build trial-offer-banner app))
-          (when (:build (get-in app state/build-data-path))
+          ; only show web notifications when the user is logged in.
+          (when (and user (:build (get-in app state/build-data-path)))
             (cond
               (and (= (n/notifications-permission) "default")
                    show-web-notif-banner?)


Revert "Projects on Project page are linked"

This reverts commit 7508d9499f00efb52df530a6e06973a9a0d35bd0.

--- src-cljs/frontend/components/pages/projects.cljs
+++ src-cljs/frontend/components/pages/projects.cljs
@@ -33,31 +33,20 @@
                 {:rows projects
                  :key-fn :project/vcs-url
                  :columns [{:header "Project"
-                            :cell-fn
-                            #(html
-                              (let [vcs-url (:project/vcs-url %)]
-                                [:a
-                                 {:href (routes/v1-project-dashboard-path {:vcs_type (vcs-url/vcs-type vcs-url)
-                                                                           :org (vcs-url/org-name vcs-url)
-                                                                           :repo (vcs-url/repo-name vcs-url)})
-                                  :on-click #((om/get-shared owner :track-event) {:event-type :project-clicked
-                                                                                :properties {:org org-name
-                                                                                :repo repo-name}})}
-                                 (:project/name %)]))}
+                            :cell-fn :project/name}

                            {:header "Parallelism"
                             :type #{:right :shrink}
-                            :cell-fn
-                            #(html
-                              (let [parallelism (project-model/parallelism %)
-                                    buildable-parallelism (when plan (project-model/buildable-parallelism plan %))
-                                    vcs-url (:project/vcs-url %)]
-                                [:a {:href (routes/v1-project-settings-path {:vcs_type (-> vcs-url vcs-url/vcs-type vcs/->short-vcs)
-                                                                             :org (vcs-url/org-name vcs-url)
-                                                                             :repo (vcs-url/repo-name vcs-url)
-                                                                             :_fragment "parallel-builds"})}
-                                 parallelism "x"
-                                 (when buildable-parallelism (str " out of " buildable-parallelism "x"))]))}
+                            :cell-fn #(html
+                                       (let [parallelism (project-model/parallelism %)
+                                             buildable-parallelism (when plan (project-model/buildable-parallelism plan %))
+                                             vcs-url (:project/vcs-url %)]
+                                         [:a {:href (routes/v1-project-settings-path {:vcs_type (-> vcs-url vcs-url/vcs-type vcs/->short-vcs)
+                                                                                :org (vcs-url/org-name vcs-url)
+                                                                                :repo (vcs-url/repo-name vcs-url)
+                                                                                :_fragment "parallel-builds"})}
+                                          parallelism "x"
+                                          (when buildable-parallelism (str " out of " buildable-parallelism "x"))]))}

                            {:header "Team"
                             :type #{:right :shrink}


Rename for simplicity

Rename for simplicity

--- plugin/src/leiningen/doo.clj
+++ plugin/src/leiningen/doo.clj
@@ -101,28 +101,27 @@
   - build-id: any of the ids under the :cljsbuild map in your project.clj
   - watch-mode (optional): either auto (default) or once\n")

-
 (defn ^{:doc help-string}
   doo
   ([project] (lmain/info help-string))
   ([project js-env]
    (lmain/info
-     (str "We have the js-env (" js-env
+     (str "We have the JavaScript Environment (" js-env
        ") but we are missing the build-id. See `lein doo` for help.")))
-  ([project js-env-alias build-id] (doo project js-env-alias build-id "auto"))
-  ([project js-env-alias build-id watch-mode]
+  ([project alias build-id] (doo project alias build-id "auto"))
+  ([project alias build-id watch-mode]
    (assert (contains? #{"auto" "once"} watch-mode)
      (str "Possible watch-modes are auto or once, " watch-mode " was given."))
    ;; FIX: execute in a try catch like the one in run-local-project
    (let [doo-opts (:doo project)
-         js-envs (doo/resolve-alias (keyword js-env-alias) (:alias doo-opts))
+         js-envs (doo/resolve-alias (keyword alias) (:alias doo-opts))
          ;; FIX: get the version dynamically
          project' (-> project
                     correct-builds
                     (add-dep ['doo "0.1.6-SNAPSHOT"]))
          builds (get-in project' [:cljsbuild :builds])
          {:keys [source-paths compiler] :as build} (find-by-id builds build-id)]
-     (doo/assert-alias js-env-alias js-envs (:alias doo-opts))
+     (doo/assert-alias alias js-envs (:alias doo-opts))
      (doseq [js-env js-envs]
        (doo/assert-js-env js-env))
      (assert (not (empty? build))


Fix issue #92

Fix issue #92

Small fix

--- plugin/src/leiningen/doo.clj
+++ plugin/src/leiningen/doo.clj
@@ -218,7 +218,7 @@
                   karma-on?# (atom false)
                   non-karma-envs# (vec (remove doo.karma/env? ~js-envs))]
               (cljs.build.api/watch
-                (apply cljs.build.api/inputs ~source-paths)
+                (apply cljs.build.api/inputs ~(vec source-paths))
                 (assoc compiler#
                   :watch-fn
                   (fn []
@@ -235,7 +235,7 @@
                       (doo.core/karma-run! ~opts))))))
             (do
               (cljs.build.api/build
-                (apply cljs.build.api/inputs ~source-paths) compiler#)
+                (apply cljs.build.api/inputs ~(vec source-paths)) compiler#)
               (let [ok# (->> ~js-envs
                           (map (fn [e#]
                                  (doo.core/print-envs e#)


CMR-6023: Default key expire is 24 hours.

--- redis-utils-lib/src/cmr/redis_utils/config.clj
+++ redis-utils-lib/src/cmr/redis_utils/config.clj
@@ -21,8 +21,8 @@
   {:default 3000 :type Long})

 (defconfig redis-default-key-timeout-seconds
-  "The default value to use to expire keys. Default is 24 hours."
-  {:default (* 60 60 24) :type Long})
+  "The default value in seconds to use to expire keys. Default is 24 hours."
+  {:default 86400 :type Long})

 (defn redis-conn-opts
   "Redis connection options to be used with wcar."


fix the double dispatching on the test machines and Safari (hopefully!)

--- frontend/history.cljs
+++ frontend/history.cljs
@@ -7,6 +7,7 @@
             [secretary.core :as sec])
   (:require-macros [dommy.macros :refer [sel sel1]])
   (:import [goog.history Html5History]
+           [goog.events EventType Event]
            [goog History]))

@@ -39,6 +40,14 @@
    manually dispatch if there is no error code from the server."
   [history-imp]
   (events/listenOnce history-imp goog.history.EventType.NAVIGATE #(setup-dispatcher! history-imp)))
+
+(defn disable-popstate!
+  "Stops the browser's popstate from triggering NAVIGATION events.
+   We don't ever use it and it causes double dispatching."
+  [history-imp]
+  ;; get this history instance's version of window, might make for easier testing later
+  (let [window (.-window_ history-imp)]
+    (events/removeAll window goog.events.EventType.POPSTATE)))

 (defn route-fragment
@@ -88,6 +97,7 @@
     (.setUseFragment false)
     (.setPathPrefix "/")
     (bootstrap-dispatcher!)
+    (disable-popstate!)
     ;; This will fire a navigate event with the current token
     (.setEnabled true)
     (setup-link-dispatcher! top-level-node)))


test logging of missing effect handlers

test logging of missing effect handlers

--- test/re-frame/fx_test.cljs
+++ test/re-frame/fx_test.cljs
@@ -3,7 +3,8 @@
     [cljs.test :refer-macros [is deftest async use-fixtures]]
     [re-frame.core :as re-frame]
     [re-frame.fx]
-    [re-frame.interop :refer [set-timeout!]]))
+    [re-frame.interop :refer [set-timeout!]]
+    [re-frame.loggers :as log]))

 ;; ---- FIXTURES ---------------------------------------------------------------

@@ -15,7 +16,13 @@
     {:before #(reset! restore-re-frame (re-frame.core/make-restore-fn))
      :after  #(@restore-re-frame)}))

-(use-fixtures :each (fixture-re-frame))
+(defn fixture-logger
+  []
+  (let [old-loggers (atom nil)]
+    {:before #(reset! old-loggers @@#'log/loggers)
+     :after  #(reset! @#'log/loggers @old-loggers)}))
+
+(use-fixtures :each (fixture-re-frame) (fixture-logger))

 ;; ---- TESTS ------------------------------------------------------------------

@@ -43,3 +50,23 @@
         1000)
       ;; kick off main handler
       (re-frame/dispatch [::later-test]))))
+
+(deftest report-missing-handler
+  (let [logs (atom [])
+        log-fn (fn[& args] (swap! logs  #(conj % (clojure.string/join args))))
+        logger (zipmap [:log :warn :error] (repeat log-fn))]
+    (log/set-loggers! logger)
+
+    (re-frame/reg-event-fx
+     ::missing-handler-test
+     (fn[_world _event-v]
+       {:dispatch [:do-not-exist :handler]}))
+
+    (re-frame/dispatch [::missing-handler-test])
+
+    (async done
+           (set-timeout!
+            (fn []
+              (is (re-matches #"re-frame: no :event handler.*:do-not-exist" (first @logs)))
+              (done))
+            2))))


have alerts show up on most pages

have alerts show up on most pages

--- pedestal-app/app/src/semtag_web/rendering.cljs
+++ pedestal-app/app/src/semtag_web/rendering.cljs
@@ -29,7 +29,7 @@
 (defn render-alert
   "Adds an alert box at the top of the page"
   [msg alert-type]
-  (dom/prepend! (dom/by-id "main")
+  (dom/prepend! (dom/by-id "content")
                 (p/alert msg (str "alert-" (name alert-type)))))

 ;; Rendering fns e.g. (fn [_ _ _])


CMR-6217 renamed confusing group name

CMR-6217 renamed confusing group name

--- access-control-app/int-test/cmr/access_control/int_test/access_control_group_crud_test.clj
+++ access-control-app/int-test/cmr/access_control/int_test/access_control_group_crud_test.clj
@@ -413,13 +413,13 @@
 (deftest update-group-failure-test
   (let [group (test-util/make-group)
         group2 (test-util/make-group {:name "Group2" :members ["user1"]})
-        group2-copy (test-util/make-group {:name "Group2a" :members ["user1"]})
+        group3 (test-util/make-group {:name "Group3" :members ["user1"]})

         token (echo-util/login (test-util/conn-context) "user1")

         {:keys [concept_id revision_id]} (test-util/create-group token group)
         {concept_id2 :concept_id} (test-util/create-group token group2)
-        {concept_id3 :concept_id} (test-util/create-group token group2-copy)]
+        {concept_id3 :concept_id} (test-util/create-group token group3)]

     (testing "Update group with invalid content type"
       (is (= {:status 400,
@@ -464,7 +464,7 @@
               :errors [(format "A system group with name [%s] already exists with concept id [%s]."
                                (:name group2)
                                concept_id2)]}
-             (test-util/update-group token concept_id3 (assoc group2-copy :name (:name group2))))))))
+             (test-util/update-group token concept_id3 (assoc group3 :name (:name group2))))))))

 (deftest update-group-legacy-guid-test
   (let [group1 (test-util/make-group {:legacy_guid "legacy_guid_1" :name "group1"})