#clojure logs

2014-08-27

00:40danielcomptonOn my gravestone when I die: This tombstone is not part of GNU Emacs.
01:22amalloycelwell: yes, that's exactly what you can/should do
03:41andrewchabmers\join #clojurescript
03:45andrewchambershow hard is it to call c++ code from clojure?
03:47beamsoyou would be calling out from clojure through java (jni or jna) to call the c++ code
03:47andrewchambershmm
03:47andrewchambersim trying to work out the best way to read in llvm bitcode files into clojure
03:48andrewchambersand convert them to native clojure data structures
03:50beamsohttp://stackoverflow.com/a/17401949 ?
03:52cYmenMorning #clojure!
04:08sm0ke,(instance? java.util.Map {}_)
04:08clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: _ in this context, compiling:(NO_SOURCE_PATH:0:0)>
04:09sm0kehurm this seems to work on my repl
04:09sm0ke,(clojure-version)
04:09clojurebot"1.7.0-master-SNAPSHOT"
04:09sm0ke##(instance? java.util.Map {}_)
04:09lazybot⇒ true
04:10sm0keha
04:10sm0ke##(clojure-version)
04:10lazybot⇒ "1.4.0"
04:10engblom,(/ 1 0)
04:10clojurebot#<ArithmeticException java.lang.ArithmeticException: Divide by zero>
04:11sm0keseems like a bug in compiler to me ##(doc instance?) ;as doc has only 2 arity
04:11lazybot⇒ "([c x]); Evaluates x and tests if it is an instance of the class c. Returns true or false"
04:12sm0ke##(assoc {} 1 {}_)
04:12lazybotjava.lang.RuntimeException: Unable to resolve symbol: _ in this context
04:12sm0kevery peculiar
04:17amalloyuhhhh...peculiar in that you typed a _ in the middle of nowhere?
04:18sm0ke##(instance? java.util.Map {}_)
04:18sm0keyes
04:18lazybot⇒ true
04:20sm0kelooks funny right?
04:21amalloyit was fixed in 1.6, i think. maybe 1.5
04:21amalloyinstance? used to be totally awful if you called it with any number of args other than 2
04:21amalloy&(instance? String)
04:21lazybot⇒ false
04:21amalloy&(instance?)
04:21lazybotclojure.lang.ArityException: Wrong number of args (0) passed to: core$instance-QMARK-
04:21amalloy0 was fine too, i guess
04:22sm0kehurm how is this possible, is instance? a macro?
04:23sm0keonly possible explaination
04:23amalloyit's...well, no
04:23amalloythere are stranger things in this world than what you consider possible
04:23sm0keweel then how can it take more than 2 arity
04:23sm0keyea right, that explaination is awesome
04:23wjlroeis it a special form?
04:24amalloyno, it's actually a regular function
04:24amalloybut there's a compiler intrinsic to turn literal calls to instance? into a single jvm bytecode op instead
04:24sm0ke##(inc 1 2)
04:24lazybotclojure.lang.ArityException: Wrong number of args (2) passed to: core$inc
04:24amalloyand in previous versions of clojure that intrinsic was written wrong
04:24sm0kewow it says wrong arity, thank god
04:24amalloysuch that it didn't complain about the wrong number of args
04:25amalloyor something like that. i think the intrinsic system is actually smarter than that, and it was actually a special case in the compiler
04:25wjlroeah right - as it's a convenience function that calls java methods
04:25andrewchambersbelated goodmorning cYmen
04:27andrewchambersbeamso: Those seem pretty out of date
04:39cYmenI'd like to work on a medium/large clojure project. Is there a list of clojure open source projects available somewhere?
04:40cataska2014-08-27 16:31 *** andrei_ QUIT Remote host closed the connection
04:40cataskaOops
05:31visof,(sorted-map {:a 1, :d 2, :b 3})
05:31clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: {:b 3, :d 2, :a 1}>
05:31visofwhy this don't work?
05:32visof,(sorted-map :a 1, :d 2, :b 3)
05:32TEttinger,(apply sorted-map {:a 1, :d 2, :b 3})
05:32clojurebot{:a 1, :b 3, :d 2}
05:32clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: [:a 1]>
05:32TEttingerthat was mine
05:32TEttingerthat errored I mean
05:33TEttingervisof, it seems like it should. you may be looking for sort
05:33TEttinger,(class (sort {:a 1, :d 2, :b 3}))
05:33clojurebotclojure.lang.ArraySeq
05:33TEttinger,(class (sorted-map :a 1, :d 2, :b 3))
05:33clojurebotclojure.lang.PersistentTreeMap
05:33TEttingerhm
05:39blorgany1 doing clj gamedev?
05:39justin_smith,,(into (sorted-map) {:a 0 :b 1 :c 2})
05:39clojurebot{:a 0, :b 1, :c 2}
05:41blorg((fn [xs n] (flatten (partition (dec n) n nil xs))) [1 2 3 4 5 6 7 8] 3)
05:42justin_smith~flatten
05:42clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
05:44blorg,,(filter (complement nil?) (map #(if (= %1 1) %2) (cycle (conj (into [] (repeat (dec 3) 1)) 0)) [1 2 3 4 5 6 7 8] ) )
05:44clojurebot(1 2 4 5 7 ...)
05:44justin_smith,((fn [xs n] (apply concat (partition (dec n) n nil xs))) [1 2 3 4 5 6 7 8] 3)
05:44clojurebot(1 2 4 5 7 ...)
05:44blorgwhats up with the commas?
05:45blorg,( whats (up (with (the (commas huh?)))))
05:45clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: whats in this context, compiling:(NO_SOURCE_PATH:0:0)>
05:45justin_smith,"it triggers the bot"
05:45clojurebot"it triggers the bot"
05:46blorg," blorgon is my master!!!"
05:46clojurebot" blorgon is my master!!!"
05:46blorg," I fear the daeleks!!"
05:46clojurebot" I fear the daeleks!!"
05:47blorgnice gimmick...
05:48blorg,((comp drop-last #(interleave %2 (repeat (count %2) %1))) 0 [1 2 3])
05:48clojurebot(1 0 2 0 3)
05:50blorg,"OBEY THE BLORGONS justin_smith!"
05:50clojurebot"OBEY THE BLORGONS justin_smith!"
05:50justin_smith,(drop-last (interleave [1 2 3] (repeat 0)))
05:50clojurebot(1 0 2 0 3)
05:53SagiCZ1what other ~ tips does the bot know?
05:53SagiCZ1~atom
05:53clojurebotTitim gan éirí ort.
05:54SagiCZ1is that irish?
05:54blorg~~
05:54justin_smith~factoids
05:54clojurebotExcuse me?
05:54clojurebotExcuse me?
05:54justin_smithSagiCZ1: I believe so
05:54blorg~'~
05:54clojurebotPardon?
05:54blorg~`~
05:54clojurebotNo entiendo
05:54SagiCZ1~blorg
05:54clojurebotHuh?
05:54blorgok ill leave u be
05:55blorga whole REPL with one purpose in life: listining to an IRC channel...
05:55justin_smith(inc clojurebot)
05:55lazybot⇒ 43
05:55blorgfunny
05:55blorg~clojurebot
05:55clojurebotclojurebot ignores several people at hiredman's whim
05:56justin_smith3d6
05:56clojurebot17
05:56blorgwho built him?
05:56justin_smithhttps://github.com/hiredman/clojurebot
05:57justin_smithnote the ~clojurebot factoid also mentions hiredman
05:57blorg'(def clojurebot dead)
05:57blorg,(def clojurebot dead)
05:57clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: dead in this context, compiling:(NO_SOURCE_PATH:0:0)>
05:58blorg,(def clojurebot nil)
05:58clojurebot#'sandbox/clojurebot
05:59SagiCZ1i love the bot though
05:59blorghe is super cute
05:59SagiCZ1yup|
05:59TEttingerI can answer questions about lazybot if anyone needs em
06:00SagiCZ1TEttinger: Nice try
06:00blorglazybot?
06:00clojurebotlazybot is forget lazybot
06:00SagiCZ1but not its clojurebot-time!
06:00SagiCZ1(doc println)
06:00clojurebot"([& more]); Same as print followed by (newline)"
06:00blorgany1 read the post about how clojure/lisp coders are happier?
06:00SagiCZ1no?
06:00TEttinger##(clojure.string/join" "(repeatedly 2000(fn [](apply str(concat[(rand-nth ["rh""s""z""t""k""ch""n""th""m""p""b""l""g""phth"])](take(+ 2(* 2(rand-int 2)))(interleave(repeatedly #(rand-nth ["a""a""o""e""i""o""au""oi""ou""eo"]))(repeatedly #(rand-nth ["s""p""t""ch""n""m""b""g""st""rst""rt""sp""rk""f""x""sh""ng"]))))[(rand-nth ["os""is""us""um""eum""ium""iam""us""um""es""anes""eros""or""ophon""on""otron"])])))))
06:00clojurebotno is tufflax: there was a question somewhere in there, the answer
06:00lazybot⇒ "thategon pounotus phthortor phthomertus maspanes taspaustis choisterkeros choifophon kortor mospamium pausheros pangospos boifum rhoseros netor choufanes mauchus kananes maumon rhobus thages thautespis laspongeum pouchor mertobium zetamophon postachotron taunopum no... https://www.refheap.com/89505
06:01TEttingerthe refheap link is handy
06:01SagiCZ1TEttinger what just hapenned?
06:01TEttingerit's a random greek-like word generator
06:01TEttingerin one IRC line
06:01TEttinger411 chars
06:02TEttinger413 if you include the prepend for lazybot
06:02SagiCZ1sweet! does lazybot link the log automatically if the output is too long?
06:02blorgwt is diff lazy vs clj?
06:02TEttingeryep!
06:02TEttingerblorg, different authors, different purposes
06:02SagiCZ1,(take 456 (range 1000))
06:02clojurebot(0 1 2 3 4 ...)
06:03blorgk
06:03TEttinger##(take 456 (range 1000))
06:03lazybot⇒ (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 ... https://www.refheap.com/89506
06:03SagiCZ1ok so its double hashmark for lazybot
06:03TEttingeronly lazybot links to refheap
06:03TEttingerthere's othrs than ##
06:03SagiCZ1(inc lazybot)
06:03lazybot⇒ 30
06:03TEttingerI think $ or & works, one of them
06:03SagiCZ1ok.. good work btw.. !
06:04justin_smithdouble hashmarks are for ##(print "inline" "calls")
06:04lazybot⇒ inline callsnil
06:04TEttingerbut ##(+ 1 1) can be inside another message
06:04lazybot⇒ 2
06:04justin_smith&"only works at the beginning of the line"
06:04lazybot⇒ "only works at the beginning of the line"
06:04blorgthis irc shud be renamed to shoe-your-clojurebot-day
06:04blorg*show
06:04TEttingerSagiCZ1, heh, it's Raynes and amalloy_'s work, I just extended the plugins for my fork that wouldn't be a good fit here
06:05blorgbring-your-clojure-bot-to-scholl-day
06:05SagiCZ1TEttinger: I see.. :)
06:06SagiCZ1i better start doing some real coding in clojure.. its so hard to learn any new languages.. at first i dont have enough experience to really code but i dont really learn if i am just doing artifical exercises :/
06:06SagiCZ1i had the same problem with java 5 years ago but ive gotten through taht somehow
06:07blorgu know 4clojure? (sagiCZ1)
06:07SagiCZ1blorg: yep
06:07SagiCZ1almost done with that
06:07blorghmm.. im only at like problem 50 or so..
06:07SagiCZ1mm.. me too
06:08SagiCZ1there is about 150 so i guess it doesnt really qualify as being "almost done" sorry
06:08blorgbut i need clj for some project so i know ill pull thru
06:08SagiCZ1i need clj too
06:08SagiCZ1but its too early to start on that project..
06:08SagiCZ1i would be rewriting all of it
06:08SagiCZ1need some small toy projects before that
06:08blorgye..
06:09blorggenetic algo is small enuf..
06:10blorga small MS-paint clone.. in clj...
06:10blorgIamDrowsy too
06:10SagiCZ1cool ideas.. ive done some evolutionary algos too.. clojure just seemed so very natural with that
06:12cYmenIamDrowsy?
06:12blorgcYmen?
06:12SagiCZ1blorg?
06:12blorgclojurebot?
06:12clojurebotclojurebot is amazing
06:13SagiCZ1lazybot?
06:13clojurebotlazybot is forget lazybot
06:13SagiCZ1...but i still dont know how to replace java's objects in clojure.. i know i talk about it all the time here.. objects just make sense to me
06:13cYmenInteresting...
06:13blorgobjects are bad
06:14SagiCZ1are they?
06:14cYmenSagiCZ1: Which part do you miss? The type-checking? Inheritance?
06:14blorgyes...
06:14SagiCZ1none of that.. just the data storage and methods that mutate their state.. i just miss mutability i guess
06:14ivanI miss the state
06:14cYmenI mean an object is just a bunch of data and a bunch of related methods.
06:15SagiCZ1cYmen: data that can be mutated
06:15cYmenBut you can just use a map or tuple or whatever and still store data i.e. state.
06:15blorgu can hack objects together in any lang
06:15blorgalmost..
06:15SagiCZ1map is ok.. but its immutable
06:15cYmenBut why does it matter if you do object.mutate() instead of object = mutate(object)?
06:15ivanSagiCZ1: the common thing is to use an atom
06:15SagiCZ1atom is for special cases though isnt it
06:16blorgim trying to do OOP rehab
06:17SagiCZ1so what i would do.. is i would have a global variable atom.. and functions with sidefect that mutate the atom.. it just seems like a horrible misuse of clojure
06:17cYmenSagiCZ1: I think this is perfectly appropriate in some cases.
06:17blorgtry exploring haskell mbe.
06:17justin_smithcYmen: it matters because the affects none of the data structures embedding object
06:18blorgits less usefull IMO than clj.. but it forces u to think diff
06:18justin_smith*the latter
06:18SagiCZ1blorg: i love the JVM.. can't live without it.. the apache math library is a lifesaver.
06:18cYmenjustin_smith: I still can't parse that sentence. :)
06:18SagiCZ1justin_smith: could you elaborate please?
06:18blorgye i agree that haskell isnt very usefull
06:21justin_smithif you have (def foo [o]) (def o (bar o)) does not change foo at all - (.mutate o) does change the contents of foo
06:22SagiCZ1yeah.. so it has no state
06:23justin_smithSagiCZ1: check out some of the alioth shootout haskell code
06:23justin_smithif you want it to, it can definitely work in terms of pure mutation
06:23justin_smith(that just happens to lead to ugly terrible code - but it performs well)
06:24SagiCZ1i see.. but i dont want ugly code :)
06:24justin_smithI find it informative to compare the ugly ass unidiomatic haskell code, to the more idiomatic ocaml that performs nearly as well
06:25blorgmy end goal is make a very "modular"/programable game. since i can do the OOD for games in my sleep its very hard for me to switch to a functional mindset.. but thats the only way to go...
06:26blorgjustin_smith: hmm.. what?
06:26lvh_I'm having some difficulty understanding when to use futures, promises and core.async channels. I have an api for getting something out of a key value store. futures don't seem appropriate because it's not cpu-blocking (although it could be that, because you're wrapping a synchronous API, blocking a thread is really what it has to do)
06:27lvh_promises feel most appropriate, but everything else in my code already has channels
06:27lvh_does a channel that will only ever return one thing (an error or a success) and then close make any sense?
06:27justin_smithblorg: what, what?
06:28blorg"ugly ass unidiomatic haskell code, to the more idiomatic ocaml that performs nearly as well"
06:29justin_smithright, on alioth
06:29justin_smithhttp://benchmarksgame.alioth.debian.org/ pick a benchmark, compare haskell code to ocaml code, and their performance
06:29SagiCZ1oh.. now i know what alioth is
06:29justin_smithhttp://benchmarksgame.alioth.debian.org/u64q/haskell.php
06:30justin_smithsorry, this is the link I meant to share http://benchmarksgame.alioth.debian.org/u64q/benchmark.php?test=all&amp;lang=ghc&amp;lang2=ocaml&amp;data=u64q
06:32SagiCZ1most of clojure programs are slower than java and some take more lines of code.. thats surprising
06:33blorgjustin_smith: both seem ugly to me...
06:37blorgthis http://benchmarksgame.alioth.debian.org/u32/program.php?test=binarytrees&amp;lang=racket&amp;id=2 however seems so nicer. and only twice slower
06:49blorghello glorbon
06:50glorbonhello blorgon
06:54SagiCZ1are you two, by any chance, each others evil twin?
06:57cYmenjustin_smith:Very often you can replace mutation with getting a new object except in cases very there are multiple references to the same thing which is exactly the case when you generally don't want mutation. :)
06:57justin_smithyeah, that's kind of what I was trying to say
06:58glorbonYES WE ARE !!
06:58glorbon(which makes us both evil!)
06:58blorgSO EVIL
07:00glorboncYmen: u r sayin one can do good OOP?
07:01mindbender1Is there a clojure library wrapping java.nio?
07:02Bronsamindbender1: https://github.com/pjstadig/nio
07:02cYmenglorbon: I don't think I said anything about OOP
07:03glorbonook.. sry then
07:04vijaykiranclear
07:04vijaykiranmeha
07:04mindbender1Bronsa: thanks.
07:04Bronsanp
07:09justin_smithmindbender1: there is also an nio.file wrapper
07:10mindbender1justin_smith: how can I access it?
07:10justin_smithhttps://github.com/ToBeReplaced/nio.file I am a contributor, prs welcom
07:11mindbender1justin_smith: cool, thanks. Checking it out.
07:55glorbonso quiet
07:56SagiCZ1im listening!
07:58glorbonare you? are . . . you . . .
08:00glorbon,"lets party"
08:00clojurebot"lets party"
08:00glorbonwe agree then
08:03glorbon,((fn do-u-love-me-clojurebot? [_] (str "YES!"))0)
08:03clojurebot"YES!"
08:03SagiCZ1~party
08:03clojurebotPardon?
08:04SagiCZ1why are u passing zero to it?
08:04glorbony not
08:05glorbonidk actually..
08:05glorbon,((fn do-u-love-me-clojurebot? [_] (str "YES!")))
08:05clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox/eval73/do-u-love-me-clojurebot?--74>
08:05glorbono.. thts y..
08:05glorbon,((fn do-u-love-me-clojurebot? (str "YES!")))
08:05clojurebot#<CompilerException java.lang.IllegalArgumentException: Parameter declaration str should be a vector, compiling:(NO_SOURCE_PATH:0:0)>
08:05SagiCZ1,((fn do-u-love-me-clojurebot? [] (str "YES!")))
08:05clojurebot"YES!"
08:06SagiCZ1this way
08:06glorbonk
08:06glorboncoolio
08:07SagiCZ1and btw..
08:07SagiCZ1,(= (str "YES!") "YES!))
08:07clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
08:08glorbon(#(do % "YES"))
08:08SagiCZ1 ,(= (str "YES!") "YES!"))
08:08clojurebottrue
08:08glorbon((#(do % "YES"))0)
08:08glorbon(#(do % "YES") 0)
08:08glorbon?
08:08glorbonoh forgot commas
08:08glorbonheh
08:09glorbon,(#(do % "YES") 0)
08:09clojurebot"YES"
08:11hyPiRionconstantly yes.
08:11samflores,(#(constantly "YES!"))
08:11clojurebot#<core$constantly$fn__4178 clojure.core$constantly$fn__4178@12b700f>
08:12glorbon,(#(constantly "YES!") 0)
08:12clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox/eval51/fn--52>
08:12samflores,(doc constantly)
08:12clojurebot"([x]); Returns a function that takes any number of arguments and returns x."
08:12glorbonhmm
08:13glorbon,((constantly "YES!") 0)
08:13clojurebot"YES!"
08:13nathan7remember, #() makes a function
08:14nathan7,(#(do %& 42) 0)
08:14clojurebot42
08:14samfloresI always forgot constantly makes a fn :D
08:15glorbon,(reduce (constantly "YES") ["does" "clj" "love" "me?"])
08:15clojurebot"YES"
08:15glorbonaww shucks
08:16samflores*forget
08:16glorbonhuh?
08:17glorbon(can I add stuff to the bot or is it protected via clojail and such?)
08:17hyPiRionit's semiprotected
08:18glorbonelaborate?
08:18andrewchambersis there a tool for pretty printing edn?
08:22hyPiRionclojure.pprint/pprint ?
08:25lvhWhat happened to clojure.contrib again? Especially clojure.contrib.base64
08:25lvh(I want base64 urlencoding and decoding)
08:25lvhSorry, base64url*
08:26lvhnothing to do with urlencoding; just base64 with a url-safe alphabet :)
08:42lvhargh
08:42spradnyeshif there are multiple expressions (w/ side-effects) in a let body, will they be executed serially or in parallel?
08:42lvhthere was *a* library on github that did this right for clojure (base64url enc/dec)
08:42spradnyeshi'm seeing parallel execution, but want serial
08:45spradnyeshfor example, in (let [x 1] (do-a) (do-b)) i'm seeing errors which should happen only if do-b is executed before do-a has finished
08:45dnolen_spradnyesh: serial
08:45spradnyeshi haven't put either in a future/Thread
08:45dnolen_spradnyesh: then present a minimal case that people can look at - but it sounds implausible
08:45spradnyeshdnolen_: thanks. that is what i expected too; but that's not what i'm seeing :(
08:47spradnyeshdo-a cleans-up something from mongodb, and do-b reads from mongodb and processes and writes back. i'm seeing a duplicate key error
08:47spradnyeshalso, i get the error back almost instantaneously, whereas do-a should have taken atleast 1-2 sec to complete
08:48dnolen_spradnyesh: sounds like a problem with a) mongodb b) your mongodb driver
08:48spradnyeshi'm thinking of putting do-a inside a future, and then referencing it from do-b. that should work, right?
08:48spradnyeshdnolen_: i'm using monger-1.7.0
08:49dnolen_spradnyesh: I don't know anything about the mongodb but I can say w/ confidence Clojure execution is serial. Look for the problem in more likely sources.
08:49spradnyeshdnolen_: what do you think about my using "future" as a bypass/solution as suggested above?
08:50dnolen_spradnyesh: sounds ok to me.
08:51cYmenIs it possible that the mongodb call returns immediately because there is no return value it needs to wait for?
08:51cYmenSo even though it isn't done it returns already?
08:53spradnyeshcYmen: i don't think so; http://docs.mongodb.org/manual/reference/method/db.collection.update/ says that update returns result of update. but thanks for pointer :)
08:53spradnyeshdnolen_: i'll try that out
08:58cYmendnolen_: Is it possible that clojure simply runs the commands serially withou waiting for them to return?
09:00spradnyeshfound out the issue: do-a has a (map (some-side-effect) some-seq) as it's last expr. this made the some-side-effect lazy. trying to do a dorun on it now
09:03cYmenah well :)
09:11ebaxtI've been using Stuart Sierra's "Clojure Workflow, Reloaded" based on tools.namespace for over a year now. I've recently started to experience PermGen exceptions when reloading my project. Could this have anything to do with http://dev.clojure.org/jira/browse/CLJ-1152? I haven't looked at the mechanics of tools.namespace reloading so I don't know if it might be related...
09:13stuartsierraebaxt: Don't know if it's related, but I've certainly experienced PermGen problems when (re)loading large projects (hundreds of source files).
09:14stuartsierratools.namespace removes namespaces before reloading them, so things like protocols & multimethods should be GC'd.
09:15ebaxtstuartsierra: about 10K loc in 138 files
09:17stuartsierraebaxt: That might be enough to fill the PermGen, depending on your JVM settings.
09:17stuartsierraSee if increasing the PermGen size fixes the problem.
09:17ebaxtstuartsierra: Any PermSize suggestions? Lein repl use :jvm-opts from user profiles right?
09:18stuartsierraebaxt: Look up the default PermGen size for your JVM, make it bigger, see if that fixes the problem :)
09:20ebaxtstuartsierra: hehe, thx, I'll do that. BTW, we're using some libs that keep state in refs, could that be part of the problem?
09:20stuartsierraebaxt: don't know
09:21ebaxtk
09:21stuartsierrabut I doubt it
09:21hyPiRionebaxt: not sure how that would affect permgen
09:21stuartsierrait might break in other ways when you try to reload though
09:29ebaxt:jvm-opts ^:replace [] in project.clj will ignore :jvm-opts in .lein/profiles.clj?
09:37stuartsierraebaxt: not sure; test or try asking later when the U.S. West Coast wakes up :)
09:38SagiCZ1clojure is trending https://www.google.cz/trends/explore#q=clojure
09:40TimMcFinland, interesting.
09:41hyPiRionNorway whut
09:41hyPiRionI feel like there's like 5 Clojure devs over here
09:41llasramAdd one more and it's up 20%
09:42FoxboronhyPiRion: Norwegian?
09:42hyPiRionFoxboron: yes
09:43Foxboronis there actually anyone doing professional CLojure development in Norway?
09:44hyPiRionFoxboron: yeah, pretty sure ebaxt is
09:44Foxboronoh, thats fun. Got a friend who wrote his master thesis in Clojure
09:44Foxboronbeen dabbling with it since autumn 2012
09:45Foxboron<- Norwegain aswell (to get that straight)
09:45hyPiRionI am working in Clojure at work.
09:45FoxboronhyPiRion: there was also a Clojure talk at Boosterconf IIRC
09:46hyPiRionFoxboron: oh nice. I know augustl is working with Clojure as well, but not sure if that's professionally or on a hobby basis
09:46ebaxtFoxboron: We are, (small startup ardoq.com) I know a couple of other small ones and I think schibsted (https://github.com/schibsted)
09:47Foxboronebaxt: thats fun. I had no idea there where places in Norway doing that
09:48hyPiRionOh, and I think Bekk has a single project in Clojure. But they seem to prefer Scala -- I think they have 3 projects with Scala.
09:48ebaxtFoxboron: There are :) Kodemaker has at least one project, maybe more magnars / augustl ?
09:49Foxboroni know magnars had a Clojure online thingie developing a zombie game
09:49FoxboronhyPiRion: got a friend working at Bekk
09:50Foxboronhe is mostly working in Javascript tho
09:51hyPiRionFoxboron: What I feel like is sort of a problem is that we don't have a Norwegian user group for Clojurists. That's probably why people don't see so many of these Clojure projects
09:52FoxboronhyPiRion: yeah, but there is a user group for functional langs in Oslo?
09:53ebaxthyPiRion: You're based in Trondheim right?
09:53hyPiRionebaxt: I was until June. Finished my master's then went down to Oslo
09:55hyPiRionFoxboron: yeah, true. But I still don't feel it's easy to figure out who to ask if I were to join a Clojure company.
09:55hyPiRion/s/were/wanted/
09:57ebaxthyPiRion: agree, most of the people I know are using Clojure at work I met at http://www.meetup.com/Oslo-Socially-Functional/
09:59hyPiRionebaxt: How often are there events with OsloSF? Seems like roughly monthly or so?
10:00TimMcOslo, San Francisco, California, USA
10:01ebaxthyPiRion: Every two months aprox. Trying to increase the number of meetings last i heard
10:04hyPiRionebaxt: cool. I'll try to join and see if I can help out with anything
10:05ebaxthyPiRion: Good idea :)
11:11acaglebuffer 1
11:15mdeboardfalse
12:02virmundiHello. I’ve got a question about naming standards. I’ve got a method that will take a map argument and execute an http call from it. The client gets to pick the HTTP method. So it could be a get or a post. Should the method’s name end with !?
12:04bbloomvirmundi: no not really
12:04bbloomvirmundi: ! does not mean side effectful
12:04bbloomotherwise entire subsections of your library would have bang on everything
12:04justin_smithdo you literally mean a method? Clojure functions are objects.
12:05virmundijustin_smith: I mean function. I try to avoid the OO side of the underlying host. Old terms for a different pardigm and all.
12:05virmundiso the api has create-database!
12:05CookedGryphonthe basic rule of thumb is, could you put it in a swap! statement
12:05CookedGryphoni.e. would it matter if it got executed 3 times over instead of one?
12:06CookedGryphonif it would matter, put a bang on it to warn other people
12:06TimMcmeh
12:06TimMcI appreciate the thoroughness, but I think that's impractical.
12:06bbloomi probably wouldn't put a ! on create-database
12:06bbloomespecially if it's idempotent
12:07virmundibbloom: since it’s a rest call, the results will change. So POST first time, returns 201. POST a second time on the resource returns a 409 (I think, I just remember not 201).
12:08bbloomvirmundi: just use ! to highlight a rare non-transaction-safe method among an otherwise transaction-safe api
12:08bbloomvirmundi: if everything is effectful, then nothing is special enough to justify a !
12:09teslanickWhat is the actual standard for using ! anyway? I usually use it as a "be careful" or a "this is *really* impure" signifier
12:09teslanicki.e. non-idempotent.
12:09justin_smith&(filter #(re-matches #".*!$" %) (map (comp name first) (ns-publics 'clojure.core)))
12:09justin_smithno lazybot?
12:09justin_smith,(filter #(re-matches #".*!$" %) (map (comp name first) (ns-publics 'clojure.core)))
12:09virmundibbloom: I thought that. Things get even weirder if the client uses the async feature of the driver, because that creates a resource for later lookup.
12:09clojurebot("set-error-mode!" "set-agent-send-executor!" "disj!" "conj!" "pop!" ...)
12:09lazybotjava.lang.SecurityException: You tripped the alarm! ns-publics is bad!
12:10mpenet,(doc pop!)
12:10clojurebot"([coll]); Removes the last item from a transient vector. If the collection is empty, throws an exception. Returns coll"
12:10mpenetah transient
12:11bbloom(doc persistent)
12:11clojurebotHuh?
12:11bbloom(doc persistent!)
12:11clojurebot"([coll]); Returns a new, persistent version of the transient collection, in constant time. The transient collection cannot be used after this call, any such use will throw an exception."
12:11bbloomthe bang doesn't have a firm meaning
12:12virmundithe thing that made me wonder about the ! is that clojure.java.jdbc has insert! and execute! where as query is normal.
12:12bbloomit can be effectful, or non-idempotent, or dangerous, or whatever
12:12bbloomit's just to make it stand out when such an effect may not be expected
12:12bbloomvirmundi: use your discretion
12:12virmundiSounds fair. I appreciate the advice from all involved.
12:13stuartsierraThere's no universal rule for `!` but it sometimes means "modifies mutable state", e.g. `swap!`
12:13bbloom(doc alter) ; stuartsierra
12:13clojurebot"([ref fun & args]); Must be called in a transaction. Sets the in-transaction-value of ref to: (apply fun in-transaction-value-of-ref args) and returns the in-transaction-value of ref."
12:13bbloomreally, it means "pay attention, dummy" :-)
12:13virmundi:)
12:14justin_smithsorry guys, I got a massive lag suddenly
12:14justin_smithvirmundi: in that case, (regarding avoiding the OO side of the underlying host), a function is self contained, a method belongs to some object
12:15virmundijustin_smith: I’m know. I’m jst not using precise language. Method is a hold over from the Java days. I first developed in VB so it took me a while to say method rather that function or sub.
12:15stuartsierrabbloom: like I said, not universal, also 'alter-var-root'
12:16virmundijustin_smith:I’ll try to be more precise.
12:17justin_smithnp - not trying to be pedantic, when I first saw your question I really didn't know if you were talking about a normal function or an object made via perhaps gen-class with a method on it
12:18justin_smithand of course I use the relatively imprecise term "function" when really I mean "object implementing IFn"
12:18noncomare bitwise operations like (bit-shift-left), (bit-and) and the likes on ints in Clojure as fast as in Java ? or do we pay for some boxing and stuff ?
12:18noncomdo i better do bitwise stuff in java ?
12:18noncomif i care for speed..
12:18justin_smithnoncom: depends on how well things are hinted and / or hotspot compiled
12:19noncomuh..
12:19justin_smithnoncom: there is a library that warns about numeric boxing and reflection... one moment
12:23justin_smithnoncom: ztellman/primative-math provides reflection and boxing warnings (normal warn-on-reflection won't actually show this) https://github.com/ztellman/primitive-math
12:24noncomthanks :)
12:24justin_smithif you aren't boxing or reflecting, and you turn on *unchecked-math*, the numeric part of your code should be competitive with java
12:25noncomi still have to master all this..
12:26stuartsierraJust write Java.
12:26noncom:)
12:28technomancyshell out to bc
12:31rhg135inlime assembly 2.0
12:31rhg135inline*
12:32justin_smithcreate a REST service to do arithmetic, implemented in fortran
12:32rhg135whoa
13:04bridgethillyerIt’s an interesting aspect of the Clojure ecosystem that it lives in the Java world
13:04bridgethillyerAnd I often wonder about the experience of people who are coming to Clojure with no Java experience
13:04justin_smithbridgethillyer: that was me - I had lisp experience but no java experience
13:05bridgethillyerSome things must be Totally Mysterious to them, and my guess is that is not a very comfortable experience
13:05technomancysame
13:05bridgethillyerAnd I just had an ah-hah! lightbulb moment about this
13:05justin_smithjava is tedious, but not that surprising (most of the time)
13:05nopromptwhy doesn't metadata for clojurescript namespaces get added to *cljs-ns*? https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/analyzer.clj#L1134-L1135
13:05bridgethillyerI am a {retired? reformed? defeated?} java programmer
13:05technomancythe main thing that confused me early on was the JDK's IO stuff
13:05technomancybut that was before clojure.java.io existed
13:06bridgethillyerSo I have a LOT of experience with Maven
13:06justin_smithsimilar to man pages, javadoc is terrible to read, but once you learn how you can get the info you need quickly
13:06bridgethillyerBut if you are not a Java programmer, likely you have little experience with Maven
13:06mdrogalisMaven will steal your lunch money. :/
13:06noprompti probably should have aimed that at dnolen_ or bbloom
13:06bridgethillyerSo here’s a tidbit of Maven know-how that comes in handy:
13:07bridgethillyerReleases you just *get* with leiningen
13:07bridgethillyerVoila they magically appear
13:07aperiodictechnomancy: do you know when the stack overflow on dependency resolution issue started?
13:08bridgethillyerBut SNAPSHOTS you actually have to go get yourself or add Sonatype repository
13:08technomancyaperiodic: AFAIK it's been around forever, but :pedantic? just got turned on by default in 2.4.3
13:09bridgethillyerSo if your library is unreleased, someone is going to be totally mystified why it’s not there when they try to require it
13:09aperiodictechnomancy: ok, so can it be worked around by turning pedantic off?
13:09technomancyaperiodic: I think so
13:09technomancyaperiodic: if not, try master and let me know
13:10mdrogalisbridgethillyer: Yeah, it's mildly infuriating. D:
13:10technomancybridgethillyer: that's not any different from ruby
13:10bridgethillyerAnyhow, just found it interesting to actually uncover one of those weirdnesses about the non-Java experience. Generally I wouldn’t see them since I don’t have the perspective
13:10aperiodictechnomancy: it's definitely fixed in master, I just misunderstood when you said it was a 2.4.3 issue yesterday (since my colleague just reproduced on 2.3.4)
13:11bridgethillyertechnomancy: Well, it’s helpful to be aware of it
13:11technomancyaperiodic: gotcha, cool
13:11technomancybridgethillyer: actually now I'm curious... in what language do you get access to unreleased libs without asking for them specifically?
13:11technomancyI guess you mean in systems that work from git directly?
13:11bridgethillyertechnomancy: If you’re aware of it, you can do things to help orient non-Java people (assuming they are a big enough population to serve that way… I assume they are)
13:12technomancybridgethillyer: I'm skeptical this has anything to do with java/non-java
13:13bridgethillyertechnomancy: fair point; I guess it’s more that you don’t know *how* it happens because the machinery is specific to Java
13:13justin_smithmy big surprise when I was new to clojure: the fact that you didn't install things via some analog of git clone, configure, make, make install
13:13bridgethillyertechnomancy: So it is mysterious and difficult to diagnose/see
13:13rhg135juarez, thats just c(++)
13:14rhg135damn tab
13:14bridgethillyertechnomancy: I’m not suggesting that anything that is happening is the wrong way to do it
13:14rhg135i can never get used to a chan with so many ppl
13:14rhg135justin_smith***
13:14bridgethillyertechnomancy: I’m pointing out the user experience of it
13:15technomancybridgethillyer: sure, it's always difficult to see things from the perspective of someone new.
13:16bridgethillyertechnomancy: *exactly* and that is what I was able to experience
13:16technomancybridgethillyer: that said, most snapshots are on clojars; contrib libs seem to like going out of their way to make things more complicated.
13:16justin_smithit's not just c - many languages have clone / build / install for libs (at least for the core language - this includes all the versions of common lisp and scheme I know of, ocaml, haskell...)
13:16bbloomnoprompt: namespaces are not reified at runtime, so there's no way to get to the metadata from cljs
13:16bbloomnoprompt: do you need it form a macro?
13:16bridgethillyertechnomancy: yes, exactly… which makes for an even more mysterious experience
13:16bblooms/form/from
13:16nopromptbbloom: yep. it's the macro use case.
13:16technomancyjustin_smith: that's just legacy ocaml stuff; these days everything is done from opam. IIUC the same is true of haskell/cabal.
13:16bbloomnoprompt: in that case, it's probably just an oversight. i can't speak for dnolen_, but i'd say patch is likely welcome
13:16technomancyjustin_smith: also CL has quicklisp now, racket has had packages forever, chicken has eggs...
13:17bridgethillyerSo I think the lesson to be taken away for library (cough contrib) authors is: if your library is unreleased, just go ahead and put this in your README:
13:17justin_smithtechnomancy: but for getting ocaml itself
13:17technomancyjustin_smith: opam manages compiler installs too
13:17justin_smithtechnomancy: what was new is the language itself being managed by the package manager
13:17bridgethillyerTo use Clojure and contrib library SNAPSHOTS in your Leiningen project, add the following to your project.clj: :repositories {“sonatype…
13:17bbloomnoprompt: just add the metadata as :meta here: https://github.com/clojure/clojurescript/blob/245de2e752f638f5d06527a1cafed26b0d8d0da8/src/clj/cljs/analyzer.clj#L1166
13:17bridgethillyerSo easy, makes things much easier for a set of your users
13:17justin_smithtechnomancy: and somehow I managed to be ignorant of the various language package managers for the most part
13:18rhg135those exist??
13:18lazybotrhg135: Uh, no. Why would you even ask?
13:18aperiodictechnomancy: FYI turning pedantic off does work around the stack overflow
13:18rhg135shut up lazybot lol
13:19nopromptbbloom: awesome. i'll work up a patch.
13:20nopromptthanks.
13:20technomancyman, rebar. =(
13:20justin_smithtechnomancy: regardless of my relative ignorance, I was used to a paradigm where to try a language I could find the source, configure make and install, and then run it, without also needing to figure out a language specific dep management tool or packaging system or construct a "project", and this was my biggest surprise as a newcomer to clojure
13:21technomancyI unknowningly pulled in a patch that changed the dependencies, and suddenly I got test failures due to needing a newer version that I had no idea about. no dep updates, no warning, nothing.
13:21technomancyjustin_smith: ah, gotcha
13:23justin_smithwhen my friend told me I had to download a shell script that downloaded another shell script and executed it and that was the right way to do clojure I was like "WTF YO"
13:24dnolen_noprompt: missing the backlog what's up?
13:25nopromptdnolen_: i was asking about metadata for *cljs-ns*. apparently it never gets used. for macro use cases that metadata is useful.
13:25dnolen_noprompt: what kind of metadata?
13:25nopromptdnolen_: namespace metadata.
13:26dnolen_noprompt: yes I never use this - what goes there that's missing?
13:27nopromptdnolen_: i'm writing a macro and i was hoping that i could read that metadata from *cljs-ns* but the only information that's there is :line, :column, etc.
13:27dnolen_noprompt: but what else is supposed to be there? I'm asking you a question because I don't know, hint, hint :)
13:28bbloomdnolen_: you can put arbitrary metadata on namespaces
13:28bbloom,(meta (the-ns 'clojure.core))
13:28clojurebot{:doc "Fundamental library of the Clojure language"}
13:29bbloom,(ns ^:omg my-ns)
13:29clojurebotnil
13:29bbloom,(meta (the-ns 'my-ns))
13:29clojurebot{:omg true}
13:29dnolen_ah right, yeah patch welcome that's an easy one
13:30nopromptdnolen_: cool, bbloom mentioned placing it here: https://github.com/clojure/clojurescript/blob/245de2e752f638f5d06527a1cafed26b0d8d0da8/src/clj/cljs/analyzer.clj#L1166
13:30dnolen_noprompt: you probably want to put it here https://github.com/clojure/clojurescript/blob/245de2e752f638f5d06527a1cafed26b0d8d0da8/src/clj/cljs/analyzer.clj#L1160
13:30dnolen_and we can dupe it into the analysis map as well
13:31nopromptdnolen_: cool, initially that's where i thought it might go.
13:32nopromptdnolen_: alrighty, well i'll work up a patch. fortunately i work with someone who knows the whole jira process (which i've been neglecting to learn). this'll get my feet wet.
13:32nopromptdnolen_, bbloom: thanks for the help. :)
13:32mindbender1where the issue tracker for org.clojure-andriod/clojure?
13:33mindbender1is the same for org.clojure/clojure?
13:39toxmeisterclojars currently gives HTTP 500 (not sure if that's the best place to mention here...)
13:40loliveirahi, congomongo or monger?
13:41Bronsatoxmeister: it's a known issue with the homepage: https://github.com/ato/clojars-web/issues/235
13:43toxmeisterbronsa: thx, it seems deploys are broken too… getting checksum failures. was going to double check my uploaded keys, but that will have to wait until the UI is fixed again
13:43arrdemloliveira: whichever, they both work fine
13:45loliveiraarrdem: thank you. I will try monger. I’ve been using congomongo since forever and I ‘m wondering if I’d like monger.
13:46arrdemloliveira: I've used congomongo a before, just looked at monger and it doesn't look fundamentally different.
13:47justin_smith~mongodb
13:47clojurebotmongodb is an ORM for mmap
13:47schmeecan `^:const` be used with arrays, like this? (def ^:const foo [6 3 0 7 4 1 8 5 2])
13:47loliveiraarrdem: ty
13:48schmeeI read the it only works with "primitive values", but I'm unsure of what that means
13:48justin_smithschmee: primitives are things in the jvm that are not objects
13:48schmeeahh, so int bool and the likes. I guess that const does nothing for arrays then?
13:48justin_smithhttp://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
13:49justin_smithright, an array is an object (as are vectors, and your example was a vector, not an array)
13:50schmeeyeah, I always mix up vectors and arrays, using many different programming languages certainly doesn't help :P
13:50schmeethanks for the info
13:50justin_smithschmee: though I think :const can actually help on vars for non-primitive values, but Bronsa or arrdem would be better people to ask about the ins and outs of that
13:51arrdemBronsa will know better than I do. I remember playing around with ^:const a while back and there is a bytecode difference in evaluating const tagged symbols but I don't think it's significant.
13:52arrdems/symbols/vars/g ;; arguably pedantic
13:53schmeeok, I think I'll leave them out in that case
13:56Bronsaschmee: ^:const can be used with anything that has a clojure literal representation, but there are some issues; the only thing I'd feel safe using ^:const with are: numbers, strings and keywords
13:58alexbaranosky_Bronsa: curious what the issues are
14:06Bronsaalexbaranosky metadata might or might not be preserved
14:07alexbaranosky_Bronsa: thx
14:09toxmeisterbronsa: I actually just chased a bug in related to ^:const attached to deftype instances a few hours ago. it behaved all fine until i started implementing a hash cache mechanism using mutable fields. then suddenly got completely weird compiler errors about missing field names. removing ^:const from some of the "const" preset instances, removed the issue...
14:10Bronsayeah, don't use ^:const for deftypes
14:11hiredmandon't use :const
14:11hiredmantoxmeister: why are you using :const at all?
14:11Bronsahiredman: that's a bit too much :), it's perfectly fine for numbers/strings/keywords
14:12hiredmanBronsa: but doesn't throw an error or warning for anything else
14:12alexbaranosky_what spots does the perf benefit of const really add up to anything substantial enough to matter?
14:12Bronsaright, it just explodes in your face later
14:13hiredmanwill be better off having maintainable code that doesn't use it
14:13Bronsaalexbaranosky_ (def ^:const x 23), you can use x as a primitive
14:14hiredmanalexbaranosky_: I am sure there are cases where it matters, I suspect the majority of (ab)use is people who sprinkle it on as magic pixy dust
14:16toxmeisterhiredman: i read somewhere (ages ago) that it would provide some minor perf difference, but I learned since that this doesn't make much sense for non-primitives
14:17hiredmanwell, there is a data point
14:18hiredman(I am counting that as one for magic pixy dust)
14:19alexbaranosky_pixie dust driven development
14:22chenglouwhat's a good beginner clojure/clojurescript rss feed to follow?
14:23hiredman /win 19
14:25kqrI don't know who I talked to before, but I've tried the java interop a little more now and I'm really starting to like it
14:26kqrit was just unfamiliarity talking before when I was unsure about how good it was
14:27samfloresquick survey: which one is more readable (or idiomatic)? https://gist.github.com/samflores/2c68a9bcb6b4742d6760
14:28kqrsamflores, for so few function calls, 1 works
14:28kqrsamflores, otherwise 3
14:29amalloysamflores: i like 3. but i'd surround the chained calls with parens, like (display-board!). i don't like that those are optional
14:29loliveirasamflores: 3, but i liked 4
14:29amalloyi definitely hate 2. 10 is a bad place to start the arrow
14:29kqrI agree with amalloy on that
14:29alexbaranosky_i do 3
14:30Jaoodindent 1 :P
14:30arrdemM-x cljr-thread-first-all RET :P
14:30amalloykqr: on which? hating 2, or using parens?
14:30alexbaranosky_or indented 1
14:30kqramalloy, I was about to say "the former" but you made it tricky by exchanging the order of them
14:31amalloyhaha
14:31kqramalloy, hating 2
14:31amalloyi try to make your answers to my questions as ambiguous as possible so i can pick which stance i think you're taking
14:31kqrthat's a good strategy
14:32kqrI don't mind the no parens... with parens it looks more like actual function calls
14:32kqrlike, fully saturated with arguments and all
14:32Jaoodthis wins: https://www.refheap.com/89513
14:32kqrwhich is probably not the intention
14:32kqrJaood, i think so too for so few levels of nesting
14:37amalloykqr, Jaood: http://stackoverflow.com/a/12716708/625403 is a summary of my oft-linked-to stance on how to use ->
14:37amalloyobviously you don't have to agree, but it's a useful viewpoint to be aware of
14:39samfloresgood point
14:40elbenis there an easy way of pasting in strings with double-quotes into the REPL? e.g. my copy buffer is ‘“hello”’ and I want (def s “\”hello\””)
14:40SagiCZ1and know i know what amalloy looks like
14:40SagiCZ1*now i know
14:41justin_smithelben: in a naked repl or in an editor?
14:41elbennaked, though i also use vim-fireplace
14:41amalloySagiCZ1: well, you know what i looked like when i took my gravatar picture like...four years ago
14:42amalloyelben: not really
14:42justin_smithelben: if you put your paste in a temporary file, slurp should get you the right result
14:42SagiCZ1amalloy: i bet u look completely different now
14:43technomancyelben: step 1: don't use smart quotes. =)
14:43justin_smithbonus points: make a small shell script that takes the paste buffer, puts it in a temp file, then puts the path to the temp file in the paste buffer
14:43elbentechnomancy: that’s just my IRC client :)
14:43amalloytechnomancy: or *do* use smart quotes, and then pasting them mid-string won't be an issue
14:43amalloynext-level thinking here
14:44elbeni really do like python’s triple-quote, though. wonder if http://dev.clojure.org/display/design/Alternate+string+quote+syntaxes is going anywhere
14:44amalloyelben: no, it's not
14:44TimMcI have an utterly terrible answer for you.
14:44technomancyamalloy: brilliant
14:44TimMcAre you ready?
14:44technomancyI would really love to have «guillemot» support work like triplequoting in python though
14:45TimMc(def input (javax.swing.JOptionPane/showInputDialog "paste it"))
14:45kqrhahaha
14:45kqrthat's actually not a bad answer
14:45TimMcTerrible, but practical.
14:45amalloyTimMc: well, i was considering suggesting (read-line)
14:45TimMcI don't know if it handles multiline.
14:45arrdem(def foo (slurp (io/resource "docs/user/foo")) ...)
14:45amalloyrich's opinion, i believe, is that you shouldn't be embedding wacky strings in your source code - anything weird you need should be in a resource file anyway, and as a side effect it then doesn't matter if it has " in it
14:46amalloyarrdem: justin_smith suggested that first
14:46rhg135what's wrong with ctrl-v assuming your term is nice
14:46elbenTimMc: amazing
14:46justin_smithrhg135: you don't get proper escaping
14:46rhg135ah
14:46rhg135justin_smith, im with rich/amalloy
14:46elbenamalloy: the common use case i have everyday is working with JSON  in the repl
14:46rhg135keep it elsewhere
14:47amalloythe problem with TimMc's suggestion is that anyone who uses it on macos will be like "argh there's a dang system tray icon for my java process now"
14:47justin_smithrhg135: my answer also involved putting the wacky string in a file first
14:47technomancythere should be an M-x clojure-escape-yank though in elisp
14:47justin_smithtechnomancy: string-edit-at-point is handy, and works recursively
14:47technomancynice
14:47TimMcamalloy: read-line would interact badly with the REPL, yeah?
14:48justin_smithcomes with the string-edit package
14:48amalloyTimMc: if you have a lame repl
14:48TimMcshots fired
14:48arrdemamalloy: oh that wasn't apparent to me.
14:48amalloy(as, for example, i do)
14:48amalloybut it works fine in lein repl, for example
14:48amalloywhich is what he was asking about
14:48TimMc(defn lame? [repl] (not= repl dr-racket))
14:49kqrwhat's the difference between when-let, if-let and if-some?
14:49amalloyTimMc: (def lame? (complement #{dr-racket}))
14:50justin_smithkqr: when-let has no else clause
14:50kqri see
14:50justin_smithand if-some doesn't exist in my currently open repl, dunno what it is
14:50justin_smith(doc if-some)
14:50clojurebot"([bindings then] [bindings then else & oldform]); bindings => binding-form test If test is not nil, evaluates then with binding-form bound to the value of test, if not, yields else"
14:50kqrnew in 1.6 apparently
14:51amalloyTimMc: you know what's cool about my repl, though? (swank.core/read-from-emacs-minibuffer "What is your name? ")
14:51justin_smithkqr: looks like it replaces (if-let [foo bar] (let [...])) by letting you put other bindings after the conditional one
14:51technomancyamalloy: nrepl-discover has that
14:52kqrjustin_smith, where do you gather that?
14:52technomancyexcept hypothetically-portable
14:52kqrit's not obvious from the documentation i've found
14:52amalloytechnomancy: does nrepl-discover actually get used? i never hear anyone but you talk about it
14:52kqrthough i'm still new so I might be missing something obvious
14:52amalloybut i don't know about the ecosystem
14:52justin_smithkqr: never mind, I was misled by the name "bindings"
14:52kqrah
14:53technomancyamalloy: I keep mentioning it in hopes that someone who actually still uses clojure will realize how cool it is
14:53kqrjustin_smith, it looks like when-some tests for (not (nil? p))
14:53kqrjustin_smith, while let-if tests for true
14:53kqrjustin_smith, possibly
14:54TimMcelben: (def input (clojure.string/join \newline (take-while (complement empty?) (repeatedly read-line)))) will do multiline input, stopping at the first empty line.
14:55TimMcFrom standard lein repl, that is.
14:57hlprmnkynewbie question time
14:58hlprmnkyI have required core.async like so in my ns decl: [clojure.core.async :as async]
14:58elbenTimMC, interestingly that only allows 1024 chars to be pasted in at a time?
14:58hlprmnkyyet when I run a repl in that namespace, things like merge are clojure.core.async/merge, not clojure.core.merge as I would expect
14:58Jaoodtechnomancy: was that phrase a pun? re:"someone who actually still uses clojure"
14:59technomancyJaood: not intentionally?
14:59amalloyhlprmnky: did you actually :require it, or did you :use it?
14:59hlprmnky(e.g., (doc merge) returns the docstring for async/merge, not core/merge, and (merge {} {:a “foo”}) returns a channel, or dies because it can’t merge a keyword
14:59Jaoodtechnomancy: :)
14:59hlprmnkyamalloy, I don’t have a :use block for any of my namespaces
15:00amalloymmmm. paste your ns form then, i guess
15:00amalloytechnomancy: king of puns so subtle even he doesn't get them
15:00amalloy(i don't either)
15:00hiredmanhlprmnky: you are likely using :use insteaad of :require
15:01hiredmanoh
15:01hiredmanI see that was already said
15:01hlprmnkyoh haha
15:01hiredman(old repl)
15:01hlprmnkyno, but I am doing something equally dumb
15:01amalloyah, or an old repl, sure
15:01justin_smithkqr: frankly, I can't make if-some do anything if-let would not do
15:01amalloyjustin_smith: try (if-some [x false] true false)
15:01amalloyvs if-let
15:01justin_smith,(if-some [a false] :yes :no)
15:01clojurebot:yes
15:01justin_smithahh
15:01justin_smiththere we go
15:02hlprmnkyno but I do still have (:refer-clojure :exclude [map reduce into …etc.]) from before I decided that I wanted the core available and async off to the side
15:02hlprmnkyamalloy: thanks for asking me to paste the ns and therefore inducing me to *actually read the whole thing again*
15:02hiredmanthat in no way explains why you would get core.asyncs merge instead of clojure cores
15:03kqris there anyone here who uses vim and can recommend something to edit expressions?
15:04hlprmnkyif I have excluded merge in that statement, and then :require [clojure.core.async :refer :all :as async], what would the expected value of ‘merge’ be?
15:04Jaoodkqr: evil-mode :P
15:05arrdemhlprmnky: :as async will create async/* bindings, :refer :all will refer all symbols from core.async with no prefixes
15:05kqrJaood, that's just evil
15:05hlprmnkyThe whole reason I decided to move to having :as async in there was that I didn’t fully understand what :refer-clojure was doing and made the conscious choice to not muck with it now
15:05hlprmnkyarrdem: Ah! (also: d’oh)
15:05hiredmanhlprmnky: :refer :all is the same as :use basically
15:05amalloyhlprmnky: :refer :all! you left out the key point
15:06hlprmnkyI did
15:06rhg135kqr, paredit.vim
15:06hlprmnkyI need to go reread that 8th light blog post about how to know what on earth I am doing with use, require, etc.
15:06rhg135that's what i used
15:07Venkqr: evil-mode and slime :P
15:07amalloyc'mon you guys, vim has fine clojure tooling. you don't have to switch to emacs
15:07caternyes you do
15:07caternswitch to emacs
15:07amalloyask tpope or Raynes or something, those being the two vimmers i can think of at this moment
15:08technomancyno, emacs is ridiculous
15:08hlprmnkyI was doing it right in <project>.core (just [clojure.core.async :as async], calls to (async/*)), doing it wrong in <project>.system, which hilariously over time has lost all its uses of async as I refactored stuff into functions in core
15:08caternat least it's not vim, regards ex-vim-user
15:08kqrrhg135, hm I also heard about another one that was supposedly better, but I can't for the life of me remember the name
15:09justin_smithkqr: I assume you are using fireplace?
15:09rhg135amalloy, no lighttable
15:09rhg135i USED to use vim
15:10virmundiI use to use Light Table, now I use vim
15:10kqrjustin_smith, not yet, but that's in the pipes as well
15:10virmundiLT takes 1 gb of ram.
15:10aperiodickqr: http://www.vim.org/scripts/script.php?script_id=3998
15:10amalloyrhg135: i don't know what i've said that you're disagreeing with? i don't think i addressed you, or said anything about what editor you're using
15:10rhg135i have a 3tb hdd
15:10rhg135if i needed more i could swap
15:11rhg135im not disagreeing
15:11rhg135vim was nice and i use it when i don't have x for lt
15:12kqrah
15:12kqrthe other alternative is vim-sexp
15:13kqrwhich is apparently made with clojure in mind
15:13kqrI don't know if paredit is
15:14schmeekqr: vim-surround gets the job done
15:14aperiodicparedit.vim is aware of clojure but not made only for clojure
15:14schmeehttps://github.com/tpope/vim-surround
15:15schmeekqr: + a whole lot of {command}ab and %{command}
15:18TimMccatern: Don't tell other people to switch editors just because you didn't like it. That's absurd.
15:19aperiodickqr: if vim-sexp treats quotes exactly like parens and square braces, and supports the majority of the operations that paredit.vim does, let me know!
15:20caternTimMc: huh? I just have their best interests at heart, I was a diehard vim user for a long time
15:20aperiodickqr: my main gripe with paredit.vim is it'll let you wrap quotes but not strip them
15:20kqraperiodic, isn't that what you have vim-surround for?
15:21technomancyswitching to emacs at the same time you're learning clojure is a pretty good way to get frustrated and give up.
15:21aperiodickqr: yeah, I should probably get that
15:21alloyedaperiodic: vim-sexp will wrap quotes as you'd expect, not sure about stripping because I always use vim-surround instead
15:21brainproxy_technomancy: it's not *that* bad
15:21alloyedusing tpopes mappings for vim-sexp make them feel like two sides of the same coin
15:23TimMcbrainproxy_: I agree with technomancy from personal experience on this.
15:23TimMcLearning a new language and a new, powerful editor at the same time is just asking for sadness.
15:23kqrhaha
15:23kqreither way
15:23kqrI've tried emacs for a few months
15:23amalloyTimMc: i learned them both at the same time and had fun with it, but i wouldn't recommend it as a strategy. certainly not to someone who specifically asked for help with a different editor
15:23kqrand I'd really like to like it
15:23TimMc*Especially* if you try to use integration features like SLIME.
15:23kqrbut it's just not for me
15:23emaphisnotepad and clojure is sadness too.
15:24danielszmulewiczEmacs is for life. Clojure, who knows?
15:24kqrI didn't even know editor wars were still a thing
15:24TimMckqr: Some people are still fighting that war. It's like those Japanese soldiers on the islands after WWII.
15:25rpaulothere's just one war
15:25rpauloemacs vs vi{,m}
15:25amalloydon't forget bash vs everyone else, since you had to bring in {,m}
15:26amalloy(obviously not an editor, but pretty similar kinds of wars)
15:26rhg135just use vim if you know it, emacs if you know it, or lt if you know neither
15:26justin_smithdoes anyone seriously defend vi[^m]* ? I prever non-vim vi, but I am only a casual vi user
15:26amalloybut i agree the editor wars are silly. use what you know, and always learn more things
15:27TimMcjustin_smith: Such as vixjohyvwaw?
15:27amalloyTimMc: visudo
15:27TimMcah, ok
15:27justin_smithTimMc: nvi, elvis, plain vi
15:27rhg135visudo actually calls EDITOR
15:28justin_smithvim overrides things like ## and ~ which I acutally like to use when doing a quick config file edit
15:28rhg135gentoo sets it to nano by default xD
15:28danielszmulewiczWhat is the editor that hipsters want to be seen with?
15:28justin_smithrhg135: so does debian
15:28rhg135D:
15:29rhg135it's a virus
15:29rhg135or plague
15:29rhg135to be less ambigous
15:29aztakdanielszmulewicz: it used to be Atom, right?
15:29justin_smithdanielszmulewicz: vintage TECO
15:29danielszmulewiczhaha.
15:29justin_smithit's the heavy vinyl pressing of the editor world
15:30TimMcrhg135: Confirmed: https://en.wikipedia.org/wiki/Nanoviridae
15:30emaphishipsters use ed
15:30rhg135i was joking...
15:30rhg135but wow ik it!
15:30aztakhehe... about editors: https://www.kickstarter.com/projects/1203633826/notepad-conf
15:31kqrhaha
15:32kqrall I can think of is how notepad fails badly when it comes to LF line endings
15:32justin_smithI actually logged into and tried the vms system hosted by sdf, and used TECO just to see what it would be like
15:32emaphiswow, $171, it's a thing.
15:32justin_smithI actually liked the vms versioning system (but hated the shell)
15:33rhg135i hope it's a joke
15:33nopromptbbloom, dnolen_: i'm trying to write a test for the patch we talked about earlier but i run in to an error: IllegalStateException Can't change/establish root binding of: *cljs-ns* with set clojure.lang.Var.set (Var.java:221)
15:33bbloom,(def x 1)
15:33clojurebot#'sandbox/x
15:33bbloom,(set! x 2)
15:33clojurebot#<IllegalStateException java.lang.IllegalStateException: Can't change/establish root binding of: x with set>
15:34bbloom,(alter-var-root #'x inc)
15:34clojurebot2
15:34bbloom,x
15:34clojurebot2
15:34bbloomnoprompt: ^^
15:34nopromptbbloom: so should i patch the analyzer to use alter-var-root instead of set!
15:34bbloomnoprompt: i have no idea. depends on what it's using set! for
15:34noprompt*cljs-ns* is a dynvar so it seems like alter-var-root is a bad idea.
15:35dnolen_noprompt: no
15:35dnolen_noprompt: we use set! just fine it's dynvar
15:36dnolen_noprompt: do you have the patch somewhere? or a gist?
15:36TimMcBy the way, this is the editor I used to transition to writing Clojure: http://www.prodevtips.com/2010/05/03/my-clojure-editor/
15:36nopromptdnolen_: right. from the doc on set! that makes sense. i guess what i'm asking is is there anything else i need to do when trying to analyze the ns form in the repl.
15:36hiredmanlikely you are doing some lazily and it is escaping the scope of the binding
15:36danielszmulewicznoprompt: Currently, it is an error to attempt to set the root binding of a var using set!, i.e. var assignments are thread-local.
15:36nopromptdnolen_: cljs.analyzer-tests> (a/analyze ns-env '(ns foo {:baz "woz"}))
15:36TimMcIt's fragile and low on features, but it is sexp-aware and that's just what I needed to make the jump.
15:36dnolen_noprompt: so you need to establish a binding around that first
15:37nopromptdnolen_: doh.
15:38bridgethillyerhlprmnky: I had that exact problem this morning
15:39arrdemhttps://github.com/clojure/clojure/pull/17#issuecomment-53628365 hooboy
15:40justin_smitharrdem: razum2um1 is the same person who considers the lack of ubiquitous usage of ansi colors in clojure output to be a usability bug
15:40razum2um1yep
15:40joegallo'oh man, what a beautiful hornet's nest this is that i have come across. i shall kick it heartily!'
15:41caterngit send-email/git format-patch should be mandatory in all git tutorials
15:41bridgethillyerhlprmnky: Or, rather, no, misreading your question
15:41caternalternatively, github shouldn't be so lame and use its own proprietary method for pull requests
15:41caternshould stop being so lame and should stop using its own*
15:41bridgethillyerhlprmnky: There is a merge, also, in Clojure core
15:42danielszmulewiczTimMc: If you ever want to make the jump: https://github.com/pierre-lecocq/emacs4developers
15:42campetersonHey all, got a question about fn args.
15:42joegalloyou may ask it
15:42campeterson:)
15:43campetersonThe function takes a keyword as the first arg, and n vectors
15:43campetersonI want to programatically build the "arg" and send it in
15:43justin_smithcampeterson: sounds like you may want apply
15:44joegallo(apply your-fn the-keyword seq-of-the-vectors)
15:44rhg135,(apply + 1 [1 2 3])
15:44clojurebot7
15:44rhg135thank you mr. bot
15:44campetersonAh, I think that might do it
15:45danielszmulewiczPlease someone help me put an end to my misery: I'm trying to retract a fact in datomic that involve a ref, and I can't wrap my head around it. In my schema, I have :video/user, it's a ref with cardinality many. I want to remove the link of that particular video with a particular user. I've tried this: (d/transact conn [[:db/retract 17592186045835 :video/user 17592186045424]]) where the first id is the id of the video, and the second
15:45danielszmulewiczthe id of the user. This is wrong, apparently.
15:45schmeeam I correct in thinking that `apply` is basically argument unpacking ala Python?
15:45joegalloi don't know python, but, uhhhh... probably.
15:45danielszmulewiczschmee: same here. but yes.
15:46joegalloyeah, it looks sortof similar
15:46rhg135yes it is schmee
15:46schmeenice, that'll be handy!
15:46rhg135except it's only on the last arg to apply
15:47lemonodorfoo(x, y, *z) in python is basically (apply foo x y z) in clojure.
15:48schmeeI was converting some old Python code I wrote to clojure yesterday, and by god Python looks horrible when you've gotten used to clojure
15:48schmeeeverything is so... inconsistent
15:48campetersonjoegallo: so, say I don't need to apply a function, but I have my keyword and my seq-of-the-vectors
15:48rhg135yup
15:49joegallookay, you've got your keyword and the seq-of-the-vectors... what of them?
15:50campetersonIn need to build "args" and pass it into the function
15:50joegallothe way to do that is with apply
15:51SagiCZ1hey how do i watch this video? cant find any play button http://www.infoq.com/presentations/Value-Identity-State-Rich-Hickey
15:51joegallothere is no (my-fn n-arguments-that-have-been-prepacked). there's only (apply mf-fn n-arguments-that-have-been-prepacked)
15:51razum2um1justin_smith: btw, it's not only me, see there is already some progress :) https://github.com/AvisoNovate/pretty but I didn't mentioned it has to be in the core, no. but there should be some way to get newbie-freindly REPL. imagine you're life without readline library inside bash/other shell-or-repl?
15:52SagiCZ1schmee: python does look horrible and i have never thought different.. even java looks better
15:52danielszmulewiczIs there any blog post/ tutorial about retracting facts in datomic?
15:52joegalloor maybe you haven't fully conveyed the situation to me, campeterson
15:52nullptrSagiCZ1: you might need to install flash
15:53campetersonjoegallo: yeah, sorry
15:53TimMcdanielszmulewicz: Oh, I already made the jump; I'm using a big-boy text editor now.
15:53danielszmulewiczTimMc: Oh, I must have misread. All Good.
15:53SagiCZ1nullptr: yeah it was flash.. works in IE
15:54campetersonjoegallo: the light just came on
15:55joegalloexcellent! http://xkcd.com/224/
15:55TimMcHowever, this might be good to skim through.
15:56campetersonjoegallo: yeah, stupid rookie mistake. but I see it now. Apply take the function you want the args to go to, then the args
15:57joegalloexactly
15:57kqrwoo! i *finally* have reason to write my first macro
15:57campetersonjoegallo: thanks again
15:57danielszmulewiczYou know, people, for a dummy like me, Clojure has been a boon. Suddenly I could write web applications with minimum effort, and I went on to master every piece in the so-called "immutable stack". I'm writing 100% Clojure for a year now. There's only one piece of the stack that eludes me, and that is datomic. I get the concept of facts accretion, but it has never played out well for me. I think I'm about to give up on datomic. Thoughts?
15:58joegallocampeterson: you're welcome!
15:58rhg135ask yourself 'do i need a db'
15:59danielszmulewiczI need a db I can understand.
15:59rhg135ah
15:59rhg135never give up
16:00technomancya db you can understand is easier when the license doesn't prevent you from examining the implementation
16:00danielszmulewiczrhg135: but is it worth it?
16:00danielszmulewicztechnomancy: Everything in the datomic experience is a turn off.
16:01danielszmulewiczDocs, installation, default memory settings.
16:01technomancyfor many use cases, it's not that hard to treat postgres as an immutable event log
16:01tuftthat's what i've been thinking lately
16:01danielszmulewicztechnomancy: exactly.
16:01tuftalso postgres has real serializable transaction isolation, which datomic only has half of
16:02tuftthe rest you have to do yourself with functions that run in the transactor
16:02tuftjust need a way to get the transactions and queries as data part -- still like that =)
16:03rhg135danidk if it is i've never used it
16:03rhg135danielszmulewicz, ***
16:03rhg135srsly i need to type out nicks
16:05TimMcGet a better chat client!
16:05rhg135i'm using hexchat
16:05akurilinquick question: how do you guys measure the load on your web applications ? I have a ring app that's getting a lot of traffic, but I'm not sure how much is too much. I have munin set up to monitor/track things like IO, cpu and mem use. I could also analyze the logs and see how long requests take on average
16:05rhg135too many ppl in this chan
16:06tuftrhg135: no tab completion in that client?
16:07schmeetuft: there sure is, works for me at least
16:10loliveirawhen should I use datomic over postgres?
16:11danielszmulewicztuft: to be honest, even mongodb would fit my use case. Heresy maybe, but good enough for me. And monger just redesigned their api to be more "functional".
16:11loliveiradid this question make any sense?
16:11technomancyloliveira: when does vendor-lock-in not matter?
16:12loliveiratechnomancy: Do you know how does the vendor-lock-in is implmented in datomic?
16:12technomancywhen you work for Cognitect I guess? =)
16:12kqrif I have a list of statements in a macro, how do I expand them one by one?
16:12dnolen_danielszmulewicz: you know there's #datomic and an active mailing list for datomic questions :)
16:13danielszmulewiczdnolen_: Oh, thanks. I forgot about that.
16:13kqrah I found it, ~@
16:14danielszmulewiczSo Clojure was a gift to the world, but the plan to monetize it was datomic. Result: the world adopts Clojure and rejects datomic? How accurate a description is this?
16:15danielszmulewiczIs Cognitect making money with Datomic?
16:15technomancyhttp://p.hagelb.org/mystery.gif
16:16TimMcI hope so.
16:17danielszmulewicztechnomancy: :-)
16:18justin_smithkqr: that splices them - everything returned by your macro gets expanded to create the form that gets run
16:19dnolen_danielszmulewicz: seems pretty inaccurate. also there's a bunch of people in this room with Clojure products making money.
16:19kqrjustin_smith, i'm not sure I follow
16:20TimMcThat doesn't monetize it for the Core folks, though.
16:20TimMcI mean, except via consulting, I guess.
16:21danielszmulewiczdnolen_: I also make money with a Clojure product. I'm asking about Cognitect's product, Datomic.
16:21kqrjustin_smith, if xs is (a b), will not `(x ~@xs x) be (x a b x)?
16:21justin_smithkqr: that is the splicing I was talking about
16:21justin_smithbut whatever you return is expanded, and then evaluated
16:21kqrah yeah
16:22JumblemuddleLet's say that I wanted to create a route that allows for forward slashes. (e.g. site.tld/a/b/c would return a (list?) of the arguments) I want it to allow for an 'infinite' amount of 'sub-folders' and return them as a list. Any way to do this with compojure?
16:23amalloy_Jumblemuddle: it's certainly possible, if a little bit weird. you'd probably want to define a recursive route
16:24JumblemuddleInteresting, I hadn't even thought about recursion. I was thinking I'd just have to do a regex that allowed for '/' then parse it myself.
16:28TimMcJumblemuddle: I think that makes far more sense.
16:30JumblemuddleI wasn't quite sure if it'd work, because '/' is a 'special' character, so I figured I'd ask here in case there was some 'pretty' way to do it.
16:40nopromptdnolen_: could you take a look at a gist real quick and give me some feedback about this patch? https://gist.github.com/noprompt/130197e3c1ede9567bc3
16:40nopromptbbloom: you're welcome to it as well.
16:42nopromptbbloom, dnolen_: i'm unsure what makes sense to test. for my use case i'm positive i want to look at *cljs-ns* when the macro is being compiled but as far as clojurescript goes i'm not sure what's relevant for the test.
16:42hiredman a2enmod proxy
16:42hiredmanwhoops pardon
16:43Jaoodnow everyone knows you use apache instead of nginx
16:43dnolen_noprompt: is that how ns metadata works, a map after the symbol is supported?
16:43nopromptdnolen_: according to what the current code says.
16:44nopromptdnolen_: https://github.com/clojure/clojurescript/blob/245de2e752f638f5d06527a1cafed26b0d8d0da8/src/clj/cljs/analyzer.clj#L1132-L1134
16:44timothywhey all. when trying to do a `lein release` the input screen doesn’t respond to my inputs (http://bit.ly/1q5Ucmp)
16:44timothywI think input is "gpg-agent > pinentry-curses"
16:44amalloy_does anyone have a recommendation for a thrift library to use from clojure? i'll be working with some java code so just a clojure-looking layer on top of the generated java classes would be nice
16:44timothywany ideas? (probably missing something simple)
16:44nopromptdnolen_: and from the look of it in the repl, yes.
16:44nopromptit's news to me. :P
16:45dnolen_noprompt: huh, ok. looks good to me, ticket + patch in JIRA then.
16:45nopromptdnolen_: what about the tests? should i leave all of that in there?
16:46dnolen_noprompt: tests are fine
16:46dnolen_noprompt: all that matters is a squashed patch with an appropriate commit message
16:46dnolen_noprompt: https://github.com/clojure/clojurescript/wiki/Patches
16:46nopromptdnolen_: thanks! i'll get that started.
16:59kqris there any sort of style guide for clojure (or some project which I can imitate?)
16:59kqrwait
17:00kqrI just googled "clojure style"
17:00kqrfirst hit seems promising
17:00justin_smithkqr: there are even automated linters - like kibit and eastwood
17:00JumblemuddleAlright, I'm probably doing this wrong. I'm trying to create a compojure route that will allow for '/'s in the route '(GET ["/:route", :route #"[A-z,a-z,/]"] [] (default))
17:00timothywkqr: I’ve seen this one reference a few times: https://github.com/bbatsov/clojure-style-guide
17:00justin_smithkqr: also, I like this one, though it is not wholly uncontroversial https://github.com/bbatsov/clojure-style-guide
17:01amalloy_that regex is bananas, Jumblemuddle. you probably want [A-Za-z/]+
17:01JumblemuddleI knew I'd end up doing something stupid... thanks
17:03JumblemuddleIt seems to work fine, until I try doing a route with a '/' in it. Is it even possible to make compojure treat routes with them as a single route?
17:04JumblemuddleI'm an idiot... It works fine, I was trying localhost:3000/test/test3 (I don't have numbers in the regex) :/ Thanks, guys!
17:05justin_smithJumblemuddle: it seems like for a route like that it would be easier to make your own middleware layer, that detects the regex for the deep path you want, and calls your handler, and only invokes the real compojure router if there is no match
17:05justin_smithoh, so it worked, never mind then
17:06JumblemuddleYa, I was just being an idiot. Thanks, anyways!
17:08PigDudeif a Java method takes a Map, can you provide a Clojure map to it?
17:08PigDudewalking my way from IPersistentMap on up, I don't think so.
17:08PigDudeis that right?
17:09technomancy,(instance? java.util.Map {})
17:09clojurebottrue
17:09justin_smith,(isa? (class {}) java.util.Map)
17:09clojurebottrue
17:09gtraktechnically that's an array map :-)
17:09technomancypsh; isa?
17:09PigDudehm, what did i miss?
17:09amalloy_,(isa? clojure.lang.IPersistentMap java.util.map)
17:09clojurebot#<CompilerException java.lang.ClassNotFoundException: java.util.map, compiling:(NO_SOURCE_PATH:0:0)>
17:09amalloy_,(isa? clojure.lang.IPersistentMap java.util.Map)
17:09clojurebotfalse
17:10amalloy_PigDude: you didn't miss anything - the interfaces are separate, it's just that every implementation of c.l.map stuff also implements j.u.map
17:10technomancy(isa? clojure.lang.TerriblyNamedFunction isa?)
17:10PigDudeamalloy_: that's what i missed :) i'm not java guy, forgot to look for the implementation
17:10PigDudeamalloy_: i see APersistentMap extends Map
17:10amalloy_it really *should* be a subinterface, because stuff in clojure.core breaks if you create classes that implement clojure stuff but not java stuff
17:11PigDudei agree
17:12tuftdanielszmulewicz: what would mongo offer you over postgres? i'm not so familiar with it, just curious
17:12justin_smithtuft: unreliability, and speed
17:13justin_smith~mongodb
17:13clojurebotmongodb is an ORM for mmap
17:14TimMc~mmap
17:14clojurebotHuh?
17:14TimMc~ORM
17:14clojurebotExcuse me?
17:17tufthaha
18:00myazakiI have a question about java interop, I have a java library which returns classes of primitive types (int.class, float.class) and I want to use that as a dispatch value for a multi method
18:00nopromptdnolen_: i opened the issue (#846) and attached the patch. thanks for your help on it.
18:01myazakiso for instance I got a float.class, but I can't seem to make it work
18:01amalloymyazaki: Float/TYPE
18:02amalloy(is one place where the class for the float primitive can be found)
18:02myazakiI tried that...
18:03myazakiI probably must be doing something wrong :)
18:03dnolen_noprompt: thanks will take a look later
18:04justin_smith,(class (float 1.0)) ; a more hacky way to get it
18:04clojurebotjava.lang.Float
18:04nopromptdnolen_: awesome. really appreciate it.
18:04lemonodori’m getting “java.lang.IllegalAccessError: in-seconds does not exist, compiling:(cookies.clj:1:1)” with ring 1.3.1, which supposedly has to do with pulling in an old clj-time, but i’ve put [clj-time “0.8.0”] in my project.clj and still get the error. lein deps :tree shows only that clj-time.
18:04justin_smithoh, never mind, for a primitive
18:04lemonodoranyone else run into this with ring 1.3.1 (released this week, i think)?
18:06amalloyjustin_smith: that doesn't work at all?
18:06justin_smithamalloy: I misunderstood what was wanted, thus my "never mind" followup
18:06amalloyokay you said that already. but also: if the goal were to get at the class for Float, it's just...Float
18:07amalloy(class (float 1.0)) is silly
18:07justin_smithyes, it is
18:07myazakiI'm dispatch on Float/TYPE, for instance like this (defmulti blah (fn [arg1 dt] dt)) and (defmethod blah Float/Type [arg1 dt] ...)
18:08myazakiwhen I use blah with the float.class returned from the java library it says that it can't find a method for dispatch value: float
18:15hiredmanmyazaki: does (= Float/TYPE dt) return true?
18:16myazakiyes!
18:16myazakiI'll try isa?
18:17myazakibecause I think multimethods use that
18:17hiredmandid you load the code that defines the method for Float/TYPE ?
18:18hiredman(require or use of the namespace, direct call to load-file or load, etc)
18:18danielszmulewicztuft: Oh, what mongodb gives me over postgres? The luxury to be lazy. No schemas in mongodb. I can shoot myself in the foot as much as I want. It's a document store, so at development time I can experiment with how I want my data to be structured without formalizing. Maybe that's why so many people hate it. It seems that people who understand databases recommend against it. Since I don't understand them, I use it happily.
18:19myazakimost definitely, hiredman
18:19myazakidamn it, such a strange error
18:19hiredmanmyazaki: what happens when you call the mutlimethod at the repl with (blah :foo Float/TYPE) ?
18:20hiredmanmyazaki: why are you so sure you have the defmethod loaded?
18:20myazakiman I think I found the error
18:21myazakiI'm an idiot
18:21myazakilol
18:24myazakithanks hiredman
18:25myazakiActually, the error was inside a let statement of a method that called one of the multimethod
18:25myazakiI ultimately passed a wrong argument
18:26myazakiwow, it works now
18:27myazakiLesson #928: Be careful with refactoring
18:40TimMc&(sort ["foo" :foo])
18:40lazybotjava.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.Keyword
18:40TimMc:-(
18:41TimMcFor a moment I was living in a utopia where Clojure implemented universal sorting.
18:41TimMclike in Python
18:42ScorchinEvening, something that might be relevant to folks in this channel is a "SICP Distilled" course that's being run in Clojure: https://www.kickstarter.com/projects/1751759988/sicp-distilled
18:42mdeboardI thought that strict ordering was like a requirement for type systems or something
18:42mdeboardTimMc:
19:39danielszmulewiczI'm offering a macro in a library for convenience. What is more idiomatic? (defystem name [args]) or (defsystem name {args}). A vector or a map?
20:00bogdancan somebody tell me if cider in any of version have something like clj browsing feature like speedbar or i only limited to jump to source?
20:00celwellHow can I 'unwrap' a collection and just have each of its elements in place of it in the function? (I assume this needs some sort of macro) (I don't think I can use apply because of the details of the situation)
20:04vermacelwell, apply?
20:04verma,(apply + [1 2 3 4])
20:04clojurebot10
20:04aperiodiccelwell: why don't you think you can use apply?
20:05vermacelwell, oh didn't see you comment for "apply"
20:11danielszmulewiczbogdan: M-. ?
20:50lpvbright now I have a function that synchronously loads sound data from an audio stream freezing the UI
20:50lpvbwhat's the right clojure concurrency way to do this?
20:50lpvbfuture? java threads? agents?
20:51TEttingerlpvb, so it's synchronous now but you want it to be async?
20:51TEttingersounds like future would be easiest
20:52TEttingerI've used it before for very similar tasks, just not from disk
20:53lpvbTEttinger: I read that it will block when I deref it
20:53lpvbbut for this case doing IO I don't need a value back so I don't ahve to worry about it right?
20:54lpvbwill the future thread be terminated once it's done doing its work?
20:54bogdanty daniel
20:55alandipertlpvb: another thing to look into would be agents + send-off
21:00lpvbalandipert: what would I put in the agent?
21:01alandiperti usually put something in there to store any information i want about how the processing went
21:01lpvbI'm confused
21:01lpvbhow does that help me load audio data into a buffer asynchronously
21:04alandipertit’s just another way to make a thread
21:08celwellHi, How can I unwrap a coll and have the elements in its place? (to anyone who recognizes this question: sorry, got disconnected from irc)
21:09akhudekyay, immutant 2 finally hit alpha!
21:09lpvbseems like future spawns an agent send off pool thread anyway
21:09lpvbcelwell: what do you mean elements in its place?
21:09celwellI don't know how I would be able to use apply because it is part of the with-query-results macro.
21:09celwelllpvb: (1 2 3 4) -> 1 2 3 4
21:11celwellIt's going into this macro in place of 'params' for [stmt & params] https://github.com/clojure/java.jdbc/blob/97be163884d402c4506e2397a528b15a23867a8f/src/main/clojure/clojure/java/jdbc/deprecated.clj#L680
21:11celwellBut I have params as a vector and it has to 'unwrapped' I assume.
21:12akhudekcelwell: you could do it with another macro I guess. Try searching for “using apply with a macro”
21:12akhudekcelwell: It should cover the same topic
21:12turbofail[stmt [a b c d & more]]
21:12amalloycelwell: sql-params just wants a vector anyway
21:12amalloyturbofail: well, it's actually [stmt a b c d & more]
21:12vermaso, (put! c val close!) is a common thing to do for one shot async calls?
21:14celwellamalloy: sorry, are you saying it's fine to just give it a vector? im confused
21:15akhudekcelwell: if you are trying to give sql-params, yes
21:15amalloycelwell: all it wants is a vector to begin with
21:17celwellamalloy: but it wants this vecotr [stmt & params], but I'm giving it this vector [stmt [blah blah blah]]. I need to figure how to give it [stmt blah blah blah]
21:17amalloy(apply vector stmt [blah blah blah]) or (into [stmt] [blah blah blah])
21:19amalloyif the entire vector is this opaque thing you can't control at all, you can do something like (into [(first v)] (rest v))
21:19celwellamalloy: ok, i see what you mean. ok I'll work on this, thanks
21:19celwellamalloy: I was getting tunnel-visioned into a certain vector
21:20lpvbI used a future to execute loading the sound buffer, but if the user clicks another sound while the original future is still running it will continue to play the previous future
21:22TEttingerlpvb, then agents may be better, I think you can cancel both, but I'm more certain that you can with agents
21:22TEttingermost of my clojure does not use concurrency :|
21:37vermahow do I put a value into an async channel and close it rightaway, I guess I cal do (do (put! c v) (close! c)) .. but was wonder if there's a thing for this
21:40lpvbMaybe to solve my problems I need to send my buffer loading function a continuation so it can halt itself when it notices the user has changed selection?
21:57whatisthewhatMy HDD crashed earlier. After recovering, I can't do lein repl anymore. Instead, I get the this Java error http://pastebin.com/2M7buaBJ. Tried reinstalling without success. Any thoughts what's causing this?
22:01vermawhich "transformer" is being referred to here: https://clojure.github.io/core.async/#clojure.core.async/filter&lt;?
22:01vermaa transducer?
22:02beamsowhatisthewhat: https://github.com/technomancy/leiningen/issues/1321 ?
22:02vermaoh
22:02vermahttps://github.com/clojure/core.async/commit/81fc946a4d80dd57f641282831e72ae0d829f1b0
22:03vermaso I can use transducers with 1.6.0?
22:05whatisthewhatbeamso: Not clear but I don't think that's my issue. The error code on that page shows the nREPL server starting. My error occurs before the server starts.
22:06TimMctechnomancy: I'm thinking of buying a Maltron ergonomic keyboard. Ever used one of those?
22:07whatisthewhatThis also seemed relevant, but my /etc/hosts file looks fine: http://stackoverflow.com/questions/22114716/lein-repl-errorconnection-refused?rq=1
22:09beamsoi checked my hosts file on two machines. both had a '127.0.0.1 localhost' entry.
22:10beamsoi also note from your stackoverflow post that 2.4.2 isn't the latest one... but there is a annoying bug in 2.4.3 anyway.
22:10whatisthewhatyeah i intentionally was running 2.4.2 because of that bug
22:23TimMcwhatisthewhat: What does your hosts file look like?
22:24TimMcThe selected answer on SO hinges on the hostname not being in /etc/hosts.
22:28gastoveBuh: I have a project that declares dev dependencies in its project.clj. On one of my computers, my lein repl loads with dev dependencies on the classpath; on my other computer, dev dependencies are omitted from the classpath. Does anybody... have any suggestions where to start looking to fix this?
22:29xeqigastove: lein versions?
22:29gastoveEven more bizarre to me: lein with-profile dev repl *still* doesn't start a repl with dev dependencies loaded. So something... is wacky. _But what?_
22:29TimMcgastove: Do you have a ~/.lein/profiles.clj on either machine?
22:30gastoveI have a profiles.clj on both machines; they're identical. And: I updated lein on both of 'em this morning.
22:30gastoveSo both are on 2.4.3
22:32hiredmangastove: I would check lein classpath
22:32whatisthewhatTimMc: my hosts file is normal, and has a 127.0.0.1 localhost entry
22:33xeqigastove: add lein-pprint and see what it tells you about the :dev profiles
22:33TimMcwhatisthewhat: Right, but does it have an entry for your hostname?
22:34TimMcIt *shouldn't* matter, but it apparently did for the SO person.
22:34whatisthewhatwhen I type hostname into terminal it says it's simply localhost
22:35TimMchuh
22:36TimMcAt this point I would try changing/setting the hostname and setting it in /etc/hosts under 127.0.1.1, but that's because I'm a little fuzzy on this stuff.
22:37gastovexeqi: I'm not perfectly sure what I'm looking for. (I'm on the broken computer, and don't have access to the working computer at the moment, so I can't compare and contrast.)
22:38gastovexeqi: but it does show the dev dep in the dev profile: `:dependencies ([midje/midje "1.6.3"])`
22:39hiredman:(
22:39hiredmanI blame midje what the problem is
22:39gastoveheh
22:39hiredmanit is terrible
22:40xeqigastove: and `lein deps :tree` and `lein with-profile +dev deps :tree` don't show midje?
22:41gastovexeqi: nope, neither of them.
22:44gastovehiredman: (or anybody else for that matter) is "which testing framework is good" going to be the kind of question I regret asking, or is there one-or-another that's emerging as Generally Pretty Solid? (I'm not super attached to midje, just like it better than clojure.test.)
22:45TimMcMidje is batteries-included, but the error messages can be pretty difficult to parse.
22:46gastoveTimMc: good to know, actually -- that's rather a pet peeve of mine.
22:46hiredmanmidje is also written by people who have demonstrated time and time again that they don't know clojure
22:46gastoveheh.
22:46gastoveAny love for Speclj? Was also looking at it.
22:46hiredmanclojure.test
22:47xeqigastove: running out of ideas debugging without pastes
22:47xeqitest.check and clojure.test have been sufficent for my purposes
22:48gastovexeqi: I appreciate the help. I'm going to put the working computer and the broken computer in the same place tomorrow, see if one is config'd differently than the other.
22:48tbaldrid_gastove: let's just say that everytime I've run into a mature midje codebase, the authors have either said "we should have written that in clojure.test" or "we're rewriting that in clojure.test"
22:48gastove*nods* I'm interested in test.check; seems solid.
22:48gastovetbaldrid_: ha! That's also good to know.
22:49tbaldrid_clojure.test has it's warts, but it's so simple it's fairly easy to understand.
22:49gastoveI just wish there were a better way to do setup/teardown/test ordering than test-ns-hook.
22:49gastove(Maybe there is and I just haven't come across it?)
22:49xeqigastove: I was considering multiple profiles in the ~/.lein directory merging weird, but I'd have expected lein-pprint to get the same merger
22:50hiredmanwhat is test-ns-hook?
22:50xeqisomething beyond `use-fixture`?
22:50hiredman^-
22:51gastoveIf I've got this right: test-ns-hook lets you specify the order in which the functions in a test ns get called. It's incompatible with fixtures, though, which is a shame.
22:51hiredmannever heard of it, so you don't need it
22:52xeqihmm, I always considered the randomness in the ordering a positive
22:52xeqitest independent/idempotency and what now
22:52hiredmanxeqi: it isn't random enough to be a positive
22:52hiredmanit will run in the same order for ever run
22:52hiredmanevery
22:53hiredmanif it was really random that would be great
22:53hiredmanour big test suite at work ends up having problems with state leaking between tests in a namespace, and even across namespaces
22:54gastoveEh, I'm doing integration testing. Idempotence/commutativity is lovely, but I also need to do things like "definitely add 5 things to a DB, make sure code FNs remove them correctly." You need at least a *little* ordering for that.
22:54hiredmangastove: that sounds like one deftest
22:55hiredmanand the body of deftest is just code that runs in order as written
22:55technomancyTimMc: Maltrons seem pretty hardcore. a lot like the kinesis advantage, but harder to find.
22:55TimMcYou can build anything you want out of clojure.test, but the question is do you *want* to.
22:56hiredmanTimMc: there are no alternatives that are good enough to trade off the simplicity
22:57gastoveWell. Thanks for the time, all.
22:57technomancyTimMc: IMO the main flaw of the kinesis advantage (beyond size) is it's only available with quiet or linear switches. I don't know if the Maltron has the same problem or not off the top of my head.
22:58TimMchiredman: You always build your own testing utils on top of clojure.test with each new project?
22:58TimMctechnomancy: What key switch do you prefer?
22:58hiredmanTimMc: not really, I just wrote code that does things and asserts things
22:59technomancyTimMc: the cherry blue switches are the best IMO, unless you are in an office where you can't make a lot of noise.
22:59hiredmanwith-redefs here and there
23:00technomancyTimMc: hm; one source says that maltron only has blacks, which are mechanical, but not tactile. (mostly used in gaming keyboards)
23:00technomancyseems like an odd choice
23:00TimMctechnomancy: I bet Maltron would use different key switches for little to no extra cost.
23:00TimMcThey hand-assemble them anyhow...
23:00technomancyTimMc: considering they're all hand-wired anyway, it's definitely a possibility
23:01technomancyat that cost level there should be room for customization =)
23:01technomancyTimMc: curious if you've seen this? http://atreus.technomancy.us
23:02technomancycan't remember if I showed you that or not
23:03xeqitechnomancy: does it come in bluetooth?
23:03TimMcOh, I vaguely recall this...
23:04technomancyxeqi: the base design doesn't. it might be possible to hack it in, but the case clearance is pretty tight.
23:04technomancymaybe if you increased the width of the spacer
23:04technomancyit's an open source design, so ... anything is possible =)
23:04technomancypersonally I have enough batteries to keep charged every day as it is
23:05TimMcI think I'd want something with more keys.
23:05technomancyit definitely takes a lot of getting used to
23:07TimMcNot having arrow keys at the base layer is a no-go for sure.
23:07TimMcIf I spent *all* my time in Emacs, maybe not...
23:07technomancyit's not for everyone; just thought I'd mention it
23:08TimMc*nod*
23:08technomancythe maltron looks neat if you don't need to take it with you
23:08TimMcheh
23:08TimMcWhat's wrong with Cherry MX Brown?
23:08technomancyI'd just watch out for the switches. maybe you'd like the ones they use by default, but I'd see if you can try it out in person before you pull the trigger.
23:09TimMcYou can "rent" the Maltrons for a month if you live in the UK.
23:09technomancyhuh, that's pretty cool
23:09TimMcI'd want to do some remapping to make Ctrl, Alt, and ( really easy to hit.
23:09technomancymakes a lot of sense; people would be reluctant otherwise. and you need about a month to get used to a layout like that.
23:10TimMcand maybe set up sticky keys or something
23:11technomancyhttp://deskthority.net/workshop-f7/anybody-ever-change-the-switches-on-their-maltron-t4675.html
23:12technomancyTimMc: the brown switches are supposed to be tactile, but they just feel weak to me; like a token effort at tactility.
23:12technomancytry it for yourself I guess, but IMO nothing is as nice as the clicky blues
23:13TimMcHow loud are blues?
23:13technomancykinda like clicking a pen
23:13TimMcWill my coworkers kill me?
23:14technomancynow the wisdom of try-before-you-buy becomes more apparent =)
23:14TimMcI'm going to see if any of my coworkers have one.
23:14mdeboardDoes flipping the brown switch activate the brown note
23:15technomancyI'm working on a prototype that uses Matias quiet switches, which are dampened but still have the good tactile feedback.
23:15technomancyunfortunately they take a different style of keycap that is very difficult to source
23:16technomancyI had to steal caps from a thrift store mid-90s Apple keyboard for the prototype
23:21TimMcI should also get ahold of a set of Cherry MX switches to poke at.
23:22technomancyif you do need something quiet, the MX clear are better than brown IMO
23:25TimMcMaybe I can play with one of these: http://www.cmstore-usa.com/mechanical-key-switch-demo-board/
23:25TimMc(What I should *really* do is go to bed.)
23:26amalloynonsense, TimMc. it's only like 5:30, in hawaii
23:38ifihtHey I have a crazy question, any takers?
23:40caterndon't ask to ask, just ask
23:40caternclojurebot? do you have that memorized?
23:40catern~ask
23:40clojurebotThe Ask To Ask protocol wastes more bandwidth than any version of the Ask protocol, so just ask your question.
23:40ifihtkk
23:40ifihtI want to redifine the result of an equation
23:40ifiht*define
23:40ifihti.e. 1+2=7
23:41ifihtHOW?
23:41amalloyyou want to make three equal to seven? this question is too vague to answer
23:42ifihtI want to specify a specific instance of incongruity in the math library
23:42ifihtnot 3=7
23:42ifihtbut 8-3 = 7
23:43ifihtor the like
23:43tbaldridgeyou want to break math?
23:43ifihtyes, but only s little
23:43ifiht*a
23:43tbaldridgeI may regret this next question....but why?
23:43catern(defn + [& _] 7)
23:43caternthere you go
23:43ifihtit's important for working with lots of zeros
23:44catern,(defn + [& _] 7)
23:44clojurebot#<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)>
23:44ifihthold on, repl tiem
23:44catern:)
23:44ifihtNICE!
23:44tbaldridgeifiht: what does "working with lots of zeroes" mean?
23:44caternlol
23:44caterni may have just done something horrible
23:44catern~xy
23:44clojurebotxy is http://mywiki.wooledge.org/XyProblem
23:44ifiht8/0 comes up more than once
23:44ifihtrather n/0
23:45ifihtI have to define them
23:45caternifiht: ~xy
23:45caternclojurebot dang it
23:45ifihtclojurebot?
23:45amalloyuse a function different from clojure's built-in /. attempting to redefine how / works for all other code that exists is just doomed
23:45caternanyway, I feel a strong xy vibe
23:45clojurebotclojurebot is not a benchmarking platform
23:45tbaldridgeI think there's got to be a much better way to avoid division by zero errors instead of redefining math
23:46ifihtI'm actually actively using n/0 to make it work.
23:46amalloymaybe if you're w WIMP, tbaldridge. i refuse to be bound by the chains of mathematics
23:46ifihtBut the separate operator is a good idea
23:46ifihtTHanks
23:55technomancywhat just happened
23:55ifiht@catern Hey about the xy thing, the main instance that led to this is 0/0
23:56ifihtI need it to return a value, and I can do it in c, but Java stops it from happening in clojure
23:56ifihtTHAT's x
23:56amalloy,(/ 0 0.0)
23:56clojurebotNaN
23:57ifihtyep
23:57amalloythat's a value
23:57ifiht,(/ 0 0)
23:57clojurebot#<ArithmeticException java.lang.ArithmeticException: Divide by zero>
23:57ifihtOh, i see
23:57ifiht*numerical value
23:57amalloyif you divide an integer 0 by an integer 0 in C, i don't think anything good happens to you after that
23:58amalloyin either language, you can do it with ieee floats, and you get back NaN
23:58ifihtit can, but it's pretty processor dependant
23:58ifihtnul = (0 / 0); if (c == (1 || nul)) <- like that
23:59amalloythen it's not "in C", it's "with my particular C compiler on this one computer", because your program isn't standards-compliant
23:59ifihtI'm dividing by 0, and you bring up standards compliance?