This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-02
Channels
- # aleph (1)
- # architecture (4)
- # beginners (39)
- # boot (12)
- # cider (25)
- # cljs-dev (3)
- # cljsrn (5)
- # clojure (175)
- # clojure-dusseldorf (1)
- # clojure-italy (13)
- # clojure-nl (4)
- # clojure-russia (1)
- # clojure-spec (52)
- # clojure-uk (110)
- # clojurescript (35)
- # data-science (2)
- # datomic (61)
- # editors (8)
- # emacs (2)
- # fulcro (7)
- # graphql (15)
- # hoplon (1)
- # hyperfiddle (3)
- # jobs (4)
- # jobs-discuss (12)
- # juxt (2)
- # lein-figwheel (6)
- # leiningen (35)
- # off-topic (4)
- # onyx (5)
- # parinfer (1)
- # pedestal (63)
- # re-frame (38)
- # reitit (7)
- # ring-swagger (7)
- # rum (2)
- # shadow-cljs (27)
- # tools-deps (10)
- # uncomplicate (16)
@seancorfield and what about https://github.com/uswitch/clj-soap? Is there something obviously wrong with it?
Hey a transducers question: what are currently some noteable transduction contexts used out there? I need to showcase to some scala devs today
this is my company http://www.copula.ai
My company and yours are really similar 🙂
@slawek098 Have you tried NOT doing SOAP?
Note: I forked that to get it working on Clojure 1.5.1 but gave up on it because it didn't do what I needed. /cc @slawek098
The libraries @seancorfield mentioned should be fine
3. Most of the modern web uses JSON, so it feels like there needs to be justification to not use that.
@emccue I'd love to use REST, of course. I just need to talk with SOAP-only service…
@slawek098 I'm fine with https://github.com/Zeto-Ltd/clj-soap
Note: I forked that to get it working on Clojure 1.5.1 but gave up on it because it didn't do what I needed. /cc @slawek098
@slawek098 @gon Just noticed that Zeto-Ltd's version is a fork off mine 🙂 So that would now be my recommendation since it's more recently updated 🙂
In my company we wrote soap library which is not requires java interop for making SOAP requests and can process WSDLs without recompiling your source code. It uses zippers in combination with selmer to build valid SOAP payload. So for library users it looks like their doing REST requests instead of SOAP. How many of you folks are interesting in such kind of library so I can arguing with source code owners about open sourcing it?
That would be excellent, @delaguardo
It’s hard to argue Clojure over Scala for XML web services.
Scala is as good at XML as Clojure is at JSON, roughly speaking in my experience.
@delaguardo sounds very interesting
Thanks for feedback. I will spend some time to add more tests and documentation and publish it at the end of this week. Stay tuned)
Hi. I'm having a major hair pulling moment. I have code that I believe should do the exact same thing behaving differently.
Unfortunately can't paste the actual code, but here's the gist of it. The second-fn
call appears to handle the data in two
differently based on wether two comes from the function call or if it is a literal.
Is there some very obvious and devious known gotcha I'm missing here? Any help and pointers very much appreciated. Thanks.
;; does not work
(let [[one two] (first-fn)
three (second-fn two)]
(prn two))
;; works fine
(let [[one two] (first-fn)
two '{literally the actual value of two copy pasted from above}
three (second-fn two)]
(prn two))
There’s a lot which could be happening here, but why are you using backtick there not quote?
Regardless of what second-fn actually does, I would have expected the behaviour to be identical.
Sorry, I mistyped when composing the example. I am using an apostrophe to quote the pasted in my code as it contains lists.
I have a bajillion print statements going deep in all the functions and the data seems to be identical until some point where it just gets treated differently.
Yes, I have checked with =
There’s nowhere near enough information here for us to commentate on what could be happening. two
is data-independent of three
and second-fn
in either of these examples and it’s fairly easy to come up with examples where object equality missbehaves with non-Clojure objects.
e.g. if you used prn at any point, in the process of checking if the two things are equal, you are not actually checking the two things for equality
two is just a regular hash-map, no funny objects
user=> (doto (java.util.HashMap.) (.put 1 1))
{1 1}
user=> (= (doto (java.util.HashMap.) (.put 1 1)) {1 1})
true
I am using prn extensively to try to figure it out. I understand you are saying that prn might be hiding the true value of the displayed data. What should I use instead?
and if the keys or values of two are numbers, check whether they are floats/bytes/chars etc
well, you have both things named two in you example above, I would rename one of them to two*
and prn (= two tow*)
keys are uuids, so string. meta might be an avenue, as I am later using zippers to go through some subparts of two and then edit the tree.
And I think zippers might use some meta, as I noticed some with-meta calls in the source of vector-zip.
Progress! Thanks. Should I be doing anything special when working with data that has meta?
I am not familiar with this part of clojure.
Regardless of whether clojure.zip is using metadata, I don't understand why this should matter? The zipper part is somewhere about 10 calls deep within second-fn
. I would expect that if I pass identical data in second-fn
, it should behave the same way. How would meta affect this?
I will definitely try to print (meta blah) for all the things, even tho I don't understand why.
At this point there should be no meta yet tho. I'll be back in a bit with the response.
in this case = returning true wouldn't rule anything out, but returning false would tell you that your two twos are in fact different
Isn’t there a library floating around for composing before and after operations onto var-bound functions as pseudo-hooks?
and so far, my understanding is you've only checked (= two (read-string (pr-str two*)))
effectively
Hm. It's a bit difficult to literally compare them with =
as the map is keyed by random uuids so I have to write a fn to normalize the data, heh. I was hoping actually copy pasting the hash would be enough. I have been doing that lots of times and haven't had issues so far.
(meta two)
is nil tho
store the interim value of two
into a var and play with two
and two-literal
at the repl
two is a hash that mostly looks like this btw
{"xxx" {:kind "hiccup", :content [[:p ("some" " " [:em ("bold")] " " "para")] [:p ("This is a " [:a {:href " "} ("moo")] " sentence.")]], :id "xxx"}}
so you aren't exactly copying and pasting two, so could be a bug in your "normalize the data"
No. I am literally copy and pasting. I would have to write a fn to normalize in order to be able to compare with =
.
Because the :id changes every time I run the fn.
Oh, I can do a def within a defn. Had no idea 🙂
Thanks
I'm not sure what to actually look for. I have two
in a var and a copy pasted version in another var and poking at them they seem identical.
Oh. That's true.
I find it hard to believe that both ^ can be true and (second-fn two)
<> (second-fn <value-of-two-copy-pasted>)
given that by copy pasting a value from the repl into the repl you're essentially just doing (read-string (pr-str
Tell me about it. I am literally losing my mind.
@bronsa I have some prn statements to trace if some methods are called and in the non-literal case some of them are not being called.
@dpsutton Thanks for the question, but no. I have a million prn statements at this point and they go pretty deep until it just doesn't.
It does seem to be related to the zipper, but whenever I try to call just that part with the literal to debug, it works.
What do you mean shadowing? Like redefining it in a let?
@the2bears Yes, repeatedly.
Definitely not doing that. It is a multiple arity fn, but I have prn's on each branch and it goes down the correct one.
I did however just manage to reproduce the wrong behaviour by passing in the saved two
.
I don't know what else to suggest, I suspect you are inadvertently doing something very broken in the way that you're testing the two paths and forming a broken hypothesis as a result
I checked with class and they're both clojure.lang.PersistentArrayMap
FALSE
That might be the ids 😞
Good point. Result is true
cool, now keep testing using just two
and two-val
, stop generating new values everytime otherwise it'll be impossible to isolate
Yeah. I have a great lead now that I have a value in a var that reproduces the bug.
Yes, they are not=.
do you expect them to be exactly equal? not sure if you've got some atomic counters or uuid's on there
you either have some metadata on some internal value and something in second-fn
depends on it
What do you mean by internal value?
or some internal value has a type that compares = to another one but behaves differently in second-fn
@dpsutton They are literally exactly equal with =, data/diff returns some result I don't comprehend. I'll have to read the docs.
last resort is using (binding [*print-dup* true] (prn two) (prn two-val))
and comparing the outputs
@dpsutton I get [nil nil a]
@bronsa I did the binding thing for both of them and the output is very different
At first glance, the output bad one is at least twice as big. Gimme a sec to compare them.
Ok. First, there is a minor issue of some values being :level #=(java.lang.Integer. "3")
in the bad one, while the literal is just :level 3
.
However, this is not a value that breaks later on. But the value that does break later on also has a similar issue. Gimme a sec to paste.
;; bad version
[[:p ^#=(clojure.lang.PersistentArrayMap/create {:line #=(java.lang.Integer. "865"), :column #=(java.lang.Integer. "862")}) ("some" " " ......
;; good version
[[:p ("some" " " .......
These arrays I obtain via commonmark-hiccup which is a wrapper over commonmark-java.
Could this be related?
I am sure that the values are different in up to now invisible way.
I don't understand what those differences mean tho 😕
Ok, I'll continue looking for other differences.
Thank you so much for the hints. I will definitely keep you posted on what I find out.
Btw, is there a way to get rid of these differences even tho they should be benign?
Unfortunately, the values are identical besides these metadata changes.
I'm suspecting that since zippers use metadata, maybe it somehow grabs some of these extra and thinks they're part of the data.
Thanks. I would need to get to each deeply nested value, right?
Thanks. I'll see whether I can add a call right where the value is used.
Does anyone know if there's a generic event dispatching/handling library for Clojure? Something like re-frame, but not hooked up to a rendering library or "database"?
https://github.com/clojurewerkz/eep this looks like it could be good
https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async.clj#L843
Also, pedestal's interceptor library can be required separately from the rest of the project. https://github.com/pedestal/pedestal/tree/master/interceptor