Fork me on GitHub

how do i add a ring middleware in addition to other dependencies in my dev profile?


I was looking at magnars prone-middleware


:profiles {:dev {:ring {:stacktrace-middleware prone.middleware/wrap-exceptions}} {:dependencies [...]}} gives me "Map literal must contain an even number of forms"


Confusing to me because it would appear that's a misleading message. Each nested map does have an even number of forms.


No they don't


{:ring {...} {:dependencies [...]} has 3 forms


Can I do stuff to namespaces? pass them around, reference their methods etc?


mosho: what do you mean? "(the.other.namespace/function arg)" should work

Alex Miller (Clojure team)13:09:55

@mosho: the symbol referring to a namespace can be passed around as data. an actual namespace object (like you'd get from ns) is a stateful Java object (not a value) and has the same caveats


Hi. Some help needed simple_smile I have go-loop that is writing to files. go-loop receives on one channel info when it should start writing to new file. Everything works except that when app is closed (CTRL-C) then data in buffers are not flushed to disk and I’m loosing some data. How to nicely close flush all buffers when app is shutting down ?? This is result of testing in lein


Here is code I’m running:


(defn start-writer [dst msg] (let [dest-file (atom nil) ] (go-loop [] (alt! dst ([val] (if @dest-file (dosync (println "Got file request change " val) (.close @dest-file) (reset! dest-file (writer val))) (dosync (reset! dest-file (writer val))) )) msg ([val] (if dest-file (.write @dest-file val)))) (recur))) )


in last if there should be @dest-file


Tip: you can fence your code in three backticks to format it with a fixed-width font.


We’ve started to use @stuartsierra’s component framework for a project that needs connections to multiple databases, statsd, etc. It cleaned up the configuration and state handling quite a bit. However, it’s now pain to work in the repl because, for every function that I want to call, I have to dig out the appropriate piece of the system so I can pass it in as an argument. Has anyone tried to combine components and dynamic variables? So, a dynamic variable for each component, plus a mechanism to bind the dynamic variables of all the components of a system. (And maybe call alter-var-root on them all, for use when developing.)


ljosa: I almost always recommend against dynamic vars; see my old blog post "On the Perils of Dynamic Scope."


And you should rarely or never need to pass more than one component to a top-level API function.


If some operation depends on multiple components, then that operation should take as its argument a single component that encapsulates all those dependencies.


What is your workflow when developing an application that uses the component framework? So far, I have been doing (def system (component/start-system (build-my-system configuration)1)) in my myproject.core ns. (Only in the repl, not for production use.) Then, when working in a different namespace, I have been doing (def c (:my-component-name project.core/system)) so that I have it on hand when I want to call functions that need the component in the repl, such as (frobnicate c 42).


is there a way using clj-time to get the tz of an iso8601 string?


@ljosa: I add convenience functions in user.clj that do the digging out of system for me. If I have to change the system structure, I change the convenience functions too.


I am using vectors to represent math vectors in my program, now I want to update certain values by index, how should I do this? Should I use some other data structure than a vector?


profil: vectors are fine. there are some specialized vectors in core.matrix too


and there are primitive specialized vectors in clojure core vector-of


(As in they don't box with a full object reference but rather store primitive arrays internally)


@ghadi: Okay, thanks. I find it ugly that I have into [] .. on several places in my code, because lots of functions returns lists. Is there some better way?


profil: maybe learn about transducers to get rid of intermediate lists


Anyone knows what's the roadmap to leiningen 2.5.3? I'd say that (about gpg signing, fixed 3 weeks ago) alone deserves a new release. That's something that worked fine in 2.5.1 and got broke in 2.5.2. The issues in don't look like 2.5.1 regressions I find myself switching between 2.5.1 (for signing a release) and 2.5.2 (so lein test picks up .cljc files, for example) too frequently... I'm also delaying building 2.5.3-SNAPSHOT in my local machine, as my experience doing so was not a walk in the park...


some have vector equivalents (e.g. mapv), also transducers


I am using stuff like for, repeatedly, take


@timvisher yes thanks, I got there. I'm saying that all of them exist way before 2.5.2, and 2.5.2 included a critical regression IMHO, so I was wondering if there's any chance that 2.5.3 might be cut before those 4 issues get a fix. @ztellman: good to know. It's also pre 2.5.2 but I see the importance


@nberger: my understanding from @hypirion is that there will not be a release prior to that


ok, ztellman, sorry for atmention you simple_smile


but you can always ask simple_smile


i want one too simple_smile


Do you think is there a better place to ask? lein google group seems inactive


@nberger: i generally ask either in #C0AB48493@freenode or directly via twitter


both are reasonably good options


There is a Leiningen mailing list (not google groups)


@nberger: The only remaining big issue is the pom task, as @timvisher mentioned. And it's good to get feedback, so thanks. simple_smile I didn't know that the regression's impact was so severe, so I'll see if I can get some time this week(end) to look at the remaining blockers.


@hypirion: whoa thanks!!! simple_smile


any ideas how to persuade travis to use leiningen 2.5.2? (it seems to default 2.5.1)