This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-19
Channels
- # announcements (7)
- # aws (4)
- # aws-lambda (1)
- # babashka (19)
- # beginners (60)
- # calva (9)
- # chlorine-clover (3)
- # cider (15)
- # clj-kondo (17)
- # clojure (34)
- # clojure-czech (1)
- # clojure-europe (96)
- # clojure-nl (2)
- # clojure-uk (46)
- # clojurescript (20)
- # css (4)
- # cursive (58)
- # data-science (3)
- # datascript (3)
- # datomic (42)
- # depstar (30)
- # dirac (4)
- # emacs (1)
- # etaoin (5)
- # events (1)
- # figwheel-main (30)
- # fulcro (6)
- # helix (9)
- # jobs (1)
- # lumo (3)
- # malli (27)
- # off-topic (15)
- # pathom (11)
- # programming-beginners (6)
- # reitit (6)
- # rewrite-clj (11)
- # shadow-cljs (14)
- # sql (1)
- # tools-deps (18)
- # utah-clojurians (3)
@kimi.im It depends on the type of resource, but with-open
is used with anything "closable".
I'm trying to use juxt
with two java function invocations (map (juxt .foo .bar) coll)
, however this doesn't work. Is there a nicer way then just fully expanding it to (map #([(.foo %) (.bar %)]) coll)
?
Have a look at memfn
macro
(map (juxt #(.foo %) #(.bar %)) coll)
should also work
clojure’s documentation suggesting to use that form instead of memfn macro
@U04V4KLKC perfect! exactly what I was looking for, thanks!
Anyone knows how to convert com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString into clojure string?
(String. your-byte-array-here)
?
and what is the type of argument?
I’m getting it from queue message property header
I’m using [com.novemberain/langohr "5.1.0"]
Is it something from your codebase? I can’t find such java class
try use type
function
it will return fullyqualified class name
#object[com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString 0x33be57eb {"foo": "bar"}
aha!
try this (String. (.getBytes your-byte-array-long-string))
or even better (str your-byte-array-long-string)
because there is toString method implemented for that type of data
How do you perceive inline tests in the attr-map
compared to other test methods such as with-test
or deftest
? I see the advantage that tests are as near to a function as they can be, ie. writing tests is easy. On the other hand, a file can grow very quickly in length and the name and signature of a function is buried between tests and function code. What's the opinion of professional Clojure coders? Do you always use a specific way (in certain scenarios)?
tests in the attribute map are a thing that predates clojure.test as a library, and not something that belongs in modern code (anything written in the last 10 or so years)
I don't think I've ever seen them in the wild :thinking_face: (tests in the attribute map, that is)
attribute map is really the right thing to call it, attr-map is just want the docstring for defn calls it
it is confusing because regrettably clojure.test also stores tests in metadata, but that semantics are different
there is clojure.core/test which is the primitive thing for running a test in the metadata system that predates clojure.test