#clojure log - Feb 28 2015

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

2:55 lvh: Hm

2:58 So, I am rebinding a dynamic var using a fixture that lives in a different namespace; that namespace then calls the original namespace back, and by the time I get there, the var is unbound again :-(

2:58 at first I thought it might be some threading shennanigans, but I get the same behavior with with-redefs

3:04 Ah. Turns out I didn't know how use-fixtures works :)

3:07 niac: user=> (import PiratePhrases)

3:07 ClassNotFoundException PiratePhrases java.net.URLClassLoader$1.run (URLClassLoader.java:372)

3:08 but there is a PiratePhrases.class

3:08 without package

3:26 SagiCZ: i am making java desktop application and i have decided to use clojure to write the gui part.. swing and javafx seem both pretty constricted where it comes to design, i would like to develop the design simliary to web pages, is it possible in clojure? maybe run it in a bundled web browser? i dont know where to start though

3:30 niac: is there any way to use a local java file without lein in clojure

3:33 devll: you can checkout reimport here. niac https://github.com/zcaudate/vinyasa/tree/master/src/vinyasa

3:35 niac: devll: thanks

3:40 sveri: Hi, I wonder if there is an abstraction for korma that let's me insert and update many-to-many entities? It seems like korma itself does not support this usecase

3:42 devll: https://github.com/friemen/aggregate

3:43 I am using yesql ,but aggregate might do what you want sveri

3:47 sveri: devll: uh, another nice library I never heard of, this looks promising, thank you

3:49 devll: :D

4:18 noncom: hi, anyone using ccw here ?

4:37 Eremox: How do I set a distinct documentation string for each arity of a function?

4:39 noncom: Eremox: i think there is no way to do that. if you look at the core clojure functions, they all just describe the arities verbally in a singal description

4:40 Eremox: ok to bad.

4:40 noncom: Eremox: not really, this goes hand-in-hand with the notion that a single function must have a single responsibility and arity overload must not seriously affect the functionality of the function

4:40 Eremox: so, ultimately, this limitation is for the greater good

4:42 Eremox: I understand but i think it makes the code clear. (I defined a macro.

5:33 SagiCZ: I am trying to add a couple of clojure files to my all java project in intellij but Cursive does not recognize any symbols, what am I doing wrong?

5:34 oh i know.. i didnt set the directory as source in the project structure.. nevermind it works now

5:34 cfleming: SagiCZ: Do you have Clojure added as a library dependency to your module? And are your Clojure files under a source root?

5:35 SagiCZ: Snap, there you go.

5:35 SagiCZ: I'm planning to add a popup in the editor when you don't do that, especially for cljs

7:06 SagiCZ: cfleming: thanks!

7:07 whats the best way to send two state parameter to a function?

7:07 lets say i have a function that can draw something on TOP or BOTTOM

7:08 i could do something like (draw x y z true) where true would mean TOP and false would mean BOTTOM.. but i dont like that

7:08 what about (draw x y z :top) and (draw x y z :bottom) is that a misused keyword?

7:19 raspasov: SagiCZ: have two separate functions? :)

8:22 devll: Hi, after deleting a file in my project,(refresh-all) gives FileNotFount Exception.

8:22 *Found

8:32 doing remove-ns does not help.

8:32 how can I remove this error?

8:33 restarting repl will do it,but it is too costly.

8:43 triss: hey all. am I right in thinking there are no pre and post conditions for defmethod?

8:48 Bronsa: triss: you can add them to the dispatch function

8:49 triss: or even to every defmethod

8:50 ,(defmulti m class)

8:50 clojurebot: #'sandbox/m

8:50 Bronsa: ,(defmethod m Object [x] {:pre [(string? x)]} x)

8:50 clojurebot: #<MultiFn clojure.lang.MultiFn@6ea5b634>

8:50 Bronsa: ,(m "foo")

8:50 clojurebot: "foo"

8:50 Bronsa: ,(m 1)

8:50 clojurebot: #<AssertionError java.lang.AssertionError: Assert failed: (string? x)>

8:51 triss: brilliant thanks Bronsa... doesn't look documented to me? http://clojuredocs.org/clojure.core/defmethod

8:52 Bronsa: dunno, I read the impl

8:52 triss: hah. might hve o try nad ge used to that.

8:53 ^ have to try and get used to that

11:17 crazydiamond: Hi. Can anyone suggest math/functional programming book with theory and/or exercises for development of functional way of thinking (with Clojure flavour)?

11:17 subhashgo: crazydiamond: I don't know about books, but 4clojure.com is a good resource for clojure exercises

11:24 crazydiamond: subhashgo, thanks

11:25 justin_smith: crazydiamond: have you looked at clojure for the brave and true, and clojure from the ground up?

11:34 gfredericks: clojure {for,from} the {brave,ground} [and] {true,up}

11:37 crazydiamond_: :D

11:37 btw, is e.g. lambda calculus useful to know for functional programming?

11:37 justin_smith: ,(str "clojure " (rand-nth '[from for]) " the " (rand-nth '[ground brave]) (rand-nth [" and " " "]) (rand-nth '[true up]))

11:37 clojurebot: "clojure from the brave true"

11:38 justin_smith: ,(str "clojure " (rand-nth '[from for]) " the " (rand-nth '[ground brave]) (rand-nth [" and " " "]) (rand-nth '[true up]))

11:38 clojurebot: "clojure from the ground and up"

11:38 gfredericks: crazydiamond_: not in too much detail

11:38 crazydiamond_: an, other fields of math?

11:38 *and

11:38 justin_smith: crazydiamond_: the lambda calculus is for fp kind of like knowing a machine language (optionally turing tape being that language) is for imperative

11:38 ,(str "clojure " (rand-nth '[from for]) " the " (rand-nth '[ground brave]) (rand-nth [" and " " "]) (rand-nth '[true up]))

11:38 clojurebot: "clojure from the brave and up"

11:39 crazydiamond_: so far no matches with "for", btw

11:39 justin_smith: ,(str "clojure " (rand-nth '[from for]) " the " (rand-nth '[ground brave]) (rand-nth [" and " " "]) (rand-nth '[true up]))

11:39 clojurebot: "clojure from the brave up"

11:39 justin_smith: ,(str "clojure " (rand-nth '[from for]) " the " (rand-nth '[ground brave]) (rand-nth [" and " " "]) (rand-nth '[true up]))

11:39 clojurebot: "clojure for the ground up"

11:39 crazydiamond_: there it is

11:40 justin_smith: finally - that last one is for pigs that want to learn how to program after they become sausage

11:46 gfredericks: (inc justin_smith)

11:46 lazybot: ⇒ 199

11:46 * gfredericks omg omg omg omg omg

11:49 justin_smith: haha

12:04 hyPiRion: (inc justin_smith)

12:04 lazybot: ⇒ 200

12:04 hyPiRion: do I win something

12:06 justin_smith: you got to be an important part of a very special moment

12:06 gfredericks: ~200 is a number made up of only smallish primes

12:06 clojurebot: Ik begrijp

12:07 gfredericks: ,(* 2 2 2 5 5)

12:07 clojurebot: 200

12:08 justin_smith: ,(filter #(zero? (rem 200 %)) (range 1 200))

12:08 clojurebot: (1 2 4 5 8 ...)

12:09 justin_smith: ,(clojure.string/join \space (filter #(zero? (rem 200 %)) (range 1 200)))

12:09 clojurebot: "1 2 4 5 8 10 20 25 40 50 100"

12:18 TEttinger: ,(clojure.string/join " " (filter #(zero? (rem 200 %)) (range -200 0)))

Logging service provided by n01se.net