#clojure logs

2012-06-12

00:15alandipertalex_baranosky: topo sort them maybe?
00:16alex_baranoskyHmmm… what is topo sort?
00:16alex_baranoskyhttps://gist.github.com/1263783 ??
00:16lazybotalex_baranosky: What are you, crazy? Of course not!
00:16alandipertalex_baranosky: it's a way to sort directed graphs, which maps kinda are
00:17alandipertalex_baranosky: aka topological sort
00:17scottjI like http://github.com/GeorgeJahad/difform
00:19alandipertalex_baranosky: yup that's one way, the the problem with converting to diff is that it's line oriented, interesting to think about a conversion that compensates for this
00:19alex_baranoskywhat's the prolem with just printing ?
00:20alandiperti think it depends on what you're interested in seeing in your diffs
00:20alandipertlike if the maps are different sizes by one, when printed the offset will make the diff massive
00:22alandipertalex_baranosky: there is stuff like http://www.altova.com/diffdog/xml-diff.html for structural XML diff, maybe you could XML and see your maps in their viewer
00:23alandipertalex_baranosky: bedtime but sounds like cool project, hit me up if i can help
00:23alex_baranoskywill do. Take it easy
00:28kwertiiAre there any VC funds or angels who specialize in Lisp-based startups? It seems like, if it's true that it gives you a huge competitive advantage (as Paul Graham has written extensively), there ought to be some funding sources somewhere that specialize in Lisp.
00:30scottjkwertii: there aren't, and it doesn't.
00:30mthvedtmight have been true in 1995
00:30scottjre VCs, as for angels who knows.
00:31kwertiiIt occurred to me that Graham's own fund, Y Combinator, has no particular Lisp bias.
00:31kwertii*even
00:31scottjkwertii: the thing is a startup is so many things other than what language you happen to use that any benefit there is drowned out by all the other factors.
00:31kwertiiMakes sense
00:31kreig1language choice is really not that big a factor
00:32scottjkwertii: even once-big-time lisp fans like peter norvig have said that other factors overshadow language choice
00:32kreig1certainly not one I would be putting any emphasis on when putting together an investment portfolio
00:32kwertiiIt certainly seems to be far more popular to crank things out in Ruby or PHP
00:32technomancyscottj: well peter norvig has to weigh staffing a lot more heavily than a startup would
00:33kwertiimuch larger talent pool to draw from, makes hiring and firing easy
00:33kwertiibut if a team is "good" at all the other factors anyway (whatever "good" means), then it stands to reason that they might benefit from using Lisp
00:34scottjtechnomancy: true, but I seem to remember him not talking about this re staffing but saying that he'd underestimated the value of powerful tools like IDEs
00:34kwertiihowever, I expect that that's a sufficiently rare circumstance so as to make it impossible to build a whole portfolio around it
00:35technomancyscottj: I think that also ties into having a huge company
00:35kwertiiA place like Google that needs to hire by the thousands can't really afford to build out in a less popular language, because there just aren't that many developers who can develop in it
00:36scottjhere's the quote I misremembered: http://news.ycombinator.com/item?id=1803815
00:36kwertiilanguages with a low barrier to entry (Ruby, PHP) create a self-perpetuating cycle of having a large developer base, and then more companies use them because of that talent pool, etc.
00:37ro_stthis looks like a fascinating conversation. i'm sorry i missed the start of it
00:38kwertiiro_st: the original question was, are there any VC firms or angels that specialize in Lisp, if indeed it gives you a competitive advantage as Paul Graham has written extensively. And no, there don't seem to be, so it must not give you such a huge advantage.
00:38kwertiiro_st: or at least, any advantage Lisp gives is drowned out among the many other factors
00:39ro_sti see. makes sense. are there vcs that specialise in any programming language?
00:40kovasbsolving a market need seems like a much more important objective for them
00:40kwertiire: Norvig quote - I agree; I'd certainly rather have excellent developers working in Visual Basic than terrible developers working in Lisp
00:40kwertii(I'd have them write a Lisp interpreter first :)
00:40ro_sti should think they'd specialise as far as a specific business model; as that's where their expertise would help
00:40kovasbstarting with technology is not the way to make money
00:40kwertiikovasb: yeah, the business side doesn't really care what tech you use
00:41ro_stas long as you remain competitive
00:41ro_stwhich was part of PG's point
00:41ro_stlisp made them ultra-competitive
00:41kwertiias long as people keep paying you. there are banks today still running COBOL, and major science projects in academia still using FORTRAN
00:42ro_stbanks are hardly the sort to use edge technologies :-)
00:42ro_stwith good reason!
00:42kwertiiro_st: that's what I was getting at -- if Graham was right, if Lisp per se actually makes you ultra-competitive, there ought to be a specialized VC funding segment for it, but there isn't
00:42kovasbi think moments like the birth of the internet are a unique time when tech can give u the edge
00:42kovasbmature stacks in shitty languages were not available yet
00:43kovasbso its more of a level playing field
00:43ro_stkwertii: that makes the investment potential for such a company far too small
00:43scottjkovasb: well, and it was harvard phds who had written books about their languages vs average joe
00:43kovasbsame thing in e.g. big data now
00:43kwertiiro_st: I think the factors that make one a great Lisp programmer don't correlate much with the factors that make one a good startup founder
00:43TheBusbygood VC's invest in good people, and hopefully good ideas. I doubt the tech stack is an issue until acquisition time
00:43ro_sti'm in SA. we don't have tech-only VCs here. you're talking about a tech VC that demonstrates an incredibly high tech awareness
00:44kovasbscottj: right but nowadays doing via web in some ruby on rails thing would be trivial
00:44ro_stsa, south africa
00:44kwertiiTheBusby: even then, they'll just buy it and rewrite it if they want it - Graham's ViaWeb got rewritten in C++ when Yahoo couldn't figure out his Lisp code
00:44TheBusbykwertii: the lisp may turn away potential purchasers though
00:44technomancywe had a symbolics guy invest in Sonian who was kind of amused to see lisp making a comeback
00:45technomancyex-symbolics obviously
00:45TheBusbydidn't someone just write a blog talking about their experiences porting a hotel booking application from Ruby to Lisp and then defending their decision during an acquisition?
00:45kwertiitechnomancy: I first heard about Clojure from a guy on the CL committee during a discussion on why CL languished in obscurity. he was very pleased that it seemed to be fixing all the baggage and political issues with CL
00:46technomancyTheBusby: there's also a good paper from the Xen authors on the same situation with OCaml
00:46scottjTheBusby: not sure the ref, but there is a clojure app for hotel bookings
00:47technomancykwertii: that's better than many CLers on IRC who seem to be horrified that a non-CL lisp could take off.
00:47kwertiithere's Reddit, too; originally written in Lisp (CL?) and then converted to Python. that was a YC company, too
00:47kovasbtheres lots of startups using clojure
00:47kwertiitechnomancy: yep. the other CL people were definitely less impressed
00:47TheBusbyahh here is the link, http://www.colinsteele.org/post/23103789647/against-the-grain-aws-clojure-startup
00:48kovasbactually PG just posted to the yc founders list, they got a discount on the clojure/core roadshow training
00:49TheBusbynow for a dumb clojure question, is there a simple way to generate the following ([0 10] [11 20] [21 30] [31 40] [41 50] [51 55]) for N (where in this case N is 55)
00:50hiredmanyes
00:50hiredmanseveral
00:51TheBusbyhiredman: yes, embarassing question but what's the simple idiomatic performant method?
00:53kovasbTheBusby: sounds cool. is there a github? :)
00:53TheBusbykovasb: not yet, this is for work so I'd need to pursue a public release when I'm done :(
00:54kovasbso do you load a big chunk into memory and then run the reducer?
00:54hiredmanyou know you can get a mmap'ed byte buffer on a file via java nio?
00:54TheBusbyI have multiple apps, in multiple languages mmap'ing the same file
00:54TheBusbyand I haven't heard many good things about nio...
00:55hiredmanthe lest error prone way to do that kind of thing is something like (map (juxt first last) (partition-all chunk-size (range size)))
00:55hiredmanleast
00:55hiredman(the cleariest, most expressive of intent, least likely to screw up)
00:56hiredmanTheBusby: so?
00:56hiredmanTheBusby: maybe you should read up on it then
00:56TheBusbyhiredman: that takes 3.4 seconds on my box
00:57hiredmanhttp://docs.oracle.com/javase/6/docs/api/java/nio/channels/FileChannel.html#map%28java.nio.channels.FileChannel.MapMode,%20long,%20long%29
00:57TheBusbyhiredman: regarding java's nio I did do some initial testing, and am using java.nio.ByteBuffer to wrap JNI stuff
00:57hiredman*shrug*, carry on then
00:58TheBusbyhiredman: yeah, there are a number of other factors as well which lead the JNI route. :(
00:59TheBusbyhiredman: I was doing the above with range earlier, but since that has to iterate through all N elements it becomes slow as N gets into the millions
01:00hiredmanTheBusby: the less apparent approach is to do it via division, but that is easier to get wrong
01:00amalloyhiredman: why not addition?
01:01hiredmanif you really want to do it fast you should avoid the seq all together
01:01hiredmanamalloy: divsion + addition
01:01hiredmanand you have to deal with the remainder
01:01TheBusbythe chunk-size will usually be rather larger (typically less than 10 chunks), but N can be in the billions
01:02xeqi&((fn [x] (map vector (conj (iterate (partial + 10) 11) 0) (concat (take-while (partial >= x) (iterate (partial + 10) 10)) [x]))) 55)
01:02lazybot⇒ ([0 10] [11 20] [21 30] [31 40] [41 50] [51 55])
01:05TheBusbyxeqi: thank you!
01:13scottj&((fn [x] (map vector (concat [0] (range 11 (inc x) 10)) (concat (range 10 x 10) [x]))) 55)
01:13lazybot⇒ ([0 10] [11 20] [21 30] [31 40] [41 50] [51 55])
01:14xeqithanks, I forget range can take a step
01:15TheBusbyusing this now, (fn [n chunk-size] (let [[x & xs] (partition 2 1 [n] (range 0 n chunk-size))] (conj (map (fn [[x y]] [(inc x) y]) xs) (clojure.core/vec x))))
01:15scottjxeqi: your solution shows more skill
01:15sayyestolifeWhen I comment in the code that is out-commented in this http://pastebin.com/AnhG1BKK, the function just waits. How come?
01:15TheBusbyscottj: definitely
02:10tomojsuppose for some pairs of values of a type in cljs, equality cannot be determined synchronously. you can't sensibly use = on values of this type, then, correct?
02:12tomojof course not
02:22amalloytomoj: what kind of type would that be?
02:24tomojsay an IPending/IDeref
02:25tomoja promise
02:25tomojwhere the desired equality compares the eventual value
02:25tomojbut IDeref can't block in cljs
02:26tomojbut it can just be (fmap =)
02:28amalloytomoj: i don't think that's a correct "desired equality"
02:28amalloywhich i guess is the same as your conclusion, that you can't use = on them
02:29francisI keep getting a null pointer exception when to use a function I've defined in a diffrent namespace. I belive that the problem is arising because I have not correcly loaded the namespace. Does this seem like a reasonable hypotheis?
02:29amalloyfrancis: reasonable, but not likely
02:30amalloyyou'd usually get a different exception, like "what the hell is this function you're calling"
02:30tomojamalloy: well, why not in clojure? e.g. (= (future 1) (future 1))
02:30amalloy&(= (future 1) (future 1))
02:30lazybotjava.lang.SecurityException: You tripped the alarm! future-call is bad!
02:30amalloy,(= (future 1) (future 1))
02:30clojurebotfalse
02:31amalloywhew
02:31tomojwhy _not_ have that be equality?
02:32tomojwe have identical? if we want that
02:33tomojhmm
02:33amalloybecause you want to be able to store blocking things in (eg) hashmaps
02:33tomojah
02:33hiredmanamalloy: well, you can store them just fine
02:33hiredmanand I would look askance at a scheme that involved using them as keys
02:33amalloysure, i meant as keys
02:34hiredmanmore likely might be sets
02:34amalloyhiredman: why not? ((memoize identity) (delay)) needs to store [(delay)] as a key
02:36hiredmanbecause once you've started using references as keys you've given up computing with values completely, maps are no longer functions of values
02:37amalloyi agree it's a bad thing to do on purpose
02:37tomojcouldn't you somewhat analogously argue that lazy seqs shouldn't implement equality because you might want to ((memoize identity) a-lazy-seq)?
02:37amalloybut it's not a fundamental error, and things like memoize will lead to it happening accidentally
02:37amalloytomoj: good point. perhaps my argument is no good
02:43Sgeo_You know what would be nice? Not having NullPointerExceptions
02:43Sgeo_Just making them things that don't happen.
02:43Sgeo_>.>
02:48spjtYou can't not have nothing.
02:49KIMAvcrpSgeo_: like in haskell
02:49Sgeo_KIMAvcrp, yes
02:49Sgeo_MUAHAHA
02:49amalloyno instance found is way better, amirite?
02:50amalloyspjt: why not?
02:50Sgeo_amalloy, you mean the compiler-time error?
02:50Sgeo_Yes
02:50Sgeo_Because it's a compile-time error
02:50KIMAvcrpthe problem with nullpointer is that you don't have to check for them they can be in everything
02:50spjtSgeo_: Because you can't have everything-is.
02:50amalloywell then...whatever one happens when you call (tail [])
02:50amalloyfor incomplete functions
02:50Sgeo_amalloy, tail shouldn't exist
02:51KIMAvcrpif you use sth like maybe monad you dave to explicitly check for nothing
02:51Sgeo_And incomplete functions shouldn't be written.
02:51Sgeo_(To the maximum extent avoidable)
02:51amalloy*shrug*
02:51spjtneither should functions that cause nullpointer exceptions :)
02:51amalloyi like haskell and its type system, don't get me wrong
02:51amalloybut if every language were the same, what would be the point?
02:51Sgeo_spjt, that's harder to avoid
02:52Sgeo_spjt, since every variable can take a null value (at least, in most languages)
02:52Sgeo_Languages that have nulls like that, I mean
02:55amalloy$heval tail []
02:55lazybot⇒ *Exception: Prelude.tail: empty list
02:57Sgeo_$heval let safeTail (_:xs) = Just xs; safeTail [] = Nothing in safeTail []
02:57lazybot⇒ Nothing
02:58Sgeo_$heval drop 1 []
02:58lazybot⇒ []
02:58Sgeo_$heval let safeTail = drop 1 in safeTail []
02:58lazybot⇒ []
03:23ro_stanyone using the bishop library? https://github.com/tnr-global/bishop
03:23ro_sti'm trying to figure out how to write tests for it
03:24ro_stah i had to include :request-method
03:31wmealing_what is the closest thing to django templating for clojure ?
03:34michaelr`wmealing_: i don't know about django templating
03:34michaelr`but i used StringTemplate
03:34michaelr`and it's pretty cool
03:35wmealing_its a pretty basic template language
03:36michaelr`yup, on porpuse
03:36michaelr`this encforces the separation of view and logic
03:36wmealing_ive seen my share of php, i completely get why.
03:49wmealing_michaelr`, yeah i think string template is going to work for me.
03:49wmealing_thanks for the pointer
03:50ro_sthow do i deal with a java.lang.ClassNotFoundException: org.mortbay.log.Logger issue when trying to run midje?
03:50ro_sti certainly didn't ask for this class anywhere in my own code
03:51wmealing_i imagine that is part of jetty
03:51wmealing_which jvm are you running ?
03:51ro_st1.6.0_31
03:52ro_stJava(TM) SE Runtime Environment (build 1.6.0_31-b04-415-11M3635)
03:53ro_stit looks like it's ring-serve's fault
03:53ro_stlein/lein2 deps isn't pulling it down, however
03:53ro_stargh. i hate issues like this :-(
03:55ro_stso now i have to choose between being able to test with midje or being able to run a ring server from within my slime repl
03:55ro_st-sigh-
03:57ro_stsometimes, it really feels like i'm the only one trying to use the combination of tools i use, although i'm using what appears to be the tools used by the majority
03:58michaelr`there is also the silent majority :)
03:58wmealing_i feel your pain
03:58wmealing_i was having all kinds off no-fun with midje --lazytest
03:58wmealing_s/soff/of/g
03:59ro_stso. how do i get lein to fetch org.mortbay.log.Logger?
03:59ro_sthere's the culprit: https://github.com/weavejester/ring-serve/blob/master/src/ring/util/serve.clj line 4
04:01ro_sti already have all the deps that ring-serve does
04:03ro_stwmealing_: did you come right with midje?
04:04wmealing_eventually
04:05wmealing_i'm just thinking out loud here
04:05ro_stthe reason midje is getting ring-serve is because ring-serve doesn't work when it's only in dev-deps
04:05wmealing_you may be able to get aroun dit by adding it to your projects.clj
04:05wmealing_i see
04:05Sgeo_Gah
04:06Sgeo_I saw a recent version of Pharo recently, and it mentioned something called rings, so now when I see rings in here I get confused
04:06ro_stactually, that's not true, i take that back. ring-serve is only in dev-deps. along with midje
04:07cljnewb02345dumb question: will apple release a 17" mbp with retina display?
04:07ro_styes, but not right away
04:07ro_st*wild guess*
04:07cljnewb02345oh
04:07cljnewb02345here's what I don't get
04:07cljnewb02345other lcds can't even ship without dead pixels
04:07Sgeo_I have a feeling that the two rings are completely unrelated
04:07cljnewb02345how does amazon get retina display w/o dead pixel
04:08cljnewb02345s/amazon/apple
04:08wmealing_cljnewb02345, order in the millions.
04:08wmealing_have each display checked by a human, and machine
04:12ro_stargh. this is ridiculous!
04:12Sgeo_I have a vague idea of what Pharo rings are
04:12Sgeo_What are rings in Clojure?
04:13ro_string is a wrapper for http
04:13ro_sthttps://github.com/mmcgrana/ring
04:14Sgeo_Something completely different, then.
04:14Sgeo_Wasn't expecting similarities
04:14ro_styup
04:19ro_sthow do i bind the whole body of a ring request? in this case the request POSTs a json blob. i want to destructure that whole blob in the route, if possible
04:20ro_stthis is a compojure question
04:24ifesdjeenro_st: mapping your request to body is not the best approach, try matching on URI and do additional sub-routing withing
04:24ifesdjeen*within
04:25ro_sti have (POST "/scores" [] (do-stuff …))
04:25ro_sti want to pass the entire post body to do-stuff
04:25ifesdjeenyou have an access to request
04:25ifesdjeenso just retrieve body from (:body request)
04:26ro_stwithin do-stuff itself? can i not destructure it in the route def so that the do-stuff function is not ring-dependent?
04:27ro_stah! just found this on the web: (POST "/scores" {body :body} (do-stuff body))
04:27ifesdjeenah :D now I see what you have meant
04:27ifesdjeenI thought you want to destructure based on body contents :/
04:28ro_stsorry that i wasn't clear :-) the posted body in this case will be a json blob, which i'll hand off to cheshire
04:28ifesdjeencool
04:31Sgeo_Is clojure-koans good?
04:31ro_sti think so
04:31francisdoes anyone know what the library equivilent for clojure.contrib.str-utils is? I'm working through Manning's Clojure in Action book and I need some of the functions that it has.
04:31ro_sti got pretty far. haven't finished yet. stuck at recursion :-)
04:32francis*had
04:33Sgeo_I just checked it out
04:33Sgeo_Their is-even? isn't tail recursi... oh, right
04:33ifesdjeenfrancis: most of them are in core.string now
04:33francisthanks
04:34Sgeo_There, there, Clojure. We know it's not your fault. It's that nasty JVM
04:34ifesdjeenfrancis: but if you want something more sophisticated, just find an old repo and port it from there ;) additional learning perk!
04:34ifesdjeenSgeo_: some say that 4clojure is good
04:35Sgeo_ifesdjeen, tried it, it doesn't teach what's needed inline >.>
04:35francisifesdjeen: I'm hoping I don't have to do that - I would like to get this TDD/mock/stubs down tonight
04:35Sgeo_Have to go hunting for documentation
04:35ifesdjeenfrancis: sure sure. good luck on that one!
04:36Sgeo_Oh, hmm
04:37ifesdjeenSgeo_: i haven't tried them myself. i have an 'algorithm/logic puzzles', gives me enough headache
04:37Sgeo_ifesdjeen, ooh, sounds interesting
04:37Sgeo_But I should really get a better grasp of basic Clojure first, probably.
04:38ifesdjeenSgeo_: if want to get to java interop, you can check out https://speakerdeck.com/u/ifesdjeen/p/java-interop
04:38ro_stSgeo_: clojurebook.com and joyofclojure.com. both excellent books. can't recommend them both enough.
04:38ifesdjeenSgeo_: actually it would get you started with most of clojure concepts, like reify, proxy, defrecord, deftype, function calls, destructuring etc
04:38Sgeo_ifesdjeen, want to avoid Java interop for as long as possible
04:39Sgeo_I think my interest in Clojure has to do with everything BUT that lol
04:39ifesdjeenSgeo_: well, most of java interop concepts are very clojuric. for example protocols, they just happen to be good fit for interop, but they let you do polymorphism in a 'new' way
04:40Sgeo_At some point
04:40ifesdjeenSgeo_: what's Lenses (for uneducated part of the crowd, like me)
04:41ifesdjeenah
04:41amalloyifesdjeen: no way. protocols are a compromise with the jvm - if multimethods could be as fast, protocols wouldn't exist
04:42ifesdjeenamalloy: well, as everyone says, protocols cover 90% of what multimethods do
04:42amalloysure
04:42amalloybut to say that they "happen" to fit well with interop is misleading. that's the exact reason they exist
04:42ifesdjeenthey're easier to understand, stuff
04:42ifesdjeenright
04:42ifesdjeenthanks amalloy
04:44Sgeo_What's #'
04:44Sgeo_?
04:44Raynes&(var 'println)
04:44lazybotjava.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol
04:44Raynesblue
04:44Raynes&(var println)
04:44lazybot⇒ #'clojure.core/println
04:44RaynesIt's a var.
04:45Sgeo_Common Lisp uses that to refer to named functions as objects, I think Racket uses it for ... syntax objects?
04:45Sgeo_It gets confusing
04:45ro_st#'foo = (var foo)
04:45Sgeo_Hmm, ok
04:45ro_st&(= (var println) #'println)
04:45lazybot⇒ true
04:49dbushenkoisn't #' syntax obsolete?
04:50borkdudedbushenko in some cases you need it
04:50borkdudedbushenko when you need the var instead of the value
04:52ro_stok. so i know i can do (PUT "/scores" {body :body} (…)). how do i destructure like that and also use a param?
04:52ro_st(PUT "/scores/:id" <some how mix [id] and {body :body}> (…))
04:52Sgeo_Lesse
04:53Sgeo_(This is based on my understanding, and, as such, may be wrong in subtle or not-so-subtle ways)
04:53Sgeo_A lens could be thought of as a first-class way to refer to something in a data structure
04:53dbushenkoborkdude: Can't I use just ' instead of #' for getting the var?
04:54Sgeo_So, you'd have functions that take a lens and an object, and either retrieve the value mentioned by the lens, or "set" (as in return a new copy) of the structure with the place modified
04:54borkdudedbushenko no, then you will get the quoted symbol
04:54borkdude,'foo
04:54clojurebotfoo
04:54borkdude,#'foo
04:54clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve var: foo in this context, compiling:(NO_SOURCE_PATH:0)>
04:54Sgeo_Easy example: keywords could be lenses
04:54Sgeo_,(get :alpha {:alpha 5})
04:54clojurebotnil
04:54Sgeo_...?
04:55ro_st,(get {:alpha 5} :alpha})
04:55clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: }>
04:55ro_st,(get {:alpha 5} :alpha)
04:55clojurebot5
04:56Sgeo_,(assoc {:alpha 5} :alpha 6)
04:56Kototamahi, I have problem using ring uberwar , any idea what the error could be: http://paste.lisp.org/display/129977
04:56clojurebot{:alpha 6}
04:56Sgeo_So, you see how :alpha is being passed into those to refer to a location
04:56Sgeo_Thus, :alpha would be an example of a lens
04:57Sgeo_Another lens could be one that gets/sets the first item in a list
04:57Sgeo_Lenses are also composable
04:58Sgeo_So I could combine them, then pass the combined lens around
04:58clgvKototama: try to get the full trace. the best info is contained in the initial exception
05:00Sgeo_I could also, to be silly, write a lens that gets/sets 1 above the number
05:00Sgeo_So getting a number through this lens results in a higher value, and setting results in lower than the set value
05:00dbushenkoborkdude, maybe you're right, I have to investigate that deeper
05:01Sgeo_get-in, assoc-in, and update-in analogues wouldn't strictly speaking be necessary, since lenses would have a comp-lens function
05:03Kototamaclgv: how can i get the full stacktracE?
05:03Kototamai run it from the command line
05:03clgvKototama: hmm I always found that difficult with leiningen. does leiningen's interactive mode provide a command?
05:05ordnungswidrigSgeo_: is there a lenses lib for clojure, yet?
05:07Kototamaring uberwar from lein interactive does just returns nil without showing anything
05:14Sgeo_ordnungswidrig, I don't know, I don't think so
05:15Sgeo_They should be reasonably simple to implement, though
05:15ordnungswidrigSgeo_: beside that update-in etc. are lenses for associative data structures
05:15borkdudeis a lens not simple a function which uses update-in
05:15borkdudesimply
05:16Sgeo_Hmm. I wouldn't call update-in a lens, I'd say that update-in takes a lens as one of the arguments
05:16borkdudelens = an accessor path?
05:17Sgeo_borkdude, that sounds like a good summary
05:28ro_stwith ring, if i have a (-> ) macro for my ring handler, in what order should i place a middleware that augments the request, the handler and a middleware that augments the response?
05:28ro_st-> req-mid handler res-mid ?
05:29ordnungswidrigro_st: sounds good
05:29ro_stand if the handler is a compojure defroutes?
05:30amalloyro_st: it might be easier to think about if you drop the ->, figure out the order things should go in, and then put it back in as just a syntactic transformation
05:30ro_stsure. the difficulty here is that i don't know how compojure's defroutes plays with
05:31ordnungswidrigro_st: the go first in the process
05:32ro_st(def app (-> app-routes wrap-json-params wrap-json-response wrap-access-control-allow-origin))
05:32ro_stthat seems wrong to me
05:33ro_sti know that app-routes and access-control are working (i can see it in the response data in Charles)
05:33ordnungswidrigI see, no it'd be (-> wrap-json-params app-routes wrap-json-response ...)
05:33ro_stit's not json-ifying the response data itself, though, because i'm getting back {:symbol "string"}
05:33ro_styeah that gives me a null pointer exception
05:34ordnungswidrigro_st: have a stacktrace pase?
05:34ro_stonly has one entry: java.lang.NullPointerException, compiling:(app.clj:63)
05:34ro_st63 in this case only has "(->" on it
05:35ordnungswidrigseems to be related to compojure macro expansion
05:41winkifesdjeen: halfway done porting from congomongo to monger, and it seems to work with mongodb 1.4 as well :P
05:42ifesdjeenwink: w0000t!
05:42ifesdjeenwink: we started development from 1.8 iirc, congrats, and glad you made that leap!
05:42wink(testbox with debian squeeze :P)
05:42Sgeo_I'm starting to think there might not be a good reason to bring lenses to Clojure
05:43Sgeo_,(get-in {:hi [4 5]} 0 :hi)
05:43clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
05:43Sgeo_,(get-in {:hi [4 5]} :hi 0)
05:43clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword>
05:43Sgeo_,(get-in {:hi [4 5]} [:hi 0])
05:43clojurebot4
05:43borkdude,(get-in {:hi [4 5]} [:hi 0])
05:43clojurebot4
05:43ifesdjeenwink: are you on Twitter?
05:43ifesdjeenwhat's your handle
05:43winkifesdjeen: @anderiasch (but half of it is German)
05:44ifesdjeenwink: i speak some german)) i'm in Germany anyways
05:44ifesdjeenaaaahhh
05:44Sgeo_But still, there's only one way to ... hmm, even that could be worked around rather easily
05:44winkifesdjeen: I was the big blonde guy yesterday ;)
05:44ifesdjeenwink: :D now I can correlate
05:44winkhehe, yeah, sorry
05:46Sgeo_Are there any cases where one might want to make a view into an object that the creator of the object didn't think of?
05:47Sgeo_Becauses lenses would be good for that
05:47borkdudeI guess the "Central" issues are gone now?
05:48hiredmanSgeo_: just expose the view has an ILookUp
05:48hiredmanthen you can mostly treat it as a map
05:48Sgeo_What does ILookUp do?
05:49hiredmanit is the interface that keywords use to lookup values when called as a function
05:49hiredman(:foo x) ;; works when x implements ILookup
05:50hiredmanhttps://github.com/arohner/clj-wallhack/blob/master/src/wall/hack.clj#L38 ILookup for private field access via reflection
05:50Sgeo_Ok, cool, it doesn't do what I want it to do
05:50Sgeo_That means my ideas might still have a use
05:51Sgeo_....oh, I see what you mean
05:51Sgeo_Wrapping the object in a wrapper that makes ILookup work how you want
05:51hiredmanyou can then do things like (let [{:keys [somePrivateField]} (mirror obj)] ...)
05:52Sgeo_...that doesn't compose well.... I still have a reason to make lenses!
05:52Sgeo_>.>
05:53hiredman(:somePrivateField (mirror obj))
05:53hiredmanILookup enables all the features you know and love
05:54hiredmanget-in uses ILookup
05:54Sgeo_But ILookup is a feature of the object being looked in, not the value used to refer to a location in that object
05:55hiredmanSgeo_: so?
05:57Sgeo_So.... it's not maximally flexible and convenient for certain tasks which I'm actually having trouble imagining
05:58Sgeo_Suppose I wanted to look up items not by their index in a vector, but by the reversed index
05:58Sgeo_So that 0 is the last item, etc.
05:58Sgeo_And I want a get-in that lets me, in the list, mix reversed indexes and regular indexes
05:59Sgeo_And this is still on ordinary, vanilla lists.
06:01hiredman,(get (let [x [1 2 3]] (reify clojure.lang.ILookup (valAt [_ k] (get x (- (count x) (inc k)))))) 0)
06:01clojurebot3
06:01hiredman,(get (let [x [1 2 3]] (reify clojure.lang.ILookup (valAt [_ k] (get x (- (count x) (inc k)))))) 2)
06:01clojurebot1
06:02Sgeo_So, you're making a new object that supports the reversed lookup?
06:03Sgeo_I want to, hypothetically, write (get-in [[1 2 3] [4 5 6] [7 8 9]] [(rev 0) 0])
06:04Sgeo_And I would get 7
06:08mrb_bkHow can I find the available flags for leiningen 2's javac task? I want to see verbose output during the compilation
06:23clojuremanSgeo_: assuming you have a get-rev fn, just do (-> [[1 2 3] [4 5 6] [7 8 9]] (get-rev 0) (get 0)) to get 7 (I know you could be posing prob in larger context than I see here, so feel free to ignore answ)
06:58dikidoomhey, can someone tell me if seq-utils made it into the new modular system yet?
07:00borkdudedikidoom http://dev.clojure.org/display/doc/Clojure+Contrib
07:01dikidoomthanks borkdude, but seq-utils is not mentioned there, so i can only guess ...
07:01borkdudedikidoom hmm, yeh, I guess not then
07:02dikidoomokay, thanks for the hint! :)
07:02ro_sti'm having a brainfart with compojure. i've used swank/break to break all the way to the point where the fn that my compofure route talks to returns its data, and the data (a map) is there. but in the browser, there's no data. content length 0.
07:04ro_stwhen i trigger my ring handler in the repl, i get the data back.
07:05ordnungswidrigro_st: did you restart the jvm? I struggled with that before and some ns was not reloaded completely
07:07ro_sttrying that now.
07:07ro_stjust found your compojure-rest lib, ordnungswidrig
07:08ordnungswidrig*g*
07:08ro_stsame issue
07:09ro_stwhen a compojure handler returns a map, must that map conform to the ring response spec?
07:09ordnungswidrigro_st: compojure routing can be hard to debug.
07:09ordnungswidrigro_st: yes
07:09ro_stnfc. i'm trying to return a map for wrap-json-response to json-fiy
07:09ro_st-ify*
07:09ro_stnfw*
07:09ordnungswidrigro_st: can you show some code?
07:12ro_stthis is what i'm trying to do
07:12ro_sthttps://www.refheap.com/paste/3102
07:12clojuremanro_st: I observed similar behaviour once with jetty and a domainname without any dots in it (defined in hosts-file) - once I changed to a domain with dots (localhost.xxxxxx.com) everything worked. I did not have time to investigate further, as I had already lost a bit of time...
07:12ro_stit appears that i need to do some response wrangling inside my compojure handlers
07:13ro_sti was hoping to have my handlers return POCOs and let the ring middlewares do all the make-up
07:14ordnungswidrigro_st: you can return a map like this: {::jsonify {:a 1 :b 2}} and make the wrapper jsonify it
07:14ro_stthe middlewares i have there are the ones from https://github.com/ngrunwald/ring-middleware-format
07:16ro_sti guess a hack would be to wrap my map in a vector and de-vectorise on the client
07:16ro_stthanks for the tip clojureman
07:17ordnungswidrighhm, never used that but associating the map as {:body mymap} should work with wrap-json-response
07:18ro_stwooohoop
07:18ro_stthat works.
07:18ro_ston the plus side, i now have a good grasp of debugging with breakpoints
07:19ordnungswidrigro_st: make a blog post :)
07:19ro_stthanks ordnungswidrig
07:19ro_stnow i can reward myself with some Diablo 3
07:20ordnungswidriglol
08:05dabdI'd like to work on Clojure on a Windows environment. ClojureBox is no longer maintained. did anyone take over this project?
08:07ordnungswidrigdadb: I think is is not needed any more.
08:08dabdWhat is the simplest way to setup a development environment on win?
08:08clgvdabd: you can get started pretty quickly with Eclipse+CCW and leiningen
08:08dabdI'd like Emacs+Clojure
08:08dabdNot a fan of Eclipse/Netbeans
08:08ordnungswidrigdownload emacs 24.1 from gnu.org, install clojure-mode using package.el (which is shipped with 24.1), install leiningen and there you go.
08:08dabdok
08:09ordnungswidrigmaybe you'd have to configuration path to leiningen from emacs.
08:09kmicudabd: it is no problem to work with eclipse and leiningen on Windows
08:09ordnungswidrigI had to setup my new windows 7 box the other day and it went rather well.
08:10borkdudeordnungswidrig what is the difference in list-packages and package-list-packages in 24.1?
08:10ordnungswidrigborkdude: i don't know. I only knew package-list-packages
08:11borkdudeordnungswidrig I guess this package thing also worked in 24.0.91.1 ?
08:11ordnungswidrigI upgraded from emacs 23.x today and I did not use 24.0.x
08:11borkdudeordnungswidrig in 24.1 my screen gets mangled in OSX
08:12ordnungswidrigborkdude: on my osx machine i'm still on 23.x
08:21ejacksonborkdude: I get the same mangling in terminal, but not out of terminal
08:21borkdudeejackson I havn't used it in terminal
08:22borkdudeejackson I used the build from emacsformacosx.com
08:22ejacksonsame here
08:22VinzentHi. Why can't I derive from class?
08:22dabdkmicu: I am used to emacs
08:23ejacksonwith emacs -nw I get shearing, double lines, vanishing lines etc. But in its own GUI frame its 100% fine
08:23borkdudeejackson hm, nwo it seems to work, don't know what caused it
08:23ejacksonits intermittent... :P
08:24borkdudeI will give it another try then
08:25kmicudabd: sorry, i had in mind emacs :)
08:29VinzentSo, can somebody explain why I can't (derive ::foo SomeClass)?
08:30cshell,(doc derive)
08:30clojurebot"([tag parent] [h tag parent]); Establishes a parent/child relationship between parent and tag. Parent must be a namespace-qualified symbol or keyword and child can be either a namespace-qualified symbol or keyword or a class. h must be a hierarchy obtained from make-hierarchy, if not supplied defaults to, and modifies, the global hierarchy."
08:31ohpauleezhaha, well there you have it
08:31cshellThe second argument has to be a symbol or keyword?
08:32ohpauleezVinzent: derive is just for creating related hierarchies, not for inheritance of any kind
08:32VinzentI know, my question was why is it so.
08:32Vinzentohpauleez, I know.
08:32ohpauleezVinzent: So in what use case does it make sense that a parent is a class?
08:33cshellOh, oops - yeah I can't explain :)
08:33ohpauleezyou'd most likely want the class name as a symbol or a keyword, but not the whole class
08:38Vinzentohpauleez, here is a little example: https://www.refheap.com/paste/3103
08:39Vinzentohpauleez, the only way to work around it is to derive Number from ::number, but I don't see much sense in that
08:42clgvVinzent: you can use `type` instead of `class` - then it will look op the :type metadata
08:44Vinzentclgv, I'm not sure how it'll help... I still can't derive from class, so it won't make any difference
08:44clgvVinzent: what do you want to do exactly?
08:44VinzentLook, my question is why the derive works the way it is, what's the background behind this decision
08:44Vinzentclgv, in that example (foo x) should return "number"
08:45clgvVinzent: well then why don't you derive the other way round?
08:46clgv(derive Number :number) (derive :complex-number :number)
08:46clgvnow both are numbers
08:46Vinzentclgv, that's exactly what I've said above: "the only way to work around it is to derive Number from ::number, but I don't see much sense in that"
08:47clgvand why?
08:47ohpauleezVinzent: Why not? that makes more sense to me
08:47ohpauleezYou want to classify a group of things as a :number - what are those things?
08:48ohpauleezthe actual number class, :complex-number … maybe :imaginary-number
08:48VinzentCreating unnecessary entity just to work around some limitation makes more sense? Oh, come on
08:48ohpauleezan :imaginary-number may or may not be a NUmber
08:49ohpauleezVinzent: I didn't mean for my remark to sound insulting, sorry about that
08:50ohpauleezOtherwise is seems like you're tightly coupling these hierarchies (potentially) to a class hierarchy and that's undesirable
08:50clgvVinzent: it's no workaround - it makes actually sense to say Number is a :number and your new complex number is a :number
08:50ohpauleezboth for the language and for design
08:51VinzentLooks like the only thing preventing from deriving from class is (assert (namespace parent)) in the derive source code
08:52Vinzentohpauleez, no, it doesn't sound insulting :) No, I don't think I'm coupling these things
08:52Vinzentclgv, how is it better than saying that complex number is a number?
08:53S11001001Vinzent: yes, that's to prevent you from putting unsafe stuff in global-hierarchy. If you want no rules, use your own hierarchy
08:53clgvbecause it is not. your complex number is a map. it shares nothing with the Number class
08:53VinzentS11001001, I can't, actually
08:54clgvthe other way round the Number class can be of an abstract type :number
08:54Vinzentclgv, why should it share something? We're talking about hierarhies, not java inheritance
08:54VinzentI think "number" is abstract enough :)
08:54ohpauleezSo you want to toss in a class, and under the hood it just uses the Symbol for that class? or the class as keyword? Or some other rule to convert your set of classes into acceptable parents in the hierarchy?
08:54clgvjava inheritance is mapped into the whole isa? concept which hierarchies is using
08:56Vinzentclgv, I don't see how it affects the issue
08:57clgvVinzent: if class A inherites from class B and you can derive the other way round that would make no sense
08:57S11001001just using ::number sounds better, Vinzent
08:57Vinzentohpauleez, you mean implementation? Hierarchies are implemented with plain maps
08:58clgv&(isa? Integer Number)
08:58lazybot⇒ true
08:58Vinzentclgv, the same with keywords. There is nothing specific to classes here.
08:58VinzentS11001001, I don't think so.
08:59clgva map of type :complex should now be derivable from the Number class which is absolutely not true in java inheritance?
09:00VinzentWe're talking about clojure hierarchies, not java inheritance
09:00S11001001ok
09:00clgvVinzent: well clojure hierarchies includes java's inheritance as seen in ##(isa? Integer Number)
09:00lazybot⇒ true
09:01clgvso (derive :blubb Number) does not make any sense
09:01Vinzentclgv, I know, but so what? Let's deny multiple inheritance in clojure because (isa? Integer Number) ⇒ true, or what? I don't understand what do you mean.
09:03ohpauleezVinzent: you can easily write one function, that converts your classes into however you want to interpret them for the hierarchy. At the end of the day, we have to accept the platform we're on
09:04Vinzentohpauleez, how is such function supposed to work?
09:04VinzentI have to redefine derive then, which is not a good idea.
09:04S11001001Vinzent: how is a function that accepts a java.lang.Number but gets a map instead supposed to work?
09:05clgv Vinzent: (fn [x & _] (case (type x) :complex-number Number (type x)))
09:05S11001001no.
09:05S11001001that's a separate type
09:05S11001001not a specialized type
09:05VinzentS11001001, well, that's not a question actually :)
09:05S11001001oh, I am reading this wrong
09:06borkdudezombie numbers
09:06borkdudesorry I had to say that, don't know why :P
09:07clgvhehe. I think java inheritance is a special case embedded in clojure's hierarchies. so classes can derive from anything else in those hierarchies, but deriving from classes would break the semantik of the embedded java inheritance
09:07Vinzentclgv, I'm not sure how it would help.
09:07Vinzent(by it I mean that function)
09:07ohpauleezVinzent: It could be something as direct as (keyword (str %))
09:07clgvthat dispatch function would translate your :complex-number type to Number thus making your code work.
09:08Vinzentohpauleez, I don't understand, could you show the whole solution?
09:08ohpauleezPersonally, I think the best solution is the double derive, especially if you're defining your own hierarchy
09:08Vinzentclgv, dispatch function is fixed (and it was `class` in my example)
09:09clgvchange it ^^
09:09VinzentHow? It's in some library, for example.
09:10Vinzentohpauleez, well, actually I was asking about the reasons why derive works this way, not about solution :)
09:10clgvseemed like you defined it yourself
09:11clgvVinzent: derive works that way because the decided that the inheritance relation of java classes shall be a part of clojure's hierarchies
09:12Vinzentwell, then maybe I should replace the mulimethod with a single `case`, huh? :)
09:12clgvVinzent: I would introduce the :number parent if I were you.
09:16Vinzentclgv, well, as I've probably said above, I don't see how (derive ::foo SomeClass) breakes java inheritance. Anyway, we should finish the discussion
09:22clgvVinzent: it breaks the java inheritance hierarchy inside clojure's hirarchy
09:47ro_stcan i run more than one slime repl in emacs at a time?
09:53S11001001ro_st: in general, slime supports that, as do certain swank-clojure arrangements, but I'm not sure that technomancy supports that in general
09:53S11001001it works perfectly well with common lisp, if that helps ;)
09:55cshellwith slime emacs, has anyone been able to get a repl running for days at a time?
09:55cshellwithout having to restart it?
09:55S11001001yep, no problem
09:55S11001001weeks, even
09:55kreig1cshell yah
09:56cshellcool, can you get all of the command history too?
09:56S11001001what's "all"?
09:56kreig1yah, it's emacs, it's in a buffer
09:56cshellIf you defined a function on the first day and you now want to move that into code, can you get back to it so you can copy it or is there a clojure function that will print the source?
09:58ro_stS11001001: thanks for that
09:58kreig1cshell: yah, but you would be much better off working in a file and then evaluating
09:58S11001001cshell: press M-< to go back to the top of the repl buffer
09:58S11001001also inc kreig1
09:59cshellOkay, so depending on the size of your buffer you can keep as much as you want
09:59cshellkreig1: that's what I've been doing but didn't know if that was teh idiomatic way :)
09:59cshellS11001001 & kreig1: thanks guys
09:59S11001001there's no scrollback limit like in terminals, at least not by default; you keep everything unless you clear explicitly
10:00ro_steven on my monster quad core machine i've found that performance degrades pretty quickly with a long repl history
10:00S11001001ro_st: it's significantly more useful in CL, so you can test in different CL implementations simultaneously
10:01ro_stthat is useful. in my case, i have a project that does my sql->mongo conversion, and a project for my json api. it'd be nice to have both running so that i can tweak the convertor and test in the api service
10:02S11001001can both projects be compatibly loaded in the same image?
10:02ro_sti could lein repl the one, but i want to be able to push code to both repls as i move on
10:02ro_stwith minor adjustments, yes. but doesn't slime repl depend on the deps present in project.clj?
10:03S11001001yes, but you can use checkouts to unify your sources
10:03S11001001so you'd make a dummy project with the deps union
10:03ro_stwhat is this sorcery you speak of
10:03S11001001and add both source trees to checkouts/
10:03ro_stcheckouts? wossat?
10:03S11001001then lein will add src/, test/, resources/, etc from both your source trees
10:03ro_st(clojure/emacs newbie. about a month in.)
10:04kreig1ro_st: very large single output blocks can slow it down when they accumulate
10:05kreig1if you disable font-lock mode, M-x font-lock-mode, it won't have much of an impact tho
10:05kreig1aka, the overhead is in all the syntax hilighting
10:05ro_stah, that makes sense
10:05kreig1Iusually keep my repl buffer clean
10:05ro_sti prefer to C-c M-o regularly
10:06ro_stclears the output, but retains entered command history
10:06S11001001anyhow, then you jack in to your dummy project, and should have the deps union you wrote, plus both source trees, available
10:06ro_stS11001001: where can i read more on how to do this?
10:07S11001001lein help checkouts maybe
10:07ro_stnope :-(
10:07gfrederickscheckouts are described in the lein readme, or one of the doc files
10:08gfredericksthere's not much to it though
10:08gfredericksmkdir checkouts && ln -s /some/other/project checkouts/some-other-project
10:09ro_stand then anything special in project.clj?
10:09gfredericksyou do have to have the project listed in your :dependencies like normal
10:09gfredericksbut nothing extra for using checkouts
10:09ro_stah i see. is it possible to refer to another project on disk in deps? or do i have to put it into git first
10:10S11001001the git bits are an afterthought; I've never used them, just symlinking
10:11S11001001gfredericks: and you don't need the project in dependencies
10:11gfredericksS11001001: at least if it has its own deps, right?
10:11S11001001I don't know the situation with lein2
10:11gfredericksS11001001: the lein docs have always said so
10:11S11001001but lein1 wouldn't pick up transitive dep changes
10:11ro_stforgive me for rehashing this, but what would the dummy project need in place? project.clj, checkouts folder with 2 symlinks, and an app.clj with nothing in it from which to clojure-jack-in ?
10:11S11001001I've used checkouts without referring to the project I checkouts-ed
10:12S11001001not even an app.clj
10:12ro_sti guess i'd need to pull something from each project into app.clj so that it's compiled
10:12kmicucan sbd try to run this https://github.com/stuartsierra/cljs-formatter ? :) lein 2.0.0 needed
10:12gfredericksS11001001: you're a naughty naughty dev
10:12S11001001gfredericks: so I'm building a new library for use in a project.
10:12S11001001should I make a dummy release before it has anything in it? No thanks.
10:13S11001001ro_st: your project.clj would need all the deps both need, and compatibly, because checkouts doesn't pick up transitive deps. That's why I asked whether they could work in the same image
10:13ro_stok great
10:13ro_sti can do that
10:14ro_stso jack-in'll use the deps env from dummy's project.clj, and then load src from the two subs as though they were source in dummy?
10:14S11001001yeah; you can see what'll happen with lein classpath in your dummy tree
10:15ro_stsweet
10:15ro_stthanks for the tip
10:15gfredericksS11001001: you can install it locally; but yeah that's not worth it if you don't have to
10:15S11001001I hate snapshots
10:15gfredericksS11001001: I was only arguing about lein's opinion on the matter, not my own
10:16S11001001I would think lein would agree about snapshots :/
10:17S11001001as for that recommendation, I think that's just to pick up what would be transitive dependencies for the library you're working on. It's a hack, and doesn't work perfectly, but it's okay
10:20ro_stthanks again. break time
10:25gfredericksS11001001: half of the time I use checkouts it's to debug some third party library that's already listed in my project.clj
10:26S11001001definitely
10:26duck1123checkouts are good when you're developing a support library alongside your main project
10:33clgvduck1123: and if you want to build all checkouts at once from your main project you can use lein-checkouts
10:37llasramTimMc: ping
11:02TimMcllasram: pong
11:05llasramTimMc: Had been trying to just /msg you, but apparently IRC is hard
11:05devnTimMc: I found a way to beat roulette
11:06devnTimMc: You just wager the same amount on both red and black
11:06devnwinner every time.
11:06llasramdevn: What about green?
11:09TimMcllasram: I've been offline since yesterday afternoon.
11:09TimMcAh, and I see your PMs.
11:15winkdevn: you know the bank has a cut usually? :P
11:19gtrakyou win on roulette by being a casino..
11:35hyPiRionIs there a more idiomatic way of writing (fn [x] (if (not= v x) x))?
11:36ohpauleezhyPiRion: when-not
11:37hyPiRionSo basically (when-not (= v x) x) then.
11:37hyPiRionokay, thanks.
11:38ohpauleeznp, happy to helo
11:38S11001001((set/difference set-of-all-values #{v}) x)
11:38S11001001definition of set-of-all-values left as exercise for y ou
11:39ohpauleezif you're using it in a binding form, you'll want to look at when-let and if-let
11:39S11001001ohpauleez: not so much
11:39ohpauleezS11001001: What do you mean?
11:40S11001001ohpauleez: how would you write that with when-let or if-let?
11:40S11001001also, (first (set/difference #{x} #{v}))
11:40S11001001sets are cool, like bowties
11:40ohpauleezI'm saying if his end goal is to use these values in a binding form
11:40Iceland_workS11001001: "for certain values of cool" ;)
11:41S11001001ohpauleez: there's nothing useful you could put in the value-to-test position of an if-let or when-let that would give you the behavior of the aforementioned function
11:42ohpauleezI was not speaking to the function, but equality check - whether that's in a function is irrelevant to me
11:42S11001001equality checking returns a boolean
11:43ohpauleez(and 1 2)
11:43ohpauleez(when-let x (and 1 2))
11:44hyPiRionSets are cool when you deal with small value ranges, not when you deal with 2^31 different values.
11:45S11001001ohpauleez: what's that second thing?
11:53clgvhyPiRion: 2^31 value on a jvm lets your RAM explode pretty much, doesn't it? ;)
11:57ohpauleezhyPiRion: There might be a cool shorthand for that in the Hacker's Handbook too, not sure if this is performance sensitive
12:05pepijndevosIs there a function like descendants for java hierarchies?
12:10tbaldridgepepijndevos: I don't think the JVM does what you want. Doing (descendants Object) would require clojure to return every single type the JVM knows about
12:10tbaldridgepossible, but doesn't seem like it would work too well.
12:10pepijndevostbaldridge, probably...
12:11tbaldridgealso, the JVM doesn't track subclasses of types. As in you can say "get all children of this type" so it would require a linear search of all objects with a (instance?) on each
12:13S11001001besides, classes load lazily, so it would be unhelpful
12:16devnllasram: I actually think green doesn't matter in TimMc's game. At least we saw it count as even
12:17oskarthtrying to generate and save an image with quil without generating an applet. Any ideas how to do this?
12:20dnolenoskarth: do you mean without constructing an Processing applet instance? How can you do any drawing then?
12:22oskarthdnolen: I guess I mean without doing anything unnecessary, I just want the image-file
12:25oskarthfound what I was looking for, :target :none in the sketch fn
12:26sthuebnerwhat's the *practical* difference between the 'type and 'class functions? I mean, for what use cases does 'type go beyond 'class?
12:27dnolensthuebner: type will also look at the :type field in meta
12:28TimMcdevn: It's not my game.
12:29sthuebnerdnolen: I assumed, that - for most cases - that field contains the same information. No?
12:29ibdknoxis aot absolutely necessary to run a clojure program from an uberjar?
12:29TimMcibdknox: Yes, at least for the main class.
12:30TimMcibdknox: The rest can be dynamically loaded quite easily. I wrote lein-otf to handle that.
12:31kreig1otf?
12:31TimMcon-the-fly :-)
12:31TimMc"jit" was confusing people.
12:32kreig1recompiled files when they change?
12:32sthuebnerdnolen: ah, not right. type returns (class x) if no :type field is found.
12:32kreig1me no good at english tenses
12:33TimMckreig1: Nothing so fancy. It's just my term for the opposite of ahead-of-time compilation.
12:34TimMckreig1: AOT compilation has to be used to some extent to make an uberjar. lein-otf injects a small AOT'd loader namespace that takes the place of your own main class, then asks the Clojure runtime to load the real one.
12:34TimMcs/an uberjar/any executable jar/
12:38ibdknoxTimMc: sweet, I think that'll work
12:38ibdknoxTimMc: the CLJS compiler keels over when it's AOT'd :(
12:39dnolenpepijndevos: re: FD, I think you're right about IFiniteDomain. I do note that B-Prolog had (has?), CLP(FD), CLP(Tree), CLP(Set), CLP(Boolean)
12:41dnolenpepijndevos: so we could probably break out ICLPFD, ICLPSet? need to think about naming ...
12:41TimMcibdknox: Curious. What breaks, exactly?
12:42TimMcibdknox: Oh, and FYI: llasram is working on some enhancements to lein-otf, such as lein2 compat.
12:49pepijndevosdnolen, right... was just trying to formulate my thoughts in an email
12:56brainproxyusing lein-ring with :auto-reload? true... have a (route/resources "/") in my handler, an when I load a page in browser from resources/public, only the path name is coming back, not the contents of the .html file
13:01jsabeaudryAnyone has had problems where agents die of heap exhaustion after a few hours?
13:04bordatoueis there a sleep equivalent in clojure
13:05rlbbordatoue: (Thread/sleep 1000)?
13:05Guest79414rlb: then what about the interrupted exception
13:05TimMcCatch it if you want to.
13:06Guest79414TimMc: so there is no compile time error if i don't catch it
13:06TimMcRight.
13:06TimMcChecked exceptions are a Java thing, not a JVM thing.
13:07Guest79414TimMC: what do you mean saying it is a Java thing
13:08Guest79414hello
13:08Guest79414why is my name change to Guest
13:09brainproxyhmm, okay, it seems to be the :auto-refresh? option for `lein ring` that's got a problem.. not correctly processing GET req's associated with html coming up out of resources/public
13:09brainproxyguess I can wait for weaverjester to come back online :)
13:09rlbGuest79414: means that java the language (and hence compiler) cares whether or not you catch those exceptions, but the JVM doesn't, so clojure doesn't have to (and it doesn't).
13:22Guest79414hello
13:25bordatoueh
13:48Sgeo_Someone pinged me here but I missed it L(
14:03gtrakSgeo_: there are logs
14:04Sgeo_gtrak, where?
14:05gtrakhttp://clojure-log.n01se.net/
14:05Sgeo_ty
14:12pepijndevosdnolen, food for thought: https://github.com/clojure/algo.generic probably not fast enough for you, though ;)
14:21sorenmacbethsomeone told me about a clojure specific pastebin.com-like site
14:21sorenmacbeth*** the other night. Anyone know what the name of it is?
14:22gtrakrefheap
14:22sorenmacbethgtrak: that's it. cheers
14:23nDuffgist.github.com has quite good Clojure syntax highlighting
14:23nDuff(in addition to allowing git as a client, keeping revision history for gists, allowing multiple files, and all the other shiny things it does)
14:36eggsbyI'm trying to use a routing library 'clout' by weavejester, it uses a method which when invoked with a route string and a request object, (route-matches "target" ring-request), given one request how can I easily do a sort of case/switch while capturing the result if it matches?
14:36eggsbyall I can think of is nested if-let's which seems horrifying
14:36jbarrioshmm, why can't my code find the log4j.properties file? I've put it all over the classpath
14:37amalloyeggsby: do you just want `some`?
14:37eggsbyhmm
14:38eggsbyI'm thinking maybe thread last?
14:38amalloythat sounds like nonsense
14:38eggsbyprobably :)
14:38amalloyeg, compojure.core/routes is basically just (fn [& handlers] (fn [request] (some #(% request) handlers)))
14:39eggsbyya, maybe I should just use compojure
14:39dustingetzhi guys, i'm new to clojure - i find myself restarting the repl a few times an hour because of ns conflicts
14:39dustingetzis this normal or am i missing a best practice
14:39nDuff...what kind of conflicts?
14:39gtrakwhat's an ns conflict?
14:39pvncadn00b here. I am having little trouble in understanding head retention. I think, i understood it in thoery
14:40dustingetzmy `use` statements fail in the repl because something is already defined
14:40nDuffdustingetz: ahh. require is your friend.
14:40dustingetzi hesitate to use require because a lot of the time im including multiple packages of the same thing
14:40pvncadbut not able to understand following example for it
14:40gtrakdustingetz: try 'require :as'
14:40pvncad(let [[t d] (split-with #(< % 12) (range 1e8))] [(count d) (count t)])
14:40eggsbyamalloy: I basically want 'cond' but I want to capture the result of the test and provide it to the form that matches
14:40pvncadany help?
14:40eggsbyis there a simple way to do that?
14:41nDuffdustingetz: ...I'm not sure I follow what you mean by "multiple packages of the same thing" in a way that would rule out require.
14:41dustingetz`(require [korma.db :as korma] [korma.db :as ???]
14:41dustingetzi want them both in 'korma' ns
14:41dustingetzaliased ns, whatever
14:41kreig1that's not how aliases work
14:41dustingetzotherwise i may as well just reference them explicitly
14:41gtrakeggsby: I'm imagining a cond-let
14:41kreig1first, you prolly don't want korma.db, just saying
14:41kreig1korma.core I alias as kql
14:41TimMcNo, korma.db is useful.
14:41kreig1you CAN access things without the alias
14:42gtrakeggsby: https://github.com/richhickey/clojure-contrib/blob/2ede388a9267d175bfaa7781ee9d57532eb4f20f/src/main/clojure/clojure/contrib/cond.clj#L18
14:42kreig1interesting, I only use it for starting up DBs
14:42eggsbyhuh, cond-let exists, how about that
14:42kreig1so I just [:require "korma.db"] and then call (korma.db/whatever
14:42TimMceggsby: Use to exist.
14:42nDuffdustingetz: ...notably, you _can_ clean out a namespace with less than a restart...
14:42kreig1see ns-unalias etc...
14:43gtrakwhy shouldn't cond-let exist?
14:43gtrakit seems like people re-invent it all the time
14:43amalloygtrak: with different semantics each time, is why
14:44neotykpvncad: what problem do you have with it?
14:44dustingetzi mean im not terribly wroried about restarting the repl a few times an hour
14:44gtrakhmm
14:44dustingetzits just 10 seconds of blocked thought
14:44dustingetz= reddit
14:44dustingetzhaha
14:45pvncadneotyk: I am not able understand how reversing the count calls solves the problem
14:45neotykpvncad: what problem?
14:45pvncadneotyk: head retention issue
14:46pvncadneotyk: (let [[t d] (split-with #(< % 12) (range 1e8))] [(count d) (count t)]) -- the sample code
14:47neotykpvncad: (count d) will realize d
14:47pvncadneotyk: won't it be true for (count t) as well?
14:48neotykpvncad: yes, but it contains 12 elements
14:48neotykpvncad: while d contains 1e8 - 12
14:50pvncadneotyk: yes. [(count t) (count d)] and [(count d) (count t)] should behave same, right?
14:50borkdudeneotyk what line was it again to Backbase from central station?
14:50borkdude26?
14:50neotykborkdude: I always ask skuro
14:50neotykborkdude: let me ping him
14:51pvncadneotyk:but former works but latter throws out-of-memory
14:52neotykpvncad: imho both should throw oom
14:52amalloypvncad: d and t both hold a reference to the 100-million-element sequence. if you count the short one first, then the compiler can release memory as it goes while it counts the big one
14:52amalloyif you count the big one first, it has to realize the whole thing before it can start counting the small one (which is also when it can start releasing memory)
14:54neotyk(inc amalloy)
14:54lazybot⇒ 23
14:56neotykborkdude: yes, line 26
15:00pvncadamalloy: thanks. What is max memory used in both the cases? Is it 100M elements or ~200M elements
15:00amalloymeh. depends on how you count things
15:01amalloyfor the OOM case, i would accept either 100M or 200M; for the non-OOM case 0, 100M, and 200M are all good approximations
15:03pvncadamalloy: won't doing (count smaller-one) realizeentire the data source (range 1e8)?
15:04amalloyno
15:04pvncadamalloy: here is the code I am referring (let [[t d] (split-with #(< % 12) (range 1e8))] [(count d) (count t)])
15:06nDuffpvncad: why would that need to realize the entire range? Both take-while and drop-while are lazy.
15:06pvncadamalloy: t holds reference to lazy (range 1e8) and (count t) will realize that lazy range seq
15:07gtrakeggsby: you could do condp :>> identity
15:08gtrakhttp://clojuredocs.org/clojure_core/1.2.0/clojure.core/condp#example_44
15:08borkdudeneotyk tnx
15:28Sgeo_Why isn't there a link to logs in the topic?
15:39TimMcSgeo_: Because chouser hasn't put it there. :-P
15:41jweissrecommended way to define a var that is only set once, at runtime: just do (defn setup [] (def myvar "x")), or (def myvar (atom nil)) (defn setup [] (reset! myvar "x")) ?
15:41TimMcdefonce
15:41TimMcerr, maybe not...
15:42amalloy(def myvar (delay "x")) ;; ...at runtime, use @myvar...
15:43jweissoh, hadn't thought of that amalloy
15:44jweissnot sure that really works though, since myvar might depend on function arguments
15:44amalloy(def myvar (promise)) (defn setup [] (deliver myvar (f x y z))) ...
15:47jweissamalloy: nice.
15:47jweissdoesn't allow easy monkeying with the value at the repl though
15:48jweissi guess i'll stick w atoms since there's no apparent consensus here
15:49TimMcjweiss: alter-var-root doesn't help from the REPL?
15:50jweissTimMc: well of course i can reset the promise and re-deliver it, but it's more of a pain
15:50TimMcNah, just reset it to an atom.
15:50TimMcIt's still an IDeref
15:50jweissah true
15:51jweissi'd thought about just using a var because i don't have to explicitly deref and concurrency is not an issue
15:53neotykis leiningen.git-deps from clojurescriptone available as standalone?
15:59Sgeo_Are there good FRP libraries for Clojure?
16:08dnolenSgeo_: no, Stuart Sierra started on something, https://github.com/stuartsierra/cljque
16:09dnolenbut it doesn't look actively developed these days.
16:09TimMcHow do you pronounce that, anyway? :-P
16:09BronsaCljque is pronounced "clique" or "click"
16:09TimMckludge-cue?
16:09TimMcah
16:09tbaldridgeI've done some playing around with FRP style coding in Clojure. The killer is the debugging
16:10kovasbstate strikes again..
16:10tbaldridgeIf everything is async (as with cljque) it's hard to know of the event you just sent is waiting to process or it was filtered out
16:11gtrakah the silent J
16:12RaynesThe silent killer.
16:12gtraktrajgic
16:12Bronsalol
16:13gtrakor tragjc
16:13kovasbproblem is the logic is complected with the propagation
16:13kovasbhard to test the logic seperately
16:13tbaldridgeyou basically run into the same issues as testing actor oriented code
16:14gtrakcljurmudgeon
16:17kovasbi think any frp solution should let you compute the same result "classically" on values, in addition to doing it on refs/event-sources
16:18tbaldridgeso how do you handle the multiple output situation? For example:
16:19tbaldridge(defn dispatch [source event]
16:19tbaldridge(if (= source :one) (send output1 event)
16:19tbaldridge (= source :two) (send output2) event)))
16:20tbaldridgeso that's more or less the way you'd do it in Erlang, but that litters side-effects throughout your code....
16:20aperiodic(inc gtrak)
16:20lazybot⇒ 1
16:22Chousuke_tbaldridge: I think you should have a dispatch table for something like that. (send (*outputs* source) event)
16:22kovasbobserving is more FRP style than sending IMHO
16:23kovasbyou have something that produces values, and other things that chose to consume them
16:24kovasbhow the consumers are told there is a new value to work on is an implementation detail
16:24kovasboh i see
16:24kovasbmisread the code
16:26kovasbare output1 and output2 supposed to be receivers, or values?
16:26tbaldridgereceivers
16:27kovasbok
16:27kovasbyeah that just looks like event processing to me then
16:30tbaldridgeBut the issue I see is how to perform this without ending up with impure functions.
16:30TimMcFRP... That's what Out of the Tar Pit talks about, right?
16:30tbaldridgeIn push-based FRP what we end up is basically Rx (from .NET) or something that looks close to what Dataflow is
16:30dnolenTimMc: not really
16:31tmciverTimMc: no, functional reactive programming, I think.
16:31TimMcWhat's this FRP, then?
16:31TimMcOr that one.
16:32tbaldridgeSo at it's core, Reactive Programming is about connecting things together. For instance:
16:32tbaldridgex = 5 * y
16:32tbaldridgein reactive programming would say (x is always 5 times y, always, if y changes re-calculate x)
16:32dnolenTimMC: Out of the Tarpit is about Functional Relational Programming.
16:33TimMcAh.
16:33kovasbwas looking at this dissertation over the weekend
16:33kovasbhttp://www.cs.brown.edu/research/pubs/theses/phd/2008/cooper.pdf
16:33kovasbthis is the flapjax guy
16:34kovasbbut more in-depth than the flapjax papers on the ideas
16:35kovasbi think one point is, anytime you see something "send" thats basically a callback
16:36kovasbcallback is the enemy
16:37tbaldridgekovasb: thanks. This looks good. I'm going to have to read it.
16:37kovasbyeah, i finally bit the bullet and started reading these papers :)
16:37tbaldridgeI'm on page 5 and already they're expressing the issues I run into every day.
16:38kovasbthat one is good. the flapjax papers are also good.
16:38kovasbdefinitely need to read a good FrTime paper
16:38kovasbsince that seems to be the original
16:39kovasbalso http://lampwww.epfl.ch/~imaier/pub/DeprecatingObserversTR2010.pdf
16:39kovasbvery good breakdown the problems with callbacks
16:40kovasbthough their solution is very much like flapjax, just scala-fied and more complicated
16:40tbaldridgedon't those two go hand-in-hand? *takes cover *
16:40kovasbyes
16:41kovasbits pretty interesting putting like ftp://ftp.cs.brown.edu/pub/techreports/09/cs09-04.pdf
16:41kovasbside by side with the scala version
16:42kovasbthe question I'm really interested in tho
16:42kovasbis how would you write that hiccup-to-dom function
16:43kovasbin a way that lets you put refs at any point in the hiccup
16:43kovasbbut without putting a "is this a ref" logic at every branch point in the hiccup transformation code
16:46kovasband none of that FRP stuff really helps with that
16:49uvtcI saw a snippet posted here a while ago (by xeqi) and was trying to figure out how it works. Here it is, with a bit more formatting: https://www.refheap.com/paste/3113 . My question is,
16:50uvtchow does that (conj ...) not go off and create an infinite list causing the whole thing to blow up?
16:50uvtcWhenever I use `iterate`, I'm always careful to put it inside a `take`...
16:52matthaveneruvtc: because map will evaluate it lazily with (concat ...) and (concat ...) is bounded by the size of x
16:52Sgeo_Infinite lists are not a problem unless you try to show them
16:52Sgeo_Or otherwise do something with every element
16:53uvtcOh. I realized that map *returns* a lazy seq, but did not realize that it evaluates its args lazily as well.
16:53uvtcAlso, I see how it goes lock-step with the concat-generated seq.
16:53uvtcThanks!
16:53Sgeo_:/
16:54Sgeo_That's ... not quite... arguments in Clojure are always strictly evaluated, if I understand correctly
16:54S11001001uvtc: it doesn't, and can't, *not* evaluate its args, because it is an ordinary function. It does just so happen to not force what you give it, if it's a lazy seq
16:54S11001001as Sgeo_ says
16:54Sgeo_$heval (const 5) (1/0)
16:54lazybot⇒ 5
16:55Sgeo_,((constantly 5) (/ 1 0))
16:55clojurebot#<ArithmeticException java.lang.ArithmeticException: Divide by zero>
16:55Sgeo_In the former, the arguments are lazily evaluated. The 1/0 is never even done
16:55Sgeo_In the latter, even though (constantly 5) ignores its argument, the argument is still evaluated
16:56Sgeo_Thus the blow up
16:56Sgeo_,((constantly 5) (repeat 3))
16:56clojurebot5
16:57Sgeo_In this case, (repeat 3) is evaluated. However, all it returns is an object that, when something asks, will give back stuff
16:57Sgeo_Although it is in principle an infinite sequence, it is such that it doesn't try to store all of them at once.
16:57Sgeo_However, the (repeat 3) still does get evaluated.
16:57Sgeo_S11001001, is that a clear demonstration?
16:57Sgeo_uvtc, does this help?
16:58uvtc(sorry, distracted --- family came home ... just a minute)
16:58S11001001Sgeo_: yes
16:59Sgeo_So glad lazybot can do Haskell >.>
16:59S11001001constantly is particularly good for examples; in truly nonstrict languages, the evaluation behavior of the second arg is totally irrelevant by definition
16:59S11001001as Sgeo_ showed were I to scroll back up more :)
17:01uvtcSgeo_, I'm not familiar with `const`. I don't see any docs for it, and it's not listed at clojuredocs...
17:02Sgeo_uvtc, $heval does Haskell, not Clojure
17:03Sgeo_const in Haskell is similar to constantly in Clojure
17:03Sgeo_With the illustrated difference, due to Haskell being nonstrict and Clojure being strict.
17:03brehaut(inc Sgeo_)
17:03lazybot⇒ 1
17:03brehaut^ points for semantic pedantry
17:03Sgeo_lol
17:04Sgeo_I personally don't actually understand the difference between nonstrictness and laziness, but I vaguely know there is one.
17:04brehautlikewise :P
17:04brehauti think bottom is involved?
17:04Sgeo_I _think_ that laziness is a way of being nonstrict but not the only way?
17:05Sgeo_As in, laziness is a subset of nonstrictness? I may be totally wrong though
17:07uvtcSgeo_, Ok, I see what you mean. ((constantly 5) x) evaluates x (which is why ((constantly 5) (/ 1 0)) blows up), but although it evaluates the arg in ((constantly 5) (repeat 3)) , `repeat` returns a lazy result. I'm just used to seeing look non-lazy because I evaluate it in the repl.
17:08Sgeo_uvtc, correct.
17:08uvtcThanks, Sgeo_ !
17:08Sgeo_<elliott> Sgeo_: Non-strictness is about operational semantics.
17:08Sgeo_<elliott> Laziness is a certain implementation strategy of non-strictness (call by need).
17:13xeqiuvtc: looks like you got an answer, and there was a better solution using partition w/ 4 args later
17:14uvtcHi xeqi, Yes, thanks. I was going to look at that one next, but I got stuck on the first one. :) Now I'm just writing up some notes before continuing.
17:21Sgeo_How often are there questions about Clojure's nonstrictness or lack thereof?
17:22brehautnot that often
17:25Sgeo_brehaut, aww
17:25Sgeo_That means less opportunity for me to be helpful
17:25Sgeo_I don't actually know much Clojure
17:26Sgeo_I had to check the cheatsheat to see that repeat actually exists
17:55brehautSgeo_: most of the clojure questions about laziness are around people mistakenly putting side effecting logic or accessing dynamic bindings in lazy code
17:56Sgeo_Ah
17:57Sgeo_8:24 of the second song in [S] Jane: Enter?
17:58Sgeo_....wrong channel
17:59pepijndevosis there something like vim starterpack?
18:02gfredericksno, vim is completely ideal by default
18:10gfredericksis there a java/clojure library that can easily compute distance between two lat/lng pairs?
18:12mwillhitequick google: http://openmap.bbn.com/
18:12mwillhitehttp://stackoverflow.com/questions/120283/working-with-latitude-longitude-values-in-java
18:14gfredericksmwillhite: thx; you're apparently a better googler than I
18:37semperosgfredericks: the GeoTools lib is part of a larger suite of open source geo tools that get a lot of development attention, have been quite impressed
18:38kay__hat are they
18:39kay__what*
18:42semperoskay__: see the right-hand sidebar of this page for a list of the OSGeo projects: http://www.osgeo.org/
18:42timvisheris mmcgrana ever ever on here?
18:43kay__nice
18:44technomancytimvisher: he doesn't really do IRC
18:53timvishertechnomancy: what's the best way to try to get him to look at one of the issues on ring-json-params?
18:56Sgeo_You know, this might have been a better illustration
18:56Sgeo_,(class (repeat 3))
18:56clojurebotclojure.lang.LazySeq
18:56amalloytimvisher: break into his house and staple a printout of a screenshot on the ceiling above his bed
18:56technomancytimvisher: he's pretty hard to get a hold of, but he's pretty good at delegating to others when he doesn't have the bandwidth. doesn't weavejester mostly handle ring these days?
19:25timvisheramalloy, technomancy: makes sense. I wasn't aware that weavejester had taken over. I can open an issue there.
19:25timvisherthanks
19:41amalloywell, i never expected "makes sense" as a response to my suggestion
19:50arrdemanyone here worked with fnparse?
19:56timvisheramalloy: yeah, do you have his address?
19:58gfrederickstimvisher: I think it would be funny if he said "yeah I'll pm you" and that was all either of you said on the topic
19:59technomancyother than "/me writes note to self to restock staples" maybe
20:00timvishergfredericks: I agree. shame he's not playing along ;)
20:01timvisherso turns out that weavejester never forked ring-json-params, sadly
20:01timvisheris it considered an ok practice to upload a custom version of a standard library to clojars?
20:02brehauttimvisher: as long as you use your own group id
20:03technomancyoh, it's not part of ring proper?
20:03timvishernope
20:03timvisherbrehaut: ah, i see that now
20:04brehautarrdem: yes
20:04brehautarrdem: im pretty sure it hasnt been updated for even clj 1.3
20:05brehautarrdem: at this point its pretty much abandonware
20:26timvisherdoes anyone think that leaving body in a consumed state is a good idea for wrap-json-params?
20:26timvisheri can't see the reasoning behind it
20:27timvisherseems better to turn it into a string and then try to parse it, so that you can do something sensible with the data rather than having a consumed object in that spot
20:28arrdembrehaut: yeah it really is abandonware... I see a couple people who have updated it themselves but there aren't lein packages for the updates. I had a question about writing recursive definitions becuause what I had wasn't working. Then I re-thought my BNF and the light of heaven shown down on me and all was resolved.
20:29technomancytimvisher: a consumed reader? yeah that seems silly but I don't see why it would hurt
20:29brehautarrdem: ok cool
20:34timvishertechnomancy: basically, if you're trying to be nice to your clients and give them plenty of data back as far as why they're request failed, one of the things I'd want is the body that I sent. But with wrap-json-params consuming body and then throwing an exception, I have no way of getting at it because it's been consumed.
20:34timvisherthat seem to make sense?
20:35timvisherso if you're trying to parse json, then assuming you can get it as a string seems to be a good idea
20:35timvisheri guess the problem might be if someone is malicious and sends you a 500 MB movie or something like that and you try to read the whole thing into a string
20:38emezesketimvisher: FWIW, I like to enforce POST parameter size limits at the web server layer (e.g. in nginx.conf), and let the webapp itself be oblivious. YMMV, though.
20:46timvisheremezeske: interesting option! I hadn't thought of that
20:46timvisheri assume jetty can do similar things
20:53gfredericksomg guys logic programming is so much fun.
20:55llasramgfredericks: It looks like it! I still haven't found anything cool do with it yet though :-(
20:57llasramWhat are you solving with it?
20:57gfredericksa few years back I had written a crappy-javascript AI for a game that my sister apparently still plays against and she wanted me to make it easier. So I'm just rewriting it in core.logic.
20:57llasramOh, cool
21:14muhoo&(keyword (.toString *ns*) "fubar")
21:14lazybotjava.lang.SecurityException: You tripped the alarm! class clojure.lang.Namespace is bad!
21:15gfredericksmuhoo: yes?
21:15mthvedt__are there any good docs/tutorials for core.logic
21:15mthvedt__besides "read the reasoned schemer"
21:16gfredericksnothing that compares to that
21:50muhooi'm trying to figure out a way to serialize namespaced keywords to json couch and back again
21:54adumuhoo: namespaced?
21:54muhoofully qualified :foo.bar/baz not :baz
21:59nDuffmuhoo: I'm not sure a fully generalized solution is possible for that, since anything JSON can represent already has a meaning in Clojure
22:01muhooi'm just going to do (keyword (.toString *ns*) foo)
22:11gfrederickswait what? what's wrong with {"foo.bar/baz": 12}?
22:12echo-areagfredericks: There's an extra colon there
22:13gfredericksecho-area: eh? I ment it as JSON
22:24xeqitechnomancy: ... it worked for me
22:27xeqiargh, refheap middle click
22:28xeqitechnomancy: https://www.refheap.com/paste/3115
22:29xeqiheh, wrong chan
22:58Raynesxeqi: I'd care more about that if I had a computer that had a mouse that had a middle click and if I actually would use it if I did have one.
22:58Raynesxeqi: I've been hoping somebody would care enough to fix it, since it's all Javascript crap that I'm unfamiliar with in the first place. :\
22:59xeqiI'm surprised it hasn't been fixed upstream
23:36lynaghkHas anyone used goog.inherits to extend a goog Closure library object in ClojureScript?
23:40devnlynaghk: https://bitbucket.org/puffnfresh/cajole/src/efb0ae91bad5/src/cajole/editor.cljs
23:41lynaghkdevn: sweet, thanks
23:41devnlynaghk: thank google ;)
23:41devn(my speciality)
23:42muhoois there a more concise form of : (if pred (assoc m :bah "stuff") m) ?
23:42devnlynaghk: im curious now
23:42devnlynaghk: what does it do?
23:42devnmuhoo: erm, i dont think so?
23:42muhookind of an if-assoc, that'll return the map without the assoc if the pred isn't truthy?
23:43devnwrite one. ;)
23:43lynaghkdevn: I'm trying to put something clickable within an item in a goog.ui.PopupMenu. However, by default onBlur the popup menu will hide
23:43muhoowell, sure, but in clojure "there's a function for that!" seems to be common
23:45devnmuhoo: fair enough, but the list is only so long
23:46gfredericksmuhoo: I think you want fix from flatland/useful
23:46devnmuhoo: that seems like a "nice to have which is easily written"
23:46amalloy(inc gfredericks)
23:46lazybot⇒ 6
23:47amalloyoh man. the karma plugin should keep track of where your karma comes from. that way when they see all my karma comes from clojurebot, they'll know i was just gaming the system
23:47devnmuhoo: i think you want to probably not pull in useful as a dependency and just add the function yourself
23:48muhoogfredericks: that's hilarious, i was just thinking "hmm, i should see if it's in useful"
23:49gfredericksdevn: he wants to do that over and over again in each of his projects
23:49clojurebotNo entiendo
23:49gfredericksI guess if everybody used useful that could get complicated though
23:50gfredericksdependencies are hard
23:50gfrederickswe need inline dependencies
23:50devngfredericks: yeah, it just is a lot to swallow. it seems like about 20 different dependecies to me
23:50devndependencies
23:50muhoono SHIT. i'm still dealing with a crazy hairball with jackson
23:50amalloyi wonder how many people actually do. the maintenance is sorta cowboyish in places; if like everyone is using it maybe we should figure out a way to be more careful
23:50muhoowell, i decided to punt for now, but i will have to deal with it before heroku goes with lein2
23:51amalloybut i doubt everyone is, really. that would be a good problem to have
23:51gfredericksamalloy: I mostly just constantly wish I was using it
23:51gfredericksmumbling to myself about how I could use fix here or there
23:51amalloytbh, for muhoo's case (where pred is a value, not a function of m) fix has some sharp edges
23:52devnwhy not just write the fn yourself?
23:52devnit's pretty straightforward, no?
23:52gfredericksbased on trying to distinguish between values and functions?
23:53muhooi did write, but it's super ugly: https://www.refheap.com/paste/3116
23:53devnthat's not ugly to me
23:53amalloygfredericks: yes
23:53gfredericksoh man devn is flirting with muhoo's function in public
23:53devnlol
23:54muhoodevn: really? watch amalloy turn it into one line with 5 symbols :-)
23:54devnstop golfing, brother.
23:54amalloythat's the sort of thing ninjudd likes to do a lot more than i do
23:54gfredericksyou're prettier than you think you are, little function
23:54muhoodevn: fair
23:54devnmuhoo: golfing is fancy. it's interesting, but clever and fancy. just write the goddamn mother fucking code.
23:55gfrederickscopy, paste, getirdone
23:55muhooi do plenty of that, for sure.
23:55devnlol. i dont want to advocate copy and paste or doing it wrong on purpose for the sake of deadlines or what have you
23:55muhooclojure does impel me towards elegance, even golf, at times.
23:55devnbut preoccupation with LOC and so on can really kill the spirit
23:55devnthe shitty code i've written in clojure is better than its imperative mutable equivalent
23:56devni need to remind me of that
23:56devns/me/myself
23:56devngfredericks: lol
23:57devnamalloy: any thoughts of splitting up useful into a more modular set of dependencies?
23:58gfredericksuseful.logic
23:58gfredericksuseful.jdbc
23:58gfredericksuseful.match
23:58gfredericksuseful.php
23:58devni really cringe when i decide ill pull in useful and the kitchen sink and an in-unit dishwasher/lawnmower. I just want seq.clj sometimes. Sure I can require that, but id rather it be spelled out in the project's deps. It feels less dirty.
23:58lynaghkdevn: that link you sent totally worked. I'm in awe; I've been fighting with this one for hours. thanks again!
23:59devnuseful.hair-dryer
23:59amalloytoo much hassle, both to maintain and to use. if it were actually being used as much as old-contrib, it would be worthwhile/necessary
23:59devnlynaghk: no problemo
23:59gfredericksI think muhoo should fork useful and call it mooseful
23:59amalloythe "size" of the dependency is only cognitive load anyway - the jar is not large
23:59devnmuhoosful