Re: Parsing namespaced XML with clojure.data.xml
2016-08-20 21:43 GMT+02:00 Matching Socks : > > Could the same effect be obtained without the global state of namespace > mappings? Do all uses of clojure.data.xml in an app, even fully > encapsulated uses, have to agree about the keyword for any given well-known > XML namespace URI? > Currently, that is the case. The motivation is to ensure value-equality for parse trees within an application. Do you have a compelling use case for passing the namespace mapping into the parse call? -- 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: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11
The documentation now includes the spec, which would explicilly mention the symbol, so this would not be tacitly hidden as you suggest. David is already working on porting these specs to ClojureScript so that issue is one we will imminently face. So again I will state: while the current spec does not support the symbol version we are in an investigatory period and things may change before release. -- 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.
Add :examples option to s/fdef for documentation and testing?
Did you consider having examples (input-output mappings) be part of the spec for a function, i.e. add an :examples option to the fdef macro in addition to :the current args, :ret, and :fn options? There is nothing really like examples for learning and clojuredocs.org has been immensely useful for this reason. I figured that especially for functions with simple input-output mappings of primitive data having a few such representative mappings be part of the spec and the doc string would be natural. Those examples could of course also drive tests. -- 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: taking my clojure game to a higher level
I think you just need a project to motivate you to go deeper into the language. Take on a project that you've been wanting to work on for some time and write it in Clojure. On Saturday, August 20, 2016 at 11:59:42 PM UTC-4, chia kang ren wrote: > > I started programming with Racket 2 years ago and i decided i want to use > a Lisp with more libraries at my disposal. So i have made some headway into > Clojure and am familiar with core functions like map, reduce, filter, loop, > for, doseq, some, every?, apply. I make use of macros like ->, ->>, .. > sometimes. I'm somewhat familiar with destructuring and the clojure data > structures. > > I have never seen the need to learn transients, macros, protocols, > transducers, multimethods, have struggled with string and file I/O > operations on the rare occasions i need to use them. I have a vague idea of > things like "parallelism", "concurrency", probably because the applications > i build never have had a need of such things. I have a vague idea of how > expensive calls to this or that function would be. > > Most of my explorations have been with Clojurescript using Om or solving > puzzles, so i have been limited to mostly small scripts, or projects that > never go beyond a few files. > > I would like to step up my game. I like working in Clojure enough and i > think i have had enough of scripts, i want to write Clojure *programs.* I > want to understand how to make the most of this language, and I would > appreciate very much anecdotes/guidance from the community on how to do so > -- 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: Parsing namespaced XML with clojure.data.xml
Apps are cobbled together from sub-systems and libraries. Some of those may use clojure.data.xml, either to share their products with their client or for their internal purposes. As soon as two libraries on Clojars differ in their namespace-URI to keyword-namespace mapping, has the ship sunk? Nonetheless, value equality might sometimes be useful. How to achieve it? There is already a globally distinct, agreed, and unambiguous way to refer to each well-known XML namespace URI. It is the URI itself. If the keyword-namespace must have the same properties, it ought to follow from the URI, not be left to the discretion of individual consumers. Could there be a well-known translation from namespace-URI to keyword-namespace and back? These keyword namespaces would be cumbersome (as they must include the whole URI and also avoid colliding with the namespace of any other namespaced keywords anywhere), but consumers could alias them conveniently without impacting value comparisons: (->> 'xmlns.http.www.w3.org.n1999.xhtml create-ns ns-name symbol (alias 'xhtml)) To account for the whole space of URIs, without violating the Clojure or EDN keyword namespace spec or compromising reverse translation back to the URI, you might have to go further. For example, combine a legible symbol name computed with some loss (as an assertion) and a Base-64 encoding... (->> 'xmlns.http.maven.apache.org.POM.4.0.0.aHR0cDovL21hdmVuLmFwYWNoZS5vcmcvUE9NLzQuMC4wCg== create-ns ns-name symbol (alias 'pom)) A well-known formula for namespace keywords representing XML namespaces could replace the ad-hoc mutable map and satisfy your dual aims that clojure.data.xml applications might use keywords for convenience while also maintaining strict value equality of the XML data structures all the way to the horizon. (The data structure would use such keywords for all element tags.) -- 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: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11
As an update. I’ve fixed the `ns` oopsie in Suchwow (one file), and the coincident `ns` oopsie in Midje (one file). But this happens when running Midje’s self-tests against Clojure 1.9alpha11: > Exception in thread "main" java.lang.IllegalArgumentException: Call to > clojure.core/fn did not conform to spec: > In: [0] val: clojure.core.unify/var-unify fails spec: > :clojure.core.specs/arg-list at: [:args :bs :arity-1 :args] predicate: vector? > In: [0] val: clojure.core.unify/var-unify fails spec: > :clojure.core.specs/args+body at: [:args :bs :arity-n] predicate: (cat :args > :clojure.core.specs/arg-list :prepost (? map?) :body (* any?)) > :clojure.spec/args (clojure.core.unify/var-unify [varp v expr binds] > (clojure.core/if-let [vb__10124__auto__ (binds v)] > (clojure.core.unify/garner-unifiers varp vb__10124__auto__ expr binds) > (clojure.core/if-let [vexpr__10125__auto__ (clojure.core/and (varp expr) > (binds expr))] (clojure.core.unify/garner-unifiers varp v > vexpr__10125__auto__ binds) (if (clojure.core.unify/occurs? varp v expr > binds) (throw (java.lang.IllegalStateException. (clojure.core/str "Cycle > found in the path " expr))) (clojure.core.unify/bind-phase binds v expr) > , compiling:(clojure/core/unify.clj:82:18) I suspect the problem is that Midje uses an old version of clojure.core.unify (0.5.2). I use that old version because a later versions (like the current 0.5.7) failed in my use case for no reason I could quickly understand. So I decided to just stick with the older, working version because forced upgrades make kittens suffer. And I am a kitten. And also: by semver, why should a satisfied user of 0.5.2 care about 0.5.7? (Note: I don’t know whether clojure.core.unify 0.5.7 is conformant to whatever spec is breaking.) So upgrading Midje to Clojure 1.0alpha11 is not turning out as simple as might be hoped. I know that, pace Casablanca[*], the problems of a guy trying to provide an alternative to clojure.test don’t amount to a hill of beans in this crazy world. But I offer this datapoint for clojure.core.team consideration. [*] Rick: But I've got a job to do, too. Where I'm going, you can't follow. What I've got to do, you can't be any part of. Ilsa, I'm no good at being noble, but it doesn't take much to see that the problems of three little people don't amount to a hill of beans in this crazy world. Someday you'll understand that. [Ilsa lowers her head and begins to cry] Rick: Now, now... [Rick gently places his hand under her chin and raises it so their eyes meet] Rick: Here's looking at you kid. -- 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: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11
FYI, while I disagree with your conclusion (I think we should go fix libraries instead), I ran into the same issue just now for roughly the same reason, except the thing that pulled in an old version of core.unify was core.typed, which pulls in 0.5.3 through core.contracts. > On Aug 21, 2016, at 5:24 PM, Brian Marick wrote: > > As an update. I’ve fixed the `ns` oopsie in Suchwow (one file), and the > coincident `ns` oopsie in Midje (one file). But this happens when running > Midje’s self-tests against Clojure 1.9alpha11: > >> Exception in thread "main" java.lang.IllegalArgumentException: Call to >> clojure.core/fn did not conform to spec: >> In: [0] val: clojure.core.unify/var-unify fails spec: >> :clojure.core.specs/arg-list at: [:args :bs :arity-1 :args] predicate: >> vector? >> In: [0] val: clojure.core.unify/var-unify fails spec: >> :clojure.core.specs/args+body at: [:args :bs :arity-n] predicate: (cat :args >> :clojure.core.specs/arg-list :prepost (? map?) :body (* any?)) >> :clojure.spec/args (clojure.core.unify/var-unify [varp v expr binds] >> (clojure.core/if-let [vb__10124__auto__ (binds v)] >> (clojure.core.unify/garner-unifiers varp vb__10124__auto__ expr binds) >> (clojure.core/if-let [vexpr__10125__auto__ (clojure.core/and (varp expr) >> (binds expr))] (clojure.core.unify/garner-unifiers varp v >> vexpr__10125__auto__ binds) (if (clojure.core.unify/occurs? varp v expr >> binds) (throw (java.lang.IllegalStateException. (clojure.core/str "Cycle >> found in the path " expr))) (clojure.core.unify/bind-phase binds v expr) >> , compiling:(clojure/core/unify.clj:82:18) > > I suspect the problem is that Midje uses an old version of clojure.core.unify > (0.5.2). I use that old version because a later versions (like the current > 0.5.7) failed in my use case for no reason I could quickly understand. So I > decided to just stick with the older, working version because forced upgrades > make kittens suffer. And I am a kitten. And also: by semver, why should a > satisfied user of 0.5.2 care about 0.5.7? > > (Note: I don’t know whether clojure.core.unify 0.5.7 is conformant to > whatever spec is breaking.) > > So upgrading Midje to Clojure 1.0alpha11 is not turning out as simple as > might be hoped. > > I know that, pace Casablanca[*], the problems of a guy trying to provide an > alternative to clojure.test don’t amount to a hill of beans in this crazy > world. But I offer this datapoint for clojure.core.team consideration. > > > > [*] > > Rick: But I've got a job to do, too. Where I'm going, you can't follow. What > I've got to do, you can't be any part of. Ilsa, I'm no good at being noble, > but it doesn't take much to see that the problems of three little people > don't amount to a hill of beans in this crazy world. Someday you'll > understand that. > [Ilsa lowers her head and begins to cry] > Rick: Now, now... > [Rick gently places his hand under her chin and raises it so their eyes meet] > Rick: Here's looking at you kid. > > -- > 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: taking my clojure game to a higher level
Sounds like you are ready for this book: https://www.amazon.com/Clojure-Applied-Practice-Practitioner-Vandgrift/dp/1680500740 -- 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: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11
On Sunday, August 21, 2016 at 5:25:03 PM UTC-5, Brian Marick wrote: > > As an update. I’ve fixed the `ns` oopsie in Suchwow (one file), and the > coincident `ns` oopsie in Midje (one file). But this happens when running > Midje’s self-tests against Clojure 1.9alpha11: > > > Exception in thread "main" java.lang.IllegalArgumentException: Call to > clojure.core/fn did not conform to spec: > > In: [0] val: clojure.core.unify/var-unify fails spec: > :clojure.core.specs/arg-list at: [:args :bs :arity-1 :args] predicate: > vector? > > In: [0] val: clojure.core.unify/var-unify fails spec: > :clojure.core.specs/args+body at: [:args :bs :arity-n] predicate: (cat > :args :clojure.core.specs/arg-list :prepost (? map?) :body (* any?)) > > :clojure.spec/args (clojure.core.unify/var-unify [varp v expr binds] > (clojure.core/if-let [vb__10124__auto__ (binds v)] > (clojure.core.unify/garner-unifiers varp vb__10124__auto__ expr binds) > (clojure.core/if-let [vexpr__10125__auto__ (clojure.core/and (varp expr) > (binds expr))] (clojure.core.unify/garner-unifiers varp v > vexpr__10125__auto__ binds) (if (clojure.core.unify/occurs? varp v expr > binds) (throw (java.lang.IllegalStateException. (clojure.core/str "Cycle > found in the path " expr))) (clojure.core.unify/bind-phase binds v > expr) > > , compiling:(clojure/core/unify.clj:82:18) > > I suspect the problem is that Midje uses an old version of > clojure.core.unify (0.5.2). I use that old version because a later versions > (like the current 0.5.7) failed in my use case for no reason I could > quickly understand. Hard to help without more info. > So I decided to just stick with the older, working version because forced > upgrades make kittens suffer. And I am a kitten. And also: by semver I don't know that core.unify follows semver. I don't know that it doesn't, but that seems like an assumption. > , why should a satisfied user of 0.5.2 care about 0.5.7? > There is a change log: https://github.com/clojure/core.unify#change-log > (Note: I don’t know whether clojure.core.unify 0.5.7 is conformant to > whatever spec is breaking.) > It is. I released core.unify 0.5.7 about a month ago to fix the spec issue mentioned above. > > So upgrading Midje to Clojure 1.0alpha11 is not turning out as simple as > might be hoped. > > I know that, pace Casablanca[*], the problems of a guy trying to provide > an alternative to clojure.test don’t amount to a hill of beans in this > crazy world. But I offer this datapoint for clojure.core.team > consideration. > > > > [*] > > Rick: But I've got a job to do, too. Where I'm going, you can't follow. > What I've got to do, you can't be any part of. Ilsa, I'm no good at being > noble, but it doesn't take much to see that the problems of three little > people don't amount to a hill of beans in this crazy world. Someday you'll > understand that. > [Ilsa lowers her head and begins to cry] > Rick: Now, now... > [Rick gently places his hand under her chin and raises it so their eyes > meet] > Rick: Here's looking at you kid. > > -- 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: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11
On Sunday, August 21, 2016 at 5:28:57 PM UTC-5, lvh wrote: > > FYI, while I disagree with your conclusion (I think we should go fix > libraries instead), I ran into the same issue just now for roughly the same > reason, except the thing that pulled in an old version of core.unify was > core.typed, which pulls in 0.5.3 through core.contracts. > BTW, core.contracts was also updated to 0.0.6 last week to use the latest core.unify. -- 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: Add :examples option to s/fdef for documentation and testing?
Hi Peter, thanks for the idea, but I don't expect that we'll add this. On Sunday, August 21, 2016 at 8:26:24 AM UTC-5, Peter Marklund wrote: > > Did you consider having examples (input-output mappings) be part of the > spec for a function, i.e. add an :examples option to the fdef macro in > addition to :the current args, :ret, and :fn options? There is nothing > really like examples for learning and clojuredocs.org has been immensely > useful for this reason. I figured that especially for functions with simple > input-output mappings of primitive data having a few such representative > mappings be part of the spec and the doc string would be natural. Those > examples could of course also drive tests. > > -- 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: taking my clojure game to a higher level
I have gotten a copy of the book and am starting to work through it - thanks. I have found https://aphyr.com/tags/Clojure a very good resource as well for more in-depth learning On Sunday, August 21, 2016 at 7:24:39 PM UTC-4, puzzler wrote: > > Sounds like you are ready for this book: > > https://www.amazon.com/Clojure-Applied-Practice-Practitioner-Vandgrift/dp/1680500740 > > -- 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: taking my clojure game to a higher level
You are right - right now the apps that a junior dev like me are just simple stuff like webapps, which i have tried before with Clojure (but learning about webapps, Clojure and the libraries out there all at the same time made me abandon my efforts after 2 months). I am thinking i should look read the source code of Luminus and see where that takes me. On Sunday, August 21, 2016 at 11:32:08 AM UTC-4, adrian...@mail.yu.edu wrote: > > I think you just need a project to motivate you to go deeper into the > language. Take on a project that you've been wanting to work on for some > time and write it in Clojure. > > On Saturday, August 20, 2016 at 11:59:42 PM UTC-4, chia kang ren wrote: >> >> I started programming with Racket 2 years ago and i decided i want to use >> a Lisp with more libraries at my disposal. So i have made some headway into >> Clojure and am familiar with core functions like map, reduce, filter, loop, >> for, doseq, some, every?, apply. I make use of macros like ->, ->>, .. >> sometimes. I'm somewhat familiar with destructuring and the clojure data >> structures. >> >> I have never seen the need to learn transients, macros, protocols, >> transducers, multimethods, have struggled with string and file I/O >> operations on the rare occasions i need to use them. I have a vague idea of >> things like "parallelism", "concurrency", probably because the applications >> i build never have had a need of such things. I have a vague idea of how >> expensive calls to this or that function would be. >> >> Most of my explorations have been with Clojurescript using Om or solving >> puzzles, so i have been limited to mostly small scripts, or projects that >> never go beyond a few files. >> >> I would like to step up my game. I like working in Clojure enough and i >> think i have had enough of scripts, i want to write Clojure *programs.* I >> want to understand how to make the most of this language, and I would >> appreciate very much anecdotes/guidance from the community on how to do so >> > -- 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.