#clojure logs

2013-10-04

00:06@technomancyrousing round of torus pong at seajure tonight
00:22ddellacostatechnomancy: jealous, sounds fun
00:22ddellacostatho I have no idea what torus pong is.
00:23uvtcI think it may be a 3D version of concentric circle pong...
00:23uvtc:)
00:23@technomancyddellacosta: http://pong.clojurecup.com
00:24ddellacostaah, cool. :-)
00:24ddellacostatechnomancy: thanks!
00:26dobry-denddellacosta: i just ended up adding 'myfun = myproj.myns.myfun;'
00:26ddellacostadobry-den: haha, there ya go. :-)
00:26dobry-den(reduce + (flatten coll)) works in clj but doesnt seem to work in js
00:26uvtcWow. Didn't realize there were so many games created. Haven't been following the Clojure Cup. Neat.
00:27uvtcLots listed at http://clojurecup.com/apps.html .
00:28Foxboronlol
00:28Foxboroni beat the pong game
00:28Foxboroni managed to get it in a perfect orbit
00:29mullr@dobry-den in cljs you mean? works for me…
00:29mullrClojureScript:cljs.user> (reduce + (flatten [1 2 [3 4]]))
00:29mullr10
00:29uvtcagh! It's multiplayer!!
00:29uvtcAnd I stink! :)
00:30@technomancyahaha
00:30uvtcWas alone the first time I tried it. :)
00:31dobry-denmullr: yeah, it works in my repl but not when i pass the compiled function an array
00:31mullrdorby-den: a JS array?
00:32mullrI'm not super good at cljs yet, but I'd be surprised if that wored
00:32mullrs/wored/worked/
00:33CaptainLexIs there a way I can ensure a string only contains ASCII characters?
00:33ddellacostadobry-den: if you run it through js->cli?
00:34mullrClojureScript:cljs.user> (seqable? (clj->js []))
00:34mullrfalse
00:34ddellacostadobry-den: I'm not sure you're going to be do much with a vanilla JS array
00:34uvtcArgh! Veritas01! You've bested me for the last time!
00:34ddellacostayah, exactly--it has to have that interface to use it with those functions in clojure.
00:35frozenlockuvtc: Everyone left :(
00:35uvtc:)
00:35uvtcSorry. I wanted to get back to Dave Ray's speakerdeck slides. :)
00:42@technomancyheh https://github.com/uswitch/torus-pong/graphs/punch-card
00:42@technomancylooks about right
00:47RaynesMan, screw that asylum game.
00:47RaynesYou can't win unless you're an asshole. :(
00:47coventryCaptainLex: ##(every? #(> 256 (int %)) "noй-ascii string") ##(every? #(> 256 (int %)) "ascii string")
00:47lazybot(every? (fn* [p1__16772#] (> 256 (in... ⇒ false
00:47lazybot(every? (fn* [p1__16773#] (> 256 (in... ⇒ true
00:47Raynesasylum.clojurecup.com
01:00TEttingercoventry, that still allows stuff like §
01:00TEttingertry 128?
01:00TEttinger^ CaptainLex
01:01coventryTEttinger: Oops. Thanks.
01:05dobry-denddellacosta: duh, didn't even know about js->clj
01:05dobry-denddellacosta: awesome
01:06dobry-denddellacosta: i writing my own transformer with clojure.walk until i realized you were referring to a function
01:06ddellacostadobry-den: yah, there is a lot there to help you out. But I'm sure you'd learn something by writing your own transformer. :-)
01:07uvtcMore than meets the eye.
02:03sm0kehello i have a function named join in one of the ns which also includes [clojure.string :as s] ..but still get conflict that join already belongs to clojure.string?
02:04sm0keoh crap my fault
02:04sm0kei put that in :use instead of :require
02:19frozenlockIs there a way to get a printable representation for a [B (byte?) object? I don't really care if I need to convert, I just want to print it...
02:23`cbpfrozenlock: seq
02:24frozenlockThanks!
02:27yedithat pong core.async post was sex
02:32devnhello all
02:32devnyedi: link?
02:37frozenlockIf I want to add a method to a java class, is it with reify? (I'm trying to goole it, but I get mixed results with proxy, reify, defmethod, gen-class..)
02:37yedi devn: http://ragnard.github.io/2013/10/01/clojurecup-pong-async.html
02:37Aciocounterclockwise cant seem to import jaqy.core because its defined a cljs
02:37Acioany ideas?
02:39logic_progis there a way in clojure to smit out jvm bytecode directly?
02:39logic_progi need to write some high performance clde in clojure; so I want toj ust straight target the jvm
02:40frozenlockHmm... actually I might need to add an entire class.. nevermind
02:42devnWhat's that new clojure lib that uses core.logic for solving symbolic equations?
02:42devnnevermind, expresso
02:43`cbplogic_prog: wat
02:45`cbplogic_prog: you can choose to compile 'ahead of time' but clojure already compiles directly to bytecode
02:46logic_progI want to write a DSl for writing java bytecode
02:46logic_progfor doing high perfomrnace numerics in java
02:47logic_progI want to output http://en.wikipedia.org/wiki/Java_bytecode_instruction_listings
02:47logic_progand have it run on the JVM
02:47glosoliAnyone had problems with nrepl server buffer not appearing in Emacs ?
02:48logic_progdoes *nrepl* show up in ibuffer?
02:49glosolilogic_prog yes
02:49glosolilogic_prog: nrepl and error buffers are visible
02:49logic_prog(1) can you not open them or (2) when you open them there's no promjpt?
02:50glosolilogic_prog: They all work just fine
02:50glosoliexcept there is no server buffer
02:50glosoli:)
02:50logic_progerr, I type stuff into *nrepl*
02:50logic_progif you can open *nrepl* buffer, what is the problem?
02:51glosolilogic_prog: Server logs were appearing in server buffer before :)
02:51glosoliI don't get to see any logs now..
02:51logic_progwhat does server logs have to do with nrepl ?
02:51devnI don't suppose we have any expresso afficionados in the room, do we?
02:52glosolilogic_prog: NREPL SERVER logs :)
02:52devnI'd like to write something which, given [1, 2, 99, 98, 50, 12, 50], can find all of the pairs of numbers which are equal to 100
02:52glosolilogic_prog: There always was a separate buffer called *nrepl-server*
02:54glosolilogic_prog: nvm :) hide special buffers option messed up, so I just disabled it
02:57logic_progrubber duck debugging for the win
03:06hvesalaidevn: use partition to get the pairs
03:13glosolihow to trim all white space in a string ?
03:14uvtcglosoli: clojure.string/trim
03:15glosoliuvtc: it does not do that
03:16glosolidamn ;/
03:21Apage43glosoli, what exactly are you trying to do? Give a sample input/output
03:21glosoliApage43: "370 626 8 9 7 5 5" should remove all spaces, currently I did replace on it
03:21glosolito replace " " with ""
03:22Apage43(clojure.string/replace "370 626 8 9 7 5 5" #"\s+" "")
03:22Apage43,(clojure.string/replace "370 626 8 9 7 5 5" #"\s+" "")
03:22clojurebot"37062689755"
03:22glosoliApage43: is it bad that I used " "
03:22glosoli instead of #"\s+"
03:22glosoli?
03:23Apage43actually " " should work fine there too
03:23Apage43,(clojure.string/replace "370 626 8 9 7 5 5" #" " "")
03:23clojurebot"37062689755"
03:23rurumateI just realized that Datomic is not FOSS software. I'm sure rms would not approve. What happened?
03:24glosoliApage43 thanks
03:30vmarcinkohi, noob question - how to create (hash) map from sequence of 2-element vectors ?
03:30Apage43,(into {} [[:a 1] [:b 2]])
03:30clojurebot{:a 1, :b 2}
03:32vmarcinkohmm, thanx, and even better ,since I have a function that creates map entries in form of 2-element vector, is there some way to skip that, and directly create map entries ?
03:33Apage43you *can*, but most folks just use 2-element vectors, since they're pretty much interchangeable
03:34Apage43what may more may not make sense depending on your situation is to refactor it as building up a map with assoc
03:35vmarcinkothanx...actually my problem is that i'm trying to iterate over existing map, and transform it to a new map that has same keys but values are results of applying function on them, so I have (map my-transform-fn original-map), and this transform-fn takes original map entry and transforms it into vector, and I get seq of 2-tuples
03:35Apage43that is, instead of (into {} (map (fn [input] (stuff here to generate a kv pair)) some-collection))
03:35Apage43write
03:36Apage43(reduce (fn [m input] (assoc m key value)) {} input-collection))
03:36Apage43ah
03:37vmarcinkoyeah, thanx, i got it...exactly my problem
04:51chareok norm device coordinates make no sense in opengl, why does opengl switch from right hand to left hand coordinates when going to norm device coordinates
04:51devnhvesalai: partition is not the answer.
04:51chareneed opengl expert to explain to me wtf is going on
04:51devnchare: ./join #opengl
04:51chareassholes won't explain
04:51chareso had to come here
04:52devnoh, yeah, that sounds about right
04:52charedevn just answer the question
04:52devn:)
04:52devnchare: well, where to begin? first: I don't know the answer to your question. second: that's a rude way to ask a question.
04:56hvesalaidevn: how is it not the answer, (partition 2 1 foo), then just filter the ones where (reduce + ) is 10
04:57devnhvesalai: write out all of the integers from 0 to 10 which, when combined with one another sum to 10
04:57devn[5 5] for instance.
04:57devnpartition 2 1 is not what i was asking for at all. im talking about using core.logic here for fun
04:58clgvdevn: you can use `for`
04:58devnheh, you folks seem to be missing the point
04:58devnthis problem is solved many ways, all of them pretty boring
04:58clgvdevn: or `doseq` if you only want to print those numbers
04:58devni want to do it using expresso
04:58clgvoh, I didnt see that since I just joined ;)
04:58devnoh, i didn't see that because i parts and joins turned off in my client :)
04:59devni have*
04:59clgvbut are you sure expresso is the right hammer for that nail?
04:59devnabsolutely not
04:59devnit's just a fun problem
04:59devnan opportunity to play with expresso more than anything else
05:00devni was thinking about using some combination of substitute, solve, and ex
05:00clgvyou could do it with core.logic and its support for finite domains
05:00devnclgv: yeah, you might be right that i should just do it in core.logic, but sets in expresso could be cool
05:01devnagain, just looking for an excuse to mess with expresso this evening :)
05:01clgvjust parsing its readme for the first time ;)
05:02clgvsummarizingly, it's for algebraic manipulation, solving equations and optimization?
05:02devn*nod* sounds about right
05:02clgvbut your problem at hand does not really fit those topics
05:03devnno, it doesn't
05:03devndoesn't change the fact that it could be used to solve it :)
05:04devnpracticality is of no concern to me right now
05:04clgvI'd be curious to see the solution if you manage to get a simple one, which I doubt with my current knowledge
05:05devni imagine substituting values for an expression, mapping those substitutions across a range of values
05:06clgvah ok substituting x with values in a suitable domain and then solving for y? it's debatable to call that "simple" ;)
05:06devnyeah, something like that
05:06devnthere are also rewrite rules in expresso
05:06devni bet those could be leveraged to good effect
05:08hvesalaidevn: ah... you don't want adjacent pairs of list (what you get with partition) but combinations of size 2
05:08devn(map #(rule (ex (+ % ?&*)) :=> target-sum)
05:08devnor something like that clgv
05:08clgvoh who did include perl into this lib? :P
05:08devnhaha
05:09devnhvesalai: check again. combinations does not include [5 5]
05:10hvesalaiso what is it that you exactly want?
05:10devnhvesalai: i already have it :)
05:10hvesalaiok
05:10clgvhvesalai: the clojure way to solve it would be ##(for [i (range 11) j (range 11) :when (= (+ i j) 10)] [i j])
05:10lazybot⇒ ([0 10] [1 9] [2 8] [3 7] [4 6] [5 5] [6 4] [7 3] [8 2] [9 1] [10 0])
05:11devn,(let [coll (range 1 25), target 12, cnt (count coll)] (->> (for [a (range 0 cnt) b (range 1 cnt)] [(nth coll a) (nth coll b)]) (filter (fn [[x y]] (= target (+ x y))))))
05:11clojurebot([1 11] [2 10] [3 9] [4 8] [5 7] ...)
05:12devnwhich excludes [10 0], but yeah, clgv -- that's basically it
05:12devnthere's another clever way
05:13devn,(let [sorted-coll (-> (range 25) sort), target 18] (loop [vs (range (count sorted-coll)) res {}] (let [v (first vs)] (if (get res (- v target)) res (recur (next vs) (assoc res v (- target v)))))))
05:13clojurebot{0 18, 1 17, 2 16, 3 15, 4 14, ...}
05:14devncould be written cleaner, but that's faster
05:15devnobviously no need for the sort there since im just using range, but if it were in a fn def and the inputs were in an unknown order it needs to be sorted
05:16hvesalaiare you still talking about: "I'd like to write something which, given [1, 2, 99, 98, 50, 12, 50], can find all of the pairs of numbers which are equal to 100"
05:16hvesalaior some other thing?
05:17devnsame thing
05:17devni believe the above needs to be sorted, but i could be wrong on that now that i think about it
05:18hvesalaiclgv: so how does your solution work for that input example
05:18devnin the above case i am trying to find all pairs of nums < 25 which = 18
05:18clgvhvesalai: place the given collection where the ranges are
05:18hvesalaibut that's a completely different thing
05:19devnhvesalai: are you talking to me?
05:19devnclgv: are you jonathan?
05:19devn(sorry if i spelled that wrong)
05:20clgvdevn: no
05:20devnk
05:20devnwell, hi anyway! :)
05:20clgvhi :)
05:21devnalgorithms are boring when they aren't written with love
05:21devnread, eval, print, love
05:29devnyogthos: how goes luminus?
06:27dublindanHey, I'm trying to rewrite some code without using loop. Been away from clojure for a bit and am shaky on my sequences.
06:27dublindanCan someone help me rewrite this code in a more idiomatic form? http://paste2.org/tZdEh3hJ
06:31lgs32ai wonder what would be a small example problem/project to demonstrate the powers of my library state-node. https://github.com/lgrapenthin/state-node
06:34ro_stdublindan: http://paste2.org/ehHz47Ak
06:34ro_st(untested)
06:34clgvdublindan: ou can do that with `reduce-kv`
06:34ro_st… or just use reduce-kv
06:34AimHeredublindan howabout (defn foo [x y & args] (reduce (fn [r [a b]] (assoc r (x a) (y b))) {} (partition 2 args)))
06:34clgvor `reduce` if you do not build an initial map
06:34AimHerero_st, args is a list, reduce-kv won't work well on that, it's list in, map out
06:35clgvoh well how about zipmap ^^
06:35ro_stthat's the thing. foo is doing two things, qualifying a map and then using x y on the k v
06:35ro_stif instead the map was created separately, it's much simpler
06:36clgv(zipmap (->> args (take-nth 2) (map x)) (->> args rest (take-nth 2) (map y)))
06:36ro_stso many ways :-)
06:37dublindanro_st: clgv: AimHere: thanks, I'll give those a look :)
06:41dublindanso.. which way would be the suggested way?
06:41TEttinger##((fn [a b & args] (into {} (map (fn [[x y]] [(a x) (b y)]) (partition 2 args)))) identity inc :a 1 :b 2 :c 3)
06:41lazybot⇒ {:a 2, :b 3, :c 4}
06:41TEttingerI don't think it _needs_ needs reduce
06:42TEttingerdublindan, whatever one makes sense to you
06:42clgvTEttinger: without redcue I'd prefer zipmap ;)
06:43TEttingerindeed, I just can't read zipmap yet
06:43dublindanWel, the reduce way, the zipmap way and ro_st's way all make sense to me :)
06:44TEttingerI kinda thought mine was clear... :(
06:44noncomdid anyone use serial-port library from Sam Aaron to communicate over the serial port?
06:44TEttingersplits the arglist into pairs, calls a function over each pair that calls a on the first, b on the second, turns each pair into a key-value entry in a map
06:45dublindanTEttinger I think I need to look up 'into', think thats what threw me from yours
06:45TEttingerah, into is super useful
06:45TEttinger(fn [a b & args] (into {} (map (fn [[x y]] [(a x) (b y)]) (partition 2 args)))) is the function. you could also do... ##((fn [a b & args] (into (sorted-map) (map (fn [[x y]] [(a x) (b y)]) (partition 2 args)))) identity inc :a 1 :b 2 :c 3)
06:45lazybot⇒ {:a 2, :b 3, :c 4}
06:47TEttingerthe trick with into is, (into {} [[1 2][3 4]]) will turn each pair into a map
06:47dublindanOk, so looked up into, your way actually looks pretty good now :P Might just use that
06:47TEttingererr map entry
06:47TEttingerhaha thanks
06:47dublindanYeah, just looked it up
06:47dublindanthanks for the help!
06:47TEttingerif zipmap is legible though, it's shortest I think
06:47TEttingernp
06:49clgvfor must performance you have to use `reduce` and transients anyway ;)
06:49clgv*most
06:50TEttingerdoes map use transients internally?
06:51clgvno.
06:52clgvtransients exist only for (hash-)map, sets, vectors
06:53clgvall the lazy sequence functions are built on lazy sequences ;)
06:56lgs32a,((fn foo [x y & args]
06:56lgs32a (apply hash-map (map #(%1 %2)
06:56lgs32a (cycle [x y]) args)))
06:56lgs32a identity inc :a 1 :b 2 :c 3)
06:56clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
06:56lgs32a,((fn foo [x y & args](apply hash-map (map #(%1 %2)(cycle [x y]) args))) identity inc :a 1 :b 2 :c 3)
06:56clojurebot{:a 2, :c 4, :b 3}
07:34TEttingerclgv, you sure about reduce being faster?
07:34TEttinger,(time (dotimes [i 1000] ((fn [x y & args] (reduce (fn [r [a b]] (assoc r (x a) (y b))) {} (partition 2 args))) identity inc :a 1 :b 2 :c 3) ))
07:34clojurebot"Elapsed time: 41.949574 msecs"\n
07:35TEttinger,(time (dotimes [i 1000] ((fn [a b & args] (into {} (map (fn [[x y]] [(a x) (b y)]) (partition 2 args)))) identity inc :a 1 :b 2 :c 3) ))
07:35clojurebot"Elapsed time: 30.852198 msecs"\n
07:35TEttingerthis surprised me
07:35clgvTEttinger: reduce+transient was the statement
07:35TEttingerI thought reduce used transients internally
07:36TEttingerthought you meant that
07:36clgvnope
07:36TEttingerso if I turned the {} into (transient {})
07:37TEttingererr no, that won't do it
07:38TEttingeryes, it is a bit faster
07:38TEttinger,(time (dotimes [i 1000] ((fn [x y & args] (reduce (fn [r [a b]] (assoc! r (x a) (y b))) (transient {}) (partition 2 args))) identity inc :a 1 :b 2 :c 3) ))
07:38clojurebot"Elapsed time: 12.533211 msecs"\n
07:39TEttingerwoah very different here
07:39TEttingernice, I will keep it in mind
07:39TEttingertransients must be faster on clojure 1.5?
07:39TEttinger,(clojure-version)
07:39clojurebot"1.6.0-master-SNAPSHOT"
07:40TEttingerdublindan, there's your answer :D (fn [x y & args] (reduce (fn [r [a b]] (assoc! r (x a) (y b))) (transient {}) (partition 2 args))) <-- thanks clgv
07:41hyPiRiontransients are actually a tiny bit slower for collections where you do relatively few conj/assocs
07:41clgvhyPiRion: but the threshold is pretty low
07:42TEttingeryeah, this is 3 pairs.
07:42hyPiRionyeah, just be aware of it
08:59sm0kehello sometimes i get exception in a clojure code with weird stac trace like
08:59sm0ke$eval1643.invoke(form-init2748065842052729346.clj:1)
08:59Foxboronsm0ke: welcome to clojure debugging. Any questions?
09:00sm0kenow in the stack trace that is the onlyline with my codes namespace
09:00sm0kebut looking at that its hard to figure out which line caused it
09:01sm0kedoes that happens for anyone else?
09:01Foxboronsm0ke: please post the whole stacktrace
09:01Foxboron(in a pastebin)
09:02llasramsm0ke: That particular line of the stacktrace just refers to a form in your REPL
09:02sm0kebut how do i figure out which form!
09:03sm0kethere are so many
09:03llasramThe one you just evaluated...?
09:03sm0keAHA
09:04sm0kellasram: did you mean that happened becuase i evaluated a form only via repl?
09:04llasramYes
09:04sm0keif i run it normally from java -jar..it will give me the exact location
09:04sm0kelet me try
09:04llasramno no
09:04sm0keno?
09:04llasramYou need to post the full stacktrace
09:04clojurebotno is tufflax: there was a question somewhere in there, the answer
09:04llasramThat *line* just refers to the form in the REPL
09:05Foxboronsm0ke: clojure debugging involves a lot of guessing and stacktrace reading sadly :/
09:05llasramThe rest of the stacktrace will show where the exception actually came from
09:05FoxboronIt gets easier over time
09:05TEttingerdefinitely.
09:06sm0kellasram: i assure you i am very sure none of it is from my code except that very line
09:06sm0kestill let me paste it
09:06llasramyes, please
09:07TEttingerthe full trace may have a line or two from your code deeper in it
09:09sm0kehere http://pastebin.com/pmtwGcwp
09:09sm0keits pretty useless
09:09sm0kemy code is comp_channel*
09:10sm0keso guys i see a lot of clojure code with much exception handling..i dont understand how can clojure hide all that ugly exception handling
09:10sm0kewithout*
09:11sm0keor do people just shrug it off in clojure?
09:11gfrederickssm0ke: are you comparing to Java code?
09:11sm0keyes
09:11sm0kei just want to know whats the take of clojure on exception handling?
09:11llasramsm0ke: Um, "Connection refused"
09:12gfredericksa lot of exception handling in java is forced by the language, not something the programmer actually wanted to do
09:12llasramI'm not sure how you get much more clear than that :-)
09:12gfredericks("checked" exceptions)
09:12sm0kellasram: yes i know what went wrong...but i want to know from which line
09:12sm0kellasram: if you see rabbitmq java api you wont really not be sure with all that ugly abstraction which line is reponsible for it
09:13sm0kegfredericks: what do you mean by that? any examples?
09:14gfrederickssm0ke: I mean that the java type system forces you to handle lots of exceptions, while that's not the case in clojure or other dynamically typed languages
09:14TEttingersm0ke, the problem is with the connection
09:14TEttingerwhat are you connecting to?
09:14gfredericksI expect you'd see a similar style of exception handling in ruby/python/etc
09:15TEttingermight be a blocked port
09:15sm0kegfredericks: sorry but thats not very concrete point..your sockets can still throw errors which is out of your control be it python java or clojure
09:15sm0keand you have to handle it
09:16sm0keTEttinger: eee i am connection to a rmq which i havent started
09:16sm0kebut you miss the point i wanted to know why isnt the stacktrace informative
09:16TEttingeroh, because you're in a repl
09:17sm0keyea i also think so
09:17TEttingerI think there may be a way, but I don't use nrepl in emacs or anything
09:17TEttingerlein repl might have similar issues
09:17sm0kehmm i think i should put a bunch of printlns
09:18llasramsm0ke: OOC, what was the exact line you evaluated in your REPL?
09:18sm0kewait
09:20sm0kehttps://www.refheap.com/19396
09:21llasramYou tossed all of that into the prompt at your REPL?
09:21sm0ke:D
09:21sm0kewhats wrong with that?
09:21sm0kethats what i like about clojure..quick check you functions
09:21llasramBecause you won't get useful line numbers
09:22llasramPut the function definitions in a file in a real namespaces
09:22llasramThen call them from the REPL
09:22sm0kellasram: hey wait
09:22llasramIf you do that, you'll get a much better experience
09:22sm0kellasram: its already in a file but i am using fireplace..
09:22sm0keoh i think its same as tossing it on repl
09:24sm0kei just realized how easy it has been to check my clojure code which i develop one small bit at a time
09:27gfrederickssm0ke: "have to handle it" is more concrete in java than in clojure/ruby/python -- your java code won't compile unless you at least nominally handle the exception
09:27gfredericksoh well
09:33mullrdelay + extend-protocol yields some unexpected delight: https://www.refheap.com/19397
09:43TEttingermullr, is the typo intentional?
09:43TEttinger(do-it lazy-intance)
09:43mullr*ninja-edit* what typo?
09:45TEttingerI don't have any idea what's going on there, can you explain?
09:46mullrThere's a random protocol and an implementation.
09:46mullrI'd like to be able to delay the creation of said implementation, but still be able to treat it as though it were real.
09:47mullrNormally if you do (delay (->Impl 1 2)) you need to deref the value with @lazy-instance before you use it
09:47mullrThis makes it transparent w.r.t. the methods in that protocol
09:47TEttingernice!
09:47TEttingerI think I get that
09:47mullri.e. instead of having to do (do-it @lazy-instance) you can do (do-it lazy-instance)
09:48TEttingerI've only used delay once anyway
09:48TEttingerI should probably use it more
09:48mullrwhich is nice when you have other code that you don't want to know about the laziness
09:48mullrThis is the first time I've needed it too
09:53lunkhow can I test for multiple types for input, like a vector, a double arrray or an Object? (fn f [name input & options])
09:55gfrederickslunk: vector? is a function
09:55gfredericksdouble arrays are trickier
09:55gfredericksinstance? is probably helpful
09:55mullrlunk: The other answer is that maybe f should be protocol method, if you need to decide what to do based on the type
09:56gfredericksor a multimethod
09:56mullraye
09:57mullrBoth approaches (manual testing with vector?, instance?, etc and protocols/multimethods) have their place
10:14wakeupHi
10:16mdrogalisMorning.
10:17TEttingerlunk, for double arrays, I don't know of any way other than ##(let [check (fn [arr] (= (type (double-array 1)) (type arr)))] (check (double-array 3)))
10:17lazybot⇒ true
10:18clgv,(.getCanonicalName (Class/forName "[D"))
10:18clojurebot"double[]"
10:18lunkmullr: ahh, let me investigate protocols, haven't actually run into a need for them yet
10:19lunkTEttinger: aha, i think with type and cond i can get the behavior i want
10:19TEttingermaybe store the types as defs with nicer names.
10:20lunkyes
10:22gfredericksalso condp instance? might be succinct
10:25noncomif i have two part of the program that run independently, can i use core.async to organize messaging between them? i need the messaging to not be blocking. if there is message, the program should respond, otherwise, simply continue
10:25noncom?
10:28lunk,(let [x (double-array 3)] (instance x)
10:28clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
10:28lunk,(let [x (double-array 3)] (instance x))
10:28clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: instance in this context, compiling:(NO_SOURCE_PATH:0:0)>
10:28xeqinoncom: it sounds to me like a normal queue would work fine
10:28lunkmeh
10:28mullr,(doc instance?)
10:29clojurebot"([c x]); Evaluates x and tests if it is an instance of the class c. Returns true or false"
10:29noncomxeqi : you mean java queue, no core.async?
10:30xeqinoncom: probably an atom with a clojure.lang.PersistentQueue/EMPTY
10:30xeqiuse peek to see if there is a message and handle it
10:31xeqiuse pop to update the queue
10:31noncomxeqi: i see, thanks! was thinking something along such lines, but asked to see if it could be core.async.. but i am interested: core.async would do if i would need blocking right?
10:33xeqinoncom: yep
10:34noncomcool! that clarifies the usage case for me!
10:35mullrlunk: A version with protocols: https://www.refheap.com/19399
10:36mullrInterestingly, doing extend-protocol like that only works when the dynamic call is the first one
10:36mullrAs noted at http://stackoverflow.com/questions/13924842/extend-clojure-protocol-to-a-primitive-array
10:41sm0keis there possibility for clojure having an inbuild debugger?
10:45seangrov`phew, refheap can continue on, mongodb got its investment
10:46sm0kewtf is it with mongodb getting all the the fundings in the world
10:48sm0kei dont see what value it provides by storing a bunch of nested bson..with no meaningful api to query it comprehensively
10:48indigosm0ke: It's good enough
10:48sm0keid rather go with elasticsearch than mongo
10:48seangrov`sm0ke: Who cares, traction
10:49sm0kedb for cool kids
10:51sm0keand btw i hate this "nosql" shit..i mean sql is not a fucking database for god sake its just a language..
10:52sm0keyou can have scalable shardable database with sql query language too
10:53sm0kemeh i better do something productive and read joy of clojure..who cares
10:54indigosm0ke: Yeah, but what if you want to have an object database
10:54indigoMongo has its uses
10:54oholiabmongo is alright for transient data that might change in schema, but I think that's the thing that people don't really get - a scalable key value store has specific applications but it doesn't necessarily mean it's a good replacement for a proper rdbms
10:55oholiabthere are certainly usage cases for it when higher persistence is involved but I think if you're talking scale and persistence then maybe having a hard and fast, well designed schema is something you want to start off with
10:55sm0keindigo: i dont understand what objects?
10:56sm0keif storing objects is what you want rather go with jpa
10:56arkhwhat's the simplest way to get the next or prev item in a sorted map relative to a known key?
10:57sm0keagree with oholiab
10:59oholiabmongo is a really easy db to decide to use and so easy to develop against because you don't really need to architect anything in order to prototype
10:59oholiabwhich is fine as long as you stop and look at your requirements once you've finished prototyping
11:00oholiabtl;dr, mongo has a bad rep because it's easy to develop against and set up so people use it in preference of what is suitable to their needs and then cry when they loose all their data
11:00sm0keoholiab: exactly
11:00sm0keok this is from a real scenario in my company
11:01sm0kea company working on data realted to hotel bookings and stuff had their whole data store in mongo
11:01sm0kei mean everything ..even used feedback was deeply nested
11:02sm0kethey were just stuck..because they just couldnt find meaningfull way to query inforamtion out of it
11:02wakeupWhy does this work: (:a {:a 2 :b 1}) ?
11:03nathanicwakeup: keywords can be used as functions to look themselves up in a map
11:03wakeupIs it pretty smart-ass syntax for (get ... :a) ?
11:03oholiabI love that behaviour
11:03oholiabwell, do be fair, it's just a replacement for [] syntax in other languages I suppose
11:03sm0kei mean you would not write mongo contrived map reduce for real time dashboards right?
11:03llasramwakeup: Kind of. There's actually some internal JVM glue which makes it more efficient, especially for Record types
11:04oholiabI just like it though, it looks nice
11:04wakeup(map :a (list {:a 1} {:a 2} {:a 3}))
11:04wakeupridiculous
11:04nathanic,(map :a (list {:a 1} {:a 2} {:a 3}))
11:04clojurebot(1 2 3)
11:04llasramwakeup: Because a Clojure function is just a JVM object which implements the IFn interface, any object can also be used as a function just by implementing that interface
11:05wakeup,(type (fn []))
11:05clojurebotsandbox$eval57$fn__58
11:05wakeup,(type :a)
11:05clojurebotclojure.lang.Keyword
11:05wakeupThis will haunt you a long time.
11:05llasram?
11:05llasramWhat will
11:06lunkmullr: that looks like it would definitely work. overkill for this particular case, but thanks for the info regardless.
11:06llasram,(map ifn? [(fn []) {} :a 'a])
11:06clojurebot(true true true true)
11:07lunkmullr: think i'll try instance/cond approach in a function first
11:07mullrlunk: n/p, good luck!
11:07wakeupllasram: Well type doesn't seem to work on functions.
11:07wakeupassuming it is the analogue to CL's TYPE-OF
11:08wakeupThe more I get into clojure the more I realize the chaos
11:08lunkmullr: any idea how to test a type that's an inter-op with a java class, that doesn't have an empty constructor?
11:08llasramwakeup: It isn't. `type` returns the concrete type of an object, which for functions is a different concrete type for each function
11:08TimMcwakeup: Side note: You usually want class, not type.
11:08lunkmullr: i guess object would work, but it's not as correct
11:09wakeup,(class (fn []))
11:09clojurebotsandbox$eval145$fn__146
11:09llasramTimMc, wakeup: Eh, `type` gives you a bit more flexibility.
11:09mullrlunk: You mean a java type? just write it down. java.lang.String, etc.
11:09llasramwakeup: `type` gives the same results as `class`, unless the object has `:type` metadata
11:09nathanic,(doc ifn?)
11:09clojurebot"([x]); Returns true if x implements IFn. Note that many data structures (e.g. sets and maps) implement IFn"
11:10wakeupSo there is no function type? just a function interface?
11:10llasramwakeup: Because so many things on the JVM and in Clojure depend on interfaces, having a single "type" for something isn't that useful
11:10llasramFor example, vectors are functions, indexed, and associative, among many other things
11:10wakeuphmm
11:10wakeuppretty frankenstein if you ask me
11:11llasramOnce you get used to it, it's pretty powerful, especially with the addition of protocols
11:11arkhduh - re: my previous question, subseq is what's needed
11:11TimMcwakeup: Interfaces *are* a "type".
11:11devnanyone use zephyros?
11:12TimMcs/a type/types/
11:13TimMcdevn: You *know* which factoid I'm going to have to pull up now, right?
11:13carkI've been trying to test core.async with clojurescript and cljs-build, but i get this error : "
11:13cark> I've been trying to test core.async with clojurescript and cljs-build, but i get this error : "
11:13cark> I've been trying to test core.async with clojurescript and cljs-build, but i get this error : "WARNING: Use of undeclared Var cljs.core.async.impl.ioc-helpers/keyword-identical?...."
11:13carkhum oops
11:14carkanyways... it obviously doesn't work, maybe i'm not usiing the correct version of clojurescriptp ?
11:14lunkmullr: derp, making it way too hard
11:15llasramwakeup: My current favorite trick is extending a protocol to Fn
11:16carki'm using core.async 0.1.242 and lein-cljsbuild 0.3.3
11:16devnTimMc: Madison Square Clabango?
11:16devnclabango?
11:16clojurebotclabango is madison
11:18indigosm0ke: ORMs are a faulty abstraction
11:20mullrwakeup: It's worth noting that result is different for clojurescript:
11:20mullrClojureScript:cljs.user> (type (fn []))
11:20mullr#<function Function() { [native code for Function.Function, arity=1] }
11:20mullr>
11:20mullrThe JVM doesn't have a function type, while javascript does.
11:20TimMcdevn: ~anyone :-P
11:21jonasencark: you'll need to explicitly add the latest cljs release to project.clj
11:21noncomis java 8 gonna have functional type?
11:21carkjonasen: ah I thought it was something like that, i'm currently trying to find a place to see which one is the last
11:21noncoms/functional/function
11:22noncomi remember them talking about lambda support for java 7 but delayed for java 8. will it affect clojure somehow?
11:22mullrnoncom: afaik, it won't; it'll just let you reify a single-method interface in a way that looks like a function literal.
11:23TEttingerclojure fns will probably still be better
11:23noncomsounds similar to what scala and clojrue already do
11:23TEttingeryeah. it might provide more backend at the JVM level though
11:25jonasencark: http://search.maven.org/#search%7Cga%7C1%7Cclojurescript
11:25jonasen0.0-1909
11:25carkjonasen: thanks !
11:26mullrlooks like it is indeed different: http://zeroturnaround.com/rebellabs/java-8-the-first-taste-of-lambdas/
11:27mullrthough I'm not sure what a lambda's *type* would be
11:29ToxicFrogmullr: it says right in that article
11:29gfredericksany interface with a single abstract method?
11:29ToxicFrogIt has the type of the SAM interface it implements
11:30ToxicFrogSo if your lambda is implementing Runnable.run(), it has type Runnable
11:30mullrBut surely it has a concrete type as well
11:31gfredericksan anonymous class?
11:31gfredericksjava has had those for a while, just syntactically clunky
11:31carkjonasen: hum not too great tho, now the warning about cljs.core.keyword-identical? disapeared, but it's still not defined !
11:31noncomone more link http://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html
11:32TEttingermaybe lambda is the implicit parent of sam interfaces, like object for all objects?
11:32mullrFrom what this article says, the lambda turns into a method in the same class it's used in
11:32noncomand http://cr.openjdk.java.net/~briangoetz/lambda/lambda-translation.html
11:34noncomso they are very different from clojure
11:35mullrThat last link seems to have it… and the answer is "it depends"
11:35mullrdifferent indeed
11:36carkjonasen: or your info, i only had to delete (clean if you will) the pre-compiled stuff from old clojurescript
11:36carkfor*
11:37carkjonasen: so now it's working, thanks again
11:38noncomthat implementation of lambdas does not seem good to me. sure i am not a compiler designer, but it just looks like they're trying to play around the existing jvm paradigm.. sure they have to..
11:39noncombut it does not look.. ummm... healthy..
11:40jonasencark: great!
11:47seangrov`Ah, damnit, you can't really update cookies with a redirect.
11:59TimMcseangrov`: Really? :-(
12:02rodnaphanyone able to help with getting started in core.typed?
12:03rodnaphwhile attmepting to check a namespace i'm getting an error about an interop call - " Call to instance field getBytes requires type hints."
12:03rodnaphbut finding the docs on the wiki a bit dense...
12:06gfredericksrodnaph: do you call .getBytes somewhere?
12:06rodnaphyes, in a function - but i'm not sure how to go about type hinting it. here's the fn...
12:07rodnaph(ann string->stream [String -> ByteArrayInputStream])
12:07rodnaph(defn string->stream [string]
12:07rodnaph (ByteArrayInputStream.
12:07rodnaph (.getBytes (.trim string))))
12:07gfrederickshm
12:08gfrederickspresumably core.typed knows it's a string
12:08gfredericksso naively it doesn't seem necessary
12:08gfredericksbut you could try (.getBytes ^String (.trim string))
12:11gfredericksperhaps core.typed is trying to help you avoid reflective code for some reason
12:13TimMcOr put the ^String in the arglist.
12:14TimMcrodnaph: Oh, and remember to specify your encoding with getBytes (almost certainly UTF-8)
12:18mullr"(almost certainly UTF-8)" Isn't it nice to be able to say that?
12:20mtpalmost
12:20mtp:)
12:20mtpIT COULD BE UTF-EBCDIC AND THEN WHAT
12:25TimMcUgh, UTF-EBCDIC.
12:25TimMc(Sadly, this is a thing: <https://en.wikipedia.org/wiki/UTF-EBCDIC&gt;)
12:25TimMcgfredericks: More like Tim'msee
12:35gfredericksllasram: what is it that has boggled your mind.
12:43maris`has anyone use leiningen to publish artifacts to a remote maven repo ? where should I specify password ?
12:43mdrogalismaris`: It depends which you're trying to publish to.
12:44maris`private repo, we are using artifactory
12:44mdrogalismaris`: Specify it in your .profile as a GPG key.
12:45maris`lein complains about password "No credentials found for snapshots"
12:46rodnaphgfredericks: TimMc: that worked, thanks a lot!
12:47maris`do I have to use GPG ? plain strings won't work ?
12:47mdrogalismaris`: Have you seen the Leinigen Wiki page about setting up keys?
12:47maris`{"snapshots" {:url "http://10.0.1.136:8081/artifactory/libs-snapshot-local&quot;
12:47maris` :username "xxx"
12:47maris` :passphrase "xxx"}}
12:47mdrogalisUnless it's a CI machine, it's kind of a pain to do without keys.
12:47@technomancymdrogalis: signing artifacts before publishing is different from authenticating to deploy
12:48@technomancymaris`: if you use full-disk encryption you can place your credentials in an unencrypted file
12:48mdrogalistechnomancy: Ahh. Brb, lunch.
12:48nDufftechnomancy: only worried about offline attacks?
12:48maris`it is CI machine, we are trying to make it work from CI server
12:49@technomancymaris`: oh, gotcha. see the "full-disk encryption" section under `lein help deploying`
12:49nDuffmaris`: I do that with SSH forwarding -- trigger the CI build over SSH into a restricted account that runs the build in the sandbox with the user's agent forwarded.
12:49@technomancynDuff: not "only", but I can't in good conscience recommend storing plaintext creds on a developer's laptop
12:50nDuffmaris`: ...that way the CI server can SFTP into the artifact repository as the user, connect to source control as the user, &c., but not be able to use that user's credentials beyond the duration of their connection.
12:50@technomancynDuff: we have a security berserker at work who threatens summary decapitations for less
12:50nDufftechnomancy: I don't see a need for plaintext creds. Store your keys encrypted and use the {ssh,gnupg}-agent interface to store unlocked versions in non-pageable memory.
12:51@technomancynDuff: yeah, that's what the lein docs recommend
12:51TimMcI want to be a security berserker.
12:51nDuff...granted, root can still get into that, but *shrug*.
12:54@technomancyhat and beard, hopefully?
12:55nDufftechnomancy: ...well, yah, that's the other part of it -- fiancee has insisted that I ditch most of the beard.
12:55gfredericksthe lefternmost 3/4 presumably
12:59goraciohi, can someone advise what to use for realtime backend for web site ? something similar to tornado and socket.io - core.async ?
13:00nDuffgoracio: have a look at http://http-kit.org/
13:01nDuffgoracio: core.async is great, but it doesn't give you a complete, usable web stack.
13:01sm0kehello anyone using https://github.com/MichaelDrogalis/dire ?
13:01goracionDuff: great i will look at it
13:01mdrogalissm0ke: Me. ;)
13:02sm0kemdrogalis: any thoughts?
13:02mdrogalissm0ke: Well, I like it.
13:02nDuffgoracio: ...you might find http://shenfeng.me/600k-concurrent-connection-http-kit.html interesting, by the way.
13:03sm0kei just looked at it imagined how fu**ing awesome it would be to have all error handling for the whole code in a seperate namespace?
13:04sm0kemdrogalis: i have one doubt though, how do you propogate errors using dire?
13:04mdrogalissm0ke: Indeed, it's pretty awesome. https://bitbucket.org/jotspec/server/src/4e12292560c66e03a9066f595457f4e2069a595a/src/jotspec/handlers.clj?at=refactor
13:04mdrogalissm0ke: throw
13:05sm0kemdrogalis: awesome! what i thought
13:05goracionDuff: ok ) used to work with rails usually but rails really bad with it (
13:05bbloomguys…. i miss sexprs...
13:05sm0kei am going with dire for sure
13:05bbloomi'm doing various js/ruby/html stuff now
13:05bbloomand all this string templating sucks :-/
13:06mdrogalissm0ke: Happy trails.
13:06mdrogalisI'm off again for a bit. Be back later.
13:08sm0kehave a good one
13:09sm0keoh i just realize i was talking to the author of the library
13:12yediman, uberjar is pretty sexy, esp coming from someone with no sysops experience
13:14sm0keyedi: its a double edge sword
13:14yedihow so
13:14jacobmj/
13:15sm0keit just unjars everying thing into a single jar..which can be nightmare for multiple dependencies with common ackage structure
13:16sm0keespecially the log nuisance in java worls
13:16sm0keworld*
13:17gfredericks,(Math/nextAfter 3.0 4.0)
13:17clojurebot3.0000000000000004
13:19gfrederickshuh. presumably you could use that to make a list of all the doubles in order
13:21hyPiRionah, just what I need
13:25coventryFor code wrapping purposes, I'd like to be able to access a macro from an arbitrary ns, the way you can with functions. Is there any way to do this without dropping a reference to the macro or its containing ns into the target ns? It appears that a form like (#'clojure.core/when 1 2 3 4) is treated as a function call, with [1 2] replacing [&form &env].
13:26gfrederickscoventry: I do not quite understand what problem you're trying to solve
13:26gfredericksyou can use macros from any namespace...
13:28gfrederickswhat are "code wrapping purposes"?
13:33coventryI've run into some problems with riddley which I think are difficult to solve in full generality (https://github.com/ztellman/riddley/issues/9). I have an idea for an alternative approach which does the same sort of walking as riddley, but does it at macroexpansion time. I.e., I would wrap every form in a macro which upon expansion wraps every form in its body in a macro, etc. But I need a way to refer to this wrapping macro in the
13:33coventrytarget source file/namespace. I could drop it in with an (intern), or by tampering with the (ns) form. I'm wondering if there's a more elegant way.
13:34gfredericksyou want a macro A that expands to calls to macro B and don't know how to do that?
13:35coventryNo, I have a file file.clj which I want to read in, wrapping every top-level form with a macro A, and I want a clean way to refer to A in file.clj's namespace(s).
13:36gfredericksif you know that A's namespace will be loaded, all you need is to use the fully qualified symbol that refers to A
13:36gfrederickssyntax-quote normally takes care of this for you
13:36gfredericks,`when
13:36clojurebotclojure.core/when
13:38coventryThat means some way of dropping a reference to A's namespace on file.clj during the read process. I was looking for a way to avoid that. For instance, I can do a (#clojure.string/replace) call without having a reference to clojure.string in the current ns. It would be nice to have a way to do that with macros.
13:39coventry(Nice for this particular application.)
13:39gfredericksthat's the same though
13:39gfredericksbecause that requires somebody to have loaded clojure.string
13:39gfrederickswhat do you mean by "dropping a reference to A's namespace on file.clj"?
13:40seangrov`I've learned a valuable lesson, now please make the pain stop...
13:40@technomancylast night I found myself wondering if it would be possible to write a macro that could losslessly collapse nested `loop`s into a single loop containing each of the loop locals
13:41@technomancyfor something like http://paste.lisp.org/display/139288
13:42coventry(Oops, meant #'clojure.string.) gfredericks, wrt loading of clojure.string: Yes, my code analysis library will be administering the reading and transformation of file.clj's form, so it will have loaded the ns containing macro A.
13:42@technomancyan inner recur would just recur with the outer locals unchanged, but an outer recur would reset the inner locals to their initial value
13:42@technomancydoes that make any sense?
13:43TimMccoventry: So just use name.space/my-macro, done.
13:43gfrederickscoventry: so I'm not sure why something like (cons `my-A-macro some-form) will not suffice
13:43TimMctechnomancy: How would this be different from non-anaphoric loop/recur?
13:43rasmustotechnomancy: it would be cool if list comprehensions could do something similar
13:43TimMcOr is that the goal?
13:44@technomancyTimMc: you can't "outer-recur" with nested loops
13:44TimMcI know.
13:44TimMcI think that's what I said. :-P
13:44coventrygfredericks: wrt "dropping a reference", I mean either (intern file.clj-namespace 'A A-macro) from the outside, or injecting something like (require 'A-macro-ns) into file.clj.
13:45@technomancyTimMc: that's the only difference I had in mind. I'm not totally sure it works.
13:45TimMccoventry: Just try what gfredericks is suggesting, please.
13:45@technomancytotally sure it's feasible, I mean
13:45gfrederickstechnomancy: do you think the bytecode optimizes for when some of the locals don't change?
13:46@technomancygfredericks: no idea
13:47coventryTimMc: The trouble is that my-A-macro is not in the context where that cons will be evaluated. There are multiple feasible ways to get it in there, but I was asking about a way to avoid having to do that.
13:48coventryIf I have to inject it explicitly, I probably have to do so for every form, in case the last form changed the namespace. Not onerous, just ugly.
13:49gfrederickscoventry: in what sense is it "not in the context"? if it's been loaded into the jvm _at all_ then it is enough "in the context" to refer to it via a fully qualified symbol
13:50logic_progI need to use a sql database as part of my Clojure app. Is there a standard quite of benchmarks that both MySQL and Postgresql run on?
13:51nDufflogic_prog: (?)
13:51coventrygfredericks: Oh, I understand now. Thanks.
13:51@technomancylogic_prog: don't choose based on benchmarks
13:51nDufflogic_prog: if I were trying to decide between those two datastores, benchmarks wouldn't come into it.
13:52@technomancymysql always wins at benchmarking because they just turn off all the "actually store your data consistently and safely" features
13:52nDufflogic_prog: benchmark results, in general, are all about the tuning. MySQL, out-of-the-box, has historically been tuned for performance over safety, and PostgreSQL, out-of-the-box, has historically been tuned for safety over performance (and to run on very resource-constrained systems)
13:52nDufflogic_prog: ...but you can tune either one either way.
13:54hiredmanfun fact, if you google "mysql fast migration" a large chunk of the front page is results for how to quickly migrate off of mysql
13:55logic_progtechnomancy: oh, mysql wins = via "we'll store shit in ram and never write to disk" ?
13:55nDufflogic_prog: nope.
13:55nDufflogic_prog: they write to disk, but do it poorly.
13:55hiredmanor, I should say, that was the case last time I checked
13:56logic_proghiredman: lol
13:56@technomancylogic_prog: iirc it's more like acknowledging writes before the disk buffers have flushed; stuff like that
13:57nDuff...which, if done poorly enough, can be worse than just losing the last few committed writes; if your metadata and your data are inconsistent with each other...
13:57nDuffs/committed/"committed"/
13:57@technomancybut yeah, unless you're distributing software for people to run in settings you don't control, I can't imagine a very solid case being made for mysql over postgres.
13:57mtpbut nobody knows postgres!!1one
13:58mtpmysql is industry standard and comes with my expensive pay-for enterprise linux distribution
13:58mtpi am a marketing fool, let me wipe my face with my own poo
13:58dnolentechnomancy: are you thinking about something like recur-to proposed by Michal Marcyk on clojure-dev a while back?
13:59@technomancydnolen: hm; no, I missed that, but it sounds like the same idea
14:02logic_progdnolen: !!!
14:02logic_progdnolen: I've been studying core.logic:
14:02logic_progdnolen: at it's core, is it juat an unification algorithm ?
14:03logic_progdnolen: besides unification algorithm + optimizations, what is there to core.logic / miniKanren? I feel like I'm missing something fundamental.
14:03dnolenlogic_prog: mK is unification + interleaving search
14:03logic_proginterleaving seach = condi, but not conde ?
14:04logic_progdnolen: actually, ignore what I just said. Can you explain to me why interleaving search is important?
14:04dnolenlogic_prog: yeah mK doesn't include condi anymore, but the version in TRS does
14:04logic_progdnolen: I fail to grasp this fundamental decision
14:04dnolenlogic_prog: rather I mean condi is the only one - there's no conde, that is condi *became* conde
14:04logic_progdnolen: I know that in core.logic, there is condi and there is no conde.
14:05logic_progdnolen: I don't understand why "interleaving search" is important/interesting
14:05dnolenlogic_prog: but this is true for mK now
14:05dnolenlogic_prog: more programs produce results
14:05logic_prog{core.logic, mK} both has condi; neither has conde
14:05logic_progdnolen: oh, there are certain things wher conde will infinite loop, but condi produces results?
14:05logic_progokay, I can believe that.
14:06dnolenlogic_prog: depth first so yes
14:06logic_progI see, so if I have something like (cond [infinite loop] [produce result] )
14:06logic_progconde hangs, while condi hits the [produce result] part
14:06dnolenlogic_prog: yep
14:06logic_progdnolen: besides unification + interleaving search, are there any other main ideas behind core.logic ?
14:07dnolenlogic_prog: constraint solving
14:07logic_progdnolen: how is that not just unification?
14:07dnolenlogic_prog: specifically finite domains and nominal logic
14:07mdrogalisdnolen: Just gave your Lambda Jam talk a watch. Fun stuff. :)
14:07logic_prog(in particular, isn't constriant solving = unificatino saying "fuck, I can't unify this, backtrack" ?)
14:07dnolenmdrogalis: thx
14:07rasmustologic_prog: unificatino, heh
14:07dnolenlogic_prog: yes, except ... performance
14:10coventryRegarding logic programming, etc., I've been reading Out of the Tarpit, and it would be great to have an example of app which comes close to its ideal of specifying its own requirements independently of implementation details. It all feels a little utopian, although a great ideal to strive for. (Just finished chapter 7, though. Maybe he gets more concrete later.)
14:10coventry*section 7
14:10mtpcoventry how about urbit
14:11mtphttp://www.urbit.org/2013/08/22/Chapter-2-nock.html it basically specifies some axioms of software
14:11coventrymtp: Thanks, I'll take a look.
14:13logic_progdnolen: thanks, this was a fantastically insightful 5 minutes
14:13dnolenlogic_prog: np
14:13logic_progcoventry: also, Coq -- it's all about specs and proving theorems, efficienty be damned. Natural numbers are defined as: nat := 0 | forall (n: nat), S n
14:13logic_prognumbers are _unary_ :-)
14:14mtp"church numerals"
14:16aaelony hmm, the following works (clj-time.core/date-time 2012 01 30 12 34 56) ;; #<DateTime 2012-01-30T12:34:56.000Z>, but when I parse from a string I get a ClassCastException... (clj-time.core/date-time (into [] (map #(Integer/parseInt %) (clojure.string/split "2012-01-30 12:34:56" #"(-| |:)")) )) ;; ClassCastException clojure.lang.PersistentVector cannot be cast to java.lang.Number clj-time.core/date-time (core.clj:196) I'm probably
14:16aaelonymaking another silly mistake...
14:18nathanicaaelony: into is producing a vector, which you are passing to date-time. perhaps you want to use apply.
14:18aaelonynathanic: cool, I'll try that
14:19rasmustoaaelony: don't you want to be using clj-time.format/parse?
14:20aaelonyrasmusto: you're right. Maybe that's better. What I'm really getting at is a function that takes in a date-string and tells me if it's in daylight savings time or not, going both forward and back in time...
14:22rasmustooh hm, not sure how you'd do that, but I think using "parse" and getting a date is the first step
14:22nathanicaaelony: in general i would mention that clojure.core/mapv will directly produce a vector (non-lazily), and give you the same result as (into [] (map ...)) but more efficiently. and you probably didn't need a vector there anyway. :-)
14:22aaelonyI'm thinking to just convert the date-string to a datetime, then use within? and interval together
14:23mikerodIs there a good/efficient way to check before calling a method that it won't result in java.lang.AbstractMethodError?
14:24sm0kewhy is it that ##(:a {:k 1}); doesnt thow exception?
14:24lazybot⇒ nil
14:25sm0keshould one just check for nil and throw exception?
14:25hiredmanmikerod: abstractmethoderrors are normally sort of a correctness problem, not something you would deal with at runtime
14:26rasmusto##(contains? {:k 1} :a)
14:26lazybot⇒ false
14:26hiredmanit means something isn't lining up correctly
14:26mikerodhiredman: Yeah, I can see your point there.
14:26hiredmanyou are calling methods on a class that claims to implment a particular interface, but doesn't really, or something similar
14:27aaelonyI think the reason I shy away from clj-time.format/parse is that I find formatters confusing
14:28bts-for dev work, i have my app configured using lein's :env in project.clj. i am trying to move the app to prod. do most people use lein in production to help with config/environment stuff like this, or is there some common pattern? it would be nice if i could keep dev and prod configuration in the same place (like project.clj)
14:29bts-i'm currently using environ for development
14:32sm0keeven java map would return null i guess
14:35sm0kei think i am thinking too much about exceptions after heated argument with friend about me saying exceptions are overrated and he would need exception handling for his exception handling code
14:35sm0keblah
14:36rasmustoI find exceptions hard to reason about, but there are always exceptions...
14:37sm0kenice one
14:37uvtcrasmusto, I take exception to that.
14:38sm0keyou had a problem and tried to use exception , now NullPointerException
14:38gfredericks(when-not (nil? x) (throw (NonNullPointerException. "should be null")))
14:39sm0keeh not as nice..i liked "You had a problem and tried to use parallelism, now problems two have you"
14:40uvtchehe
14:42jenny1986http://Fun4Days.com/sms/sms.php?share=178616
14:43sm0kewtf bots posting porn video links? so it has come to this
14:43uvtchit and run spam on #clojure? Hm. First time I've seen that.
14:43indigoWe must be getting popular ;D
14:43havenwoodsame bot just hit #ruby
14:49rurumateeuroclojure anyone?
14:51mdrogalisSomeone here was saying that gen-class isn't the way to do it anymore - that its recommended to use a Java shim to call into the Clojure code. Did I remember that bit correctly?
14:51devn(:require [clojure.core.async :exclude [map into reduce merge] :as async :refer :all] :reload-all)
14:51devnis there a better way to do this?
14:51devnerr, sans reload-all
14:54rasmustodevn: better in what way? What about ":as async" or something so you don't get the collisions
14:55jonasendevn: or you can (:refer-clojure :exclude [...])
14:57devnrasmusto: i find the need to prefix everything with async as really chatty
14:58devnjonasen: i think i prefer to exclude from async so I need to be explicit when I want to use async/into, async/merge etc. rather than clojure.core/into
14:58jonasendevn: I agree
14:58devnanyway, it's not a big deal, i just noticed that since i last played with async the namespace declaration is getting to be kind of unwieldy
15:00jonasendevn: why don't you just :refer the vars you actually use?
15:00jonaseninstead of :refer :all
15:11cmajor7why would lein not resolve transitive dependencies for jars that were deployed to a local maven repo?
15:12hiredmanbecause when you mvn installed those jars the poms you created didn't have the correct dependencies
15:13cmajor7that is a logical conclusion, but they do :)
15:13cmajor7have correct dependencies
15:13cmajor7I used "lein localrepo install" and -p for a pom that "lein pom" produced
15:14cmajor7just curious what could have gone wrong
15:14cmajor7at the same time I understand that with maven anything can go wrong.. :)
15:15hiredmandid you actually set up you project from the "local repo" you are publishing to?
15:17cmajor7ok, false alarm.. there is something wrong with the box.. I see some other apps throwing "Caused by: java.io.IOException: No space left on device".. thx for responses though
15:44bitemyappianeslick: hi
15:44ianeslickbitemyapp: hi
15:45bitemyappianeslick: how's the startup?
15:45ianeslickCranking away!
15:45bitemyappstrangemonad: I like the nick, having a hard time envisioning what a strange monad would be though.
15:45bitemyappstrangemonad: Cont of Conts?
15:45mtpit's like a top quark
15:45bitemyappianeslick: good luck :)
15:49ianeslickbitemyapp: May be fruitful to have an offline conversation about what I'm up to.
15:50bitemyappianeslick: I'd like that. Are you in the Yay?
15:50ianeslickbitemyapp: Yay?
15:50bitemyappianeslick: Yay! Area - bay area.
15:50bitemyappSF Bay Area. It's in California. You should check it out sometime. I hear startups are big here.
15:51ianeslickbitemyapp: Totally outta the loop on vernacular I see. The office is at 1st and Market!
15:51ianeslickbitemyapp: That's downtown SF to you.
15:51rurumateCascalog hello-world question incoming. I have the jobtracker running on port 50030, now (?- (stdout) sentence) apparently runs some hadoop job, but there are no retired hadoop jobs listed on localhost:50030/jobtracker.jsp. How to configure cascalog to connect to an actual jobtracker, instead of running things in memory?
15:51bitemyappianeslick: I'm at 3rd and Brannan. :)
15:51llasramrurumate: The stdout sink only works in local mode
15:52ianeslickbitemyapp: "It's a small world…"
15:52rurumatellasram: hmm, good to know
15:52ianeslickbitemyapp: Lunch next week? Tue or Wed?
15:52konris there a way to redefine a function using its old version in the redefinition, and not the redefined one? The following causes a stack overflow: (let [wrap #(str "[" %)] (with-redefs [wrap #(str (wrap %) "]")] (wrap "a")))
15:52bitemyappianeslick: Tuesday would work well.
15:53llasramrurumate: For actually running from a REPL against a cluster, you need to run an nREPL server w/ the correct Hadoop classpath to pick up the Hadoop JARs and config
15:53llasramrurumate: You can either use `hadoop jar ...` to launch something which starts an nREPL server
15:53llasramrurumate: Or use leiningen and add the exact version of hadoop on your cluster to your deps and your hadoop config dir to the :resource-paths
15:54rurumatellasram: hadoop jar or java jar?
15:54llasramThe `hadoop jar` subcommand. That launches a class from a JAR with the environment configured for Hadoop, including Hadoop dependency JARs and config on classpath
15:54ianeslickbitemyapp: Taking this offline (see email:)
15:55rurumatellasram: can the repl server be launched as an hadoop job?
15:55llasramNo
15:55llasramI mean, you could
15:55llasramBut it wouldn't make much senes
15:55llasram~sense
15:55clojurebotexcusez-moi
15:56rurumatellasram: ok, the second options looks good idea
15:56dobry-dentechnomancy: i got this syntax to work in elisp. (let. [x 1 add (fn. [a b] (+ a b)) y 2] (add x y))
15:57dobry-dena feat for the noob
16:05nycsuser=> (seq? [[1 2]])
16:05nycsfalse ;; why?
16:05coventry,(sequential? [[1 2]])
16:05clojurebottrue
16:06coventry,(doc seq?)
16:06clojurebot"([x]); Return true if x implements ISeq"
16:06nycsoh
16:07bitemyapp,(seq? '())
16:07clojurebottrue
16:14noonian,(doc sequential?)
16:14clojurebot"([coll]); Returns true if coll implements Sequential"
16:14noonian,(doc Sequential)
16:14clojurebotI don't understand.
16:19tbaldridge,clojure.lang.Sequential
16:19clojurebotclojure.lang.Sequential
16:20tbaldridgenoonian: it's an interface
16:20coventryhttp://www.brainonfire.net/files/seqs-and-colls/main.html
16:32dobry-denthis is a slow afternoon for me. how can i turn [\0 \1 \1 \0] into [0 1 1 0].
16:33mdrogalisdobry-den: (map #(Integer/parseInt (str %)) coll)
16:33dobry-denof course. thanks
16:34mdrogalisSure.
16:35rasmustowhy do function call signatures pop up in my *nrepl* buffer but not in my .clj file buffer in emacs?
16:36dobry-denrasmusto: in what context? when i hover over a function, it displays the sig in the minibuffer. when i'm autocompleting, it shows the sig in the autocompletion popup.
16:37dobry-den(clojure.repl/doc myfunc) is only way i see sigs in *nrepl*
16:38rasmustodobry-den: I can hover over prn in *nrepl* and see the sig, but in a normal file buffer it doesn't show it
16:38gfredericks,(->> (repeatedly 5 #(rand-int 500)) (map char))
16:38clojureboteval service is offline
16:38gfredericks&(->> (repeatedly 5 #(rand-int 500)) (map char))
16:38lazybot⇒ (\Ǎ \( \_ \Ƅ \Ä)
16:39rasmustodobry-den: er what? now it's showing call signatures for some other lisp in my clj buffer :o
16:39rasmustooh, I manually turned on ElDoc
16:46@technomancydobry-den: wow, faking out lisp-1 in a lisp-2? very cool.
16:46uvtcRegarding seesaw, can anyone tell me what "actions" are, or what the difference is between actions and listeners?
16:47rurumatellasram: tried with hfs-seqfile instead of stdout, and added the hadoop-1.2.1 dir to the classpath with :resource-paths. But apparently the job still runs in-memory. Maybe I overlooked something?
16:49nDuffuvtc: Seesaw's actions wrap Swing actions, so it'd probably make sense to start with Swing's docs there.
16:49llasramrurumate: Your cluster configuration on the lasspath?
16:51nDuffuvtc: ...actions complect a bunch of additional things together -- keystrokes, mnemonics, handlers, etc., while listeners are just listeners.
16:51uvtcnDuff, yes... though, the Java docs tend to jam terms together, such as ActionListener and ActionEvent...
16:52uvtcnDuff, ok.
16:52rurumatellasram: oh you mean, I need the conf/ folder in classpath root? no
16:53llasramYep. That's how it finds those files once the JVM starts
16:55rurumatellasram: oh yeah it works, thank u
16:56llasramnp
17:00rasmustodobry-den: I was missing a hook for 'nrepl-turn-on-eldoc-mode, found it
17:17aaelonyFor those interested, here's a refheap to my daylight-savings-time? function. https://www.refheap.com/19417 Internally there is a vector of daylight savings time ranges for 2012 and 2013. The function returns true or false for an input date string.
17:21gwsaaelony: interesting, what about wrapping http://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html ?
17:24aaelonygws: maybe but this suits my purpose better and I find it less confusing.
17:29nathanicaaelony: I think you can factor out some redundancy by simply using `or` instead of that `if` and `true` and `some` business. something like:
17:29nathanicaaelony: (defn dst? [date-string] (let [date (to-datetime date-string)] (or (within (interval ...) date) (within (interval ...) date) ...))
17:32aaelonynathanic: I need it to return false instead of nil for the non-true case though
17:32nathanicaaelony: `or` returns true if any of its arguments is truthy. else it returns false.
17:33aaelonynathanic: that's correct, but some returns nil when not true
17:34tbaldridgenathanic: correction, it returns truthy
17:34tbaldridge,(or false nil 42)
17:34clojurebot42
17:34taloshelo is this a sex room?
17:34mtpyes
17:34talosi am nude
17:34nathanicaaelony: you don't need `some` as far as i can tell
17:34mtpwe have sexpressions
17:34mtp(oh 'baby)
17:34llasram*snort*
17:34mtp(defn fuck [partner] (let [pants off
17:35nathanictbaldridge: I stand corrected :-)
17:35llasramI have been told that the correct pronunciation of s-exp is "sex-p"
17:35uvtchehehehe
17:35uvtcGah. Crude humor catching me off guard here.
17:36talosyou boring i am going to scala sex room
17:37talos#scala
17:37aaelonynathanic: probably right. I only added it when (time/date-time 2014 11 02 02) was bombing and became (time/date-time 2014 11 2 02)
17:37clojurebotexcusez-moi
17:37nathanicand regarding `or` returning truthy, I suppose I did know that, because I have done a lot of (let [x (or some-arg-that-might-be-nil default-value-if-that-arg-was-nill)])
17:38talosbuy room :)
17:50@technomancytalos: sod off
17:51@technomancyoh, he left
17:51mtptechnomancy "i chased him out" :)
17:55@technomancymtp: gotta put on your robe and wizard hat
17:56mtpor i can just take out my sexpressions
18:07yeoj___is there anyway to use a not= and compare the results to multiple items... it's already embedded in a map so i'm not sure.
18:08yeoj___It's a beginner question, sorry. pastebin'd here: http://pastebin.com/FBiPtrk8
18:09yeoj___i don't think i should be "nesting my filter" because i want to filter on the not= to a coll
18:09rasmustoyeoj___: and?
18:10ucbyeoj___: you can filter with a set and not
18:10ucbyeoj___: like (filter (comp not #{:this :that}) collection)
18:10ucbwait
18:10`cbpremove? :P
18:10ucb,(filter (comp not {:foo :bar}) '(:foo :bar :baz))
18:10rasmustoucb: (remove #{:a :b} coll)
18:10clojurebot(:bar :baz)
18:11ucbthat's probably nicer :)
18:11rasmustoyou have to be careful about falsey values in the set though
18:11ucband correct
18:11ucbyeah, that's what I was thinking
18:11rasmusto,(remove #{nil false :a} [nil false true :a :b])
18:11clojurebot(nil false true :b)
18:11yeoj___geez. lisps bend my brain. in a good way.
18:12rasmusto,(remove #{nil false :a} [nil false true :a :b])
18:12clojurebot(nil false true :b)
18:12rasmusto,(map #{nil false :a} [nil false true :a :b])
18:12clojurebot(nil false nil :a nil)
18:12yeoj___ucb: the problem
18:12yeoj___ucb: the prob is there are two collections
18:13yeoj___ucb: i want to filter all results (coll) to make sure it's not any of another collection
18:14rasmustowait a second, now I'm confused about the "set containing falsey values as a predicate" thingy
18:14rasmustohow do nil and false get through?
18:15coventryyeoj___: Where is the other collection in your pastebin?
18:15yeoj___coventry: it's in the comment
18:15rasmustooh, nm, was thinking of filter
18:15jonasaci've bumped into this a couple of times now and figured i should ask here in case there is a good way to do this
18:15yeoj___coventry: so, i want to filter the results to make sure the schema is not in '("pg_catalog" "information_schema")
18:15jonasaci have a function like [x & y]
18:15jonasacand i wanto recur on it
18:16yeoj___coventry: i'm trying to look at postgres, and return all tables that are interesting. i.e. not system tables. I want to build a database automapper sorta thing, to generate ddl for othre systems based on lookups. (i.e. postgres timestamp -> mssql datetime ) for data migration stuff.
18:16joegallojonasac: and have you run into a problem doing that?
18:17rasmustojonasac: are you wondering about the termination condition?
18:17rasmusto(because I am too)
18:17jonasacno but i want to do something like (recur ~@y)
18:17jonasacif that makes sense
18:17coventryyeoj___: Try (remove #(#{"pg_catalog" "information_schema"} (:table_schem %)) (get-sql-metadata...))
18:17jonasacsince clojure packs y into a vector
18:18yeoj___coventry: ok thanks. i'll try to understand that statement. so much to learn. too bad it's not my day job. :/
18:19coventryyeoj___: ##(#{0 1} 2)
18:19lazybot⇒ nil
18:19yeoj___coventry: that works... but i don't exactly understand it yet. But cool beans. thanks.
18:19coventryyeoj___: ##(#{0 1} 1)
18:19lazybot⇒ 1
18:19rasmustojonasac: would it work to have the second argument be a collection? Do you need the multi-arity thing?
18:20jonasacrasmusto: thats the way i usally solve it, but it encouter this quite alot of figured i should see if there is some 'idimatic' way to do this that i just missed or something
18:20rasmustojonasac: that way you can terminate on (empty? coll)
18:20rasmustojonasac: i think it gets weird checking for that condition if you have, say, a nil last element
18:20rasmustoso you'd have a [x nil, y '()]
18:21rasmustowhich means you skip one loop
18:21jonasacyeah the last binding will be nil
18:21jonasaclooks like i'll have to change my ways :p
18:22rasmustoi've tried to do fancy vector destructuring with loop/recur, and that termination thing has always felt clunky
18:22jonasacyah
18:22jonasacworking on 4clojure golfing
18:22rasmustoah, that's why you don't use a let :p
18:22jonasacyep
18:23rasmusto,(filter #{nil false :a} [nil false true :a :b])
18:23clojurebot(:a)
18:23rasmustoah, that's what I remember about set-as-a-predicate-with-falsey-elements
18:23@technomancyztellman: you don't work with icylisper any more, do you?
18:30frozenlockIs there a function to check if a string 'looks like' a date time?
18:30frozenlockThe closest I got was to use clj-time and try to unparse using pretty much all formatters :-/
18:31frozenlockParse even
18:32jonasacfrozenlock: regex ;p
18:48mdeboardMan I would love something like clojure's threading macros in javascript. Maybe cljs has this but like (->done (->then promise f1 f2 f3 f4) finalFunc)
18:50mdeboardof course cljs uses channels for that sort of logic.
19:07ztellmantechnomancy: sorry for the late reply, but no
19:07ztellmanhaven't talked to him in more than a year
19:08@technomancyztellman: oh, he's (was?) at runa, right
19:08@technomancydo you know if he has plans to pick back up with jark?
19:09ztellmanwas, Runa shut down the Bangalore office a while back
19:09@technomancyoh, gotcha
19:09ztellmanand I'm not sure
19:09@technomancygrenchman kinda overlaps a lot with jark, but it looks like jark has basically stalled
19:10ztellmanas far as I know, it was more an exercise in curiosity than scratching any particular itch
19:10ztellmanso I wouldn't be surprised if it's been abandoned
19:10@technomancyyeah, that's what I figured. the nREPL protocol totally changed since it was written, which probably made it difficult to justify putting more work into it.
19:25coventryWeird that both jark and grenchman are written in OCaml. Does it have some specifically useful features for this problem?
19:26bitemyappcoventry: handy-dandy binaries
19:34@technomancyFP, fast startup and (originally) small binaries, but the latter actually doesn't pan out once you use the Jane Street libs
19:35@technomancycould have used racket just as well, but wouldn't have learned as much
19:35@technomancyracket doesn't compile to native code, but it can still be very small and starts just as quickly
19:36coventrybitemyapp: technomancy: Thanks.
20:14logic_prognrepl question ==> I am aware of nrepl-send-string-sync. It is not what I want. I want a command which simulates typing a given string into my *repl* buffer and hitting enter. In particular, I want this command run right in the *nrepl* buffer -- and I want it's output sent to the *nrepl* buffer.
20:15logic_progHow do I do the above?
20:20coventryYou could do it with a macro, which can be bound to function names and keys. http://www.emacswiki.org/emacs/KeyboardMacros
20:36holohi
20:42holohttp://clojure.org/java_interop <- mentions: "Once a type hint has been placed on an identifier or expression, the compiler will try to resolve any calls to methods thereupon at compile time." and https://github.com/clojure/core.typed/wiki/User-Guide mentions: "We use the term "type" to mean static type and "tag" for runtime tags. Types only exist at compile time and are used by the static type system to model runtime invariants and properties….
20:47Gnosis-hi holo
20:47frozenlockIs there a way, using an embbeded nrepl in a project, to send a message to the user when he connects to the repl?
20:47holoi'm planning to use type hints, or core.typed, or schema for more useful documentation.. often i find myself using types in names like something-str
20:47holohi Gnosis-
20:49holoprobably i'm going to start with type hints and evolve to schema when necessary
20:49@technomancyfrozenlock: you could do it with an nrepl middleware that watches for op=clone, I think
20:50frozenlocktechnomancy: hmm, I take a look at that, thanks!
20:54frozenlockAnother totally unrelated question... is there a way to reboot a 'lein run' from inside a repl? I'm thinking of maybe using the System/exit with some kind of shell script that checks if there a java app running, but it feels dirty :-/
20:55frozenlock(I said 'lein run', but it might as well be a running uberjar)
21:02@technomancyyou should be using runit or something to keep the server up anyway
21:02@technomancyso System/exit is fine
21:02mtprunit is the best <3
21:04bitemyappor upstart.
21:04bitemyappif you hate yourself like I do.
21:04mtpupshart does stupid things with stderr
21:04mtplike "throws it away"
21:05bitemyappdon't get me started.
21:05bitemyappyou have to manually dump 2 somewhere in initramfs
21:05frozenlockAhhhh so many things to read about :)
21:05mtpthat's why i call it upshart
21:05@technomancyupstart is infuriating in that it refuses to check updated job config upon restarts; you have to explicitly reload
21:05@technomancyI have lost several hours to that, and I hardly use upstart
21:06bitemyappditto.
21:06@technomancythat said, at least it's not systemd
21:06bitemyapptechnomancy: been fighting monsters lately?
21:06mtpi bet you can't guess the unflattering euphemism i have for systemturd
21:06mtpi mean systemd
21:06@technomancybitemyapp: just boring rubby
21:06bitemyapptechnomancy: I was referring to the cowboy hat, but that works too. :)
21:06bitemyappmtp: that's a dysphemism.
21:07@technomancycowboy ... hat?
21:07@technomancyoh oops
21:07mtpbitemyapp‘ you are, of course, correct :)
21:07@technomancyyeah, there was a #scala tcroll
21:07bitemyappreally?
21:07bitemyappScala trolls have been trolling me at work.
21:07bitemyappThey're trying to rope me into some kind of retarded "show down" at a meeting
21:08bitemyappIt has taken immense amounts of self-control to just ignore them.
21:09technomancyhe actually left before I realized he had joined, but I have join/parts hidden
21:10bitemyappif I have to go back to deploying Python apps after only having to concern myself with firing up a jar and a database I am going to cry.
21:10technomancya jar and a database and upstart
21:11bitemyappokay, yes
21:11bitemyappbut upstart is a given even with Python.
21:11OlegYch8technomancy: what makes you think he was a "scala" troll
21:12technomancyOlegYch8: he seemed to imply he preferred the company of the #scala channel
21:12technomancymaybe he just meant he thought he'd get more of a rise out of them
21:12TimMcThat was my interpretation.
21:13mtpi assume he wanted sex
21:14mtpbut we only had sexp
21:14mtpdoes scala have sex?
21:14bitemyappmtp: Scala only has SEXML DSLs.
21:14OlegYch8heh
21:14TimMcNo, I believe it, too is a genderless construct.
21:15OlegYch8jfyi he has no relation to #scala
21:18gfredericksso if you make a lib that has some specialty types and wants to make them serializable via data readers, the best approach is to just recommend an entry for data_readers.clj in the README?
21:18gfredericksi.e., make it not work by default?
21:21rlbSo I have a program that only includes cheshire and clj-http and then retrieves a url, parses the json body, and prints it, and it takes about 2.5s (as compared to 1.0s for a no-op clojure program). Is that expected, or is there something I might be doing wrong? (running via "java -jar uberjar").
21:24technomancyOlegYch8: sorry for besmirching that channel =)
21:25dnolenrlb: did you AOT?
21:27rlbdnolen: hmm, not sure, possibly not -- lein is complaining about AOT (needing :aot :all in the :uberjar profile), but "lein new app" did put this in the project: ":profiles {:uberjar {:aot :all}}", which looked somwhat like what lein was asking for.
21:27rlb
21:27rlbI'll need to learn a bit more about AOT.
21:27dnolenrlb: but also what are you trying to test here, writing shell scripts w/ Clojure?
21:28rlbdnolen: yep -- in some cases, clojure's fast enough, so I use it, but in others, I have to revert to python.
21:28rlbSince I hadn't used this lib combination yet, just wondered if I might be doing something wrong.
21:28rlb(python or whatever)
21:28frozenlockLast time I needed to make a quick and dirty graph from a timeseries, the easiest way was with incanter. Is it still the case?
21:28dnolenrlb: yeah startup is going to dominate for trivial things unless you AOT, even then you're still going to lose a second or so
21:29dnolenrlb: well startup + compile time
21:29OlegYch8technomancy: no worries
21:29rlbI'm ok in some cases with runtimes close to 1.0s (and of course longer if it's a long running program), but in this case, a base of 2.5s may be too high.
21:29technomancyrlb: you could try grenchman if you don't mind keeping a daemon running
21:29rlbtechnomancy: right
21:30rlbtechnomancy: I also saw someone post unixdomain nrepl (re previous discussion)
21:31rlbDoes the fact that lein's complaining about AOT during "lein uberjar" mean that I probably don't have all the right bits set?
21:32frozenlockWtf... I just realized we are Friday. I must have lost a day somewhere in the week... o_O
21:36holoheh.. :) programmers always think weeks are too short
21:36ruzudo you feel... probed?
21:37ruzuvictims of... probing... sometimes describe a loss of time.
21:37technomancyrlb: there's a bug in the warning criteria; should be fixed in a release tomorrow
21:37mtpruzu‘ haha
21:37frozenlockHmm... I should check for new scars...
21:37rlbtechnomancy: oh, ok thanks.
21:39technomancyrlb: just check the jar file for .class files
21:40holothis image came to my mind: http://farm6.static.flickr.com/5202/5255814637_274168a8dd_z.jpg
21:40rlbtechnomancy: yep, the main namespace has class files.
21:57dnolenbeing able to step debug CLJS is a pretty freaking amazing time saver
21:58gf3:D
21:59dnolenif you just use whitespace optimization, you get sensible locals and everything
21:59muhoowat, did source maps happen to cljs while i wasn't looking?
21:59dnolenmuhoo: yeah a couple of weeks now
22:01gf3dnolen: Although I couldn't get them working the other day
22:01akurilinbitemyapp, ping. How do you prefer people to filter by method with bulwark? As in, do you want users to wrap the middleware in their own middleware that checks for method, or is there something in the lib that can do it for you?
22:02dnolengf3: use Canary it just works, don't need browser REPL
22:02gf3dnolen: That being said, I didn't try very hard because I was in a rush for the ClojureCup
22:02bitemyappakurilin: the functions you're passing to bulwark can do that or you can do it at the middleware application level
22:03bitemyappakurilin: we discussed basically this exact same thing with pathing and the answer was the same then.
22:03bitemyappeither make the fn handler for the whitelist/blacklist check the content of the request or selectively apply the closed over middleware.
22:04bitemyappthere's nothing in the lib to do this because the lib shouldn't concern itself with those kinds of details. It's just functions.
22:06ruzuanyone use La Clojure? i'm a total newb but it's been seeming pretty nice
22:06bobwilliamsuser=> (take 4 (iterate #(map + [0 -1] %) [5 5]))
22:06bobwilliams([5 5] (5 4) (5 3) (5 2))
22:06bobwilliamswhy is only 1st item a vector?
22:07bobwilliamsthanks for any help
22:07bitemyappKinda caremad cljs has a step debugger before we do.
22:07bitemyappI mean, anything for the greater glory of Clojure, but god damn.
22:09TimMc"caremad"?
22:11TEttingerbobwilliams, that's the type of the first arg, map later returns seqs.
22:12TEttinger##(take 4 (iterate #(mapv + [0 -1] %) [5 5]))
22:12lazybot⇒ ([5 5] [5 4] [5 3] [5 2])
22:12ruzuwhat is lazybot running?
22:13TEttinger##(clojure-version)
22:13lazybot⇒ "1.4.0"
22:13bobwilliamsTEttinger: big thanks!!
22:13TEttingernp
22:13TEttingergotta go
22:13bobwilliamslater
22:15akurilinbitemyapp, so if I wanted to only check for say POSTs and want to use the list of rules inside of blackwater, I could whitelist everything but POST, right?
22:16bitemyappakurilin: you've moved to a different library methinks
22:16bitemyappakurilin: do you mean bulwark?
22:16akurilinshoot, bulwark.
22:17bitemyappakurilin: the function you pass to bulwark can whitelist anything you want. You can make an anonymous function generator that works against a spec of allowed path and HTTP method combos if you want.
22:17akurilinI don't think there's another way without a separate middleware wrapper of getting "only check % of hits on this set of request conditions"
22:17akurilin*#
22:18akurilinblacklist/whitelist tests are hit # agnostic, correct?
22:18akurilin*hit count
22:19bitemyappakurilin: aye.
22:19bitemyappakurilin: that's getting into throttling behavior.
22:20bitemyappakurilin: you realize you can generate an arbitrary number of "protect-middlewares" right?
22:20bitemyappakurilin: and apply them selectively to routes or groups of routes at will
22:20bitemyappthat's the whole point of the closures, they're more powerful than a single "protect-middleware" with the muggle-mode atom config
22:21bitemyappakurilin: also do you *really* need to be this persnickety with bulwark? What are you protecting?
22:22akurilinbitemyapp, that's fair with the multiple protect-middleware, just wrap handlers inside of POST with them, then you don't have to bother right checking for method, eh?
22:23bitemyappRight.
22:23bitemyappakurilin: that's part of the whole point of Ring's design. Just wrap whatever you want.
22:23bitemyappIt's very general and powerful once you realize what it's offering you.
22:34akurilinbitemyapp, I hear ya.
22:34akurilinalso reminds me how I need to nuke liberator from this one page so that I can actually use that approach :)
22:35coventryAnyone gotten jswat working with clojure, as described here? http://dev.clojure.org/display/doc/Debugging Does it work with a "lein repl" session? "lein repl" with the given jvm-opts does allow you to connect to jswat and set a breakpoint, but I can't figure out how to hit that breakpoint. Just (require)ing a file which hits it from the repl doesn't seem to work.
22:39coventryHoly shit, I got it to hit the breakpoint.
22:42coventryIs there some way to evaluate clojure forms in the evaluator window? I guess it's not hugely useful without that.
22:42gf3bitemyapp: How do you typically deploy your composure apps?
22:47coventryHow do you say (eval (read-string "clojure code")) in java?
22:49FoxboronI just saw rich posting "tools.analyze" on github. Is that a possible solution for messy stacktraces?
22:54dnolenFoxboron: unrelated, that's for Bronsa's Clojure-in-Clojure work
22:54bitemyappgf3: http-kit, uberjar, lein-otf or :aot :all, a script.
22:54bitemyappgf3: if you get more specific I can be more helpful. I actually deployed a Compojure application a few hours ago at work.
22:55coventryjswat hung a few seconds after complaining about an exception from evaluation of clojure.lang.Compiler.eval(clojure.lang.RT.readString("wrapped-internals")). The hanging might be a coincidence. The internal call to readString ran without errors.
22:55gf3bitemyapp: Are you using nginx?
22:56bitemyappgf3: I do with public apps that have static assets.
22:56bitemyappgf3: this one is an internal API server - no point.
22:57bitemyappI make a point of copying the static assets to the nginx servers so they can serve that content directly.
22:57gf3bitemyapp: Ahh—do you know of any decent/current articles re: proxying from nginx?
22:58bitemyappgf3: I end up googling it every single with reasonable amounts of success in finding something about reverse proxying in nginx. I don't have anything on-hand, sorry./
22:58gf3bitemyapp: np <3
23:06Foxborondnolen: that explains it. Dosnt dim the interesting part tho
23:29holo,(str \n)
23:29clojurebot"n"
23:29holohowto => "\n"?
23:30xeqi,"\\n"
23:30clojurebot"\\n"
23:30holoxeqi, thanks, but char input is mandatory
23:31xeqi,\newline
23:31clojurebot\newline
23:31xeqi,(str \newline)
23:31clojurebot"\n"
23:31holo(inc xeqi) ; awesomeness!
23:31lazybot⇒ 9
23:37TimMc&(filter #(< 2 (->> % pr-str count)) (map char (range 0 256)))
23:37lazybot⇒ (\backspace \tab \newline \formfeed \return \space)
23:40holo(inc TimMc) ; thanks, you saved me further inevitable bugs
23:40lazybot⇒ 48
23:53muhoo~primitive
23:53clojurebotGabh mo leithscéal?
23:54muhooin this document, they talk about "primitive support". https://github.com/Prismatic/eng-practices/blob/master/20130926-data-representation.md . what do they mean by "primitive"?
23:56coventryhttp://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
23:56xeqimuhoo: primitive support refers to values that are not objects. like ints, longs, doubles, etc
23:57muhooah, thanks