This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-11
Channels
- # beginners (2)
- # boot (97)
- # cider (58)
- # cljs-dev (10)
- # cljsrn (7)
- # clojure (79)
- # clojure-austin (4)
- # clojure-brasil (1)
- # clojure-france (1)
- # clojure-russia (42)
- # clojure-spec (12)
- # clojure-uk (22)
- # clojurescript (150)
- # clr (1)
- # conf-proposals (7)
- # core-matrix (2)
- # cursive (4)
- # datomic (9)
- # jobs (2)
- # klipse (28)
- # leiningen (3)
- # lumo (8)
- # nrepl (1)
- # off-topic (28)
- # om (18)
- # om-next (2)
- # perun (17)
- # planck (9)
- # rdf (1)
- # re-frame (18)
- # reagent (7)
- # ring (2)
- # rum (1)
- # specter (11)
- # test-check (3)
- # untangled (1)
- # yada (7)
@alexmiller Ah, there is? I’ll take a look at the Compiler.
@bronsa metadata on fns has overhead? Even if you don’t read it?
There should be a way around that, though, surely...
Unless you run Jaunt’s dev branch, in which case all your fns are several bytes fatter and implement the metadata stuff themselves 😛
Jaunt is something I haven’t looked at for a while
user=> (defn fn->ns-name [obj] (clojure.lang.Compiler/demunge (first (str/split (.getName (class obj)) #"\$"))))
#'user/fn->ns-name
user=> (fn->ns-name (fn []))
"user"
It was only ever me, and I had a bunch of unstable idea(s) with no sounding board. Then I got an all python job and here we are.
but I also wasn’t willing to charge off into the sunset and refactor all of core because I wanted CIDER to still work
It’s a shame, but entirely understandable.
@bronsa Thanks. I should be able to write a function for grabbing all active multimethods, finding their namespaces, and then adding something that clears out any that are slated for reload.
@weavejester Here's an example
``
(def nf-atom (atom { :blurbs [ {:bid 172
:content "B172"
:link " " }
{:bid 182
:content "B7517"
:link " " }
{:bid 333
:content "S221"
:link "" }
] } ))
``Say I want to grab the map containing :bid 333
I could use a good primer on how-to-atom-attribs
well so deref
will get a value out of an atom, :blurbs
will get the elements out of your mapping and filter
could be used to select an element if you have a predicate function on :bid
.
oh, filter is a new word for me. Thanks @arrdem I'll do more investigating
why is (apply str (butlast “hello:”))
correct but (-> "hello:" butlast #(apply str %))
is not? What am I missing?
@rparra it has to do with macro expansion... #(apply str %)
gets expanded to (fn [x] (apply str x))
, and the ->
macro expands everything as (fn (butlast "hello:") [x] (apply str x))
, which is invalid Clojure syntax
thanks for such a clear explanation. I found this example useful too: https://clojuredocs.org/clojure.core/-%3E#example-572e46e1e4b039e78aadabfc
@rparra consider (->> "hello:" butlast (apply str))
to avoid creating and executing that funtion
Can anyone give me advice on how to profile my code?
Here's an experience report: https://techblog.roomkey.com/posts/memory-leak.html
Ok, thanks, probably best if I just pick one and try it so let's try this one.
Hmm seems to be a paid product. I'd prefer something open source or at least free 😛
Think I will try https://visualvm.github.io/
@U0DHDNZR9 JMC, built into Oracle Java 8. basically gives you YourKit. run jmc
and attach to a process, start recording, do stuff, inspect results
@U0509NKGK Thanks, I remember hearing about that before but I forgot, think it's what I wanted to hear again. Tend to prefer built-in simple stuff.
Ah, it is an Oracle add-on though.
I've been trying to VisualVM, connecting via jmx and running bits of code through cider. It seems to hang and then crash with an error 😞
VisualVM, tufte...?
hello clojure people. what’s the neatest way to fill a vector of vetors with a random integer in your opinion?
i usually end up with something horrible like this monstrosity: (vec (repeatedly n #(vec (repeatedly n (fn [] (rand-int n))))))
looks good to me?
(partition 5 (repeatedly 25 #(rand-int 25)))
vectors: (->> #(rand-int 25) (repeatedly 25) (partition 5) (map vec) vec)
you're welcome
Hi, using sente I always wondered if I have to handle the :chsk/ws-ping message somehow? It seems like I can just ignore it, at least in the sente context
A separate thread, Thread/sleep?
Java has a ScheduledExecutor for this
Bit confused about clojure.zip/path
, I was expecting to get something like [:foo :bar 0]
but I've got what looks like a "history" of positions, is there some way I can convert between the two?
@hiredman Not sure I understand, I was hoping to get [:foo :bar 0]
for {:foo {:bar [:baz]}}
where my current location was :baz
Right, what paths returns is a list of zipper locations, the same thing you see at each step if you did a bunch of z/down calls
@hiredman oh, I think I see now. I'm not interested in the paths for information extraction, I need to determine the correct order to call a function on certain nodes (`[:foo :bar]` depends on [:foo :baz]
, so I must call (f m (get-in m [:foo :baz]))
before (f new-m (get-in new-m [:foo :bar]))
)
licensing question. if i crib a few lines of code from clojure.core, do i need to include the copyright thing? if i write 99% of the code but 1% is cribbed from clojure.core, ??? i can see sth like "portions copyright Rich Hickey" or some such, but i'm unsure of the legal requirements, obligations, etc.