This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-05
Channels
- # aatree (2)
- # admin-announcements (15)
- # announcements (2)
- # aws (8)
- # beginners (160)
- # boot (290)
- # braid-chat (28)
- # cider (8)
- # clara (1)
- # cljsrn (3)
- # clojure (154)
- # clojure-czech (7)
- # clojure-russia (162)
- # clojurebridge (2)
- # clojurescript (128)
- # cursive (29)
- # datomic (30)
- # emacs (7)
- # events (1)
- # hoplon (5)
- # jobs (1)
- # ldnclj (7)
- # leiningen (3)
- # off-topic (11)
- # om (82)
- # onyx (68)
- # overtone (1)
- # parinfer (57)
- # portland-or (1)
- # proton (18)
- # re-frame (8)
- # reagent (32)
- # ring-swagger (3)
- # yada (5)
Vars allow thread-local dynamic binding too
@jaen: Sorry I meant subtle and novel for me specifically given the languages I've used before Clojure.
So both vars and symbols can have metadata? Now I'm confused.
Why both? When would you need that?
A symbol can house where it was defined in source code. What could you put on the underlying var?
currentmoor: a symbol can't really do that, a symbol just "is", like a keyword. where it was defined depends on the load order of the code
scratch that. I was thinking of keywords. I guess you'd use metadata on a symbol when you're actually using it as data
@meow: I never understood that phrase "turtles all the way down"?
How do I extract a property from a JSON file and set it to leiningen project version?
Without a built-in JSON parser, leiningen has to execute defproject first to load dependencies.
Well, it depends on the macro. If you macroexpand defproject
, I think it’ll be clearer. But anyway, in your case with version
it shouldn’t be an issue, so forget I said anything
If you’re curious though, I just looked up the source code. This is the reason why: https://github.com/technomancy/leiningen/blob/master/leiningen-core/src/leiningen/core/project.clj#L177
That’s still arbitrary evaluation, which is why ~
is needed. Depending on what you’re doing, I’d extract everything out into a defn
and then simply call the function with ~
preprended
What do you mean by "extract everything out into a defn
and then simply call the function with ~
preprended"?
Maybe creating a snippet? I’ve never actually used that feature, but clicking on the + icon shows it
Yeah, that str
for the repo url will need ~
as well. That’s fine, but you can also define it outside defproject
like you did with license
and url
. Like:
(def url "")
(def repo-url (str …))
But that’s exactly what def
is, but you said “not so good” for that, so now I’m confused
Leiningen starts becoming diffcult to wield if a build becomes more complex than a clojure library.
Not really (though I've seen boot-figwheel
somewhere, not sure how well that works) but there are boot-reload
and boot-cljs-repl
libs which achieve the same.
if anyone knows where i can look at a example of a login system using enlive and compojure?
@krchia: how about this blogpost - https://adambard.com/blog/buddy-password-auth-example/
No problem; looks like a solid blogpost (and I personally like buddy) and has a runnable repo linked at the bottom of the blogpost.
@alexmiller: do you maybe know if there's any plans to support named groups in Clojure regexp functions? Right now (re-find #"t(?<test>es)t" "test")
returns ["test", "es"]
instead of something like ["test" {:test "es"}]
or similar.
Not really a feature request, just curiosity; named groups seem like terribly useful things to have when writing regexps (at least I use them all the time).
Clojure really builds on Java's regex support
it looks like java 7 added regex named group support
presumably it would be possible to extend the existing fns to support that
the difference in output would likely require either a new fn (or fns) or some sort of switch
Yeah, it's something post-6, I remember first time when I tried that Java just complained about the syntax.
this seems like a good idea for a feature to me but would require some investigation on the best way to add it in backwards-compatible way
I've never seen anyone ask about it
so, enhancement jira welcome (patches or further investigation also welcome)
I think this would not require a switch - regexs with no named groups could behave as before and only regexes with named groups would return a map.
seems possible
if you wanted to do the work, I'd be happy to try to get it considered in 1.9
b/c we still support jdk 6, there are some tricks likely needed to make this work in 1.7+ only, but there are other things like this already
Would certainly be a welcome enhancement; each time I had to do capturing groups I was all like "whyyy positional groups, we're in a dynamic language with maps". So, I'll get back to you when i'm through with my thesis and can investigate that.
what does "this" refer to?
if the question is about jdk varying code, the big one is fork/join - https://github.com/clojure/clojure/blob/bc186508ab98514780efbbddb002bf6fd2938aee/src/clj/clojure/core/reducers.clj#L24
"A library for reduction and parallel folding. Alpha - is that still true for reducers? the alpha stage
personal opinion: transducers sort of obsolete reducers. Collections being reducible are officially legit with the introduction of the clojure.lang.IReduceInit interface.
I'd like to do a tutorial on Eduction + reducible I/O sources. Have had a really good time with it
what about cases when you want to do parallel processing? My understanding is that you need to combine transducers with a core.async pipeline or something, whereas c.c.reducers parallelise out-of-the-box
sorta -- it remains to be seen how to integrate transducers with parallel collections, a simple way is:
Hi, what would you use to draw a graph from a background proces and continiously update it? Currently I dont have any gui running.
I've used Incanter for that kind of graphing with success. http://incanter.org/
And I just saw this from WalmartLabs if your needs are pure ascii: https://github.com/walmartlabs/active-status
@nkraft: I also tried incanter for some stuff, but was not aware that you could update existing graphs? Everytime I used it, it created a new JFrame and window.
active-statues looked interesting, but, as always, cool console stuff only runs on linux 😄
@sveri If you give incanter's view static data, it makes a static graph. If you hand it an active function it updates. For active-status, can't you use Git-Bash for that?
Try this discussion for some ideas: https://groups.google.com/forum/#!topic/incanter/kx-fQ9heB80
Hey! @apa512 and/or @danielcompton, when you have a moment: does clj-rethinkdb not properly handle sets? Whenever I try to insert
a data structure with a set as a value, it comes back with ExceptionInfo RethinkDB server: Expected a TermType as a NUMBER but found STRING.
. I would think it would convert a set to an array for compatibility.
Don't think it does because RethinkDB doesn't. I'd prefer if users manually converted it themselves so they know what's happening. Also, on the way back out we'd have no way of knowing if an array was meant to be a set
That makes sense. I just wanted to be sure it wasn’t a bug. I'm handling the way back out because I know which keys have sets.
Now that I’ve sat here thinking about it, it isn’t really necessary to have a set over a vector other than that sets automatically de-dupe. I’m going to just switch it all to vectors.
Thanks for the info, @danielcompton.
Also note RethinkDB has some functions for treating vectors as sets
hi everyone. i’m curious why a (log/info “event”) message at the top of a function will always output to the commandline one inside an anonymous function in the body of the function would not
(defn merge-product-events
"run merge_events across all blocks for the given product event mappings."
[]
(log/info "begin event merge:")
(map (fn [product-event-map]
(map (fn [working-dirs]
(log/info "block:" working-dirs "event map:" (second product-event-map))
…
and just to clarify, you don't need two doall
s, just one around the outer (I made it sound like you needed it around each one)
(defn merge-product-events
"run merge_events across all blocks for the given product event mappings."
[]
(log/info "begin event merge:")
(doall
(map (fn [product-event-map]
(map (fn [working-dirs]
(log/info "block:" working-dirs "event map:" (second product-event-map))
(shell/sh merge-tool working-dirs (second product-event-map)))
(generate-block-files-list
(generate-product-working-dirs basedir (first product-event-map) block-dirs))))
(generate-product-event-map product-event-map-file))))
but as @stuartsierra is trying to lead you, this isn't a good use of map
yes i’m still pretty green/new to clojure. this was a one off work project to build a small utility. thought it would be a good learning exercise rather than just bashing it
all that stuff you want to eventually shell/sh
on, I would generate inside one seq and then doseq
over that
that worked for now @drewr thank you. im going to read @stuartsierra ’s post and refactor
i think the last piece im going to read up on before i refactor that is to also pass standardout from the shell/sh commands to the commandline
is that up-to-date? ^ Because it's not matching what I get from (dir compojure.api.sweet)
Let's say I want to send off a small piece of work to be done in the background. For this I would use an agent
. But let's say I am only doing this for side-effects, so I don't care about the return value. Is an agent
still the right way to do this?
Is there an existing convention for what it means if a symbol starts with -
? I'm thinking about using it for symbols that are for internal use in my namespace, but that I don't want to make private (with def-
) because it's too much of a pain to access them from my testing namespace (with #'
, etc.).
hey @alexisgallagher you may want to consider a go block from core.async instead. an agent includes internal state, so it may not be a precise semantic match for the work you need to perform, if it does not have any internal state implications.
Huh. I thought go blocks were used only for communication along channels, not just for sending off work to background threads. I need to read up.
@crocket: system is a library optimized for code reloading in boot. https://github.com/danielsz/holygrail
there's no requirement to use channels with go blocks, and you can ignore the channel returned by calling go.
can also use a future
usually there is some use case for some sort of communication or notification or control over execution- side effect on an external system takes too long, or something
e.g. one doesn't care in the success case but if there is some ability to detect failure perhaps there is some need to take action
Okay. Good to know. The reason I'm using an agent
is because I want to use send-off
, because I want send-off
's guarantee that it won't execute if the dosync
transaction does not commit. I only want my side-effect once, only if the transaction commits, and if a condition holds.
gotcha- sounds like a good reason
I did look at the source of future
to try to figure out if it was also transaction-aware, w/r/t/ to dosync. It seems like it might be but I don't understand the underlying Java concurrency libs well enough to tell right away.
They both reach down to a clojure.lang.Agent/SsoloExecutor. One is submit
ing, the other is dispatch
ing....