From b5c983c849015ed9d20b9a11e8b3cc4dd510c1da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atamert=20=C3=96l=C3=A7gen?= Date: Tue, 2 Feb 2016 21:11:10 +0200 Subject: [PATCH 01/10] Renamed sequence context & friends as lazy-sequence. --- src/cats/builtin.cljc | 10 +++---- test/cats/builtin_spec.cljc | 54 ++++++++++++++++++------------------- test/cats/core_spec.cljc | 6 ++--- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/cats/builtin.cljc b/src/cats/builtin.cljc index 6fdd157..5843515 100644 --- a/src/cats/builtin.cljc +++ b/src/cats/builtin.cljc @@ -44,10 +44,10 @@ (-extract [_] nil)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (Lazy) Sequence Monad +;; Lazy Sequence Monad ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(def sequence-context +(def lazy-sequence-context (reify p/Context (-get-level [_] ctx/+level-default+) @@ -112,14 +112,14 @@ p/Printable (-repr [_] - "#"))) + "#"))) -(util/make-printable (type sequence-context)) +(util/make-printable (type lazy-sequence-context)) (extend-type #?(:clj clojure.lang.LazySeq :cljs cljs.core.LazySeq) p/Contextual - (-get-context [_] sequence-context)) + (-get-context [_] lazy-sequence-context)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Range diff --git a/test/cats/builtin_spec.cljc b/test/cats/builtin_spec.cljc index 755dffe..2aaaf2a 100644 --- a/test/cats/builtin_spec.cljc +++ b/test/cats/builtin_spec.cljc @@ -166,66 +166,66 @@ (ctx/with-context maybe/context (m/traverse inc-if-even [1 2])))))) -;; Sequence +;; Lazy Sequence -(defn sequence-gen [g] +(defn lazy-sequence-gen [g] (gen/fmap #(lazy-seq %) (gen/vector g))) -(defspec sequence-semigroup 10 +(defspec lazy-sequence-semigroup 10 (lt/semigroup-associativity - {:ctx b/sequence-context - :gen (gen/not-empty (sequence-gen gen/any))})) + {:ctx b/lazy-sequence-context + :gen (gen/not-empty (lazy-sequence-gen gen/any))})) -(defspec sequence-monoid 10 +(defspec lazy-sequence-monoid 10 (lt/monoid-identity-element - {:ctx b/sequence-context - :gen (sequence-gen gen/any)})) + {:ctx b/lazy-sequence-context + :gen (lazy-sequence-gen gen/any)})) -(defspec sequence-first-functor-law 10 +(defspec lazy-sequence-first-functor-law 10 (lt/first-functor-law - {:gen (sequence-gen gen/any)})) + {:gen (lazy-sequence-gen gen/any)})) -(defspec sequence-second-functor-law 10 +(defspec lazy-sequence-second-functor-law 10 (lt/second-functor-law - {:gen (sequence-gen gen/any) + {:gen (lazy-sequence-gen gen/any) :f #(lazy-seq [%]) :g #(lazy-seq [%])})) -(defspec sequence-applicative-identity 10 +(defspec lazy-sequence-applicative-identity 10 (lt/applicative-identity-law - {:ctx b/sequence-context - :gen (sequence-gen gen/any)})) + {:ctx b/lazy-sequence-context + :gen (lazy-sequence-gen gen/any)})) -(defspec sequence-applicative-homomorphism 10 +(defspec lazy-sequence-applicative-homomorphism 10 (lt/applicative-homomorphism - {:ctx b/sequence-context + {:ctx b/lazy-sequence-context :gen gen/any :f (constantly false)})) -(defspec sequence-applicative-interchange 10 +(defspec lazy-sequence-applicative-interchange 10 (lt/applicative-interchange - {:ctx b/sequence-context + {:ctx b/lazy-sequence-context :gen gen/int :appf (lazy-seq [inc])})) -(defspec sequence-applicative-composition 10 +(defspec lazy-sequence-applicative-composition 10 (lt/applicative-composition - {:ctx b/sequence-context + {:ctx b/lazy-sequence-context :gen gen/int :appf (lazy-seq [inc]) :appg (lazy-seq [dec])})) -(defspec sequence-first-monad-law 10 +(defspec lazy-sequence-first-monad-law 10 (lt/first-monad-law - {:ctx b/sequence-context + {:ctx b/lazy-sequence-context :mf #(if % (lazy-seq [%]) (lazy-seq []))})) -(defspec sequence-second-monad-law 10 - (lt/second-monad-law {:ctx b/sequence-context})) +(defspec lazy-sequence-second-monad-law 10 + (lt/second-monad-law {:ctx b/lazy-sequence-context})) -(defspec sequence-third-monad-law 10 +(defspec lazy-sequence-third-monad-law 10 (lt/third-monad-law - {:ctx b/sequence-context + {:ctx b/lazy-sequence-context :f (comp seq vector str) :g (comp seq vector count)})) diff --git a/test/cats/core_spec.cljc b/test/cats/core_spec.cljc index 7cf9200..10199a1 100644 --- a/test/cats/core_spec.cljc +++ b/test/cats/core_spec.cljc @@ -160,7 +160,7 @@ ;; FIXME: uncomment when finishing funcool/cats#77 #_(t/testing "It can lift a function to a Monad Transformer" - (let [maybe-sequence-monad (maybe/maybe-t b/sequence-context)] + (let [maybe-sequence-monad (maybe/maybe-t b/lazy-sequence-context)] (t/is (= [(maybe/just 1) (maybe/just 2) (maybe/just 3) (maybe/just 4) (maybe/just 5) (maybe/just 6)] @@ -181,7 +181,7 @@ (monad+ (maybe/just 1) (maybe/nothing))))) (t/testing "It can lift a function to a Monad Transformer" - (let [maybe-sequence-monad (maybe/maybe-t b/sequence-context)] + (let [maybe-sequence-monad (maybe/maybe-t b/lazy-sequence-context)] (t/is (= [(maybe/just 1) (maybe/just 2) (maybe/just 3) (maybe/just 4) (maybe/just 5) (maybe/just 6)] @@ -209,7 +209,7 @@ ((curry-monad+ (maybe/just 1)) (maybe/just 5)))))) (t/testing "It can lift a function to a Monad Transformer" - (let [maybe-sequence-monad (maybe/maybe-t b/sequence-context) + (let [maybe-sequence-monad (maybe/maybe-t b/lazy-sequence-context) monad+ (m/lift-m 2 add2)] (t/is (= [(maybe/just 1) (maybe/just 2) (maybe/just 3) (maybe/just 4) From 68585db3e9cdf35fa5f581dc8f90a3a7ac15a3da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atamert=20=C3=96l=C3=A7gen?= Date: Tue, 2 Feb 2016 22:40:46 +0200 Subject: [PATCH 02/10] Implemented sequence monad on PersistentList. --- src/cats/builtin.cljc | 103 ++++++++++++++++++++++++++++++++++++ test/cats/builtin_spec.cljc | 86 ++++++++++++++++++++++++++++++ 2 files changed, 189 insertions(+) diff --git a/src/cats/builtin.cljc b/src/cats/builtin.cljc index 5843515..2cffcee 100644 --- a/src/cats/builtin.cljc +++ b/src/cats/builtin.cljc @@ -43,6 +43,109 @@ p/Extract (-extract [_] nil)) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Sequence Monad i.e. PersistentList +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(def sequence-context + (reify + p/Context + (-get-level [_] ctx/+level-default+) + + p/Semigroup + (-mappend [_ sv sv'] + (into sv' (reverse sv))) + + p/Monoid + (-mempty [_] + '()) + + p/Functor + (-fmap [_ f v] + ;; Essentially (doall (map f v)) but without an + ;; intermediary lazy-seq, therefore it is faster. + (loop [[x & xs :as coll] v + ys '()] + (if (empty? coll) + (reverse ys) + (recur xs + (cons (f x) ys))))) + + p/Applicative + (-pure [_ v] + (list v)) + + (-fapply [_ self av] + (loop [[f & fs :as fcoll] self + [v & vs :as vcoll] av + ys '()] + (if (or (empty? fcoll) + (empty? vcoll)) + (reverse ys) + (recur fs + vs + (cons (f v) ys))))) + + p/Monad + (-mreturn [_ v] + (list v)) + + (-mbind [_ self f] + ;; Essentially (doall (apply concat (map f self))) but without + ;; an intermediary lazy-seq, therefore it is faster. + (loop [[x & xs :as coll] self + result '()] + (if (empty? coll) + (reverse result) + (recur xs + (into result (f x)))))) + + p/MonadZero + (-mzero [_] + '()) + + p/MonadPlus + (-mplus [_ mv mv'] + (into mv' (reverse mv))) + + p/Foldable + (-foldr [ctx f z xs] + (let [x (first xs)] + (if (nil? x) + z + (let [xs (rest xs)] + (f x (p/-foldr ctx f z xs)))))) + + (-foldl [ctx f z xs] + (reduce f z xs)) + + p/Traversable + (-traverse [ctx f tv] + (let [as (p/-fmap ctx f tv)] + (p/-foldr ctx + (fn [a acc] + (m/alet [x a + xs acc] + (cons x xs))) + (m/pure '()) + as))) + + p/Printable + (-repr [_] + "#"))) + +(util/make-printable (type sequence-context)) + +(extend-type #?(:clj clojure.lang.PersistentList + :cljs cljs.core.List) + p/Contextual + (-get-context [_] sequence-context)) + +(extend-type #?(:clj clojure.lang.PersistentList$EmptyList + :cljs cljs.core.EmptyList) + p/Contextual + (-get-context [_] sequence-context)) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Lazy Sequence Monad ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/test/cats/builtin_spec.cljc b/test/cats/builtin_spec.cljc index 2aaaf2a..e3d44a9 100644 --- a/test/cats/builtin_spec.cljc +++ b/test/cats/builtin_spec.cljc @@ -166,6 +166,92 @@ (ctx/with-context maybe/context (m/traverse inc-if-even [1 2])))))) +;; Sequence + +(defn sequence-gen [g] + (gen/list g)) + +(defspec sequence-semigroup 10 + (lt/semigroup-associativity + {:ctx b/sequence-context + :gen (gen/not-empty (sequence-gen gen/any))})) + +(defspec sequence-monoid 10 + (lt/monoid-identity-element + {:ctx b/sequence-context + :gen (sequence-gen gen/any)})) + +(defspec sequence-first-functor-law 10 + (lt/first-functor-law + {:gen (sequence-gen gen/any)})) + +(defspec sequence-second-functor-law 10 + (lt/second-functor-law + {:gen (sequence-gen gen/any) + :f #(list %) + :g #(list %)})) + +(defspec sequence-applicative-identity 10 + (lt/applicative-identity-law + {:ctx b/sequence-context + :gen (sequence-gen gen/any)})) + +(defspec sequence-applicative-homomorphism 10 + (lt/applicative-homomorphism + {:ctx b/sequence-context + :gen gen/any + :f (constantly false)})) + +(defspec sequence-applicative-interchange 10 + (lt/applicative-interchange + {:ctx b/sequence-context + :gen gen/int + :appf (list inc)})) + +(defspec sequence-applicative-composition 10 + (lt/applicative-composition + {:ctx b/sequence-context + :gen gen/int + :appf (list inc) + :appg (list dec)})) + +(defspec sequence-first-monad-law 10 + (lt/first-monad-law + {:ctx b/sequence-context + :mf #(if % (lazy-seq [%]) (lazy-seq []))})) + +(defspec sequence-second-monad-law 10 + (lt/second-monad-law {:ctx b/sequence-context})) + +(defspec sequence-third-monad-law 10 + (lt/third-monad-law + {:ctx b/sequence-context + :f (comp seq vector str) + :g (comp seq vector count)})) + +(t/deftest sequence-foldable + (t/testing "Foldl" + (t/is (= [3 2 1] + (m/foldl (fn [acc v] (into [v] acc)) [] (list 1 2 3)))) + (t/is (= 6 (m/foldl + 0 (list 1 2 3))))) + + (t/testing "Foldr" + (t/is (= [1 2 3] + (m/foldr (fn [v acc] (into [v] acc)) [] (list 1 2 3)))) + (t/is (= 6 (m/foldr + 0 (list 1 2 3)))))) + +(t/deftest sequence-traversable + (t/testing "Traverse" + (t/is (= (maybe/just []) + (ctx/with-context maybe/context + (m/traverse inc-if-even '())))) + (t/is (= (maybe/just [3 5]) + (ctx/with-context maybe/context + (m/traverse inc-if-even (list 2 4))))) + (t/is (= (maybe/nothing) + (ctx/with-context maybe/context + (m/traverse inc-if-even (list 1 2))))))) + ;; Lazy Sequence (defn lazy-sequence-gen [g] From 36ecf5e21bbce80a0e50515957ae5cc51910ae3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atamert=20=C3=96l=C3=A7gen?= Date: Thu, 4 Feb 2016 10:39:18 +0200 Subject: [PATCH 03/10] Fixed fapply implementation for sequence-monad. --- src/cats/builtin.cljc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/cats/builtin.cljc b/src/cats/builtin.cljc index 2cffcee..69c3ee1 100644 --- a/src/cats/builtin.cljc +++ b/src/cats/builtin.cljc @@ -77,14 +77,20 @@ (-fapply [_ self av] (loop [[f & fs :as fcoll] self - [v & vs :as vcoll] av - ys '()] - (if (or (empty? fcoll) - (empty? vcoll)) - (reverse ys) + results []] + (if (empty? fcoll) + (loop [[x & xs :as coll] results + result '()] + (if (empty? coll) + (reverse result) + (recur xs + (into result x)))) (recur fs - vs - (cons (f v) ys))))) + (conj results (loop [[v & vs :as vcoll] av + r '()] + (if (empty? vcoll) + (reverse r) + (recur vs (cons (f v) r))))))))) p/Monad (-mreturn [_ v] From 0368f0577d19b8c355e69a5ff1177ee49c76c57f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atamert=20=C3=96l=C3=A7gen?= Date: Thu, 4 Feb 2016 11:28:14 +0200 Subject: [PATCH 04/10] Refactored loops as map & reduce variations for lists. --- src/cats/builtin.cljc | 40 ++++++++-------------------------------- src/cats/util.cljc | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 32 deletions(-) diff --git a/src/cats/builtin.cljc b/src/cats/builtin.cljc index 69c3ee1..a7c75d4 100644 --- a/src/cats/builtin.cljc +++ b/src/cats/builtin.cljc @@ -30,7 +30,9 @@ [cats.protocols :as p] [cats.context :as ctx] [cats.core :as m] - [cats.util :as util])) + [cats.util :as util]) + #?(:clj (:require [cats.util :refer [flattenl-1 mapl]]) + :cljs (:require-macros [cats.util :refer [flattenl-1 mapl]]))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Nil as Nothing of Maybe monad @@ -62,49 +64,23 @@ p/Functor (-fmap [_ f v] - ;; Essentially (doall (map f v)) but without an - ;; intermediary lazy-seq, therefore it is faster. - (loop [[x & xs :as coll] v - ys '()] - (if (empty? coll) - (reverse ys) - (recur xs - (cons (f x) ys))))) + (mapl f v)) p/Applicative (-pure [_ v] (list v)) (-fapply [_ self av] - (loop [[f & fs :as fcoll] self - results []] - (if (empty? fcoll) - (loop [[x & xs :as coll] results - result '()] - (if (empty? coll) - (reverse result) - (recur xs - (into result x)))) - (recur fs - (conj results (loop [[v & vs :as vcoll] av - r '()] - (if (empty? vcoll) - (reverse r) - (recur vs (cons (f v) r))))))))) + (flattenl-1 (mapl #(mapl % av) self))) p/Monad (-mreturn [_ v] (list v)) (-mbind [_ self f] - ;; Essentially (doall (apply concat (map f self))) but without - ;; an intermediary lazy-seq, therefore it is faster. - (loop [[x & xs :as coll] self - result '()] - (if (empty? coll) - (reverse result) - (recur xs - (into result (f x)))))) + (->> self + (mapl f) + (flattenl-1))) p/MonadZero (-mzero [_] diff --git a/src/cats/util.cljc b/src/cats/util.cljc index 46b1648..f8618b5 100644 --- a/src/cats/util.cljc +++ b/src/cats/util.cljc @@ -27,6 +27,12 @@ "A collection of utils that used around the library." (:require [cats.protocols])) +(defmacro flattenl-1 [coll] + "Like (doall (apply concat coll)) but without the laziness. + + This is not a generic operation. Use for PersistentList's only." + `(reduce #(into %1 (reverse %2)) '() ~coll)) + (defn make-printable [klass] #?(:clj (defmethod print-method klass @@ -36,3 +42,14 @@ IPrintWithWriter (-pr-writer [mv writer _] (-write writer (cats.protocols/-repr mv)))))) + +(defmacro mapl [f coll] + "Lie (doall (map f v)) but without the laziness. + + This is not a generic operation. Use for PersistentList's only." + `(loop [[x# & xs# :as c#] ~coll + result# '()] + (if (empty? c#) + (reverse result#) + (recur xs# + (cons (~f x#) result#))))) From 4abe94fed9739fa278c821efb8809459ca409635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atamert=20=C3=96l=C3=A7gen?= Date: Tue, 9 Feb 2016 22:58:59 +0200 Subject: [PATCH 05/10] Removed mapl & flattenl-1 macros. --- src/cats/builtin.cljc | 54 +++++++++++++++++++++++++++++++------------ src/cats/util.cljc | 17 -------------- 2 files changed, 39 insertions(+), 32 deletions(-) diff --git a/src/cats/builtin.cljc b/src/cats/builtin.cljc index a7c75d4..7d09a17 100644 --- a/src/cats/builtin.cljc +++ b/src/cats/builtin.cljc @@ -30,9 +30,7 @@ [cats.protocols :as p] [cats.context :as ctx] [cats.core :as m] - [cats.util :as util]) - #?(:clj (:require [cats.util :refer [flattenl-1 mapl]]) - :cljs (:require-macros [cats.util :refer [flattenl-1 mapl]]))) + [cats.util :as util])) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Nil as Nothing of Maybe monad @@ -59,32 +57,58 @@ (into sv' (reverse sv))) p/Monoid - (-mempty [_] - '()) + (-mempty [_] ()) p/Functor (-fmap [_ f v] - (mapl f v)) + (loop [[h & t :as c] v + result ()] + (if (empty? c) + (reverse result) + (recur t (cons (f h) result))))) p/Applicative - (-pure [_ v] - (list v)) + (-pure [_ v] (list v)) (-fapply [_ self av] - (flattenl-1 (mapl #(mapl % av) self))) + ;; Each function (outer loop) applied to each value (inner loop). + (->> (loop [[h & t :as c] self + result ()] + (if (empty? c) + result + (recur t + (cons (loop [[h' & t' :as c'] av + result' ()] + (if (empty? c') + result' + (recur t' (cons (h h') result')))) + result)))) + ;; Note that both `result` & `result'` above are + ;; in reverse order. + ;; Conjing elements of %2 into %1 below is done in + ;; in reverse order, so final result is correctly + ;; ordered. + (reduce #(into %1 %2) ()))) + p/Monad (-mreturn [_ v] (list v)) (-mbind [_ self f] - (->> self - (mapl f) - (flattenl-1))) + (->> (loop [[h & t :as c] self + result ()] + (if (empty? c) + result + (recur t (cons (f h) result)))) + ;; Note that `result` above is in reverse order. + ;; Conjing elements of %2 into %1 below is done in + ;; in reverse order, so final result is correctly + ;; ordered. + (reduce #(into %1 %2) ()))) p/MonadZero - (-mzero [_] - '()) + (-mzero [_] ()) p/MonadPlus (-mplus [_ mv mv'] @@ -109,7 +133,7 @@ (m/alet [x a xs acc] (cons x xs))) - (m/pure '()) + (m/pure ()) as))) p/Printable diff --git a/src/cats/util.cljc b/src/cats/util.cljc index f8618b5..46b1648 100644 --- a/src/cats/util.cljc +++ b/src/cats/util.cljc @@ -27,12 +27,6 @@ "A collection of utils that used around the library." (:require [cats.protocols])) -(defmacro flattenl-1 [coll] - "Like (doall (apply concat coll)) but without the laziness. - - This is not a generic operation. Use for PersistentList's only." - `(reduce #(into %1 (reverse %2)) '() ~coll)) - (defn make-printable [klass] #?(:clj (defmethod print-method klass @@ -42,14 +36,3 @@ IPrintWithWriter (-pr-writer [mv writer _] (-write writer (cats.protocols/-repr mv)))))) - -(defmacro mapl [f coll] - "Lie (doall (map f v)) but without the laziness. - - This is not a generic operation. Use for PersistentList's only." - `(loop [[x# & xs# :as c#] ~coll - result# '()] - (if (empty? c#) - (reverse result#) - (recur xs# - (cons (~f x#) result#))))) From 2c663ab8a82ce6e0c4c8f6cfb81810d41d7b3749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atamert=20=C3=96l=C3=A7gen?= Date: Wed, 10 Feb 2016 11:42:54 +0200 Subject: [PATCH 06/10] Upgraded ClojureScript 1.7.189 -> 1.7.228. --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index 7eb47dc..9d26bce 100644 --- a/project.clj +++ b/project.clj @@ -4,7 +4,7 @@ :license {:name "BSD (2 Clause)" :url "http://opensource.org/licenses/BSD-2-Clause"} :dependencies [[org.clojure/clojure "1.7.0" :scope "provided"] - [org.clojure/clojurescript "1.7.189" :scope "provided"] + [org.clojure/clojurescript "1.7.228" :scope "provided"] [org.clojure/core.async "0.2.374" :scope "provided"] [org.clojure/test.check "0.9.0" :scope "provided"] [manifold "0.1.1" :scope "provided"]] From be678a7829fd29b32ee7ab9ea101b8807a0a2a8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atamert=20=C3=96l=C3=A7gen?= Date: Wed, 10 Feb 2016 11:48:13 +0200 Subject: [PATCH 07/10] Reverted ClojureScript upgrade. --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index 9d26bce..7eb47dc 100644 --- a/project.clj +++ b/project.clj @@ -4,7 +4,7 @@ :license {:name "BSD (2 Clause)" :url "http://opensource.org/licenses/BSD-2-Clause"} :dependencies [[org.clojure/clojure "1.7.0" :scope "provided"] - [org.clojure/clojurescript "1.7.228" :scope "provided"] + [org.clojure/clojurescript "1.7.189" :scope "provided"] [org.clojure/core.async "0.2.374" :scope "provided"] [org.clojure/test.check "0.9.0" :scope "provided"] [manifold "0.1.1" :scope "provided"]] From 24dfef25520aaa8f47a12e9f47885a25c71af957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atamert=20=C3=96l=C3=A7gen?= Date: Wed, 10 Feb 2016 20:48:13 +0200 Subject: [PATCH 08/10] Fixed indentation. --- src/cats/builtin.cljc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cats/builtin.cljc b/src/cats/builtin.cljc index 7d09a17..8fa5d98 100644 --- a/src/cats/builtin.cljc +++ b/src/cats/builtin.cljc @@ -73,12 +73,12 @@ (-fapply [_ self av] ;; Each function (outer loop) applied to each value (inner loop). (->> (loop [[h & t :as c] self - result ()] + result ()] (if (empty? c) result (recur t (cons (loop [[h' & t' :as c'] av - result' ()] + result' ()] (if (empty? c') result' (recur t' (cons (h h') result')))) From 2d4cd133784000163b898b223ab1c7de92694220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atamert=20=C3=96l=C3=A7gen?= Date: Sat, 13 Feb 2016 10:55:58 +0200 Subject: [PATCH 09/10] Changed ClojureScript optimization level to :simple. --- scripts/build.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build.clj b/scripts/build.clj index 0c9bbdd..5835e07 100644 --- a/scripts/build.clj +++ b/scripts/build.clj @@ -8,7 +8,7 @@ {:main 'cats.runner :output-to "out/tests.js" :output-dir "out" - :optimizations :advanced + :optimizations :simple :target :nodejs :verbose true}) (println "... done. Elapsed" (/ (- (System/nanoTime) start) 1e9) "seconds")) From 886d333910f14099cd93046d101787b0b0a49592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atamert=20=C3=96l=C3=A7gen?= Date: Sat, 13 Feb 2016 11:03:06 +0200 Subject: [PATCH 10/10] Changed ClojureScript optimization level to :none. --- scripts/build.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build.clj b/scripts/build.clj index 5835e07..a4dd1eb 100644 --- a/scripts/build.clj +++ b/scripts/build.clj @@ -8,7 +8,7 @@ {:main 'cats.runner :output-to "out/tests.js" :output-dir "out" - :optimizations :simple + :optimizations :none :target :nodejs :verbose true}) (println "... done. Elapsed" (/ (- (System/nanoTime) start) 1e9) "seconds"))