#clojure log - Dec 25 2014

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

4:26 hellofunk: many splendid holiday wishes to you folks

4:40 dysfun: so how many people are writing code instead of lazing about eating too much?

4:44 hellofunk: dysfun: yeah i'm working today

4:44 TEttinger: dysfun: I got an F# book on the last day of hanukkah

4:44 hellofunk: not too much food here to eat anyway

4:44 SagiCZ1: good morning guys

4:44 TEttinger: thinking of working through that

4:45 dysfun: i used to love working christmas

4:45 you spend most of the time in the pub anyway

4:45 hellofunk: TEttinger so wait every song in the entire book is in the key of F#? that would get interesting

4:45 dysfun: TEttinger: commiserations. i find f# to be horrible

4:46 the marketing seemed to be largely centered around "hey, look we've implemented the |> operator which does for functions what the unix pipe does for stdio"

4:46 their minds might be blown if they discovered ->

4:46 TEttinger: ha

4:46 SagiCZ1: heh

4:47 dysfun: there's an online tutorial with repl for it somewhere

4:47 but you need silverlight

4:47 SagiCZ1: bleh

4:47 dysfun: i ran through most of it and decided i didn't like it

4:47 TEttinger: for games, I kinda think the JVM is a rat's nest of performance pitfalls

4:47 dysfun: clojure/clr

4:47 TEttinger: I really did spend a lot of time optimizing clojure code to use arrays, etc.

4:47 dysfun: it'll still work and you can pick up more recent versions of the libraries

4:48 of course now you've got a slightly different problem

4:48 but hey there are lots of games libraries for .net

4:49 TEttinger: indeed. I'll probably use monogame. java has libgdx, which is bound to clojure with play-clj, but I kinda doubt play-clj scales well since it abstracts so much

4:49 dysfun: fwiw i'm using jmonkeyengine for graphical stuff

4:49 but i'm not trying to squeeze the last ounce of performance out of it

4:50 AimHere: If you're using monogame, why not just ramp up to Unity?

4:50 TEttinger: I can manage pretty well with libgdx and java right now, actually

4:50 ugh

4:50 dysfun: with the exceptions of gaming and compiling scala code, computers have been 'fast enough' for some while

4:50 TEttinger: Unity is a totally alien environment to me, it's very opposed to the way I like to develop

4:51 dysfun: yeah, but it feels like the future too

4:51 AimHere: It is a bit of a culture shock, sure, but it is quite pleasant

4:51 Once you get used to it

4:51 dysfun: i asked a friend who'se been building games for a living for like 20 years about the good bits. he said a surprising thing: everyone (not just devs) uses unity, that's the value in it

4:51 so teamwork is enhanced

4:52 as someone who's sat on the project management side of the fence a little too often, this might be the killer feature

4:52 TEttinger: heh, I'm a one-man team so that point kinda is missed on me

4:52 AimHere: Well even if you're a lone dude, that does mean that there are plenty of people on the net able to answer any questions on IRC, StackOverflow, Unity forums and the like

4:53 dysfun: me too, but i'm also not working in a games studio

4:53 the pricing model is fascinating actually

4:53 i think they've been very clever

4:54 TEttinger: I'm sure they make a lot of money off asset store purchases

4:54 AimHere: The price is another killer feature

4:54 SagiCZ1: yeah i thought jmonkey was worth mentioning.. it works pretty ok.. it would be lovely if someone made a clojure wrapper like they made seesaw, because the api is not great

4:54 dysfun: very hard to get ubiquity as a non open-source product

4:54 SagiCZ1: i'm using some code someone else cribbed together and am writing a library as i go along

4:54 SagiCZ1: dysfun: in clojure?

4:54 dysfun: SagiCZ1: but i'm mostly rendering in 2d right now, so it may not meet your needs

4:54 yes clojure

4:55 SagiCZ1: cool.. im using it for my bachelor thesis project, not sure if my profesor would let me switch to clojure..

4:55 dysfun: oh, you're in java?

4:55 SagiCZ1: yea

4:55 dysfun: sorry, you're on your own :)

4:56 SagiCZ1: still, do you have any github project i could check out?

4:56 dysfun: i'll ping you a link once i've tidied it up a bit

4:56 SagiCZ1: great, thanks

4:57 dysfun: but i should get back to my swift code

4:57 hellofunk: dysfun: how do you like swift

4:58 dysfun: i started in Obj-C before the ARC days and now I wonder what swift would be like had we sticked with iOS products

4:58 dysfun: it feels quite programmable on the whole. my complaints are largely around compiler segfaults, ridiculous error messages, objectionable c interop and decisions they made a long time ago in libraries because objectionable c

4:59 e.g. i had to disable autorelease on an NSWindow because otherwise i got a bizarre runtime error

4:59 hellofunk: dysfun: in short, how is it an improvement over Obj-C, which I rather liked?

4:59 dysfun: memory management is a lot more automatic-feeling

5:00 locals just drop out of scope quietly and drop the reference count

5:00 hellofunk: dysfun: more so than Arc?

5:00 dysfun: yeah

5:00 and if you overwrite something with nil it decrements the refcount too

5:01 hellofunk: interesting. syntax as a whole, more elegant, or about same basket of boilerplate for classes, etc?

5:01 dysfun: that NSWindow thing was because swift's cleverness tried to double-dealloc an NSWindow

5:02 oh the syntax is much nicer than objectionable C imo. much less verbose too

5:02 there are some things that are tedious, mind

5:02 hellofunk: sounds nice. i really liked developing for apple products, i must admit. too bad swift wasn't around when i did

5:02 dysfun: especially if you're using xctest

5:02 i'm starting to appreciate cocoa

5:02 this is a desktop project, not ios though. i no longer own any ios devices

5:03 cocoa seems largely well put together

5:03 swift, they've obviously compromised a lot to make it mostly seamless with objectionable c, but it's a good language

5:03 the compiler is crap though and it segfaults a lot compiling complex code

5:04 hellofunk: how do you get around that?

5:04 if you can't compile your code?!

5:05 dysfun: you... rewrite it :/

5:06 and hope that one day they'll fix the compiler

5:06 i didn't say the experience was perfect, but i have to put up with a lot of shit in most languages

5:06 part of why i like clojure so much is it takes care of most of that for you

5:25 ticking: I wonder how long it takes for cljs to get an eval after all, the original point that eval is needed for dev environments has kinda gone out of the window since a lot of IDEs are now written in cljs...

5:27 SagiCZ1: what would be the predicate for take-while to return all elements until for some succesive two elements a condition is met?

5:27 for example (1 2 3 4 5 5 6 7) --> (1 2 3 4 5 5) when the predicate is =

5:27 ticking: SagiCZ1: that would require state in the predicate or someting not that simple I think

5:28 SagiCZ1: yeah..

5:28 maybe use partial to create succesive pairs..

5:28 partition

5:28 ticking: yeah

5:28 SagiCZ1: ,(partition-all 2 1 (range 10))

5:28 clojurebot: ((0 1) (1 2) (2 3) (3 4) (4 5) ...)

5:28 ticking: partition is the first thing I came up as well

5:28 SagiCZ1: you could also do

5:29 ,(first (partition-by = [1 2 3 4 5 5 6 7]))

5:29 clojurebot: (1 2 3 4 5 ...)

5:29 ticking: ,(first (partition-by = [1 2 5 5 6 7]))

5:29 clojurebot: (1 2 5 5 6 ...)

5:29 ticking: hrm sec

5:31 SagiCZ1: lol sorry, partition-by is not partition between...

5:43 hellofunk: maybe a simple recursive loop would be good in that case SagiCZ1

5:44 luxbock: ,(reduce (fn [seen n] (if (= (last seen) n) (reduced seen) (conj seen n))) [] '(1 2 3 4 5 5 6 7))

5:44 clojurebot: [1 2 3 4 5]

5:46 hellofunk: luxbock: but the reduce would still go through the entire seq, right? because reduce doesn't cut out on a test

5:46 luxbock: that's what `reduced` does

5:46 ticking: hellofunk: reduced will cut

5:46 hellofunk: well hot damn learned something new, that's awesome. didn't know that one.

5:50 dysfun: hrm, that would have been handy to know about

5:52 hellofunk: dysfun: if you didn't know reduced either, then i won't feel too bad

5:52 dysfun: why would you feel bad? i discover things all the time

5:53 i've been paid to write code for over ten years now, not to mention all the unpaid before and i've not stopped learning yet

6:07 okay, writing tests in swift/xctest is a lot more tedious than clojure/midje

6:14 hellofunk: dysfun: so in other words you can do it in clojure even more swiftly than swift

6:17 dysfun: because it's so unlike apple to employ marketing in the naming of things

6:27 ticking: dysfun: far better than iLanguage though

6:28 which is only the version without assignment and bitwise operations btw if you want that you need Language Pro

6:32 dysfun: hah

6:48 thanks to multicultural britain, my local greasy spoon cafe is actually open today so we're outsourcing breakfast

7:33 hellofunk: dysfun: here in NL i had to go to train station to find anything open, and got myself some doner kebab

8:16 dysfun: hellofunk: well my flatmate and i have feasted on fryups. great stuff.

8:38 justin_smith: luxbock: don't use last on vectors, use peek

8:38 last is guaranteed linear time

8:39 peek is O(1)

8:42 ,(butlast (reductions (fn [prev n] (if (= prev n) (reduced n) n)) [1 2 3 4 4 5 6 7]))

8:42 clojurebot: (1 2 3 4)

8:43 justin_smith: (lazy version)

10:47 delexi: is there an abs function in clojure?

10:50 AimHere: delexi, a lot of mathematical functions are palmed off to java so that it becomes Math/function

10:50 ,(Math/abs -0.3)

10:50 clojurebot: 0.3

10:51 AimHere: It might not work with all numeric types

10:54 delexi: AimHere: Ah, dang, of course! Thanks!

10:57 SagiCZ1: btw look at incanter if you care about infix notation and such things

11:41 AimHere: Hmmm, I'm feeling stupid. Is it possible to create a record with defrecord that has a circularly linked field, without mutable state? I figure that consigning the whole field to dirty old mutability forever because you only want to change it once to actually initialize it is a bit overkill

12:47 TimMc: &(Math/abs 5N)

12:47 lazybot: java.lang.IllegalArgumentException: No matching method found: abs

12:48 TimMc: &(.longValue 9999999999999999999999999999999999N)

12:48 lazybot: ⇒ 4003012203950112767

12:49 TimMc: &(.longValue (inc' Long/MAX_VALUE))

12:49 lazybot: ⇒ -9223372036854775808

12:49 TimMc: :-(

12:49 andyf: .longValue is asking for truncation, yes?

12:49 TimMc: Apparently.

12:50 So to get get the absolute value of a Number you'd have to do something with checking if it is < 0 and then multiplying by -1 if so.

12:51 andyf: math.numeric-tower should already have it implemented

12:51 I haven't used it personally, but its there in the docs

12:51 TimMc: *nod*

12:53 engblom: ,(println "Merry Christmas")

12:53 clojurebot: Merry Christmas\n

13:32 preschema: hi, is there a wiki engine written in Clojure?

13:32 also, is there a list anywhere of the various web-based softwares written in Clojure?

13:43 so in case there is no wiki engine written in Clojure yet, would anyone be interested in a collaboration to port Instiki from rails to Clojure? i think it would be great for Clojure, if done well. furthermore it will go live on a very big wiki used by pure mathematicians (where i am technical admin)

13:47 kenrestivo: you could go to http://crossclj.info/ and search for compojure, ring, even "wiki"

13:48 i think searching for the basic compojure functions, and looking up all its usage, will give you pretty much all the existing clojure web apps, at least the ones indexed there

13:49 "transitively used by 491 artifacts" eg http://crossclj.info/ns/compojure/1.3.1/project.clj.html

13:50 preschema: thanks

13:51 kenrestivo: tho there are web apps that don't use compojure, but most do. searching for ring might be good too. i find crossclj the best tool for choosing libraries or looking for example code for how to use one (esp when the documentation is thin).

14:01 jonathanj: yogthos: it seems like specifying :target-path in project.clj was breaking `lein ring uberjar`

14:03 yogthos: jonathanj: ah lein-ring is might be expecting a hardcoded location for the target?

14:04 jonathanj: yogthos: i'm not sure what the reason is, all i know is that removing that stopped the warning about missing a main method

14:31 newfriend: does anyone know how to enable syntax highligting in the cider-repl

14:51 justin_smith: AimHere: I would make the :children key (or whatever you call it in your record) a promise

14:51 that allows circularity via delayed evaluation, without mutability

14:52 though it does require deref for direct access - likely you would want to implement a protocol that hides all that ugliness

14:52 AimHere: Aha, I forgot laziness

14:52 justin_smith: well promises aren't lazy, per-se

14:52 but similar concept, for sure

14:53 AimHere: SICP tends to use promises in their implementation, as I recall

14:54 justin_smith: promises implement lazy-seqs, but are not lazy-seqs concretely :)

14:54 *can implement

14:54 I don't think clojure lazy-seqs use promises

14:55 AimHere: Won't it use a similar mechanic, even if hardcoded in Java?

14:55 justin_smith: (list 'new 'clojure.lang.LazySeq (list* '^{:once true} fn* [] body)))

14:55 that's lazy-seq (arg vector was [& body])

14:56 not java, not a promise

14:56 well, partially java, OK

14:56 that looks more like delay than promise though

14:57 and delay isn't as nice for circular structures as promise is

15:29 OscarZ-: im trying to get NREPL server running on my Java application.. i suppose i need to run start-server somehow from native java.. any ideas?

15:29 or is that even possible.. do I need to have native Clojure application for that?

15:29 justin_smith: OscarZ-: should just be a question of using clojure.lang.RT - but it would be easier to make a namespace of clojure code that takes care of all the details, and makes a function you can invoke from java

15:29 s/would/might

15:30 OscarZ-: yeah.. i'll probably have use for some helper functions in that namespace.. thanks ill look into RT

15:31 justin_smith: http://blog.jayfields.com/2011/12/clojure-java-interop.html this has a good intro in the second half

15:32 pretty simple actually

15:38 delexi: I am trying to solve the doublets wonderland-clojure-kata but got stuck with an error I don't know what to do with. The Exception along with the code can be found here: https://gist.github.com/5e29a9ab0bdecb6cdec1 What did I do wrong?

15:39 justin_smith: delexi: in the let binding for neighbors, map gets the args in the wrong order

15:40 I think you meant to use ->> instead of ->

15:40 (in fact every clause there gets the args in the wrong order, but ->> would fix that)

15:42 since it gets a function instead of a collection, and a collection instead of a function, you get the error "Don't know how to create ISeq from: doublets.solver$doublets$doublets_rec__3564$fn__3569"

15:42 delexi: ah, thank you, this removes the exception. Now off to see, why the code returns the wrong result!

16:02 grios: All Clojure code (and other lisps) I find has very short variable names, people seem to favour one-letter namer rather than something more descriptive. Is there a style guide that say's that's good, or is that just lisp tradition? //Confused code-reader

16:02 OscarZ-: justin_smith, cool i got it to work.. was really easy :)

16:02 justin_smith: grios: it really depends - I think super short names are common in fp

16:03 grios: also, in fp, sometimes the code is so general, no longer name would be especially helpful

16:03 grios: justin_smith: why? Do people need to save 5 bytes of source code?

16:03 justin_smith: (look at the variable names they use in math)

16:03 grios: justin_smith: ah, that kinda makes sense

16:04 justin_smith: ie. if you have a function like (defn dotwice [f] (fn [x] (f (f x)))) - f and x are probably the best names you can use there

16:05 grios: in haskell, they have "point free style" where they even eliminate variable names (it's all implicit application on unnamed args)

16:05 OscarZ-: justin_smith, heh yeah.. i always have trouble with that point free style

16:16 justin_smith, in interop/Example.java, why is there no arguments in (defn main [] println) ? it seems that when its called from Java, there is argument passed f.invoke("hello world") ?

16:29 ah its returning the function to java side.. misunderstood what its trying to do

16:31 if i want to have something like a global variable that is only assigned once.. a bit like Java final, is it ok to just use def to assign it to some namespace?

16:31 it will be some java object which methods i will be calling later on

16:33 justin_smith: OscarZ-: well, vars are mutable

16:33 chouser: yes, though you may want (defonce ^:constant foo value)

16:33 justin_smith: if you want something that is truly single assignment maybe you could use a promise or delay and hold onto that, and not its var

16:34 chouser: oh, sorry ^:const

16:34 OscarZ-: i see

16:37 chouser: I wouldn't worry about vars being technically mutable. People generally don't mutate them.

16:39 OscarZ-: yes, in this case im calling my nrepl setup code from Java application and i just want to pass in some object that i can refer to in my clojure code

16:39 im impressed how to easy it was to get this thing going :)

16:40 justin_smith: clearly some thought was put into making it a usable API

16:40 OscarZ-: going to try the "bean" function you told about earlier

16:45 SagiCZ1: how does one mutate a var?

16:45 justin_smith: SagiCZ1: def

16:45 SagiCZ1: ,(def x 6)

16:45 clojurebot: #'sandbox/x

16:45 SagiCZ1: ,(def x 7)

16:45 clojurebot: #'sandbox/x

16:45 SagiCZ1: thats how?

16:45 justin_smith: yes, that mutates the var

16:45 SagiCZ1: thats not something you would do in a production code though

16:45 justin_smith: one would hope not

16:47 SagiCZ1: now that you are here.. do you have any idea what the exclamation marks in different function names mean? like why is the new run! function with exclamation mark when it does almost the same thing as doseq which has no ! ..

16:48 justin_smith: it's complicated and not super internally consistent. One general idea is that things unsafe in transactions often have !

16:49 but in scheme things that do side effects have ! and we see some of that carried over too

16:50 SagiCZ1: too bad its not consistent

16:51 what is a transaction?

16:51 justin_smith: &(->> (all-ns) (mapcat ns-publics) (map (comp name key)) (filter #(.endsWith % "!")))

16:51 lazybot: java.lang.SecurityException: You tripped the alarm! ns-publics is bad!

16:51 justin_smith: blergh

16:51 ,(->> (all-ns) (mapcat ns-publics) (map (comp name key)) (filter #(.endsWith % "!")) (clojure.string/join "; "))

16:51 clojurebot: "vswap!; vreset!; set-error-mode!; set-agent-send-executor!; disj!; conj!; pop!; compare-and-set!; reset-meta!; set-error-handler!; set-agent-send-off-executor!; dissoc!; assoc!; reset!; alter-meta!; persistent!; run!; set-validator!; swap!; volatile!; io!; set-break-handler!"

16:51 andyf: You can also mutate at least the thread-locally bound value of a Var with set! I believe.

16:51 justin_smith: as you see, it's not many things that are named that way

16:52 andyf: and alter-var-root

16:52 SagiCZ1: okay then

16:53 justin_smith: I wonder why ns-publics is restricted

16:53 (on lazybot, that is)

17:19 Dynasty: does anyone know if there is documentation for writing Light Table plugins?

17:26 dbacar: hello

17:27 i have a web app initiated like this

17:27 (def app (-> #'app-routes

17:27 (enforce-content-type-middleware "text/html")

17:27 (wrap-defaults site-defaults)

17:27 (nses/wrap-noir-session {:store (memory-store nses/mem)})

17:27 ))

17:27

17:28 it seems I use two session wrappers

17:29 and in my application session-id seems to change in between requests

17:29 so I lose the session

17:30 it is convenient to use noir to have get and put! commands, is it still the recommended way to deal with sessions?

17:31 any ideas?

17:37 anyone here?

17:37 anyone reading my message?

17:38 SagiCZ1: i do

17:38 but i have no idea how to help you.. sorry

17:38 hyPiRion: it's christmas day, most people are probably doing something with their family

17:43 dbacar: terribly sorry, i am new to emacs erc, so thought it was sth wrong with connection

17:43 merry christmas

17:43 :)

17:44 hyPiRion: happy holidays

17:51 octe: i have a nested list like this: http://pastebin.com/4YPSqGTL

17:51 i want to extract the lists containing numbers from that

17:51 transform it into ((30000139 30000144 30000140 30000142) (30000139 30000144 30000142) (30000139 30000144 30000143 30000142)) i guess

17:52 SagiCZ1: you want to leave out the nils?

17:52 octe: and semi-flatten it

17:52 SagiCZ1: whenever you encounter something like this, think first about how you actually got such a mess and try to fix it there

17:52 andyf: I was going to suggest flatten, but it sounds like you want some list structure to remain?

17:53 octe: yes

17:53 andyf: (remove nil? ...) is good for one level, at least.

17:54 octe: SagiCZ1, yes, that's probably something i need to fix. i became curios on how to solve this though

17:55 dbacar: would clojure.walk be helpful here?

17:55 SagiCZ1: maybe treeseq

17:55 octe: it feels like it

17:55 but i'm not sure ho

17:55 w

18:03 SagiCZ1: can i hook a listener to an atom to do something when its value changes?

18:03 in seesaw particulaly

18:04 justin_smith: SagiCZ1: add-watch maybe?

18:04 SagiCZ1: cool thanks

18:05 justin_smith: SagiCZ1: octe: yeah, tree-seq plus a filter based on (fn [el] (and (coll? el) (every? number el)) would probably do it

18:07 andyf: octe: This probably won't always do what you want, but it seems to work on the example given: (filter #(and (sequential? %) (every? number? %)) (tree-seq seq? seq d1))

18:07 octe: justin_smith, thanks, i'll give it a try

18:08 andyf: Ah, missed justin_smith answer

18:08 octe: andyf, cool, that works

18:11 justin_smith: octe: https://www.refheap.com/95412

18:12 andyf: haha, and you got the more concrete answer while I was busy composing, formatting, and pasting mine

18:12 but the fact that the two of us each came up with that is reassuring :)

18:16 SagiCZ1: i have a collection on which i take while like this (take-while #(some-predicate %) coll), i also want to stop taking when the lement is nil.. how would i do that?

18:17 justin_smith: SagiCZ1: (take-while #(and (some %) (some-predicate %)) coll)

18:17 wait, no, not some

18:17 some?

18:18 I get the two confused sometimes :)

18:18 (doc some?)

18:18 SagiCZ1: me too

18:18 clojurebot: "([x]); Returns true if x is not nil, false otherwise."

18:18 justin_smith: &(some? false)

18:18 lazybot: ⇒ true

18:18 justin_smith: yup, that's the right one

18:18 SagiCZ1: thank you

18:20 ,(map some? [nil 0 false true])

18:20 clojurebot: (false true true true)

18:20 SagiCZ1: ,(map boolean [nil 0 false true])

18:20 clojurebot: (false true false true)

18:20 SagiCZ1: i see

18:23 hex6: What's the best practice to split up your project into several files? right now I have one ns and use (load "file") and (in-ns ...)

18:23 SagiCZ1: you can group functions and have a namespaces for each of them

18:35 i need to format a double

18:35 ,(format "%.2d" 45.976)

18:35 clojurebot: #<IllegalFormatPrecisionException java.util.IllegalFormatPrecisionException: 2>

18:36 SagiCZ1: ,(format "%.2f" 45.976)

18:36 clojurebot: "45.98"

18:36 SagiCZ1: ,(String/format "%.2f" 45.976)

18:36 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Double cannot be cast to [Ljava.lang.Object;>

18:37 SagiCZ1: ,(String/format "%.2f" (to-array 45.976))

18:37 clojurebot: #<RuntimeException java.lang.RuntimeException: Unable to convert: class java.lang.Double to Object[]>

18:37 SagiCZ1: ,(String/format "%.2f" (to-array [45.976]))

18:37 clojurebot: "45.98"

18:37 dbacar`: (= 3 4)

18:37 SagiCZ1: ,(String/format Locale.US "%.2f" (to-array [45.976]))

18:37 clojurebot: #<CompilerException java.lang.ClassNotFoundException: Locale.US, compiling:(NO_SOURCE_PATH:0:0)>

18:38 dbacar`: ,(= 3 4)

18:38 clojurebot: false

18:38 dbacar`: oh my goodness :), ididnt know this

18:38 SagiCZ1: ,(String/format java.util.Locale.US "%.2f" (to-array [45.976]))

18:38 clojurebot: #<CompilerException java.lang.ClassNotFoundException: java.util.Locale.US, compiling:(NO_SOURCE_PATH:0:0)>

18:38 SagiCZ1: god damn

18:38 what a hassle

18:39 (String/format java.util.Locale/US "%.2f" (to-array [45.976]))

18:39 ,(String/format java.util.Locale/US "%.2f" (to-array [45.976]))

18:39 clojurebot: "45.98"

18:39 SagiCZ1: finally

18:39 clojure should really make the format function to accept locale, this is just terrible

18:41 andyf: SagiCZ1: Why not just use format?

18:41 hex6: What was wrong with ,(format "%.2f" 45.976)?

18:42 andyf: ah, because you need to specify a locale?

18:42 SagiCZ1: whats wrong? it ASSUMES my locale.. and since my locale is non us, it uses different decimal separator

18:42 i hate when someone ASSUMES locale.. horrible

18:42 it solve 2 problems and creates 5000 new ones

18:43 andyf: You might have gotten there with a bit less hassle if you had read (source format)

18:45 JackRack: , (source format)

18:46 clojurebot: Source not found\n

18:46 SagiCZ1: (source format)

18:46 JackRack: ,(source format)

18:46 clojurebot: Source not found\n

18:46 SagiCZ1: did this ever work?

18:47 JackRack: ,(clojure.repl/source format)

18:47 clojurebot: Source not found\n

18:57 andyf: SagiCZ1: Try a local repl instead

18:57 SagiCZ1: i just ctrl+click to see the source

19:33 sova: I am fascinated by clojurebot. does anyone know how it (she?) works?

19:33 alexbara`: how can I set styles on a snippet using Kioo/Enlive?

19:53 anyone around who has used much Enlive or Kioo that I could run a question by?

19:57 kl: What does (Boolean. "false") do?

19:58 Specifically, it's the (Something. "something") syntax I'm looking to decipher

20:00 ambrosebs: kl: expands to (new Something "something")

20:00 calls the 1 argument constructor on Something

20:00 kl: ambrosebs: I see, thank you!

20:01 ambrosebs: kl: np

20:10 andyf: kl: Strongly recommended against using the constructor for class Boolean, though, for Java and Clojure

20:11 because this....

20:11 ,(if (Boolean. false) "true" "false")

20:11 clojurebot: #<AccessControlException java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")>

20:11 andyf: well, if you do that in a local repl, you will see "true" as the result, which is very surprising.

20:12 sova: There is source code in a GitHub repo for clojurebot, I'm pretty sure.

20:14 sova: Not sure if this is the most up to date repo: https://github.com/hiredman/clojurebot

20:14 kl: andyf: thanks for the heads up, I'm aware of that issue :)

20:14 The text explained that problem, without the syntax (from what I saw, at least!)

21:10 ffwacom: is there any reason why 'lein test' would be taking forever to run?

21:30 mearnsh: stumped by a bug. see two examples at end, using a trusty prn to find where the first one fails and testing directly on that case (second example), works https://www.refheap.com/95414

22:15 justin_smith: ffwacom: a common culprit for things like that is side effects (like creating a server or thread) at the top level of a namespace

22:15 ie. (def server (run-jetty ...))

22:15 bad idea

22:16 ffwacom: hmm might be the case, datomic transactor is being started

22:17 justin_smith: mearnsh: the exception clearly states that the function "atom" is being used where a number is expected

22:17 but nothing in the code you pasted uses atom

22:18 also, using "atom" to mean things other than clojure.core/atom is going to confuse people

22:18 ffwacom: justin_smith: ah had some api calls being made

22:18 thanks

22:19 justin_smith: ffwacom: yeah, the common pattern is to def an "init" function, and either generate the resources you need inside that and return them, or fulfill a promise/ force a delay, whathaveyou

22:19 and just document that init must be called, of course

22:20 ffwacom: sounds good

22:21 justin_smith: actually, if you use delays (which only run when \they are dereffed) you may not need an init

22:21 depending on your logic of course

23:15 sova: andyf: thanks on the linkage.

Logging service provided by n01se.net