This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-24
Channels
- # beginners (12)
- # cider (3)
- # clara (3)
- # cljs-dev (3)
- # cljsrn (19)
- # clojure (83)
- # clojure-android (1)
- # clojure-dev (15)
- # clojure-dusseldorf (1)
- # clojure-greece (30)
- # clojure-italy (10)
- # clojure-madison (1)
- # clojure-nl (6)
- # clojure-russia (274)
- # clojure-spec (51)
- # clojure-uk (31)
- # clojurescript (38)
- # core-async (7)
- # cursive (11)
- # datascript (1)
- # datomic (63)
- # emacs (10)
- # figwheel (1)
- # hoplon (27)
- # jobs (11)
- # klipse (4)
- # lein-figwheel (1)
- # lumo (6)
- # nyc (1)
- # off-topic (278)
- # om (12)
- # pedestal (10)
- # protorepl (31)
- # re-frame (13)
- # reagent (23)
- # remote-jobs (1)
- # spacemacs (9)
- # untangled (24)
- # yada (54)
I'm looking for an Edn library for .net.
We evaluated https://github.com/edn-format/edn-dot-net but found it unusable.
@olivergeorge almost all non Clojure(Script) edn readers are unusable. That's one of the key reasons Transit was written: https://github.com/cognitect/transit-format
Nevermind that Transit is a lot faster than EDN
tbaldridge: Thanks. I hadn't considered that. We're looking for something to define our data schema / configuration which means human readable/editable is important. Was hoping for something nicer than JSON or XML... Edn seemed like a perfect candidate.
If you have to use edn, look at the LispReader code in Clojure-CLR. that will probably mean loading most of the Clojure runtime, but I've done that before in projects, and having a full set of immutable data structures in C# isn't bad either.
look for usages of this file in Clojure-CLR and that should give you a overview of how to use it: https://github.com/clojure/clojure-clr/blob/master/Clojure/Clojure/Lib/LispReader.cs
Sounds a bit heavy handed (if tempting). Thanks for the feedback.
I had asked here about the fine print at https://clojure.org/reference/transducers yesterday, and got a link to a youtube video featuring very heavy accent and in general hard to follow. Can anyone recommend a good resource to learn about these caveats of transducers? > If you have a new context for applying transducers, there are a few general rules to be aware of: > • If a step function returns a reduced value, the transducible process must not supply any more inputs to the step function. The reduced value must be unwrapped with deref before completion. > • A completing process must call the completion operation on the final accumulated value exactly once. > • A transducing process must encapsulate references to the function returned by invoking a transducer - these may be stateful and unsafe for use across threads.
I am concerned at going into transducers without apt understanding of these issues, as the guy with the heavy accent said in the beginning of his video, not understanding these cause him great grief and frustration, something I cannot afford as they translate to zero productivity.
Perhaps you can recommend a book or resource specifically addressing these or more broadly the safety rules or must knows for transducers?
Can I serve files with compojure, which are not in the resources folder?
danielgrosse: if the files exist on the classpath or file system sure - how would the server be finding the files?
@matan I'd start with "Transducers by Rich Hickey": https://www.youtube.com/watch?v=6mTbuzafcII (If you haven't seen it yet) and then continue with "Inside transducers": https://www.youtube.com/watch?v=4KqUvG8HPYo One good example that I've recently seen is also https://tech.grammarly.com/blog/building-etl-pipelines-with-clojure
needed to strip some non-printable things from an ex-data
thing, ended up with this but listing things like that feels like a certain way to miss things:
(defn strip-non-serializable [m]
(walk/postwalk (fn [x]
(if-not (or (string? x)
(keyword? x)
(number? x)
(symbol? x)
(map? x)
(vector? x)
(list? x))
:ommitted-not-serializable
x))
m))
Anyone a smart alternative to suggest?@martinklepsch I suspect that's the best you can do
(eventually it goes into cheshire but cheshire doesn’t seem to have a jsonable?
type thing
java.util.Date is also printable
I've needed a function like this many times by the way
You can have it 😛
to "sanitize" a data structure for serialization/priting
thanks!!!! 🎁
would be nice if serialization libs (I’ll also need this for nippy) expose a “serializable?” predicate to let you do this kind of thing
(maybe nippy has this, haven’t checked)
alternatively a flag to just skip over/replace all non-serializable values
that’d be “nicer” but a predicate would just get the job done w/o much consideration of impact on public APIs etc https://github.com/dakrone/cheshire/issues/118
it would also be faster..
@danielgrosse IIRC, yup!
@martinklepsch I think nippy is protocol based, so in theory you can use satisifes?
@mpenet yeah could be. Didn’t get to nippy yet anyways
@martinklepsch Use seq?
instead of list?
since lots of data structures end up as seqs that aren't actually lists
@stuartsierra good point
Is there a way to get a .cljc file to hot reload while developing? prior to adding it, we had our .clj code hot reloading anytime we made a change. We're using lein and immutant, among lots of other libraries. Using emacs/cider to develop, and even C-c C-k doesn't recompile the cljc code.
Can anyone recommend a good Cursive cheatsheet. I’m helping someone who uses Intellij and a quick google didn’t produce anything I liked. Intellij is not my goto ide…
Anyone here have a favourite way of working with elasticsearch through Clojure? https://github.com/clojurewerkz/elastisch seems a bit outdated. https://github.com/mpenet/spandex ? Raw http requests? Something else?
based on crossclj I’d say elastisch is more mature and better supported / more widely used
Spandex is quite new, so crossclj doesnt paint a clear pic. It s been running millions of queries per day in prod without hiccups
@mpenet I hope it didn’t look like I was comparing their merits. Of course “better supported” is speculation but clojurewerkz has been around for a while and that counts for something. No disparagement meant toward your project of course.
Persistent cnx and binary proto plus few other things. But it's going the way of the dodo for clients
@curlyfry I have also only used elastich and found it worked great, but it’s been about a year since I was doing that work.
@noisesmith @mpenet @rauh @joshjones @bballantine Thanks for the input!
@ztellman Do you ever sleep? I thank you very much for the effort you put into your software. I really do enjoy #aleph and #manifold. Thank you very much!
@ddeaguiar There are a couple here: https://www.cheatography.com/tag/cursive/
@U0567Q30W thanks!
Note that I don’t think his windows bindings are the defaults, although I may make them the defaults due to https://github.com/cursive-ide/cursive/issues/1139
has anyone considered a development mode for clojure where when you evaluated
(def some-user {:first-name "Adam"})
...
(:firrst-name some-user) ;; => Exception
an exception would be thrown if the key is not found in the map, in order to quickly spot typo'd keywords?Obviously you could do something similar with spec and making sure that maps conform to having those keys, but I would like to try something with minimal effort on the programmer's part.
so the data returned by the data reader there is passed through the compiler after the read is done
x/y1 reads 3 and evals it to 3 x/y2 reads (+ 1 2) and evals it to 3 x/y3 reads (quote (+ 1 2)) and evals it to (+ 1 2)
@hiredman @bronsa I see. I was looking at the built in stuff (uuid and inst) and none of those seems to be quoted anywhere
the quotation, when foo2 is compiled, tells the compiler to compile generate code that creates a list object at runtime, not compile the list as a function call
so if you evaluate a list returned by the reader, well we do that all the time and we know how lists evaluate
what seems strange to me is that a macro then, if passed #inst ...
, sees not some literal data, but an object
reader-macros are expanded before regular macros are
pre-read, what you have is an inputstream