This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-10
Channels
- # admin-announcements (32)
- # announcements (4)
- # aws (25)
- # beginners (296)
- # boot (1)
- # cider (87)
- # clara (16)
- # cljs-dev (7)
- # cljsrn (41)
- # clojure (121)
- # clojure-art (26)
- # clojure-japan (4)
- # clojure-miami (190)
- # clojure-russia (168)
- # clojure-sg (3)
- # clojure-sweden (13)
- # clojurescript (138)
- # clojurex (7)
- # cursive (98)
- # data-science (2)
- # datomic (129)
- # devcards (10)
- # editors (5)
- # funcool (1)
- # hoplon (31)
- # jobs (1)
- # ldnclj (4)
- # lein-figwheel (3)
- # off-topic (2)
- # om (213)
- # onyx (33)
- # parinfer (7)
- # portland-or (1)
- # re-frame (19)
- # reagent (2)
- # ring-swagger (27)
- # slack-help (3)
Working on some color algorithms: https://images1.sw-cdn.net/model/picture/625x465_4133974_13340651_1449705852.jpg
@threequal: thanks. I'm using Clojure. 😉
I'm using the http://thi.ng library, my own code, output to an X3D file, upload to Shapeways, use their renderer to create a JPG.
You can see a bunch of my designs here: https://www.shapeways.com/designer/pkobrien
Hahaha. Ah right, I had a feeling that you would have been using http://thi.ng - that looks really incredible! I haven’t started mucking around with it yet
Cool, I have been mucking around with Overtone a lot - maybe it is time to start some visual stuff!
Now if I could just figure out how I'm sometimes getting leaks in my meshes that would be great - java.lang.NullPointerException doesn't tell me much to go on.
Here's one I just uploaded that you can play around with in the 3D tool: https://www.shapeways.com/model/3dtools/4134592/1/26?key=faf3fe4a5c1a0e19905868764335c760
I wish they had better 2D rendering on their site, or even better if the 3D tool was accessible to customers.
This isn't a very good 2D render: https://images2.sw-cdn.net/model/picture/625x465_4134592_13343246_1449721897.jpg
Some expert who is willing to help a beginner in the beginners channel with a problem ?
Is thee a datomic channel? Is datomic suitable for startup like twitter? (assuming it’s using dynamodb as store)
there is a #C03RZMDSH channel
suitable is a highly subjective word. i can imagine cases where Datomic can add a lot of value to a system like Twitter’s
How can I access the cause argument for ex-info? https://clojuredocs.org/clojure.core/ex-info
@robert-stuttaford: thanks.
@danielgrosse: .getCause
http://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#getCause()
(try
(throw
(Exception. "Exception" (Throwable. "cause")))
(catch Exception e
(println (.getMessage e) (.getMessage (.getCause e)))))
Is this okay? Or is there a better way?I think you can turn (.getMessage (.getCause e))
into (.. e getCause getMessage)
for readability.
hi guys, is there any way we can develop a macro that can do so : for example (fn)
, then if we add ??(fn)
, it will print out the value of fn but still doesn't break the whole thing. it would be very convenient in testing 😄
cider has tooling for this, it’s called tracing
you can simply alter the defn to deftrace
presumably you wouldn’t keep it traced for production use, this is for dev usage?
then I can remove the debug macro quickly later as well, I don't have to deal with brackets just like #_
are you using CIDER?
http://endlessparentheses.com/cider-debug-a-visual-interactive-debugger-for-clojure.html
i don’t use Cursive so i don’t know what debug facilities it has. perhaps someone who does can share?
CIDER -ing rocks
@nxqd might want to check out https://github.com/dgrnbrg/spyscope as well
ah, yes, totally forgot about that. infact, that’ probably exactly waht you need
@robert-stuttaford: thanks 😄
How can I write this more elegantly and concisely? (into {} (map (fn [c] [(:id c) (certificate-name c)]) certificates))
Is there a way I can tell clojure a file is in the resources directory. I use now this (def filename "suspects.csv")
@roelof: are you talking about ring application? if so, ring.util.response
provides resource-response
function, you can use like (resource-response "index.html" {:root "public"})
@roelof: what about
?
@roelof: resource
should give you nil
if it cannot be found - resource paths configuration (default + whatever) is to be kept in mind though
does an (if|when)-let
exist that and
s successive assignments together and executes the body if the result is truthy?
@timvisher: not in core
I generally use when
where the else branch of an if
would be a nil
. Nothing to do with side effects
@timvisher: regarding when
-- yeah, it's only needed because of side-effects, but I sometimes like to use it in place of one-armed ifs
@stuartsierra: listed it only as a 'some people' option http://stuartsierra.com/2015/06/16/clojure-donts-single-branch-if
@bronsa: it's not needed for side-effects because it's semantically equivalent to (if … (do …))
, right?
it seems like the divide would be over whether or not people are used to seeing consequent only if
forms or not
well i would assume anyone reviewing this code would throw it back to me (do (+ 1 1))
or (do (prn "ohai"))
they'd immediately say "you don't need a do there. it adds nothing but some extra code"
Hi everyone, in the context of building and REST API, which sql abstraction library would you recommend to support dynamic queries (pagination, filters, sorting). Until now I was using Yesql, but it seems that I am going to need another one to support this more flexible feature.
@rcanepa: I use honeysql and it has been great for my needs so far https://github.com/jkk/honeysql
@rcanepa: I will shamelessly recommend my own: https://github.com/bsvingen/squirrel (only PostgreSQL for now).
@noonian: to be sure I understood how honeysql works, all that Honeysql does is to create SQL queries (strings), so, I have to rely on another library like clojure.java.jdbc to execute them, right?.
You have to use either clojure.java.jdbc
or clojure.jdbc
to execute them (I'm not aware of any other JDBC lib).
Though there's also non-JDBC lib - https://github.com/alaisi/postgres.async
@rcanepa: From what I understand, HugsQL is supposed to be a fairly natural extension of YesQL. Caveat: I'm not very familiar with either of them.
To chime in, I've been working on a library (very new) for postgres that's similar to yesql which has support for dynamic sections. Any feedback would be very welcome. https://github.com/mikeball/foundation/blob/master/docs/templated-queries.md#you-can-also-specify-dynamic-sections
Oh, I didn't know HugsQL, looks interesting (though I still it still doesn't allow conditional evaluation in queries).
@mikeb: oh, that's interesting, but I understand this means the dynamic part lives in Clojure code not in the external file?
@jaen: Correct, the dynamic part is just a function that is passed the parameters and that returns a string that is injected into the template.
@nxqd: You should take a look at spyscope, it does almost exactly what you were looking for: https://github.com/dgrnbrg/spyscope
is somewhere implementation of java.io.Writer wrapper in clojure? I want to look at it as an example to write my replacement for out and err
After running clojure.core/load-file
on a file with a (ns my-cool-ns)
, I have that new ns loaded and all. Is there some way to do (unload 'my-cool-ns)
, and reverse that action? I want to free up memory, kill threads started in that ns, etc. Wipe it from existence.
Is this possible?
load-file
does almost exactly the same thing as typing each form in the file into the REPL.
Have this function, which can ns-unmap every var in a ns:
Clojure
(defn unload-namespace!
"Unloads every var in a namespace"
[ns]
(doseq [[sym var] (ns-map ns)]
(if (and (var? var)
(= (.. var -ns -name) ns))
(ns-unmap ns sym))))
It does pretty much half the job I want...@stuartsierra: thanks for replying! And thanks for the tools.namespace lib!
@codemartin: You're welcome. There is no code which can "undo" arbitrary side-effects. I wrote http://github.com/stuartsierra/component to help structure code to cleanly shut things down.
@stuartsierra: I understand. Will look into your linked component
project for some inspiration. Thanks for sharing
Another way would maybe be to remove code paths to objects, and then have the GC eat it. In Javascript you can have the GC eat something by re-defining it to undefined
(or just use the delete
keyword).
What makes a go-block or a thread defined on global (ns) level in clj become 'dirty' for the GC?
Hi, could someone help me with github please... I am trying to do a pull request and struggling a bit. please DM me. TIA.
I got closer on my quest to “tee” stdout in clojure, using proxy, I’m able to intercept all calls to out writer like this: https://gist.github.com/darwin/0375c435ed239db7ce4a the problem is .append, single-paramter arity can receive char or CharSequence, it looks like Clojure is converting both to string for me, and when I pass it to super, it acts differently, it inserts extra newlines and spaces. Any ideas what is going wrong? btw. the underlying StringWriter’s buffer contains proper output (without extra spaces/newlines)
I guess, I need something to tell clojure not to touch my arguments in any way and just pass them through as-is
it is interesting when I commend out this particular line, it works as expected for my test case: https://gist.github.com/darwin/0375c435ed239db7ce4a#file-tee-stdout-clj-L15