Re: [ANN] data.xml 0.2.0-alpha1

2016-12-20 Thread Herwig Hochleitner
Hi Francis,

first off: if you can afford it, I'd recommend working with the 0.2.0
series, as the 0.1.0 namespace api is legacy.

In the 0.2.0 series, the mapping of keyword prefix to xmlns is unique and
fixed, so names are always parsed as keywords (though QName instances still
are permitted for emitting).
In the 0.1.0 series, namespaced names are only rewritten to keyword form,
if there is an active alias, established by declare-ns.

An example for using 0.2.0 is here
https://github.com/webnf/davstore/blob/master/src/server/webnf/davstore/dav/xml.cljc,
though 0.1.0 works in a similar way, if declare-ns is used.

tag= of xml-zip and other processing equipement should just work as with
non-namespaced names (which are represented as blank keywords, as before)

data.xml also has qname-uri and qname-local to get at the respective parts
of an accepted qname representation (keyword, qname instance, string). The
qname prefix should be completely discarded during xml processing (which
data.xml does).

hope that helps

-- 
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: Changing value of atom vector using swap

2016-12-20 Thread Michael Blume
It doesn't look like data is actually an atom? Maybe that's just an error
in your e-mail...

On Tue, Dec 20, 2016 at 8:24 AM Ghadi Shayban  wrote:

> swap! takes as its arguments the atom and the function to transition the
> state inside the atom.  It implicitly calls the function on the state:
> (swap! data replace-value)
>
> It also can accept trailing arguments too...
>
>
> https://www.conj.io/store/v1/org.clojure/clojure/1.8.0/clj/clojure.core/swap%21
>
> On Tuesday, December 20, 2016 at 11:04:11 AM UTC-5, Rickesh Bedia wrote:
>
> I have
> (def data {:headers ["A" "B" "C" "D"]
>  :rows [["1" "2" "3" "4"] ["5" "6" "7" "8"] ["9" "10" "11"
> "12"]]})
>
> And I have a function
> (defn replace-value [struct]
> (clojure.walk/prewalk-replace {"3" "hello"} (struct :rows)))
>
> When I do
> (replace-value @data) > [["1" "2" "hello" "4"] ["5" "6" "7" "8"] ["9" "10"
> "11" "12"]]
>
> which is what I am expecting.
>
> However I want to achieve this same result using swap! So I tried
> #(swap! data (replace-value %))
>
> but I get the error #object[user$eval1308$fn__1309 0x6caeefd7
> "user$eval1308$fn__1309@6caeefd7"]
>
> I don't know what this error means nor how to resolve it
>
> --
> 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.


unit tests on gen-class outcome

2016-12-20 Thread Jacek Grzebyta
Hi,

I have a project which uses some java project. I made classes using
gen-class. Than in unit test just wanted to test it (clojure.test enviro).
If I run tests in emacs+cider they works. If I run test in the command line
I have class not found exception:

boot testing aot run-test

task testing adds test/ directory to source
run-test just executes test. It works if there are tests against clojure
code.

Adding paths to *.class files into CLASSPATH does not help.

Thanks a lot,
Jacek

-- 
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-20 Thread Francis Hitchens
Hi Herwig,

I would like some help on how to use namespaces. I'm using 
the org.clojure/data.xml "0.1.0-beta3" and am a bit confused and can't find 
any good examples.

My namespaced xml message has elements where the  :tag is an 
javax.xml.namespace.QName object. Up to now I have been just handling 
keyword tag objects and have become proficient in locating them using 
zx/tag= out of the clojure.data.zip library.

Have you any advice on how to do this, bearing in mind I need to be able to 
process namespaced and flat XML's at the same time? Right now I'm thinking 
about just zipping through the XML and replacing all the QName's with a 
keyword representation of .getPrefix / .getLocalPart. 

regards, Francis. 

On Tuesday, December 13, 2016 at 4:31:20 PM UTC-6, Herwig Hochleitner wrote:
>
> 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 
> .
>
> The major updates in 0.2.0-alpha1 are a breaking change to the xml 
> namespace API as well as clojurescript support.
>
> It turns out I was overconfident in the choice to use a runtime registry 
> for establishing a clojure ns <-> xmlns mapping, hence pushed for beta 
> releases right away. Apologies for that.
>
> Choosing a fixed, uniform mapping is much simpler. Many benefits unfold 
> from that (e.g. one can now get an efficient binary xml encoding, by just 
> serializing parse trees with fressian).
> Find detailed rationale in the design page 
> .
>
> 0.2.0-alpha1 has a breaking change in the namespacing api. Basically, 
> `declare-ns` and `alias-ns` have been merged into `alias-uri`.
>
> The 0.1.0-beta series will be discontiued without a stable release. If 
> you're already depending on the 0.1.0 flavor of namespace support with the 
> runtime registry, we can do further beta releases with bugfix backports. 
> Please let me know if you would have any use for such.
>
> Clojurescript support, while incomplete, has been coming along nicely.
>
> Feedback is very welcome, also in particular to the new representation of 
> qnames:
> The qname {http://www.w3.org/1999/xhtml}head is encoded in data.xml as 
> :http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml/head
> You'll notice the percent-encoding in keywords, which works on clojure >= 
> 1.5
>
> Thanks to all data.xml contributors!
> Thanks to Phill Wolf aka Matching Socks for providing great feedback 
> !
> Special Thanks to Alex Miller for being super responsive and a big help 
> with figuring out cljc deployment!
>

-- 
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: Changing value of atom vector using swap

2016-12-20 Thread Ghadi Shayban
swap! takes as its arguments the atom and the function to transition the 
state inside the atom.  It implicitly calls the function on the state:
(swap! data replace-value)

It also can accept trailing arguments too...  

https://www.conj.io/store/v1/org.clojure/clojure/1.8.0/clj/clojure.core/swap%21

On Tuesday, December 20, 2016 at 11:04:11 AM UTC-5, Rickesh Bedia wrote:
>
> I have
> (def data {:headers ["A" "B" "C" "D"]
>  :rows [["1" "2" "3" "4"] ["5" "6" "7" "8"] ["9" "10" "11" 
> "12"]]})
>
> And I have a function
> (defn replace-value [struct] 
> (clojure.walk/prewalk-replace {"3" "hello"} (struct :rows)))
>
> When I do
> (replace-value @data) > [["1" "2" "hello" "4"] ["5" "6" "7" "8"] ["9" "10" 
> "11" "12"]]
>
> which is what I am expecting.
>
> However I want to achieve this same result using swap! So I tried
> #(swap! data (replace-value %))
>
> but I get the error #object[user$eval1308$fn__1309 0x6caeefd7 
> "user$eval1308$fn__1309@6caeefd7"]
>
> I don't know what this error means nor how to resolve it
>

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


Changing value of atom vector using swap

2016-12-20 Thread 'Rickesh Bedia' via Clojure
I have
(def data {:headers ["A" "B" "C" "D"]
 :rows [["1" "2" "3" "4"] ["5" "6" "7" "8"] ["9" "10" "11" 
"12"]]})

And I have a function
(defn replace-value [struct] 
(clojure.walk/prewalk-replace {"3" "hello"} (struct :rows)))

When I do
(replace-value @data) > [["1" "2" "hello" "4"] ["5" "6" "7" "8"] ["9" "10" 
"11" "12"]]

which is what I am expecting.

However I want to achieve this same result using swap! So I tried
#(swap! data (replace-value %))

but I get the error #object[user$eval1308$fn__1309 0x6caeefd7 
"user$eval1308$fn__1309@6caeefd7"]

I don't know what this error means nor how to resolve it

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