ANN: Cordova-Om Leiningen template
I've created a Leiningen template for Om projects with support for building with Cordova (alias PhoneGap). Core.async and Sablono are included. The template generates a small Hello World app (from a gist by Keith Irwin) which can be built upon. Documenting my process and hoping it's of use to others. I have deployed it to Clojars, so Leiningen will fetch it and use it if you say % lein new cordova-om new-project-name Source is at https://github.com/nodename/cordova-om-template Comments welcome... -A -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Composing Stuart Sierra's components
Hi Dan, The key to understanding what's happening here is to remember that `component/start` combines both dependency ordering *and* dependency injection. Your super system looks like this just after it is constructed: {:system {:foo {}, :bar {}}, :system2 {:baz {}, :qux {}}} When you call `component/start` on this system, it dispatches to `start-system`, which will build the dependency graph to see that :system must be started before :system2. Next, start-system will call `component/start` on the component at :system. That component is itself a SystemMap, so it dispatches to `start-system`, which starts :foo and :bar. Now it's time to start :system2. start-system sees that :system2 has a dependency (`component/using`) on :system. So it will `assoc` :system into the component at :system2. Now the system looks like this: {:system {:foo {:started true}, :bar {:started true, :foo {:started true}}}, :system2 {:baz {}, :qux {}, :system {:foo {:started true}, :bar {:started true, :foo {:started true} Notice that :system2 now contains a complete copy of :system. The rest should be obvious. Starting :system2 will start :baz, :qux, *and* the nested copy of :system. So :system gets started again. :foo and :bar were already started, but `component/start` doesn't know that, so it starts them again. This is another reason I don't recommend nesting systems: the behavior is not obvious unless you deeply understand the model. There are 2 ways to prevent the repeated starting of :foo and :bar in this example. 1. Define a custom record for your super system implementing component/Lifecycle in a way that knows how to start the subsystems in the correct order without `assoc`ing their dependencies. 2. Define the `start` and `stop` methods of :foo and :bar to check if they have already been started before starting them again. (i.e. make them idempotent) -S On Wednesday, April 15, 2015 at 7:52:42 PM UTC+1, Dan Kee wrote: Sorry to resurrect an old thread with a somewhat tangential question but... I'm seeing strange behavior in nesting systems that I am hoping someone can explain. I have two independent systems as components of a super system, with an artificial dependency to attempt to enforce ordering of starting them. When I start the super system, the first system starts, then the second, then first system is started again and I don't understand why. I've since realized much simpler, more obvious ways to accomplish this, but I'd like to understand what I'm seeing. Code (apologies for the macro, but it keeps things brief): ``` (ns component-debug (:require [com.stuartsierra.component :as c]) ) (defn capitalize-symbol [s] (symbol (clojure.string/capitalize (str s))) ) (defmacro make-example-component [name] (let [capitalized-name (capitalize-symbol name)] `(do (defrecord ~capitalized-name [] c/Lifecycle (start [~name] (println (str Starting '~name)) (assoc ~name :started true) ) (stop [~name] (println (str Stopping '~name)) (assoc ~name :started false) ) ) (defn ~(symbol (str new- name)) [] (~(symbol (str map- capitalized-name)) {}) ) ) ) ) (make-example-component foo) (make-example-component bar) (make-example-component baz) (make-example-component qux) (defn new-system [] (c/system-map :foo (new-foo) :bar (c/using (new-bar) [:foo] ) ) ) (defn new-system2 [] (c/system-map
[ANN] Expectations v2.1.1
Expectations v2.1.1 has just been released with support for Clojure/Script. Expectations is a Clojure(Script) testing framework where your tests are written in a very concise manner: (expect 4 (+ 2 2)) Check it out: http://jayfields.com/expectations/ https://github.com/jaycfields/expectations/blob/master/CHANGELOG.md Cheers ; Ivan -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
reader conditional indentation (clojure-mode)
Does anyone know the required clojure-mode indentation configuration to achieve indentation aligned with http://dev.clojure.org/display/design/Reader+Conditionals ? Specifically, I'd like the next line following either #?(... or #?@(... to be indented at the same level as the #. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: reader conditional indentation (clojure-mode)
Also, what would be necessary to get repl (cider, etc) working with cljc? On Thursday, April 16, 2015 at 10:41:28 AM UTC-4, Dylan Butman wrote: Does anyone know the required clojure-mode indentation configuration to achieve indentation aligned with http://dev.clojure.org/display/design/Reader+Conditionals ? Specifically, I'd like the next line following either #?(... or #?@(... to be indented at the same level as the #. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Interested in building the Clojure module for Vert.x 3?
Vert.x v2[0] currently has Clojure support via a language module[1], but that module won't work with the upcoming Vert.x v3[2], since it is substantially different. I wrote the Clojure module for v2, but don't have time to build/maintain the module for v3. If you are a Clojure + Vert.x user and want to take on building the v3 language module, get in touch with me off-list, or reply to the thread on the Vert.x list[3]. I would be happy to provide guidance as to how the v2 module works, but know little about v3. - Toby [0]: http://vertx.io [1]: https://github.com/vert-x/mod-lang-clojure/ [2]: https://vert-x3.github.io/ [3]: https://groups.google.com/d/msg/vertx/0X5hSlAHw18/nOu7kun6pgIJ -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Composing Stuart Sierra's components
Ah, that makes sense. Thanks for the thorough response! On Thursday, April 16, 2015 at 7:00:16 AM UTC-5, Stuart Sierra wrote: Hi Dan, The key to understanding what's happening here is to remember that `component/start` combines both dependency ordering *and* dependency injection. Your super system looks like this just after it is constructed: {:system {:foo {}, :bar {}}, :system2 {:baz {}, :qux {}}} When you call `component/start` on this system, it dispatches to `start-system`, which will build the dependency graph to see that :system must be started before :system2. Next, start-system will call `component/start` on the component at :system. That component is itself a SystemMap, so it dispatches to `start-system`, which starts :foo and :bar. Now it's time to start :system2. start-system sees that :system2 has a dependency (`component/using`) on :system. So it will `assoc` :system into the component at :system2. Now the system looks like this: {:system {:foo {:started true}, :bar {:started true, :foo {:started true}}}, :system2 {:baz {}, :qux {}, :system {:foo {:started true}, :bar {:started true, :foo {:started true} Notice that :system2 now contains a complete copy of :system. The rest should be obvious. Starting :system2 will start :baz, :qux, *and* the nested copy of :system. So :system gets started again. :foo and :bar were already started, but `component/start` doesn't know that, so it starts them again. This is another reason I don't recommend nesting systems: the behavior is not obvious unless you deeply understand the model. There are 2 ways to prevent the repeated starting of :foo and :bar in this example. 1. Define a custom record for your super system implementing component/Lifecycle in a way that knows how to start the subsystems in the correct order without `assoc`ing their dependencies. 2. Define the `start` and `stop` methods of :foo and :bar to check if they have already been started before starting them again. (i.e. make them idempotent) -S On Wednesday, April 15, 2015 at 7:52:42 PM UTC+1, Dan Kee wrote: Sorry to resurrect an old thread with a somewhat tangential question but... I'm seeing strange behavior in nesting systems that I am hoping someone can explain. I have two independent systems as components of a super system, with an artificial dependency to attempt to enforce ordering of starting them. When I start the super system, the first system starts, then the second, then first system is started again and I don't understand why. I've since realized much simpler, more obvious ways to accomplish this, but I'd like to understand what I'm seeing. Code (apologies for the macro, but it keeps things brief): ``` (ns component-debug (:require [com.stuartsierra.component :as c]) ) (defn capitalize-symbol [s] (symbol (clojure.string/capitalize (str s))) ) (defmacro make-example-component [name] (let [capitalized-name (capitalize-symbol name)] `(do (defrecord ~capitalized-name [] c/Lifecycle (start [~name] (println (str Starting '~name)) (assoc ~name :started true) ) (stop [~name] (println (str Stopping '~name)) (assoc ~name :started false) ) ) (defn ~(symbol (str new- name)) [] (~(symbol (str map- capitalized-name)) {}) ) ) ) ) (make-example-component foo) (make-example-component bar) (make-example-component baz) (make-example-component qux) (defn new-system [] (c/system-map :foo (new-foo) :bar (c/using (new-bar) [:foo] ) ) )
Re: reader conditional indentation (clojure-mode)
Just bump your clojure version in project.clj and cider will work just fine. Dylan Butman mailto:dbut...@gmail.com April 16, 2015 at 9:18 AM Also, what would be necessary to get repl (cider, etc) working with cljc? On Thursday, April 16, 2015 at 10:41:28 AM UTC-4, Dylan Butman wrote: -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com mailto:clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. Dylan Butman mailto:dbut...@gmail.com April 16, 2015 at 8:41 AM Does anyone know the required clojure-mode indentation configuration to achieve indentation aligned with http://dev.clojure.org/display/design/Reader+Conditionals ? Specifically, I'd like the next line following either #?(... or #?@(... to be indented at the same level as the #. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com mailto:clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Sam Ritchie (@sritchie) Paddleguru Co-Founder 703.863.8561 www.paddleguru.com http://www.paddleguru.com/ Twitter http://twitter.com/paddleguru// Facebook http://facebook.com/paddleguru -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: core.typed question (maybe a bug?)
Now thats a really nice explanation of union versus intersection in termes of types. Thank you very much for that, Sven Am Donnerstag, 16. April 2015 23:25:42 UTC+2 schrieb Ambrose Bonnaire-Sergeant: It might help thinking in terms of Java interfaces, Foo and Bar. (definterface Foo (foo [])) (definterface Bar (bar [])) (I Foo Bar) is a value that extends both Foo and Bar. (deftype IImp [] Foo (foo [this]) Bar (bar [this])) (-IImp) is of type Foo, Bar, (I Foo Bar) and (U Foo Bar). Assuming we assign (-IImp) the type (I Foo Bar), we can call these safely: (let [i :- (I Foo Bar), (-IImp)] (.foo i) (.bar i)) A type that just implements Foo is not a Bar, so we can't claim it's a Foo *and* a Bar. (deftype UImp [] Foo (foo [this])) (-UImp) is of type Foo, and (U Foo Bar). Assuming we assign (-UImp) the type (U Foo Bar), the same operations now must cast at runtime. (let [i :- (U Foo Bar), (-UImp)] (if (instance? Foo) (.foo i) (.bar i)) Thanks, Ambrose On Thu, Apr 16, 2015 at 5:15 PM, Sven Richter sve...@googlemail.com javascript: wrote: I meant when I change: (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) to (t/HVec [Keyword (t/I Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) ^^ to ^^ Still I think that making an intersection of it is wrong conceptually. Thanks, Sven Am Donnerstag, 16. April 2015 23:08:30 UTC+2 schrieb Ambrose Bonnaire-Sergeant: I don't see an intersection, what do you mean? Thanks, Ambrose On Thu, Apr 16, 2015 at 4:43 PM, Sven Richter sve...@googlemail.com wrote: Hi, I tried both destructuring and the nth form instead of second and first. None of which worked. However, if I change the Union to Intersection in (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) it works for the definition of the multimethod. Does that make sense? I thought Union was either one type or the other. Thanks, Sven Am Donnerstag, 16. April 2015 21:44:25 UTC+2 schrieb Ambrose Bonnaire-Sergeant: I don't think second's type is is smart enough. Try using nth or destructuring instead: (let [[f s] v] (if (vector? s) (first s) s)) or (if (vector? (nth v 1)) (first (nth v 1)) s) Thanks, Ambrose On Thu, Apr 16, 2015 at 3:39 PM, Sven Richter sve...@googlemail.com wrote: Hi, I have this code: (defalias html-label (t/HVec [Keyword (t/HMap :mandatory {:for String }) String])) (defalias html-form (t/HVec [Keyword (t/HMap :mandatory {:id String}) t/Any *])) (defalias html-form-group (t/HVec [html-label html-form])) (t/ann dt-hiccup [(HVec [Keyword (U Keyword (HVec [Keyword Number])) t/Any t/Any *]) - html-form-group]) (defmulti dt-hiccup (t/fn [col :- pt/et-column] (if (vector? (second col)) (first (second col)) (second col And here comes the error message when checking this function: Type Error (leiningen/td_to_hiccup.clj:25:34) Polymorphic function first could not be applied to arguments: Polymorphic Variables: x Domains: (t/HSequential [x t/Any *]) (t/Option (t/EmptySeqable x)) (t/NonEmptySeqable x) (t/Option (clojure.lang.Seqable x)) Arguments: (t/U Keyword (t/HVec [clojure.lang.Keyword java.lang.Number]) ) Ranges: x :object {:path [(Nth 0)], :id 0} nil x (t/Option x) in: (first (second col)) in: (first (second col)) ExceptionInfo Type Checker: Found 1 error clojure.core/ex-info (core .clj:4403) My assumption is that the check (if (vector? (second col will return only true if it is this type: (HVec [Keyword Number]). However, I have the impression that core.typed does not resolve the if expression properly. Or maybe I am missing something completely. Any hints or recommendations? Thanks, Sven -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to
Re: [ANN] Clojure 1.7.0-beta1 released
We deployed beta1 to production this morning. I’ll report back if we encounter any problems (generally we’ve found Clojure pre-release builds to be very stable). We were previously running alpha5 in production. Sean On Apr 10, 2015, at 12:25 PM, Alex Miller a...@puredanger.com wrote: Clojure 1.7.0-beta1 is now available. Try it via - Download: https://repo1.maven.org/maven2/org/clojure/clojure/1.7.0-beta1/ https://repo1.maven.org/maven2/org/clojure/clojure/1.7.0-beta1/ - Leiningen: [org.clojure/clojure 1.7.0-beta1] Regression fixes since 1.7.0-alpha6: 1) CLJ-1692 - make iterate match prior laziness 2) CLJ-1694 - make cycle match prior laziness 3) CLJ-1685 - correctly handle :eof option in read and read-string One faster sequence and reduce path that didn't quite make it into alpha6 is now available - range is now faster for both the traditional sequence use case (both chunked and unchunked traversal) and the fast reduce path. Also, since alpha6 was released, reader conditionals were ported to tools.reader and the latest ClojureScript release now supports them, so now is a great time to try them out! For all changes new in beta1, see the issues marked (beta1) in the full changes below. … -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: core.typed question (maybe a bug?)
I don't see an intersection, what do you mean? Thanks, Ambrose On Thu, Apr 16, 2015 at 4:43 PM, Sven Richter sver...@googlemail.com wrote: Hi, I tried both destructuring and the nth form instead of second and first. None of which worked. However, if I change the Union to Intersection in (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) it works for the definition of the multimethod. Does that make sense? I thought Union was either one type or the other. Thanks, Sven Am Donnerstag, 16. April 2015 21:44:25 UTC+2 schrieb Ambrose Bonnaire-Sergeant: I don't think second's type is is smart enough. Try using nth or destructuring instead: (let [[f s] v] (if (vector? s) (first s) s)) or (if (vector? (nth v 1)) (first (nth v 1)) s) Thanks, Ambrose On Thu, Apr 16, 2015 at 3:39 PM, Sven Richter sve...@googlemail.com wrote: Hi, I have this code: (defalias html-label (t/HVec [Keyword (t/HMap :mandatory {:for String}) String])) (defalias html-form (t/HVec [Keyword (t/HMap :mandatory {:id String}) t/Any *])) (defalias html-form-group (t/HVec [html-label html-form])) (t/ann dt-hiccup [(HVec [Keyword (U Keyword (HVec [Keyword Number])) t/Any t/Any *]) - html-form-group]) (defmulti dt-hiccup (t/fn [col :- pt/et-column] (if (vector? (second col)) (first (second col)) (second col And here comes the error message when checking this function: Type Error (leiningen/td_to_hiccup.clj:25:34) Polymorphic function first could not be applied to arguments: Polymorphic Variables: x Domains: (t/HSequential [x t/Any *]) (t/Option (t/EmptySeqable x)) (t/NonEmptySeqable x) (t/Option (clojure.lang.Seqable x)) Arguments: (t/U Keyword (t/HVec [clojure.lang.Keyword java.lang.Number])) Ranges: x :object {:path [(Nth 0)], :id 0} nil x (t/Option x) in: (first (second col)) in: (first (second col)) ExceptionInfo Type Checker: Found 1 error clojure.core/ex-info (core. clj:4403) My assumption is that the check (if (vector? (second col will return only true if it is this type: (HVec [Keyword Number]). However, I have the impression that core.typed does not resolve the if expression properly. Or maybe I am missing something completely. Any hints or recommendations? Thanks, Sven -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: core.typed question (maybe a bug?)
It might help thinking in terms of Java interfaces, Foo and Bar. (definterface Foo (foo [])) (definterface Bar (bar [])) (I Foo Bar) is a value that extends both Foo and Bar. (deftype IImp [] Foo (foo [this]) Bar (bar [this])) (-IImp) is of type Foo, Bar, (I Foo Bar) and (U Foo Bar). Assuming we assign (-IImp) the type (I Foo Bar), we can call these safely: (let [i :- (I Foo Bar), (-IImp)] (.foo i) (.bar i)) A type that just implements Foo is not a Bar, so we can't claim it's a Foo *and* a Bar. (deftype UImp [] Foo (foo [this])) (-UImp) is of type Foo, and (U Foo Bar). Assuming we assign (-UImp) the type (U Foo Bar), the same operations now must cast at runtime. (let [i :- (U Foo Bar), (-UImp)] (if (instance? Foo) (.foo i) (.bar i)) Thanks, Ambrose On Thu, Apr 16, 2015 at 5:15 PM, Sven Richter sver...@googlemail.com wrote: I meant when I change: (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) to (t/HVec [Keyword (t/I Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) ^^ to ^^ Still I think that making an intersection of it is wrong conceptually. Thanks, Sven Am Donnerstag, 16. April 2015 23:08:30 UTC+2 schrieb Ambrose Bonnaire-Sergeant: I don't see an intersection, what do you mean? Thanks, Ambrose On Thu, Apr 16, 2015 at 4:43 PM, Sven Richter sve...@googlemail.com wrote: Hi, I tried both destructuring and the nth form instead of second and first. None of which worked. However, if I change the Union to Intersection in (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) it works for the definition of the multimethod. Does that make sense? I thought Union was either one type or the other. Thanks, Sven Am Donnerstag, 16. April 2015 21:44:25 UTC+2 schrieb Ambrose Bonnaire-Sergeant: I don't think second's type is is smart enough. Try using nth or destructuring instead: (let [[f s] v] (if (vector? s) (first s) s)) or (if (vector? (nth v 1)) (first (nth v 1)) s) Thanks, Ambrose On Thu, Apr 16, 2015 at 3:39 PM, Sven Richter sve...@googlemail.com wrote: Hi, I have this code: (defalias html-label (t/HVec [Keyword (t/HMap :mandatory {:for String} ) String])) (defalias html-form (t/HVec [Keyword (t/HMap :mandatory {:id String}) t/Any *])) (defalias html-form-group (t/HVec [html-label html-form])) (t/ann dt-hiccup [(HVec [Keyword (U Keyword (HVec [Keyword Number])) t/Any t/Any *]) - html-form-group]) (defmulti dt-hiccup (t/fn [col :- pt/et-column] (if (vector? (second col)) (first (second col)) (second col And here comes the error message when checking this function: Type Error (leiningen/td_to_hiccup.clj:25:34) Polymorphic function first could not be applied to arguments: Polymorphic Variables: x Domains: (t/HSequential [x t/Any *]) (t/Option (t/EmptySeqable x)) (t/NonEmptySeqable x) (t/Option (clojure.lang.Seqable x)) Arguments: (t/U Keyword (t/HVec [clojure.lang.Keyword java.lang.Number])) Ranges: x :object {:path [(Nth 0)], :id 0} nil x (t/Option x) in: (first (second col)) in: (first (second col)) ExceptionInfo Type Checker: Found 1 error clojure.core/ex-info (core. clj:4403) My assumption is that the check (if (vector? (second col will return only true if it is this type: (HVec [Keyword Number]). However, I have the impression that core.typed does not resolve the if expression properly. Or maybe I am missing something completely. Any hints or recommendations? Thanks, Sven -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop
Re: core.typed question (maybe a bug?)
I don't think second's type is is smart enough. Try using nth or destructuring instead: (let [[f s] v] (if (vector? s) (first s) s)) or (if (vector? (nth v 1)) (first (nth v 1)) s) Thanks, Ambrose On Thu, Apr 16, 2015 at 3:39 PM, Sven Richter sver...@googlemail.com wrote: Hi, I have this code: (defalias html-label (t/HVec [Keyword (t/HMap :mandatory {:for String}) String])) (defalias html-form (t/HVec [Keyword (t/HMap :mandatory {:id String}) t/Any *])) (defalias html-form-group (t/HVec [html-label html-form])) (t/ann dt-hiccup [(HVec [Keyword (U Keyword (HVec [Keyword Number])) t/Any t/Any *]) - html-form-group]) (defmulti dt-hiccup (t/fn [col :- pt/et-column] (if (vector? (second col)) (first (second col)) (second col And here comes the error message when checking this function: Type Error (leiningen/td_to_hiccup.clj:25:34) Polymorphic function first could not be applied to arguments: Polymorphic Variables: x Domains: (t/HSequential [x t/Any *]) (t/Option (t/EmptySeqable x)) (t/NonEmptySeqable x) (t/Option (clojure.lang.Seqable x)) Arguments: (t/U Keyword (t/HVec [clojure.lang.Keyword java.lang.Number])) Ranges: x :object {:path [(Nth 0)], :id 0} nil x (t/Option x) in: (first (second col)) in: (first (second col)) ExceptionInfo Type Checker: Found 1 error clojure.core/ex-info (core.clj: 4403) My assumption is that the check (if (vector? (second col will return only true if it is this type: (HVec [Keyword Number]). However, I have the impression that core.typed does not resolve the if expression properly. Or maybe I am missing something completely. Any hints or recommendations? Thanks, Sven -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: core.typed question (maybe a bug?)
Oh, you changed it to (t/HVec [Keyword (t/I Keyword (t/HVec [Keyword Number])) t/Any t/Any *])? Unions are like `or`, intersections like `and`. This might work for checking the definition, as function bodies are checked with a set of assumptions about parameter types. However it should be impossible to call this function as you cannot construct a type of (I Keyword (HVec ...)). Thanks, Ambrose On Thu, Apr 16, 2015 at 5:07 PM, Ambrose Bonnaire-Sergeant abonnaireserge...@gmail.com wrote: I don't see an intersection, what do you mean? Thanks, Ambrose On Thu, Apr 16, 2015 at 4:43 PM, Sven Richter sver...@googlemail.com wrote: Hi, I tried both destructuring and the nth form instead of second and first. None of which worked. However, if I change the Union to Intersection in (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) it works for the definition of the multimethod. Does that make sense? I thought Union was either one type or the other. Thanks, Sven Am Donnerstag, 16. April 2015 21:44:25 UTC+2 schrieb Ambrose Bonnaire-Sergeant: I don't think second's type is is smart enough. Try using nth or destructuring instead: (let [[f s] v] (if (vector? s) (first s) s)) or (if (vector? (nth v 1)) (first (nth v 1)) s) Thanks, Ambrose On Thu, Apr 16, 2015 at 3:39 PM, Sven Richter sve...@googlemail.com wrote: Hi, I have this code: (defalias html-label (t/HVec [Keyword (t/HMap :mandatory {:for String}) String])) (defalias html-form (t/HVec [Keyword (t/HMap :mandatory {:id String}) t /Any *])) (defalias html-form-group (t/HVec [html-label html-form])) (t/ann dt-hiccup [(HVec [Keyword (U Keyword (HVec [Keyword Number])) t /Any t/Any *]) - html-form-group]) (defmulti dt-hiccup (t/fn [col :- pt/et-column] (if (vector? (second col)) (first (second col)) (second col And here comes the error message when checking this function: Type Error (leiningen/td_to_hiccup.clj:25:34) Polymorphic function first could not be applied to arguments: Polymorphic Variables: x Domains: (t/HSequential [x t/Any *]) (t/Option (t/EmptySeqable x)) (t/NonEmptySeqable x) (t/Option (clojure.lang.Seqable x)) Arguments: (t/U Keyword (t/HVec [clojure.lang.Keyword java.lang.Number])) Ranges: x :object {:path [(Nth 0)], :id 0} nil x (t/Option x) in: (first (second col)) in: (first (second col)) ExceptionInfo Type Checker: Found 1 error clojure.core/ex-info (core. clj:4403) My assumption is that the check (if (vector? (second col will return only true if it is this type: (HVec [Keyword Number]). However, I have the impression that core.typed does not resolve the if expression properly. Or maybe I am missing something completely. Any hints or recommendations? Thanks, Sven -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to
Re: core.typed question (maybe a bug?)
I meant when I change: (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) to (t/HVec [Keyword (t/I Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) ^^ to ^^ Still I think that making an intersection of it is wrong conceptually. Thanks, Sven Am Donnerstag, 16. April 2015 23:08:30 UTC+2 schrieb Ambrose Bonnaire-Sergeant: I don't see an intersection, what do you mean? Thanks, Ambrose On Thu, Apr 16, 2015 at 4:43 PM, Sven Richter sve...@googlemail.com javascript: wrote: Hi, I tried both destructuring and the nth form instead of second and first. None of which worked. However, if I change the Union to Intersection in (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) it works for the definition of the multimethod. Does that make sense? I thought Union was either one type or the other. Thanks, Sven Am Donnerstag, 16. April 2015 21:44:25 UTC+2 schrieb Ambrose Bonnaire-Sergeant: I don't think second's type is is smart enough. Try using nth or destructuring instead: (let [[f s] v] (if (vector? s) (first s) s)) or (if (vector? (nth v 1)) (first (nth v 1)) s) Thanks, Ambrose On Thu, Apr 16, 2015 at 3:39 PM, Sven Richter sve...@googlemail.com wrote: Hi, I have this code: (defalias html-label (t/HVec [Keyword (t/HMap :mandatory {:for String}) String])) (defalias html-form (t/HVec [Keyword (t/HMap :mandatory {:id String}) t /Any *])) (defalias html-form-group (t/HVec [html-label html-form])) (t/ann dt-hiccup [(HVec [Keyword (U Keyword (HVec [Keyword Number])) t /Any t/Any *]) - html-form-group]) (defmulti dt-hiccup (t/fn [col :- pt/et-column] (if (vector? (second col)) (first (second col)) (second col And here comes the error message when checking this function: Type Error (leiningen/td_to_hiccup.clj:25:34) Polymorphic function first could not be applied to arguments: Polymorphic Variables: x Domains: (t/HSequential [x t/Any *]) (t/Option (t/EmptySeqable x)) (t/NonEmptySeqable x) (t/Option (clojure.lang.Seqable x)) Arguments: (t/U Keyword (t/HVec [clojure.lang.Keyword java.lang.Number])) Ranges: x :object {:path [(Nth 0)], :id 0} nil x (t/Option x) in: (first (second col)) in: (first (second col)) ExceptionInfo Type Checker: Found 1 error clojure.core/ex-info (core. clj:4403) My assumption is that the check (if (vector? (second col will return only true if it is this type: (HVec [Keyword Number]). However, I have the impression that core.typed does not resolve the if expression properly. Or maybe I am missing something completely. Any hints or recommendations? Thanks, Sven -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com javascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and
core.typed question (maybe a bug?)
Hi, I have this code: (defalias html-label (t/HVec [Keyword (t/HMap :mandatory {:for String}) String])) (defalias html-form (t/HVec [Keyword (t/HMap :mandatory {:id String}) t/Any *])) (defalias html-form-group (t/HVec [html-label html-form])) (t/ann dt-hiccup [(HVec [Keyword (U Keyword (HVec [Keyword Number])) t/Any t/Any *]) - html-form-group]) (defmulti dt-hiccup (t/fn [col :- pt/et-column] (if (vector? (second col)) (first (second col)) (second col And here comes the error message when checking this function: Type Error (leiningen/td_to_hiccup.clj:25:34) Polymorphic function first could not be applied to arguments: Polymorphic Variables: x Domains: (t/HSequential [x t/Any *]) (t/Option (t/EmptySeqable x)) (t/NonEmptySeqable x) (t/Option (clojure.lang.Seqable x)) Arguments: (t/U Keyword (t/HVec [clojure.lang.Keyword java.lang.Number])) Ranges: x :object {:path [(Nth 0)], :id 0} nil x (t/Option x) in: (first (second col)) in: (first (second col)) ExceptionInfo Type Checker: Found 1 error clojure.core/ex-info (core.clj: 4403) My assumption is that the check (if (vector? (second col will return only true if it is this type: (HVec [Keyword Number]). However, I have the impression that core.typed does not resolve the if expression properly. Or maybe I am missing something completely. Any hints or recommendations? Thanks, Sven -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: core.typed question (maybe a bug?)
Hi, I tried both destructuring and the nth form instead of second and first. None of which worked. However, if I change the Union to Intersection in (t/HVec [Keyword (t/U Keyword (t/HVec [Keyword Number])) t/Any t/Any *]) it works for the definition of the multimethod. Does that make sense? I thought Union was either one type or the other. Thanks, Sven Am Donnerstag, 16. April 2015 21:44:25 UTC+2 schrieb Ambrose Bonnaire-Sergeant: I don't think second's type is is smart enough. Try using nth or destructuring instead: (let [[f s] v] (if (vector? s) (first s) s)) or (if (vector? (nth v 1)) (first (nth v 1)) s) Thanks, Ambrose On Thu, Apr 16, 2015 at 3:39 PM, Sven Richter sve...@googlemail.com javascript: wrote: Hi, I have this code: (defalias html-label (t/HVec [Keyword (t/HMap :mandatory {:for String}) String])) (defalias html-form (t/HVec [Keyword (t/HMap :mandatory {:id String}) t/Any *])) (defalias html-form-group (t/HVec [html-label html-form])) (t/ann dt-hiccup [(HVec [Keyword (U Keyword (HVec [Keyword Number])) t/Any t/Any *]) - html-form-group]) (defmulti dt-hiccup (t/fn [col :- pt/et-column] (if (vector? (second col)) (first (second col)) (second col And here comes the error message when checking this function: Type Error (leiningen/td_to_hiccup.clj:25:34) Polymorphic function first could not be applied to arguments: Polymorphic Variables: x Domains: (t/HSequential [x t/Any *]) (t/Option (t/EmptySeqable x)) (t/NonEmptySeqable x) (t/Option (clojure.lang.Seqable x)) Arguments: (t/U Keyword (t/HVec [clojure.lang.Keyword java.lang.Number])) Ranges: x :object {:path [(Nth 0)], :id 0} nil x (t/Option x) in: (first (second col)) in: (first (second col)) ExceptionInfo Type Checker: Found 1 error clojure.core/ex-info (core. clj:4403) My assumption is that the check (if (vector? (second col will return only true if it is this type: (HVec [Keyword Number]). However, I have the impression that core.typed does not resolve the if expression properly. Or maybe I am missing something completely. Any hints or recommendations? Thanks, Sven -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com javascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ANN] Clojure 1.7.0-beta1 released
I've been running beta1 in production since about 1 day after it was announced. Everything's been smooth so far :D On Friday, 17 April 2015 06:51:53 UTC+12, Sean Corfield wrote: We deployed beta1 to production this morning. I’ll report back if we encounter any problems (generally we’ve found Clojure pre-release builds to be very stable). We were previously running alpha5 in production. Sean On Apr 10, 2015, at 12:25 PM, Alex Miller al...@puredanger.com javascript: wrote: Clojure 1.7.0-beta1 is now available. Try it via - Download: https://repo1.maven.org/maven2/org/clojure/clojure/1.7.0-beta1/ - Leiningen: [org.clojure/clojure 1.7.0-beta1] Regression fixes since 1.7.0-alpha6: 1) CLJ-1692 - make iterate match prior laziness 2) CLJ-1694 - make cycle match prior laziness 3) CLJ-1685 - correctly handle :eof option in read and read-string One faster sequence and reduce path that didn't quite make it into alpha6 is now available - range is now faster for both the traditional sequence use case (both chunked and unchunked traversal) and the fast reduce path. Also, since alpha6 was released, reader conditionals were ported to tools.reader and the latest ClojureScript release now supports them, so now is a great time to try them out! For all changes new in beta1, see the issues marked (beta1) in the full changes below. … -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.