This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-16
Channels
- # announcements (3)
- # beginners (104)
- # boot (18)
- # calva (1)
- # cider (43)
- # cljs-dev (45)
- # cljsrn (2)
- # clojure (29)
- # clojure-dev (10)
- # clojure-europe (2)
- # clojure-italy (117)
- # clojure-nl (17)
- # clojure-spec (56)
- # clojure-uk (41)
- # clojuredesign-podcast (12)
- # clojurescript (35)
- # community-development (6)
- # cursive (27)
- # datomic (12)
- # emacs (9)
- # fulcro (6)
- # graalvm (52)
- # instaparse (6)
- # klipse (3)
- # leiningen (11)
- # lumo (1)
- # off-topic (16)
- # pathom (31)
- # re-frame (10)
- # reagent (26)
- # reitit (3)
- # shadow-cljs (67)
- # sql (4)
- # tools-deps (1)
great explanation. thx a lot!
maybe it makes sense to first read json values from the inputstream and then feed them into transit read-string?
this is what I got right now, it's a bit iffy:
(defn transit-reader []
(transit/reader (ReaderInputStream. *in*) :json))
(defn parse-transit [rdr]
(try (transit/read rdr)
(catch java.lang.RuntimeException e
(if-let [cause (.getCause e)]
(if (instance? java.io.EOFException cause)
::EOF
(throw e))
(throw e)))))
looks fine to me, although you should specify charset in ReaderInputStream constructor: https://commons.apache.org/proper/commons-io/javadocs/api-release/org/apache/commons/io/input/ReaderInputStream.html 1-arg constructor is deprecated
you could sniff it https://www.garykessler.net/library/file_sigs.html
but most likely you just a) assume a default b) switch encoding with optional args / config / etc.
What is generally implied by a Clojure programmer when a trailing asterisk is used in a function name, e.g. my-cool-fn*
?
I usually assume its a implementation/helper function called by my-cool-fn
Okay. So then the details of my-cool-fn*
are likely uninteresting, or distract from the clarity of my-cool-fn
, and a better name really isn’t available?
And often there just isn’t a good name, or that the function is very coupled to the sans-asterisk fn.
sometimes my-cool-fn
is boilerplate and my-cool-fn*
does the actual work, and this is done to make my-cool-fn*
clearer (and not the opposite)
Ah okay, that makes sense. Almost as if my-cool-fn
is the “public facing” function. The gory details can be kept elsewhere for clarity.
if you have a macro that expands to a function, that function needs to be public, but is often not the public api
I have upgraded our project to clojure 1.10 and there is this error:
:cause Call to clojure.core/refer-clojure did not conform to spec.
:message Syntax error macroexpanding clojure.core/refer-clojure at (clojure/core/async.clj:9:1).
I see the commit that should fix it but for some reason i have old version of core.async
@bennyk this is something to sort out in your dep manager (often the solution is depending a specific newer core.async before depending anything that would pull in another version)
yea its leiningen, maybe someone knows how to fix it?
then the fix is to ask for a newer core.async version in your :dependencies
, before anaything that depends on core.async
you can also look at lein deps :tree
and lein deps :why org.clojure/core.async
for more detailed info
great! thx a lot!
Might also be worth checking your ~/.lein/profiles.clj, if you have one