Re: [ANN] Instaparse 1.4.4

2016-12-24 Thread Alex Engelberg
Hi Jeaye,

1. That's indeed a mistaken breakage, I will fix it. Note that specifically
the java.net.URL input is what's not properly handled, so if you call (str
(io/resource "...")) that will still work as expected.

2. That's also a bug, due to how defparser quotes all of its arguments and
tries to use them as arguments to insta/parser. I will fix it, and add more
thorough tests for the macro.

To answer your more general question: I don't think Clojure users of
Instaparse should really have to think about defparser, since I think most
JVM use cases don't suffer from the small extra one-time startup cost. I
made it primarily with ClojureScript in mind, since being able to now slurp
the grammar adds some power that's non-trivial to implement otherwise. But
I made it available to both clj and cljs for completeness and
cross-compatibility.

Thanks for the reports.
--Alex

On Sat, Dec 24, 2016 at 3:13 PM, Jeaye  wrote:

> This is great to see; instaparse is crucial for some of my projects and I
> appreciate the ongoing development.
>
> I've noticed two issues with 1.4.4 which I want to run by you:
>
> 1. insta/parser has a breaking change, in that it no longer accepts
> resources directly
>
>   I can work around this easily by slurping before hand, but this may've
> been an accidental breakage.
>
> 2. insta/defparser doesn't support the same optional parameters as
> insta/parser
>
>   Specifically, I've found that it doesn't like when I specify
> :auto-whitespace, which is a feature on which I rely heavily for my grammar.
>
> Finally, given the possible performance benefits, do you recommend
> everyone (Clojure and ClojureScript) prefer defparser, where possible?
>
> Thanks!
>
> On Fri, Dec 23, 2016 at 04:52:12PM -0800, Mark Engelberg wrote:
> > Instaparse is a library for generating parsers from context-free
> grammars.
> > https://github.com/engelberg/instaparse
> >
> > The big news for this release is that Alex Engelberg has combined the
> > Clojure version with the Clojurescript version of instaparse (initiated
> by
> > Lucas Bradstreet in 2014) so that moving forward, we can maintain both
> > versions as part of the same codebase.  Instaparse leverages a number of
> > Clojure interfaces and subtle features that differ between Clojure and
> > Clojurescript, so merging the ports was a significant effort.
> >
> > Also, to achieve backwards compatibility, Alex wrote the cljsee leiningen
> > plugin which splits cljc files into clj and cljs files for compatibility
> > with Clojure 1.5 and 1.6.  Check out cljsee if you are interested in
> > maintaining backwards compatibility in your own cljc-based projects.  (
> > https://github.com/aengelberg/cljsee)
> >
> > The one new feature is a defparser macro, especially relevant to the
> > Clojurescript port because it makes it possible to build the parser at
> > compile time so the Clojurescript code will execute more quickly.
> >
> > Other than that one addition, the behavior should be identical to the
> prior
> > 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.
>
> --
> 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 

[ANN] data.xml 0.2.0-alpha2

2016-12-24 Thread Herwig Hochleitner
data.xml is a Clojure contrib library that parses and emits XML.

Github: https://github.com/clojure/data.xml
Changelog: https://github.com/clojure/data.xml/blob/master/CHANGES.md

Information on updating the dependency is here
.

0.2.0-alpha2 simplifies the API for constructing QNames and cleans up
leftover cruft from the 0.1.0 series QName handling.

XML elements now implement MapEquivalence, such that a data.xml element can
be equal to an element in hash-map form. The defrecord had to be replaced
with a deftype for that purpose.

Thanks to all data.xml contributors!

-- 
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] data.xml 0.2.0-alpha1

2016-12-24 Thread Herwig Hochleitner
Sorry for the late response, I had to finish 0.2.0-alpha2, in order to
present you with the final API for constructing qnames.
Please upgrade.

​::can/mqMessageHeader is a purely syntactic shorthand, which gets expanded
by the reader to whatever 'can aliases to in the current namespace.
Apparently this feature is undocumented in the clojure reference. It is,
however documented for clojurescript http://cljs.github.io/api/
syntax/keyword-qualify and I'm going to file a clojure ticket for this.

Since keyword representation is fully unified in 0.2.0 and there is no more
prefix lookup, there is no way around storing the uri into the keywords
themselves. If you want to construct them, please use the qname constructor.

-- 
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] Instaparse 1.4.4

2016-12-24 Thread Jeaye
This is great to see; instaparse is crucial for some of my projects and I 
appreciate the ongoing development.

I've noticed two issues with 1.4.4 which I want to run by you:

1. insta/parser has a breaking change, in that it no longer accepts resources 
directly

  I can work around this easily by slurping before hand, but this may've been 
an accidental breakage.

2. insta/defparser doesn't support the same optional parameters as insta/parser

  Specifically, I've found that it doesn't like when I specify 
:auto-whitespace, which is a feature on which I rely heavily for my grammar.

Finally, given the possible performance benefits, do you recommend everyone 
(Clojure and ClojureScript) prefer defparser, where possible?

Thanks!

On Fri, Dec 23, 2016 at 04:52:12PM -0800, Mark Engelberg wrote:
> Instaparse is a library for generating parsers from context-free grammars.
> https://github.com/engelberg/instaparse
> 
> The big news for this release is that Alex Engelberg has combined the
> Clojure version with the Clojurescript version of instaparse (initiated by
> Lucas Bradstreet in 2014) so that moving forward, we can maintain both
> versions as part of the same codebase.  Instaparse leverages a number of
> Clojure interfaces and subtle features that differ between Clojure and
> Clojurescript, so merging the ports was a significant effort.
> 
> Also, to achieve backwards compatibility, Alex wrote the cljsee leiningen
> plugin which splits cljc files into clj and cljs files for compatibility
> with Clojure 1.5 and 1.6.  Check out cljsee if you are interested in
> maintaining backwards compatibility in your own cljc-based projects.  (
> https://github.com/aengelberg/cljsee)
> 
> The one new feature is a defparser macro, especially relevant to the
> Clojurescript port because it makes it possible to build the parser at
> compile time so the Clojurescript code will execute more quickly.
> 
> Other than that one addition, the behavior should be identical to the prior
> 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.

-- 
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.


signature.asc
Description: PGP signature


Re: Why does "clojure.core/run!" end in an exclamation mark?

2016-12-24 Thread Shantanu Kumar
I'm curious about `clojure.core/run!` too, but my question is whether it is 
meant to be a `reduce` variant of `clojure.core/doseq` or it has some other 
purpose.

Shantanu

On Saturday, 24 December 2016 21:37:11 UTC+5:30, James Reeves wrote:
>
> My understanding is that the convention used in clojure.core is to put an 
> exclamation mark onto the end of any function unsafe to run in a 
> transaction.
>
> Does the reasoning differ for "run!" or is it assumed that the function 
> passed to "run!" will not usually be idempotent?
>
> - James
>

-- 
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.


Why does "clojure.core/run!" end in an exclamation mark?

2016-12-24 Thread James Reeves
My understanding is that the convention used in clojure.core is to put an
exclamation mark onto the end of any function unsafe to run in a
transaction.

Does the reasoning differ for "run!" or is it assumed that the function
passed to "run!" will not usually be idempotent?

- James

-- 
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: Stack Overflow Question

2016-12-24 Thread James Reeves
On 24 December 2016 at 11:48, Jiacai Liu  wrote:

> how to make correct fn args when create fn using macro
> http://stackoverflow.com/q/41312963/2163429?sem=2
>

For reference, I posted an answer on StackOverflow.

- James

-- 
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: Stack Overflow Question

2016-12-24 Thread Jiacai Liu


your version is obviously wrong, when '~param will try to resolve param, 
but no luck

On Saturday, December 24, 2016 at 10:07:15 PM UTC+8, Jim foo.bar wrote:
>
> try the following:
>
> (defmacro defapihandler [handler-name params & body]
>   `(defn ~handler-name ['~passed-param]
>  (let [param-keys# (vec (map (comp symbol name :key)
> ~params))
>{:keys param-keys#} '~passed-param]
>;; some check
>~@body)))
>
>
>
> Sorry for brevity, I'm on my phone...
> Dimitris
>
> On 24/12/16 13:23, Jiacai Liu wrote:
>
> I don’t think your answer is correct. From the expaned macro
>
> (defn create-user [passed-param__10243__auto__]
>   (let [param-keys__10244__auto__ (vec
> (map
>   (comp symbol name :key)
>   [{:key :username,
> :checkers []}]))
> {:keys param-keys__10244__auto__} passed-param__10243__auto__]
> (do (println username
>
> and following test
>
> (let [some-keys '[a b]
>   {:keys some-keys} {:a 1 :b 2}]
>   ; thows Don't know how to create ISeq from: clojure.lang.Symbol
>   (println a b))
>
> (let [{:keys [a b]} {:a 1 :b 2}]
>   ; ok
>   (println a b))
>
> I think it is in let destructuring form, we can’t use dynamic var to 
> represent symbols
>
>
>
> On Saturday, December 24, 2016 at 8:43:42 PM UTC+8, Jim foo.bar wrote: 
>>
>> you need to use `'~passed-param` in your arg-vector, and the same 
>> whenever you use it inside the newly defined fn.
>>
>>
>> HTH,
>>
>> Dimitris
>>
>> On 24/12/16 11:48, Jiacai Liu wrote:
>>
>> how to make correct fn args when create fn using macro
>> http://stackoverflow.com/q/41312963/2163429?sem=2
>> -- 
>> 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 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.


Re: Stack Overflow Question

2016-12-24 Thread dimitris

try the following:

|(defmacrodefapihandler [handler-name params & body]`(defn~handler-name 
['~passed-param](let[param-keys# (vec(map(comp symbol name 
:key)~params)){:keysparam-keys#}'~passed-param];; some check~@body))) |


Sorry for brevity, I'm on my phone...
Dimitris

On 24/12/16 13:23, Jiacai Liu wrote:


I don’t think your answer is correct. From the expaned macro

|(defn create-user [passed-param__10243__auto__] (let 
[param-keys__10244__auto__ (vec (map (comp symbol name :key) [{:key 
:username, :checkers []}])) {:keys param-keys__10244__auto__} 
passed-param__10243__auto__] (do (println username |


and following test

|(let [some-keys '[a b] {:keys some-keys} {:a 1 :b 2}] ; thows Don't 
know how to create ISeq from: clojure.lang.Symbol (println a b)) (let 
[{:keys [a b]} {:a 1 :b 2}] ; ok (println a b)) |


I think it is in let destructuring form, we can’t use dynamic var to 
represent symbols





On Saturday, December 24, 2016 at 8:43:42 PM UTC+8, Jim foo.bar wrote:

you need to use `'~passed-param` in your arg-vector, and the same
whenever you use it inside the newly defined fn.


HTH,

Dimitris


On 24/12/16 11:48, Jiacai Liu wrote:

how to make correct fn args when create fn using macro
http://stackoverflow.com/q/41312963/2163429?sem=2

-- 
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: Stack Overflow Question

2016-12-24 Thread Jiacai Liu


I don’t think your answer is correct. From the expaned macro

(defn create-user [passed-param__10243__auto__]
  (let [param-keys__10244__auto__ (vec
(map
  (comp symbol name :key)
  [{:key :username,
:checkers []}]))
{:keys param-keys__10244__auto__} passed-param__10243__auto__]
(do (println username

and following test

(let [some-keys '[a b]
  {:keys some-keys} {:a 1 :b 2}]
  ; thows Don't know how to create ISeq from: clojure.lang.Symbol
  (println a b))

(let [{:keys [a b]} {:a 1 :b 2}]
  ; ok
  (println a b))

I think it is in let destructuring form, we can’t use dynamic var to 
represent symbols



On Saturday, December 24, 2016 at 8:43:42 PM UTC+8, Jim foo.bar wrote:
>
> you need to use `'~passed-param` in your arg-vector, and the same whenever 
> you use it inside the newly defined fn.
>
>
> HTH,
>
> Dimitris
>
> On 24/12/16 11:48, Jiacai Liu wrote:
>
> how to make correct fn args when create fn using macro
> http://stackoverflow.com/q/41312963/2163429?sem=2
> -- 
> 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.


Re: Stack Overflow Question

2016-12-24 Thread dimitris
you need to use `'~passed-param` in your arg-vector, and the same 
whenever you use it inside the newly defined fn.



HTH,

Dimitris


On 24/12/16 11:48, Jiacai Liu wrote:

how to make correct fn args when create fn using macro
http://stackoverflow.com/q/41312963/2163429?sem=2
--
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.


Stack Overflow Question

2016-12-24 Thread Jiacai Liu
how to make correct fn args when create fn using macro
http://stackoverflow.com/q/41312963/2163429?sem=2

-- 
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.