#clojure logs

2014-01-27

00:19devnyay for JoC 2ED
00:19devnI've been enjoying the read. Fantastic teaching moment with reducible/reducers
00:19rgrinbergis there a clojurescript instarepl in lighttable?
00:20rgrinbergkinda like the scratch buffer in emacs
00:27tutysaraddellacosta: how does the changes look, are they fine?
00:28ddellacostatutysara: sorry, I haven't had time to take a look. As I said, I'll take a look ASAP.
00:29tutysaraddellacosta: sure :)
00:37ddellacostatutysara: please be aware, it may take more time than I have in the next few days. I have to try setting up a few things and see what structure makes more sense in terms of multi-config in one workflow vs. multi-workflows. So please be patient and bear with me as I have a lot of priorities ahead of updating friend-oauth2, unfortunately.
00:40tutysaraddellacosta: okie, np, keep me updated, I am available for discussions around this time daily if we have to discuss something
00:40ddellacostatutysara: thanks--good to know.
00:42dissipateddellacosta, are you guys discussing contract work?
00:43quizdrI like to provide to everyone best wishes for the remainig days of the Snake. May your start of the year of the Horse be a good one, filled with many fine sexprs.
00:43ddellacostadissipate: no, tutysara has been contributing a bunch to friend-oauth2, and we were just talking about the most recent changes (and my unfortunate lack of time to review them this week)
00:45dissipateddellacosta, i see. i'm going to be looking for clojure projects to contribute to over the next couple of months. any good ones you recommend?
00:45ddellacostadissipate: depends, anything you're interested in in particular?
00:47dissipateddellacosta, i'm interested in rule engines with business applications. for instance, a business that runs promotions might have all kinds of rules. ideally, they would be able to select these easily from a UI.
00:49ddellacostadissipate: not super familiar with what is available in Clojure for those kinds of systems, but have you checked out Clara? https://github.com/rbrush/clara-rules
00:49ddellacostadissipate: seems like there are a number of open issues
00:50ddellacostadissipate: based on your interest, perhaps a UI front-end for Clara would be an interesting project as well?
00:50dissipateddellacosta, i have. seems interesting.
00:50ddellacostadissipate: ah, sorry I don't have knowledge of other related projects out there...
00:52ddellacostadissipate: my knowledge of Clojure tends to be in the web domain, and I know there are a ton of projects all over the place that could be improved. But I find that it is best to try building something yourself and then figure out the parts you want improved based on your own usage. Or rather, that works best for me.
00:53dissipateddellacosta, no worries. seems like Clara is enough for me to get going. i'm not a UI guy really, but i did help build a rather complex UI about a year ago for a web-based electrical engineering tool.
00:53ddellacostadissipate: yeah, I was just throwing that out there...but I bet there's a ton of different directions you could go with it.
00:55dissipateddellacosta, indeed. i'm actually new to Clojure. been interested in it for quite awhile, but haven't had time to really sit down and learn it. :P
00:56ddellacostadissipate: there's no time like the present. :-)
00:56ddellacostadissipate: seriously though, I think it will be worth your while if you are interested in functional languages. Clojure has a lot of nice qualities.
00:59dissipateddellacosta, all the videos i've watched about Clojure by Hickey etc. have me convinced Clojure is definitely in the right direction from where software development is now with the imperative languages.
00:59ddellacostadissipate: I definitely feel similarly, and think that is what draws a lot of folks to Clojure.
01:00ddellacostadissipate: the community is pretty nice too. Lots of friendly and smart folks.
01:01dissipateddellacosta, indeed. now how do i get the company i'm working for to switch to a Clojure based stack? :P
01:02ddellacostadissipate: ha, I dunno...I solved that by trying to find a company that used Clojure. ;-)
01:03ddellacostadissipate: only works if you are ready to look for a new position, as I was at the time.
01:06dissipateddellacosta, i am very interested in working for Cognitect actually
01:07dissipateddellacosta, i'm kind of confused as to what the relationship between relevance and cognitect though.
01:07dissipateer, what the relationship is
01:07ddellacostadissipate: well, seems like they may be looking. :-) http://www.cognitect.com/jobs
01:07ddellacostadissipate: relevance merged with the datomic/clojure core team to become cognitect, as I understand it.
01:08ddellacostadissipate: ah, they explain better here: http://cognitect.com/hello
01:10dissipateddellacosta, do you work for congitect?
01:10dissipateer, cognitect
01:10ddellacostadissipate: nope, I work for a Canadian startup
01:10ddellacostadissipate: but I work remotely.
01:12dissipateddellacosta, i'm jut wondering what it takes to get a contract type job at a clojure shop. how long had you been doing clojure before you got hired there?
01:14ddellacostadissipate: well, these guys needed a web developer and posted something on the Clojure mailing list. I had been doing web dev for a while (Rails and etc.) and had been using Clojure on the side as a hobby for about ~3 months. We did a test project to see if there was a fit and it worked out.
01:16logic_progin clojure, is there any good "sliding list", i.e. I want "cons" to create lists that have at most 100 elements
01:16dissipateddellacosta, do you have any idea what kinds of projects cognitect does?
01:16logic_progi.e. it bumps/drops eisting items
01:17ddellacostadissipate: I don't, I'm sorry
01:17dissipatelogic_prog, are you talking about a ring buffer?
01:21dissipatelogic_prog, this looks like what you are looking for: https://github.com/amalloy/ring-buffer
01:24logic_prog(inc dissipate)
01:24lazybot⇒ 1
01:26dissipateddellacosta, are you doing full-stack web dev or do you specialize in front-end or back-end?
01:27ddellacostadissipate: full-stack web dev, but lately doing a lot of front-end work as we've moved from more back-end rendering heavy to front-end rendering
01:28dissipateddellacosta, i see. i'm much more interested in back-end development myself.
01:29dissipatelogic_prog, thanks for the inc. :D
01:30dissipateddellacosta, i'm very keen on uncle bob's Clean Architecture.
01:30ddellacostadissipate: http://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html ?
01:31dissipateddellacosta, i'm curious as to how far you can push this idea of completely abstracting the persistence layer though.
01:31ddellacostadissipate: I definitely agree with it in theory, but I've had trouble reconciling the database parts of it with my own experience lately
01:31ddellacostadissipate: I think it works rather poorly actually (abstracting the persistence layer)
01:31ddellacostadissipate: whatever you end up with seems like a terribly leaky abstraction.
01:32dissipateddellacosta, i've seen that and i've watched UB's talks and kept an eye on the 'clean code' discussion board
01:32ddellacostadissipate: and I think he's glossing over a lot when he equates something like mongo with oracle, in terms of swapping things out
01:33dissipateddellacosta, but it's strange. UB hasn't pointed to a significant implementation of Clean Architecture. only thing he has pointed to of substance is 'Obvious Architecture', which is just an clean architecture based Ruby framework.
01:34ddellacostadissipate: yeah...I think it's a pretty challenging thing to put into practice.
01:34dissipateand i haven't seen any significant 'Obvious Architecture' implementations. it all seems too good to be true for non-trivial implementations.
01:34ddellacostadissipate: it may just be. ;-)
01:34dissipateddellacosta, so is 'clean architecture' just a marketing scheme? :O
01:35ddellacostadissipate: no, I suspect it is a glorious platonic ideal of the sort that software developers love, no?
01:35ddellacostadissipate: I suppose it's marketing in some sense, for Uncle Bob
01:36ddellacostadissipate: don't get me wrong, I always like thinking about what Uncle Bob has to say, he is provocative. But there are many cases where I don't agree (and many I do)
01:37quizdrddellacosta you guys are moving to front-end processing to save on server resources and demand?
01:38ddellacostaquizdr: no, I think that it's much more about providing a high quality user experience.
01:38dissipateddellacosta, he says that web frameworks, calls to external services, persistence are all just 'details' and should be rapidly interchangeable. and yet, i see little of this going on in real applications. indeed it seems platonic.
01:38ddellacostadissipate: yeah. :-(
01:39quizdrddellacosta if a lot of your proprietary logic is in clojurescript, which is seen in the browser as javascript, then I'd think it would technically be visible to all visitors, right? hard to keep source proprietary when a lot depends on front-end processing?
01:40dissipatequizdr, it is probably obfuscated
01:40ddellacostaquizdr: I suppose so...what's your point? (yes, we compiled to advanced mode, it's not exactly easy to read, dunno about de-compiling it though...)
01:42carki would hate being the on decompiling a google closure compiler output
01:42carkthe one*
01:43dsrxmy thing.... it's half working http://www.youtube.com/watch?v=fLmq_S5cWsg
01:45quizdrddellacosta i'm just curious how companies handle keeping their stuff closed when it's all running in a browser
01:45akhudekquizdr: we have our critical services behind the server
01:46akhudekquizdr: plus, the ui code is pretty useless without the backend services and data
01:47ddellacostaquizdr: (I work for akhudek) ;-)
01:48quizdrgot it, i've never looked at clojurescript at all but am quite curious about it.
01:48dissipateddellacosta, are you guys doing dating apps?
01:49ddellacostadissipate: no. I think seancorfield is working for a company that does that kind of stuff though.
01:50dissipateddellacosta, i'm really getting the itch to do some stuff with docker. not sure what though.
02:46logic_progwhat does #inst mean ?
02:46logic_progin the context of (pr-str ... )
02:50carki think it's a reader macro for inlining an instant in time as a string
04:19dsrx,(pr-str #inst)
04:19clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
04:19dsrx,(pr-str #inst "foo")
04:19clojurebot#<RuntimeException java.lang.RuntimeException: Unrecognized date/time syntax: foo>
04:20clgvdidn't zach tellman announce a library implementing a map-like data structure which is more space efficient than clojure's maps but has no structural sharing?
04:28AeroNotixclgv: was it still persistent?
04:29clgvAeroNotix: afair yes, copy-on-modification
04:29clgvbut maybe it was'nt maps but his tuple-library
04:33AeroNotixoh there was a tuple library recently
04:35clgvI currently represent datasets for analysis as normal maps. but that way they consume unnecessary memory since I hardly manipulate them
04:36AeroNotixYou're just making a time/efficiency tradeoff, your time is worth more than your programs {in}efficiency, it seems.
04:43sobelprocessing only needs to run as fast as i/o
04:43sobelunless you just like wait states
04:43sobel(i'm a huge fan!)
05:17noncomhi, what is the recommended way to approach parsing an xml stream incoming through udp/tcp ?
05:18noncommy initial guess would be aleph + lamina + clojure.xml , is it a fine approach?
05:20clgvAeroNotix: no, it's a fits in my RAM or not tradeoff ;)
05:21sobelclgv: working with a SQL store?
05:21clgvsobel: no. no time yet. I tried datomic a while ago, but I shouldnt have
05:22AeroNotixNot tried datomic yet
05:23sobelheh. i was more responding to your data not fitting in RAM. postgresql (and probably oracle and sql server) has a pretty mature i/o system. i do any big analysis in sql because it would take me years to ever write code that could do better
05:27sobeldatomic looks complex. what is that thing?
05:29sm0kedatalog
05:29sobelso far i'm getting a strong whiff of jboss-style enterprise transactions
05:29sm0kei guess
05:29sm0kenot for the ^
05:29sobeldatalog is not datomic
05:29sobelthat i can tell
05:30sm0keyes its not datalog, its a immutable fact based datastore
05:30sobelso i read
05:30sm0kebut the query language is based on datalog
05:30tim_hi, very new to clojure. From what i can tell the 'let' keyword defines a local variable why not use a 'def' statement?
05:30AeroNotixtim_: because that'd be global, mmmkay
05:31AeroNotixtim_: try it
05:31sobeltim_: you need to learn the difference between binding and defining. let binds, def defines.
05:31tim_all variables defined using 'def' are global and accessible to all functions?
05:31AeroNotixtim_: try it
05:32sobeltim_: i recommend looking at the doc on 'let' at http://clojure.org/special_forms
05:32AeroNotixtim_: https://gist.github.com/AeroNotix/532e67f7175bbe3e466c
05:32sobeltim_: the special forms are fairly critical to learning clojure. i'm starting there, also new to clojure as of this weekend
05:35tim_Thanks, just tried it in my noddy web app. I see what you mean.
05:40sobelso... do clojurists use jackson to render json for the web? does it correctly render sexps?
05:41sobelthat's a bit ahead of where i am now but i don't really do html delivery from the server anymore.
05:41sobel(yeah, i thought client-server should have beaten the web but i was shouted down by the whole internet)
05:42sobelSoA is a dish best served cold
05:48noncomsobel: i use the cheshire library.. i think it can be based on jackson yeah..
05:55Ember-cheshire is based on jackson
06:08andrevdmPerhaps I misunderstaning terminoligy but the docs for case say "The test-constants are not evaluated. They must be compile-time literals" and yet this "(let [a :x] (case a :z 1 :x 2))" evals to 2
06:08andrevdmi.e. a in my example is evaluated to :x
06:08andrevdmThis is exactly what I want to happen, I'm just not sure if I can rely on it given the docs
06:08andrevdmany ideas?
06:10clgvsobel: yeah, that was my short way to say that I wasted my time for that scenario differently, otherwise I'd have some SQL DB running therefore
06:10opqdonutandrevdm: the doc means that the _tests_ (i.e. :z and :x) have to be literals
06:11opqdonutthe value you test can obviously be a nonliteral, otherwise case would be pretty useless
06:11opqdonut,(let [a :x] (case :x :z 1 a 2))
06:11clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: � in this context, compiling:(NO_SOURCE_PATH:0:0)>
06:11opqdonutoops
06:11opqdonut,(let [a :x] (case :x :z 1 a 2))
06:11clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching clause: :x>
06:12clgvopqdonut: ,(let [a :x] (case a :z 1 :x 2))
06:12clgvopqdonut: ##(let [a :x] (case a :z 1 :x 2))
06:12lazybot⇒ 2
06:13clgvthe matching values need to be literals
06:13clgv,(let [a :x] (case :x :z 1 a 2 :default))
06:13clojurebot:default
06:13andrevdmoh right, thanks. yip I was being daft. Thanks!
06:13andrevdmI dont need to run for pattern matching just yet, then
06:14clgv,(let [a :x] (case a :z 1 (:y :x) 2 :default))
06:14clojurebot2
06:16andrevdmRight but if I want the matching val to be evaluated first then case wont work...
06:16andrevdmSo then is the next best option pattern matching?
06:18effywhat is the correct way to use memoize with a recursive function? i've tried this http://pastebin.com/xpgsAKfi but it only cache the top level call not the recursives calls
06:27andrevdmfwiw using a cond rather than a case works for my case
06:27noncomi know that ccw does not use leiningen's project file to run a clojure application. someone please tell me, how do i make all the definitions of the project file be effective for the launched app?
06:30noncomclgv: ping
06:46clgvnoncom: I think newest CCW uses a tight leiningen integration but I have not checked the details yet
06:46clgvnoncom: since 0.22.0
06:52logic_progwhy does clojure prfer foo-bar to FooBar ?
06:52Ember-lisp way of naming things
06:52logic_progI'm looking at "placed-nodes", and I think "PlacedNodes" makes more sense
06:52logic_progsince I want to say "there is many of "placed-node""
06:53fredyr_effy: the memoization is only local to one computation of fibo
06:54fredyr_effy: so all the recursions are being memoized, but if you run a new call to fibo-m its going to start over
06:55effyfredyr_: yeah i get that, that's why i'd like to know what would be a correct way to make the inner call to fibo to point to the "global" outter memoized one
06:56fredyr_effy: alright, don't really know, i guess the point of memoize is to keep the caching local
06:56fredyr_effy: you can have a look at how its implemented, to get some ideas perhaps
06:56fredyr_,(source memoize)
06:56clojurebotSource not found\n
07:07edbondeffy, you should call memozied fibo-m inside fibo
07:08effyedbond: isn't that create a new cache at each recursion ?
07:08edbondeffy, no, memoized returns new function with cache - see https://github.com/clojure/clojure/blob/c6756a8bab137128c8119add29a25b0a88509900/src/clj/clojure/core.clj#L5723
07:10opqdonutandrevdm: I find myself using condp = more often than case
07:10effyedbond: unless i'm missing something here, it doesnt work, placing the memoize inside the body of the function just made it 3 time slower
07:11edbondeffy, try http://pastebin.com/dmwgRT6T
07:13edbondeffy, better another way - http://pastebin.com/VKWMJzRn
07:14edbondeffy, the idea is to call memoized version
07:16effyedbond: oh sweet, the declare thing do the tricks, i didn't know you could pre-declare things like that, that's kind of neat ! :)
07:17edbondeffy, I would better change fibo to return memoized version without declare trick. That looks hacky to me.
07:19effyhey at least i learned a new concept, doesn't matter if it's hacky, it's not like if i cared about fibonacci anyway :)
07:31squidzDoes anybody know how to use a clojurescript multimethod from javascript? My multimethod dispatch-fn is just a key to a map which is passed (defmulti mymulti :akey) (defmethod mymethod :akeyval ...
07:39squidzso if I have a clojurescript function a can easily access it in javascript via app.myfn(), but if myfn is a multimethod this doesn't return a javascript function. Is there a way to call a multimethod from clojurescript?
07:42clgvsquidz: you can have a look in the not-optimized javascript where you compiled a multimethod call to see how clojurescript does it
07:43squidzclgv: alright, i'll just look there. Thanks
07:57noncomclgv: oh ok, but otherwise, there was no way to specify the same things for a ccw project as for the lein project, right? for example, aot targets...
07:59noncomoh i guess i just have to read ccw manual more
08:00clgvnoncom: no. there were no settings dialogs in eclipse
08:01noncomclgv: then how do i specify aots?
08:03clgvnoncom: I am not sure whether the leiningen setting for :aot worked before. but it might now.
08:06clgvnoncom: hm ok. :repl-options is not supported yet
08:07clgvnoncom: so maybe just running launchers is enabled...
08:22noncomclgv: i see.... well, aot works in leiningen and i really need it to work for me, so seems ccw is of no help here..
08:22noncomhowever, ccw is said to use leiningen internally..
08:22noncomso i am lost..
08:23noncomwell.. maybe i can still use leiningen for building the app, not ccw
08:23clgvnoncom: file an issue on the googlecode page. laurent uses this to organize his work
08:23noncomokay, thanks, i'll ask laurent about this one!
08:30deadghosthttps://www.refheap.com/28385
08:30deadghostenlive is making some funky html for me
08:32deadghostI don't know what to pin it on
08:32deadghostI've stripped it pretty bare
08:41edbonddeadghost, did you try html/content instead of html/prepend?
08:42deadghostedbond, just tried it
08:42deadghoststill wonky
09:00deadghostok going to bed
09:00deadghosthttp://stackoverflow.com/questions/21382703/enlive-snippet-giving-me-odd-html
09:00deadghostif anyone wants to take a shot at it
09:09ro_sthowdy dnolen
09:10dnolenro_st: hello
09:28noncomwhat is the best option to parse xml in clojure?
09:29ro_sthttps://github.com/clojure/data.xml
09:31noncomthanks!
09:39mikerodIf I'm looking at a decompiled .class generated by the Clojure compiler, and I see something like: somefn_const.invoke(local_variable_name_1 = null, local_variable_name_2 = null)
09:39mikerodWell: to make this more readable:
09:39mikerodsomefn_const.invoke(local_variable_name_1 = null, local_variable_name_2 = null)
09:39mikerodis this being decompiled wrong, or does that actually work?
09:40mikerodI am fairly sure this has to do with "locals clearing" (which I cannot actually find any real explanation on, but I think I get it).
09:40mikerodHowever, I'd think this would just invoke the function with null's
09:40mikerodSince, I'd think the assignment would be done first. Maybe I am misinterpreting the semantics of how this works though...
09:48tbaldridgemikerod: the decompiler may be messing something up. Yes it is loccals clearing, but the assignment doesn't happen until after the value is pushed on onto the stack
09:49stuartsierraIt might be pushing the values of those locals on to the stack before clearing them.
09:49clgvmikerod: yes definitely wrong decompilation. I have seen that often as well
09:50mikerodOh, ok. Thanks for the feedback on that. It was bothering me since I couldn't see how that would possibly work.
09:51mikerodI guess the lesson is to just read the bytecode. :P
10:25clgvmikerod: not necessarily, most output of the decompilers is readable
10:26clgvdepends on which on you use though
10:27mikerodclgv: I haven't really decided on the best one to use. I should look into it some more.
10:27clgvmikerod: I default to procyon currently. I am using it with the luyten gui
10:28clgvmikerod: but I have jd-gui installed as well
10:28mikerodclgv: Cool, I'll look at these options. Thanks for recommendations.
10:29clgvmikerod: what did you use?
10:30mikerodI was using the built in decompiler of jarzilla when I was observing this locals clearing issue I mentioned. I'm not sure what decompiler it uses.
10:30clgvah ok thanks
10:30mikerod(I was looking in a jar archive too, but I could just extract)
10:58gfrederickswith cider does anybody get "Variable binding depth exceeds max-specpdl-size" when trying to eval a form in a large file with lotso forms?
11:00gfredericksseems like a weird thing to be sensitive to
11:02technomancygfredericks: that's elisp for "stack overflow"
11:03technomancyI would expect to see it from clojure-mode; pretty weird for cider to be susceptible to it
11:06tim_does clojure have a 'not' function to invert a boolean input? Just want to test for a input that is not nill '(=(nil? a) false)'
11:06technomancy~tias
11:06clojurebottias is try it and see
11:07RickInAtlanta,(nil? nil)
11:07clojurebottrue
11:11ianbishophappy to announce another clojure shop has been acq'd :) - http://techcrunch.com/2014/01/27/liveops-raises-another-30m-acquires-userevents-to-expand-its-cloud-contact-center-platform-with-routing/
11:12tim_,(=(nil? nil) false)
11:12clojurebotfalse
11:13tim_just wondered if there was a shortened version.
11:13RickInAtlanta,(not (nil? nil))
11:13clojurebotfalse
11:14tim_ok, thanks. i couldn't see the not function on clojure docs
11:15ToBeReplacedanyone ever used clojure to create circuit diagrams? i'm looking for a way to go from an edn representation of a simple circuit to visual output
11:21RickInAtlantatechnomancy: I am sure you get this a lot. but from time to time I just need to comment on how awesome lein is.
11:21Wild_Cat`so very true.
11:22gfrederickstechnomancy: I don't know for sure it's not clojure mode?
11:23gfredericks,((complement nil?) nil)
11:23clojurebotfalse
11:23gfredericksToBeReplaced: this is probably not exactly what you're thinking of? http://gfredericks.com/gfrlog/98/sha1.svg
11:26ToBeReplacedgfredericks: no -- i might not even be using the best language -- i'm looking for the ability to draw http://commons.wikimedia.org/wiki/File:Transistor_Simple_Circuit_Diagram_with_NPN_Labels.svg
11:27ToBeReplacedi get that graph drawing is not a solved problem, but figured there might be attempts for the common case -- think like ztellman's rhizome for xcircuit/tinycad/whatever
11:28ToBeReplaceddoesn't have to be clojure either really -- just anything that doesn't make me click on a screen and assign the layout myself because I really have no idea what i'm doing with that
11:53JaniczekHi guys, core.logic.fd question... I have a vector [[0 1] [2 3]] and I want to get a value from it with get-in. I've got lvars x,y - (fd/in x y (fd/interval 0 1)). How do I do get the integer values from the lvars? (get-in myvec [y x] -1) gives -1 everytime. Do I have to use project or something like that?
11:54tim_i'm stuck on a problem with my code. '(> a 0)', i'm getting 'clojure.lang.Keyword cannot be cast to java.lang.Number'. i'm confused and can't replicate it in the repl, but it occurs in my web app.
11:57S11001001,(> :hi 0)
11:57clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.Number>
11:57S11001001^^ tim_
11:57dsrx,(let [a :hi] (> a 0))
11:57clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.Number>
11:58gfredericks,(type (hash-map)) ;; wat
11:58clojurebotclojure.lang.PersistentArrayMap
11:58hyPiRiongfredericks: welcome to Clojure
11:58gfredericks:D
11:58gfredericks,(type (array-map))
11:58clojurebotclojure.lang.PersistentArrayMap
11:59gfredericksphew
11:59rasmusto,(map type {} {1 2})
11:59clojurebot()
11:59rasmustoo woops
11:59rasmusto,(map type [{} {1 2}])
11:59clojurebot(clojure.lang.PersistentArrayMap clojure.lang.PersistentArrayMap)
12:00dsrx,(type (into (hash-map) (for [n (range 50)] [n n])))
12:00clojurebotclojure.lang.PersistentHashMap
12:00hyPiRiongfredericks: Aha
12:00hyPiRionfor no args, it's just ([] {})
12:00gfredericksyeah I figured it prollably was that
12:00gfredericks,(type (dissoc (hash-map 1 2) 1))
12:00clojurebotclojure.lang.PersistentHashMap
12:00gfredericks^ empty hash map
12:01gfredericks,(type (apply array-map (range 10000)))
12:01clojurebotclojure.lang.PersistentArrayMap
12:01hyPiRion,clojure.lang.PersistentHashMap/EMPTY
12:01clojurebot{}
12:02dsrx,(type clojure.lang.PersistentHashMap/EMPTY)
12:02clojurebotclojure.lang.PersistentHashMap
12:05tim_thanks!
12:10Wild_Cat`so what's the deal with PersistentArrayMap? Are those faster/easier on the RAM for small sizes?
12:10hyPiRionfaster for small sizes
12:11Wild_Cat`actually, is there a paper somewhere that describes how Clojure maps are implemented?
12:12Wild_Cat`(kind of like http://hypirion.com/musings/understanding-persistent-vector-pt-1 -- which is awesome, thanks hyPiRion)
12:13katoxwoohoo, I just found out that Om discarded om/read, cool
12:14dsrxwhat was om/read?
12:15katoxdsrx: it was a way how to prevent unsynced access to application state
12:16katoxdsrx: now cursors should behave similar to atoms if I understand it correctly
12:16gfredericksWild_Cat`: I always imagined it was a pretty obvious hash tree thing but I'm probably wrong
12:17Wild_Cat`gfredericks: well since it looks like Clojure has at least 3 map types, only one of which is explicitly sorted, maybe not ;)
12:19hyPiRionWild_Cat`: http://lampwww.epfl.ch/papers/idealhashtrees.pdf is probably the closest one. Describes a mutable version very similar to the hash map
12:20Wild_Cat`I figure I'll have to read the source if I want to find out how the immutable updates/merges work, then...
12:20Wild_Cat`(I'm assuming there's a clever mechanism to avoid duplication like there is for vector)
12:22hyPiRionWild_Cat`: It's the same idea, mostly. Path copying down to the node, then update/replace the lowest level
12:22hyPiRionAt least from what I've gathered
12:23gfredericksWild_Cat`: well a hashmap wouldn't be sorted
12:23Wild_Cat`hyPiRion: and I imagine there's some promotion magic to determine what type will end up being used for the final map
12:24hyPiRionWild_Cat`: hah, yeah. Probably
12:25hyPiRionThat's the magic I guess. I have no clue how that actually works
12:28TimMcWild_Cat`: This has some info: http://blog.higher-order.net/2009/09/08/understanding-clojures-persistenthashmap-deftwice.html
12:29TimMcI think PHM has changed since then, though.
12:29Wild_Cat`TimMc: thanks, I'll check it out
13:17gfredericksIs it a problem that :post precludes recur?
13:18mdrogalisgfredericks: IMO yes, but there's not really a good solution.
13:18bbloomi mean, if you have a post condition, then that's the new tail position
13:19bbloomif you want the post condition checked every go around, then you can't sue recur.. .makes sense to me. just insert a new loop or anonymous function & recur on that
13:19dnolenmdrogalis: seems doable w/ a little of analysis actually
13:19dnolenlittle bit
13:19sdegutishead position is the new tail position
13:19mdrogalisdnolen: I suppose so.
13:19gfredericksbbloom: that could be done in the fn macro, right?
13:20gfredericksmaybe a bit sticky; too sticky?
13:20dnolenmdrogalis: we actually already do loop/recur return type analysis ClojureScript, it's pretty trivial actually.
13:20bbloomgfredericks: which would it do? check post conditions on every recur or only at the top level?
13:20gfredericksdnolen: would that mean it's easier to do in the compiler than the fn macro?
13:20mdrogalisdnolen: Huh - did not know. Pretty cool.
13:20gfredericksbbloom: only at the top level
13:21bbloomgfredericks: i guess that's a somewhat reasonable thing to do
13:21dnolengfredericks: the macro could call the analyzer and do the write thing in the actual tail positions that are not recur expresions
13:21bbloomalternatively, it could add a precondition to non-top-level calls
13:21dnolens/write/right
13:21teslanickI'm working through the om tutorial in the project wiki, why is this the case? : "First we set the initial state by implementing om/IInitState.We just allocate a core.async channel. It's extremely important we don't do this in a let binding around reify. This is a common mistake. Remember the contacts-view function will potentially be invoked many, many times."
13:21teslanickDoes let do something under the hood that breaks reify/async channels?
13:22bbloomteslanick: no, thinking about the "many, many times" bit
13:22dnolenteslanick: because your component fn will be invoked multiple times, allocating a resource in a let binding outside reify is a leak
13:22teslanickAh, so let [ my-chan (chan) ] would be no bueno?
13:23dnolenteslanick: any resource
13:23teslanickThat makes sense, thanks!
13:53teslanickAnother question about the tutorial: "Evaluate the new code and try it out. As you'll see, clicking on the delete button won't do anything. In fact if you look at the JavaScript console you'll see an error about trying to manipulate a cursor outside of the render phase. What went wrong?"
13:53teslanickI did not get this error, the contacts in the list appear to delete.
13:57teslanickAdding the proposed fix throws the following error: "No protocol method IDeref.-deref defined for type om.core/MapCursor: [object Object]"
14:00socksywhat's the best practice regarding large data structures within a reference type (say an atom)? Can't intuitively think how to alter some submap
14:00technomancysocksy: swap! + update-in
14:01socksyah cheers
14:05dnolenteslanick: look at the list of closed issues, this has been reported many times now
14:07teslanickSorry, and thanks again
14:08devnA lisp in Julia would be interesting...
14:08devnin the style of clojure
14:10bbloomjulia already has a lisp on the inside :-)
14:10bbloomdevn: julia> :(5 + 10 * 2 * 3) evals to :(+(5,*(10,2,3)))
14:11carkdnolen: i've been bugging the clojure-mode people to add indentation and coloring for specify. But they ask me now if specify! and specify* should also be added. I know these two were discussed, but are they part of the "public" api ?
14:12dnolencark: specify* and specify! don't exist
14:12carkdnolen: ah that settles it, thanks
14:28sdegutisdevn: was thinking of the very same thing the other day.
14:29sdegutisa VM hosted on Julia could be almost as fast as one written in C if done right without sacrificing much expressivityness
14:34xusersdegutis: why would I C implementation of Clojure sacrifice expressiveness?
14:35xusers/I/a/
14:36sdegutisxuser: C just makes it hard to separate the abstraction from the implementation
14:41devnsdegutis: we should do it, man
14:42sdegutisdevn: lol, I'm not smart enough for that kind of thing
14:42sdegutisnot yet at least.. in a few years maybe
14:42devnwriting a lisp?
14:42sdegutisdevn: writing a VM with a GV and bytecode compiler
14:42devnoh, that. :)
14:42sdegutisI tried my hand at a VM and bytecode compiler over the holidays and failed miserably
14:42sdegutishavent even attempted the GC of course
14:43sdegutisive written a dead-simple AST-walking Lisp interpreter a few years ago that did no GC, it just leaked like crazy
14:44devni dont know julia all that well yet, but i was imagining something more like just doing something stupid, like having an env with k/v, where the k is the fn name, and the v is the operation performed in julia
14:45devnthen just parse some ()s and eval those expressions
14:47sdegutisdevn: so a simple lisp interpreter? yeah sure im up for that
14:47sdegutiswould be a fun way to learn julia
14:47devnyeah, that's kind of what i was thinking
14:47sdegutis(more than just readin the docs)
14:48devnit'd also be fun to see if we could get to macros by way of julia's macro system
14:48devni mean, i know we could, just curious what it'd look like
14:48sdegutishmm yeah
14:48sdegutissetup a github repo and invite me if you want
14:49devnneeds a nem.
14:49devnname*
14:49sdegutisim terrible at naming things.
14:49sdegutisalso we could use the github issues to discuss design questions
14:49technomancyI was just wondering this morning if there were any projects named "alcibiades"
14:49sdegutishow about Clojure? i.e. closures in Julia
14:49devn"Ascanius"
14:50devnJulia is "of the gens Julia, a descendant of Julus"
14:50sdegutis(the J in Clojure is for Julia)
14:51devnand Ascanius was also called Iulus or Julus
14:51devnIulus is kind of a cool name
14:52DerGuteMoritzdangerously close to lulz though
14:52devnhaha
14:53devnjulisp sounds borderline inflammatory
14:54sdegutisI was reading Romana Familia the other day and Iulius kept popping up, which you just reminded me of.
14:54sdegutiser i mean Familia Romana, it teaches latin using natural method
14:55RickInAtlantahow about julep, after the drink?
14:56devnsdegutis: is this you?
14:56devnRickInAtlanta: i like that name. maybe we'll change it, but i just went ahead and called it lispia
14:56sdegutisdevn: huh?
14:56devnsdegutis: err this github username (sdegutis)
14:56sdegutisys
14:56devnk, added
14:56DerGuteMoritzhow about romeo? ;-)
14:57RickInAtlantanice!
14:57DerGuteMoritzoh wait it's juliet in english, isn't it
14:57devni like it either way
14:57gfredericksdoes anybody try to log in a compojure app which route is being matched? I feel like it is difficult/impossible to log that ideally early
14:57devnhttps://github.com/devn/romeo
14:57DerGuteMoritzyou could even have an alpha romeo release
14:57devnromeo wins
14:57gfredericksand difficult to log at all in any case, without redefining the compojure macros
14:57DerGuteMoritzheh, cool,
14:58gfredericksi.e., I'd prefer to be able to log in some of the earliest middleware which route is being requested, but of course at that point the matching hasn't occurred yet
14:59hiredmangfredericks: time to start looking for an alternative
14:59gfrederickshiredman: that thought has occurred to me many times
14:59gfrederickshiredman: I don't imagine you know of one?
15:00hiredmancompojure routes are composed ring handlers, ring handlers are just functions, function composition is not sufficiently rich
15:00hiredmannope
15:00sdegutisdevn: pretty sure we can rename the github repo at any time any number of times with no problems btw
15:00hiredmanmaybe pedestal has one?
15:00sdegutiswoo downloading windows 8.1
15:00gfrederickshiredman: well it's not inconceivable to define routes as data, then have a function that does just the matching and a later handler that calls the matched function
15:01gfredericksI've 1/7 of a mind to write this myself
15:01scape_anyone use korma?
15:01sdegutisscape_: i was considering it before i eventually settled on datomic
15:01hiredmansure, not at all, you just need extra information above and beyond the ability to invoke a function
15:01scape_sdegutis: dataomic nice? I bet it is
15:02sdegutisscape_: much better than the alternatives for my use-case
15:02sdegutiswhich is just a plain old web app: www.cleancoders.com
15:03sdegutisgot much faster the day i deployed the datomic branch and killed the mongodb branch
15:03scape_nteresting
15:03scape_nice site :)
15:04scape_mongo is tricky sometimes, seems better as a place to put things, then to retrieve
15:05DerGuteMoritzscape_: https://twitter.com/BigDataBorat/status/352043285549813760
15:06scape_hah
15:07katoxhuh, that was quite a bit unexpected, destructured #uuid from a cursor is a cursor a and must be derefed first
15:08katoxdnolen: do you think Om will support #uuids as react :key-s? or is it unreasonable and additional guid should be used instead?
15:09scape_in korma when updating a table in mysql, it returns nil when typically you'd get the number of affected rows. when running a raw query in korma it does return that, strange that the update function/macro does not return anything
15:10dnolenkatox: deref in render phase will not be allowed in the future, that bug is becauase UUID is ICloneable in CLJS, probably a mistake on my part, should have restricted that to collections only.
15:12sdegutisdevn: oh, your name is devin? i thought your nick was just a play on "developer" and "defn"
15:12sdegutisthis actually makes it cooler
15:14katoxdnolen: ah, ok. will that uuid fix also resolve its usage as a react :key? (having a unique identity)
15:15dnolenkatox: the key should be a string or something that has a short sensible toString result
15:15dnolenkatox: I wouldn't use uuid
15:17katoxdnolen: hmm, yes I use an additional id right now, so I'll probably leave it at that. I guess the duplication will be lesser evil than slower react node comparisons. thanks
15:21piranhadnolen: right now it's not possible to have computed cursor in om, right?
15:21dnolenpiranha: what is that exactly?
15:21piranhahmm... well I have data incoming to a component which is two parts, some list with data and some hash-map with metadata
15:22piranhaand when I render one component I need to pass metadata there as well
15:22piranhaand can't really understand what's the proper way to do that...
15:22piranhaI mean I want to render a list of components from that list of data, and each such component should get corresponding meta-data
15:26piranhadnolen: ^
15:28dnolenpiranha: there are couple of ways to do this
15:28dnolencursors can be modified like normal collections
15:28dnolenyou can join in some new data from elsewhere in your render implementation with om.core/join
15:29piranhaso I can preprocess it with :fn, I figured out this one but I'm not sure how to turn back my LazySeq from for to a cursor
15:29piranhahmmm ok I didn't really understand how to use join, I need to look at examples some more
15:29dnolenit's not fully baked yet, because we need some extra dependency tracking for it to work
15:29dnolenbut it's on my list of things to do "right now"
15:29dnolenpiranha: preprocess with :fn could also work
15:30dnolendepending
15:30dnolenbut honestly a proper om.core/join sounds closest to what you and other people want for this use case
15:30piranhaok, I'll try with join first
15:31piranharight
15:31piranhadnolen: I'm still unsure how to use it...
15:31piranhaah
15:31dnolenpiranha: expect suprises, om.core/join doesn't do dependency tracking, so if you join with something and that thing changes, you won't get re-renders
15:31piranhaah I think I got it
15:31piranhaohhhh
15:31dnolenthis is what needs to be fixed
15:31piranhathat's exactly what I want... well I think in my case it still could work
15:32piranhalet me try :)
15:36piranhaargh, it just breaks :\
15:36piranhadnolen: when I use om/join, it says 'cannot build Om component from a non-cursor'
15:37piranhaI do something like (for [item items] (om/build single-item-view (om/join item [:points (:text item)])), does that look right?
15:38dnolenpiranha: that's not how om.core/join works (apologies, it's experimental)
15:38piranhaoh, how does it work?
15:38dnolenit just returns a cursor for a some other value from the root of the app state
15:38piranhahmmm
15:38piranhanot sure I understand
15:38dnolenyou typically call it from inside your component's render implementation
15:38dnolennot at build
15:38piranhaah
15:38piranhaAH!
15:38piranha:))
15:38dnolenpiranha: look at the last section of the Om tutorial, it will clarify things
15:39dnolenpiranha: it's very short
15:39piranhawell I looked at that point exactly but somehow it didn't get to me :)
15:40dnolenpiranha: once fully baked, it will be the way to construct components that use different bits from the application state.
15:40piranhasure, that's what I actually need :)
15:41dnolenpeople are doing all sorts of crazy things at the moment and I can't blame them as I haven't really explained nor finished om.core/join
15:41piranha:)
15:42dnolenprobably today or tomorrow I'll get it done and cut a new release. I already have the implementation worked out.
15:42piranhadnolen: yeah it really does not update :(
15:42dnolenyep
15:42piranhacool! :)
15:43escherizehello?
15:43clojurebotBUENOS DING DONG DIDDLY DIOS, fRaUline escherize
15:45escherize,(+)
15:46clojurebot0
15:46escherize((fn [x] (eval (conj (range 1 (inc x)) *)) 5))
15:46escherize,((fn [x] (eval (conj (range 1 (inc x)) *)) 5))
15:46clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox/eval49/fn--50>
15:47dnolenpiranha: I take in React land people just pass more information via props in this case no?
15:47piranhadnolen: yeah, and then you just take what you need and pass further in props
16:01ior3k`anyone know what's relevance's % of clojure projects as opposed to say, rails projects, etc
16:01ior3k`I had a "heated" argument about the viability of clojure
16:01ior3k`I work at a dev shop and I'm trying to introduce clojure there
16:02bbloomior3k`: i doubt they will share that number, but anybody who things clojure isn't viable isn't worth arguing with. 60 seconds of research can show dozens of companies that do clojure work
16:02bblooms/things/thinks
16:03stuartsierraI can say that a significant proportion of our consulting work is in Clojure(Script) these days.
16:04ior3k`yeah, the main argument thrown at me is that it's a relatively unknown technology, clients won't handle it after the handoff, etc
16:04ior3k`seems like a chicken and egg problem
16:04bbloomior3k`: those are two different statements
16:04stuartsierraior3k`: They can always hire us. :)
16:05ior3k`ha, that doesn't help me
16:05bbloomior3k`: relatively unknown == obviously bullshit. but not great for handoff is quite possibly true
16:05ior3k`bbloom: unknown relative to say, rails (our main technology)
16:05ior3k`I argued rails was once relatively unknown as well
16:06ior3k`but that didn't seem to work so well
16:06bbloomior3k`: the better argument to make is to say that some tech is unknown and stays unknown and some tech grows
16:06bbloomior3k`: clojure is clearly growing, so it's a good bet b/c you'll be experts sooner rather than later
16:06bbloomhowever, it's worth noting that clojure is unlikely to grow to rails scale
16:07ior3k`bbloom: that's ok as long as *I* can work using it :)
16:07ior3k`although I really think it's a better way to develop software
16:07ior3k`which would clearly benefit us and our clients
16:07bbloomior3k`: sure, but developing software is only part of your job
16:07bbloomior3k`: solving your clients problems is a bigger part of it
16:07RickInAtlantaior3k thoughtworks has clojure as "adopt" on their technology radar http://www.thoughtworks.com/radar
16:08ior3k`bbloom: sure, but what if clojure helps me solve them better?
16:08ior3k`definitely not trying to push it just for the sake of it
16:08bbloomior3k`: that's all well and good, unless your clients need to be able to maintain the software and wish to retain access to a larger pool of existing experts
16:08ior3k`bbloom: of course, I agree
16:08bbloomior3k`: as with anything in life, it's a tradeoff
16:09bbloomior3k`: the question you need to ask/answer is whether the benefit in development speed/cost/quality is worth the risk of reduced ecosystem size
16:09bbloomior3k`: it's going to vary for different clients and consultancies
16:09andreiIs fmap from clojure.contrib.generic.functor supposed to return a list in reverse?
16:10andreiThis breaks the definition of a Functor
16:10bmathThe Python Paradox: http://paulgraham.com/pypar.html.
16:10bmathtldr; Using non-mainstream languages paradoxically attracts better developers.
16:10bmath(applies more to in-house hires than consulting)
16:10ior3k`bbloom: definitely
16:10ior3k`bbloom: but it still seems a chicken and egg problem
16:12dnolenior3k`: any Rails shop making that argument against Clojure can hardly be taken seriously given history
16:12dnolenandrei: more importantly clojure.contrib is dead
16:12ior3k`dnolen: exactly
16:13andreidnolen: Oh. Where does one get fmap that is in clojure.contrib.generic.functor ?
16:13dnolenandrei: don't know but there are several monad / functor libs for Clojure floating around
16:14andreidnolen: Ah, algo.generic
16:15andreidnolen: Great! Seems like this was a bug and was fixed at some point after the migration. Thanks!
16:19stuartsierraclojurebot: contrib?
16:19clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go
16:19hhenkelHi all, got a small question regarding nested doseq and let constructs. What is the best way to return multiple values from such a beast?
16:19rasmustohhenkel: return a map or a vector?
16:19OneFourSevenhhenkel, isn't for what you're looking for?
16:20joegalloput a vector on it
16:20joegallo(http://www.youtube.com/watch?v=0XM3vWJmpfo)
16:20rasmustoI think I know what that is already
16:21hhenkelrasmusto: so, I create a temp variable within the doseq and at that to a map or vector then...once I'm finished I return it, right?
16:21hhenkelOneFourSeven: Nope, I think doseq does what I need it to do so far...
16:21rasmustohhenkel: use 'for' instead of doseq if you're returning something.
16:22hhenkelrasmusto: okay, I'll check.
16:22joegallo,(for [i (range 5) :let [j (inc i)]] [i j])
16:22clojurebot([0 1] [1 2] [2 3] [3 4] [4 5])
16:24hhenkeljoegallo: rasmusto: Is there a better way to do the same thing in a "more" clojure compatible way (my code looks a bit iterative) or is this a good way to do?
16:24joegalloreduce is also a thing
16:25joegallofor is for list comprehensions
16:25rasmustohhenkel: "for" is a good way to do it, it's not iterative, though it shares a name with other languages
16:25joegallodoseq is iterative, but doesn't return anything (nor should you want it to)
16:25joegallohow about you pastebin some of your code for us to see, rather than describing it?
16:26AeroNotixif you could go ahead and *do that*, that'd be greeeeeaaat.
16:26OneFourSevenAnybody making web apps?
16:27hhenkeljoegallo: rasmusto: okay, thanks so far, I'll give it a try and have a look how far I get...I guess I'll stop by later and paste my code when I'm facing probs.
16:27rasmustohhenkel: ok, feel free to paste at any time, no use getting stuck
16:27OneFourSevenIf you guys want to look at some code, I've got something
16:34OneFourSevenOkay
16:34OneFourSevenWho knows about authentication and sessions for ring apps
16:41dnolenOneFourSeven: if you have a question just ask a question
16:41OneFourSevendnolen, sorry, was prepping something
16:43OneFourSevenTwo things, first, I was building an authentication library for Ring because I thought friend was a little too complicated. Secondly, my weekend project was a code annotator/review site.
16:44OneFourSevenI was wondering if somebody could take a gander at the library I built
16:44OneFourSevenSee if there are any possible security concerns
16:44OneFourSevenHere: http://kurikku.com/s/52e6c870e4b0909ac906fc5a
16:48elarsonis there a good reason to use a record over a struct?
16:49dnolenelarson: structs are deprecated
16:49elarsonI'm just starting out with clojure and noticed in the docs it mentioned most structs could just use records
16:49OneFourSevenI believe that structs aren't used much anymore
16:49elarsonok, cool
16:49xexonixxexillionI'm fairly new to clojure, so this is probably a stupid question, but does clojure have an equivalent of common lisp's set-dispatch-macro-character (I'm currently getting the feeling it doesn't)
16:50technomancyxexonixxexillion: it's intentionally omitted for composability reasons
16:51dnolenxexonixxexillion: you have a more restricted version of it - reader literals
16:52dnolenclojure has I mean
16:52TimMcxexonixxexillion: Effectively, no.
16:58elarsonif I have a record Foo, how can I do (let [a-foo (->Foo "hello")] ...)
16:59jeremyheilerelarson: Why can't you do that?
17:00elarsonjeremyheiler: probably b/c something was wrong with another item in my let statment :/
17:00jeremyheilerheh
17:11akurilinWhen I'm validating outside input in my Ring app, does it make sense to separate validation into a "is the type correct" pass and then into a "can I parse this input to the intended type" pass?
17:11akurilinAs in, say you're getting a date as input, you want to make sure it's a string and hen that the string actually parses to a date
17:12akurilinI'm thinking I might as well combine the two into one single check.
17:12akurilinAnd just return the same error for both cases "Could not parse foo to date"
17:12akhudekakurilin: don't parameters always come as strings?
17:13akurilinakhudek: this is post JSON deserialization in cheshire
17:14akhudekakurilin: ah. well, separating it into a type check then a parse check could make sense if you have a generic way of doing type checks (maybe like schema?)
17:15akurilinFor some reason this originally sounded like a great idea, but in reprospect it felt overly complicated for the purpose of telling the caller tha ttheir input is invalid.
17:15akurilinStill can't quite fully remember why I thought that was going to be a superior approach
17:17devnDoes anyone know of any good information on reduce-kv? I don't think any book to date has written anything about it.
17:19doppioslashDoes caribou actually deploy to Heroku?
17:19devndoppioslash: no :)
17:19devndoppioslash: well, they claimed that in their docs, but I found it borderline impossible
17:19devni dont think they've tested it
17:19devnbut this was a month or two ago, so maybe the story is better now
17:20doppioslashI'm trying now with a lein new caribou project and after changing the Procfile, adding in the postgres data in production.clj
17:20doppioslashI'm having trouble actually making the migration run
17:20devndoppioslash: you're going to need changes to the postgres config
17:20devnlet me see if i can find my old stuff
17:20doppioslashthanks :)
17:21devndoppioslash: i ended up running the migrations from my local machine
17:22doppioslashif I do it complains about no pg_hba.conf entry
17:23devndoppioslash: https://gist.github.com/devn/8658515
17:24devnthis was my local.clj.
17:24devnwhich i did not commit
17:24devni dropped it into resources/config/
17:24devnand then i was able to migrate to the heroku DB from my local machine
17:24devnthere were still issues after i got past this though, FWIW
17:24doppioslashthanks :)
17:24doppioslashwhat issues?
17:24devnalso, you will have another issue
17:25devnso, when you go to deploy, it's going to try and generate the js
17:25devnand that directory is not there, so you'll need to commit a .gitkeep inside of.. (let me look)
17:27cmathesoni'm getting an "No matching method found: getPath" error when running the following code: (.getPath (FileSystems/getDefault) ""), but the FileSystem class *does* have a getPath method. what am i doing wrong?
17:27devndoppioslash: resources/public/js/app/.gitkeep, $PROJECT_ROOT/app/.gitkeep
17:28doppioslashthanks :)
17:28devndoppioslash: there may be another you need to handle, but im pretty sure you'll run into heroku complaining about directories not existing when it goes to compile JS and what not
17:28doppioslashthe migration command
17:28doppioslashwas it lein caribou migrate rsources/config/local.clj?
17:29devnalso, doppioslash -- remove the jvm-opts line from project.clj
17:29devndoppioslash: maybe, it's been awhile
17:29devndoppioslash: additional stuff you might want to kill: project.clj :cljsbuild {:repl-listen-port 44994
17:30devnyou may also need to change :ring in project.clj to be :port (or (Integer/parseInt (System/getenv "PORT")) 33333)
17:30devnor something like that
17:30devndoppioslash: now you can see why i gave up :)
17:30cmathesonn/m, i can't read javadocs apparently
17:31doppioslashfor the port changing the Procfile to web: lein with-profile production trampoline run -m myapp.core $PORT seems to have worked
17:31devngotcha
17:31doppioslashat least it stopped complaining of being unable to get port 60
17:31devndoppioslash: i remember seeing something where it was spawning a repl server no matter what
17:31devnthat's going to tie up resources, so watch for that
17:32doppioslashyeah I think I saw it in the logs
17:32doppioslashhaven't chased it yet
17:32devndoppioslash: you may also time out on deploy because heroku has a limit of 60sec or so
17:32doppioslasheven after removing it from the proct.clj?
17:32devnyou can do an uberwar deployment
17:32doppioslashproject.clj*
17:32devndoppioslash: hmm, i think they recognized what i was seeing as a bug
17:33devnso if you're on a newer caribou maybe they fixed it
17:33devndoppioslash: boot.clj is the other place to look
17:33devn:brepl and :nrepl are in there
17:33doppioslashthere are indeed still in boot.clj
17:34doppioslash:brepl
17:34devndoppioslash: either way, if you get something working i'd love to see it. a write up would be much appreciated.
17:34alewdevn: I'm deploying caribou to heroku
17:34alewdevn: It requires a bit of modification
17:34doppioslashI shall if I manage to make it work :)
17:34doppioslashthanks a lot
17:35devnalew: is that stuff documented now?
17:35alewdevn: I was going to handle but I haven't gotten around to it yet
17:36devnfair enough. but alew, it would be nice to change the docs to reflect the reality of heroku deployment. the docs paint a picture that is far from accurate
17:36alewdevn: I don't control the docs :P but yes, agreed
17:37devni dont mind if it says: Heroku: "WIP. YMMV. You might have trouble. It's not easy. It can be done, though."
17:37alewdoppioslash: There is a #caribou channel that you might want to check out to talk directly to those people
17:39devnalew: did you wind up doing the migration from your local machine, or did you set something up to run them on deploy?
17:39devnalew: also, did you figure out how to turn off the repl server starting automatically?
17:40alewdevn: It wouldn't make sense to do migration on deploy imo because that's a pretty sensitive operation
17:40alewdevn: And no, I haven't tried that yet.
17:40devnmeh, i do it with rails
17:40devni feel like we've talked about this before
17:44MorgawrRaynes: opinions on a refheap plugin for LightTable? Do you know if somebody is working on it or if it's planned or... ?
17:44Morgawr(I could hack a plugin for that in case nobody is doing that)
17:45RaynesMorgawr: I don't know if anyone is working on it and I'm unlikely to get to it soon if you want to tackle it. I've written just under 7 billion clients across numerous languages, so there is plenty of code to look at. Also the API documentation on the refheap wiki.
17:45Morgawryeah I saw the API docs, it shouldn't be hard to write, I might get to it in these couple of days ;)
17:45Morgawrjust wanted to know so it's not duplicated/wasted effort
17:46doppioslashdevn: inserting your local.clj :database in development.clj and running lein caribou migrate resources/config/development.clj made the migration work
17:46devnbadda bing :)
17:49arrdemibdknox: is the source for chromashift anywhere? I'm playing with my own CES architecture and curious what your update semantics are like.
17:50patchworkdevn, alew: Yeah, I have been meaning to update the heroku docs for clojure for awhile now
17:51patchworkI don't use it, so I haven't gotten around to it
17:51patchwork*caribou
17:51arrdemyes.. the source is on github! google first.....
17:58devnwow. the JoC 2nd edition is /fantastic/.
17:59scape_I am using assoc-in on an atom {} to update a particular key's key, but I want to swap in more than 1 value to update a particular key's keys; like update key2 and key3 {:thing1 {:key1 :value1,:key2 :value2, :key3 :value3}}
18:00AeroNotixscape_: merge?
18:00AeroNotixdevn: really?
18:00scape_i'll try that thanks
18:01AeroNotixscape_: but you have to ask yourself why you're updating multiple keys?
18:01AeroNotixperhaps you'd be better served with a map of refs
18:01AeroNotixand then use dosync to take care of updates
18:02rhg135cljs
18:02rhg135no stm yet
18:02AeroNotixoh
18:02rhg135just pointing out a reason :P
18:02scape_that's an idea
18:02rhg135idk why
18:02AeroNotixI didn't see any mention of CLJS
18:02scape_it's not
18:03rhg135ik
18:03rhg135it's a valid reason it should be though
18:03scape_not using refs because I don't necessarily need it to be synchronously done, I just wanted to know if there was a way to update 2 keys at a time
18:03Morgawrif a function with only a when statement is evaluated and the when is not hit, it returns nil, right?
18:03scape_thx
18:04rhg135ya
18:04Morgawrmy whole life was a lie :<
18:04rhg135...
18:04MorgawrI've always written single when function with a stray "nil" at the end
18:04Morgawralways looked so ugly
18:04AeroNotixyeah it's not like there was a quick and easy way to check it
18:04rhg135mocker, thats funny and sad
18:05rhg135oops
18:05rhg135Morgawr,
18:05AeroNotixif only they made a program which could interactively read input, evaluate it and then print the results
18:05AeroNotixa REPL, if you will
18:05rhg135my tabbing :c
18:05AeroNotixohhh well, perhaps one day
18:05rhg135not node
18:05rhg135well
18:05rhg135repl yes
18:06rhg135live no
18:06AeroNotixrhg135: I think you missed my sarcasm
18:06rhg135nope
18:06rhg135i love it
18:06rhg135the sad part is it doesnt always exist
18:07MorgawrAeroNotix: haha, I know right, I just never thought about it
18:07AeroNotixmost not-shit languages have repls. There are even basic repls for C++
18:07rhg135ooh
18:07doppioslashdevn: it's working :)
18:07Morgawrthen I was wondering "wait, what if I just don't put it in?" and thought that sensibly it would return nil, I tested it and it did.. just asked in here cause I wanted to make sure there were no pesky corner cases
18:07rhg135a c++ one
18:09rhg135i'd be sad without the repl
18:09rhg135so useful
18:09rhg135,(doc when)
18:09clojurebot"([test & body]); Evaluates test. If logical true, evaluates body in an implicit do."
18:10rhg135hmm
18:10rhg135i swear it was in the docs
18:10rhg135,(doc if)
18:10clojurebotIt's greek to me.
18:10rhg135wut
18:10michaniskin,(source when)
18:10clojurebotSource not found\n
18:11rhg135is it broken?
18:11AeroNotixno it just doesn't have the source on-file
18:12AeroNotixafk
18:12rhg135i meant the doc thing
18:17oichway off topic,but I thought someone here would know. DITA-OT is software that uses ant for scripting that includes a plugin architecture. It's not an API. It doesn't have an API, exactly. Framework doesn't seem to fit. Is it a programming platform?
18:18rhg135oich, seems like a program
18:19rhg135similar to eclipse sans ide
18:19oichok. that makes sense.
18:20rhg135oich, js is a nice scripting lang
18:20rhg135then clj was invented
18:20oichthat is a very odd choice of events to describe history
18:21rhg135i mean before clojure you embeded rhino for scripting
18:22rhg135now you write it in clojure and expose that
18:22oichok. yeah I thought of comparing dita-ot to xulrunner or some such thing,but that's a bit of a stretch.
18:23rhg135im not familiar with either lol
18:23oichxulrunner is lower level than the mozilla... program. but it certainly has an API.
18:24rhg135ya... but it's for ___________ in ____?
18:25oichwriting applications using the facilities shared by firefox, thunderbird and other stuff
18:25rhg135ah
18:25technomancyxulrunner: their heart's in the right place
18:26rhg135hmm
18:26rhg135ohya i remember
18:26elarsonif I change my code in clojure-mode and use C-c C-c in a function to compile it, does that also update the cider repl's version of that function?
18:26rhg135tried fixing a bug once
18:27technomancyrhg135: at least it's worlds better than Chrome's stance on extensibility: "Oh, you want to change a key binding? Cool; hope you've got three spare hours to recompile this huge chunk of C++"
18:27rhg135technomancy, touche
18:28scape_elarson: it should, though I use Cc Ce
18:28technomancyhttp://p.hagelb.org/punch.png
18:28rhg135i actually program on android
18:28elarsonscape_: ah ok, I'll give that a try
18:28rhg135all that c++ and java
18:29rhg135im referring to the core
18:32rhg135technomancy, it was mainly cuz i had no c(++) experience and it was the first OSS project i worked on
18:36Morgawrmmm
18:37MorgawrI need some data transformation wizard.. I have some map inside a map inside a map (can be infinitely deep) and I need a non-destructive merge function to achieve something like this https://www.refheap.com/09051374e527ad08845dd85db
18:37MorgawrI tried using merge but it just overrides the old value and removes the inner maps, I tried using merge-with but then I'd have to recurse for as many inner maps I find
18:37Morgawris there a function that does it already or do I need to make my own?
18:37scape_deep-merge?
18:37Morgawris that a function in the stdlib?
18:37Morgawr(core, whatever)
18:38scape_http://clojuredocs.org/clojure_contrib/clojure.contrib.map-utils/deep-merge-with
18:38Morgawrscape_: nice, thanks!
18:39scape_:)
18:44elarsonwhat is setq in clojure? I'm sure I could do a let but that seems like it is overkill... I'm probably missing something here
18:46dnolenelarson: setq doesn't exist, the closesting thing set! isn't really used the way it traditionally is in Lisp
18:47dnolenelarson: you probably want a atom if you want something mutable that you can change
18:50Morgawrcan I recursively apply destructuring of parameters?
18:50Morgawrlike I have a map {:a 1 :b { :c 3}} and I want to get a and c out of it using :keys
18:50scape_dnolen: as in david nolen? i liked your talk on core.async! :D
18:50technomancy~tias
18:50clojurebotTry it and see! You'll get results faster than asking someone in #clojure to evaluate it for you, and you'll get that warm, fuzzy feeling of self-reliance.
18:51devn_nick devn
18:51dnolenscape_: thanks
18:51Morgawrtechnomancy: was that related to my question? I was asking if there's a simple way to do it like {:keys [something {:keys [something else]}]} or if I need to make my own
18:52rhg1350.0
18:52Morgawrlooks like freenode dun goof'd
18:52technomancyMorgawr: oh; I see. iiuc you can do it with exact destructuring but not with :keys
18:52rhg135again?
18:52justin_smithyeah, a map inside :keys doesn't really work
18:53Morgawrthe problem is that I might have a lot of complex maps to pass around and I am only interested in a few parameters inside them, not the whole map
18:53justin_smiththere is also get-in
18:53justin_smithor multi-stage destructuring
18:53Morgawrmulti-stage?
18:53justin_smith(in a let block)
18:53Morgawrah
18:53Morgawroh well, that could work
18:54Morgawr(fn [{:keys [a b]}] (let [{:keys c} b] ...))
18:54justin_smith(let [{:keys [a b]} params {:keys [c d]} a] ...)
18:54justin_smithor that
18:54justin_smithbut if you need a let already, it can be more clear to put it all in a let
18:54Morgawryeah, probably
18:54Morgawrthanks
18:54Morgawrthat makes sense
19:01akurilinHas anybody here tried to build sets of where clauses with Korma procedurally? E.g like what I'm doing here: https://www.refheap.com/28559
19:01akurilinObviously that won't work since it will actually evaluate the conditions before they're processed within Korma
19:02akurilinAnd I can't get the quoting of it quite right in case that's how you'resupposed to roll
19:03scape_akurilin: maybe ['(< :id 100) '(= :id 50)] ?
19:03carkakurilin: i don't know much about korma but... there is no evaluation in conditions
19:03carkoh sorry there are the < functions
19:04akurilinscape_: that won't work, Korma ends up generating something like WHERE ((?, answers.id, ?) AND (?, answers.id, ?))
19:04scape_i noticed it does that with as-sql for me too, not sure it is related to your issue
19:05carki think you're supposed to compose the whole thing like the first example on the korma page
19:06carkthe end result is what you need
19:07akurilincark: none of their examples use procedurally generated lists of clauses
19:07carkthe first example composes two where
19:07carksame thing, only done differently
19:13akurilinSo apparently you need to quote the predicates if you want Korma to get them right
19:13akurilinhttps://www.refheap.com/28559
19:13akurilinThey're evaluated somewhere within it too soon if you just leave them in the vec
19:13scape_interesting
19:14carkbeats storing sql query text in a file =)
19:14akurilinConsidering apply or / apply and aren't even documented, this is probably not the most trivial scenario.
19:15MorgawrRaynes: https://groups.google.com/forum/#!topic/light-table-discussion/ZZ9pcnUsKTQ looks like somebody is implementing a refheap plugin already, neat
19:16scape_I was trying to figure out earlier why I kept receiving ?'s in the query, figured I was doing it wrong. https://www.refheap.com/28566
19:17scape_I ended up just building a raw query
19:27dsrxraw query: "the electronica fans, tired of guitar riffs, considered themselves raw query"
19:30akurilinHow do I evaluate something and then quote the return value?
19:30akurilinAs opposed to quoting the whole thing.
19:31carkit oesn't make sense
19:31carkdoesn't
19:32carkquote is a special form
19:32carkyou can't apply it
19:32carkalso if something, say a function, returns a list. It's already "quoted"
19:33carkthe first element in that list isn't used as a functiona pplied to the rest
19:35akurilinI'm referencing the Korma quirk above. If I have something like [(give-me-function) "foo"], I'd like to get to ['> "foo"]
19:35akurilinbecause returning just the fn at the beginning of that vec won't work
19:36akurilinso I need to quote it
19:36carkagain i'm not sure about korma, the macro could interpret the first element any way it wants. but my guess is that the first element should be a symbol instead of the function >
19:36carkso just return the symbol >
19:36cark(defn give-me-func [] '>)
19:39akurilincark: that's fair, seems to do the trick
19:40akurilinI don't get to work much explicitly with (symbol), not sure that's good or bad :)
19:40carkyou might want to review your understanding of symbols and quoting
19:40cark=)
19:40cark,(symbol? '>)
19:40clojurebottrue
19:41cark,(symbol? >)
19:41clojurebotfalse
19:42akurilinIs the idea that symbol just gives you the actual name of something as opposed to whatever the name evaluates to / is bound to?
19:42akurilinThe docs are pretty terse on this.
19:42carkright, the reader sees ">" ... he checks if it's a var and returns that
19:42carkyou can tell the reader to leave it alone by quoting it
19:43akurilinSo when working with macros, you work on a symbolic level for the most part anyway, right?
19:43carkyes it's often the case
19:44akurilinIf any of this breaks I'll never be able to debug it :D
19:44carkhaha good luck =)
19:44akurilinActually it's probably in my interest to get exposed to this stuff more.
19:45carki'm not sure, i rarely if ever use symbols or even write macros anymore
19:45carkmost of the time, a mix of higher order functions will do the trick just as good
19:46akurilinI'm with you, which is why most of this is pretty foreign to me.
19:47akurilinDifficult to get xp in macros when the n.1 rule is to never write them if you don't have to.
19:47carki think you're supposed to thread your query through your functions and do you composition that way with korma
19:47carkwhich might make it all easier
19:49carkhave a function check-credentials, for-customer-id, for-customer-name ...then (-> base-query check-credentials for-customer-id for-customer-name)
19:49carktho the example is kinda bad =P
19:50akurilinwell I'm essentially implementing a generic JSON where blob to SQL translation where the caller gets to pick columns, predicates etc.
19:50akurilinBasically what you'd get from using parse.com
19:50akurilinSo the whole thing is completely procedural.
19:51carki think you may still do it this way only the functions a generated
19:51akurilinSo I basically translate whatever's in that where map that I get from the caller into a sequence of where clauses that Korma can understand and then (apply and) them.
19:51teslanickI'm just barely looking at core.async; it seems like (go (while true … is a really weird pattern; is this actually common, or is it a hoist for tutorial purposes?
19:52carkteslanick: common pattern
19:53carkakurilin: then once you have generated your functions you "thrush" these
19:53cark(reduce #(%2 %1) base-qry functions)
19:55carkthis parse.com has a nice looking page =)
19:56akurilincark: o is that the word for doing that kind of reduce?
19:57carkakurilin: i think so, that's the one i use anyways =)
19:57akurilinI never knew that.
19:57devnare you talking about thrush?
19:57scape_would it be possible to use filter with a vector as the predicate?
20:00devnscape_: you mean like this?
20:00devn,(filter [1 2 3] [0 1 2])
20:00clojurebot(0 1 2)
20:01carkkeep only the indexes that map to a value
20:01carkmhh
20:01carknot very usefull =)
20:01devnyeah
20:01scape_hmm
20:01devn,(filter [0 0 0] [0 1 2])
20:01clojurebot(0 1 2)
20:01cark,(filter [0 0 0] [4 0 1 2])
20:01clojurebot#<IndexOutOfBoundsException java.lang.IndexOutOfBoundsException>
20:02carknot even that
20:02devncark: this is why we have set
20:02devn,(filter #{0 1 2} [4 0 1 2])
20:02clojurebot(0 1 2)
20:02scape_i'm doing this: (filter #(= (:uuid (val %)) uuid) @clients) but want to basically filter multiple uuid's and get a seq back, I guess I could use a for statement outside of this
20:03carknto the same thing
20:03scape_so instead of filtering the 1 uuid, a vector of many uuids to filter out
20:12devn,(filter #(some #{:A :B :C} [%]) [:a :B :C :D])
20:12clojurebot(:B :C)
20:13devnthat's kind of a weird way to do it though
20:13devnmy brain is melting at the moment
20:13scape_yes, but that is a start for me
20:13scape_thx
20:13scape_the val % i have is complicating matters :-\ hah
20:15delihiros,(clojure.set/intersection #{0 1 2} #{2 3})
20:15clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.set>
20:15devn,(require '[clojure.set :as set])
20:15clojurebotnil
20:15devn,(set/intersection #{0 1 2} #{2 3})
20:15clojurebot#{2}
20:19delihirosdevn: oops, thanks
20:19devnscape_: you could use reduce-kv as well
20:20benmossshould a .clj file in my cljsbuild source-path "just work"?
20:21devnto build up a sequence of uuids, filtering inside the reduce function
20:21benmossin order to get it turned into JS that is
20:21benmossor do i have to use this "crossovers" feature
20:24devn,(clojure.set/difference (into #{} (map (comp :uuid val) {:user1 {:uuid "user1"} :user2 {:uuid "user"}})) #{"user1"})
20:24clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.set>
20:24devn,(require 'clojure.set)
20:24clojurebotnil
20:24devn,(clojure.set/difference (into #{} (map (comp :uuid val) {:user1 {:uuid "user1"} :user2 {:uuid "user"}})) #{"user1"})
20:24clojurebot#{"user"}
20:25devnscape_: does that do what you're looking for?
20:26devn,(clojure.set/difference (set (map #(get-in % [1 :uuid]) {:user1 {:uuid "user1"} :user2 {:uuid "user"}})) #{"user1"})
20:26clojurebot#{"user"}
20:26devnor that or something
20:28elarsondnolen: thanks. I'd like to use it in the repl so I can play around with a record
20:28devn,(reduce-kv (fn [init k v] (conj init (:uuid v))) [] {:user1 {:uuid "user1"} :user2 {:uuid "user"}})
20:28clojurebot["user1" "user"]
20:28devnetc. etc. etc. etc. etc.
20:31devnokay okay, one more 'cause i'm a bit bored
20:31devn,(persistent! (reduce-kv (fn [init k {uuid :uuid}] (conj! init uuid)) (transient []) {:user1 {:uuid "user1"} :user2 {:uuid "user"}}))
20:31clojurebot["user1" "user"]
20:32devnnoooooooo!
20:32elarsondevn: no to var-set?
20:32technomancy~guards
20:32clojurebotSEIZE HIM!
20:32devnhaha, i was mostly kidding
20:33elarsonthat didn't work anyway ;)
20:33rhg135mostly...
20:33elarsonwhat is a good way to play with a variable you create in the repl then?
20:33devnwhat do you mean?
20:33rhg135hmm
20:33devnjust rebind it to a new value
20:34devn,(def x 1)
20:34clojurebot#'sandbox/x
20:34devn,x
20:34clojurebot1
20:34devn,(def x 2)
20:34clojurebot#'sandbox/x
20:34devn,x
20:34clojurebot2
20:34elarsonwell, in elisp I might do something like (setq some-url "http://foo.com&quot;) and then I can use some-url where I want
20:35elarsonI'm just wanting to do something similar in the repl where I'm instantiating (if that is the right word) a record
20:35rhg135def...
20:35cark(def some-url "sdfsdf")
20:36elarsongeez... I feel really dumb now
20:36devnelarson: s'cool man
20:36rhg135lol
20:36devnhappy def'ing
20:36elarsonthanks for pointing out the obvious :)
20:36devnelarson: if you think that's cool, wait until you see defn! ;)
20:37rhg135or defmacro
20:37devnrhg135: i have something for you!
20:37devnerr sorry
20:37devnelarson: i have something for you!
20:37rhg135phew
20:37elarsondevn: man seriously. I thought I was liv'n large with a defrecord and my defns
20:37devnelarson: http://hyperpolyglot.org/lisp
20:37devnthat might help you out if you're familiar with another lisp
20:37technomancydevn: no don't do that
20:38devntechnomancy: haha, oh come on
20:38technomancyhyperpolyglot is rubbish
20:38technomancyno seriously
20:38technomancyit exhibits a very superficial understanding of everything but the CL/Scheme differences
20:38devntechnomancy: i take your point, but it still can be useful if you're totally trying to hack something together
20:39technomancyit's very misleading
20:39devnlike in this case he could have searched the page for setq, and then could see def in the same column
20:39devngranted it's under "last butlast", but still
20:39elarsontechnomancy: my only real lisp experience is elisp and little cl by way of stumpwm (so very little)
20:39technomancysetq is totally different from def though
20:39technomancycase in point
20:39devntechnomancy: okay okay ill give you that
20:39elarsontechnomancy: it didn't load for me anyway ;)
20:40devntechnomancy: i've used it when i knew absolutely nothing about a language and needed to just make someone's janky script work. it's done its job in that respect.
20:41technomancyok, the arithmetic/logic stuff is decent
20:41devndoing the /right/ thing in that script? the idiomatic thing? maybe not.
20:41technomancybut as soon as you venture into stuff that just doesn't exist in CL, it tries to find something that looks vaguely similar in clojure and shoehorns it into there
20:42devnit uses (seq (.split "foo bar baz" "[ \t\n]+")) for split
20:42devn:\
20:42technomancyhm; actually this has changed since I read it
20:42technomancyit's a lot longer, and it used to not cover racket
20:42devnwell, it's still not perfect
20:43technomancymaybe they've gotten rid of the really egregious stuff
20:43devnI see (String/format) in the clojure column
20:43devnthey include next in the cdr column
20:43rhg135awesome site btw xD
20:43technomancyyeah, this is not knee-jerk cringeworthy bad like it used to be
20:44hiredmanhttp://hyperpolyglot.org/computer-algebra is kind of funny "select About Mathematica in Mathematica menu"
20:44technomancyactually looks kinda decent
20:44devnsql/awk/pig is kind of neat
20:47hiredmanwell, the real problem is, how does this matrix show you that clojure makes a large distinction between the local environment and the global environment, where other lisps don't make as large a distinction
21:04technomancyhiredman: right, it's like Google Translate; it'll sort of get the point across in an awkward way, but it'll never sound like a native speaker
21:08hiredmanthe news here in seattle is showing you things you might want to do if you fly to newyork for the super bowl in new jersey
21:10quizdrSeattle! nice.
21:10hiredmanhaha, whoops, wrong channel
21:10quizdrhiredman no worries
21:28Kuollutrunkkau5hiredman, do you still love me?
21:29Bronsasoo. I just loaded with success tools.reader with tools.analyzer.jvm :)
21:30bbloomBronsa: before i get excited, let me see if i parsed that correctly
21:30Bronsabbloom: I compiled tools.reader with tools.analyzer.jvm
21:30Bronsas/analyzer/emitter
21:30Bronsaderp.
21:31bbloomBronsa: haha yeah i was gonna ask if you meant emitter :-)
21:31bbloomBronsa: pretty freaking awesome
21:32bbloomBronsa: i'm wondering what your jvm assembler toolchain looks like....
21:33Bronsabbloom: yeah. also pretty fast compared to what I were expecting. Only ~6x slower than Compiler.java
21:33bbloomBronsa: why did you expect it to be so slow?
21:34bbloomoh you're still using objectweb.asm directly
21:34bbloomcool, so it's more or less a direct port from compiler.java?
21:34dnolenBronsa: that's pretty cool :)
21:35Bronsabbloom: the bytecode emitted is really similar, yes
21:36bbloomBronsa: why do still need all the interpreter goo?
21:36Bronsabbloom: what do you mean?
21:37bbloomBronsa: all the -exec methods are interpreting the ast, right?
21:37Bronsaoh no. they are interpreting the data rapresentation of the bytecode built.
21:37BronsaSee https://github.com/clojure/tools.emitter.jvm/blob/master/src/main/clojure/clojure/tools/emitter/jvm/emit.clj
21:38bbloomoh, ok, i see the distinction....
21:38bbloombut why do you need *that* :-)
21:38bbloomis it actually doing the work?
21:38bbloomor just recording it to the output?
21:39Bronsaby "*that*" do you mean -emit or -exec?
21:39bbloomthe -exec
21:40bbloomit's not actually executing right, it's just writing to the output buffer?
21:40Bronsayes
21:40bbloomok, that makes more sense. name confused me a bit, but makes perfect sense now
21:40Bronsa-emit builds the bytecode, -exec emits it
21:40bbloomand now that you wrote that ^^ you see my confusion :-)
21:41Bronsa... yeah. It's probably better to s/emit/build/ I guess
21:42bbloomnaming things is hard generally, it's extra hard in compilers/runtimes when everthing has a generic name and has two different names depending on which layer you're operating at lol
21:42bbloomin theory, you are in fact executing a DSL that is a byte code emission DSL
21:42bbloom:-P
21:43BronsaI'll think about renaming those.
21:43bbloomlooks like some good stuff though man
21:43bbloomgreat work!
21:43BronsaAnyway, I really need to sleep now. almost 4am again.
21:44bbloomalso, looking at it more, i now see exactly why you expected it to be slow: lots and lots of intermediate data structures :-P
21:44Bronsayeah
21:44Bronsabut it's too easy to generate the bytecode like that to do it in another way
21:45bbloomBronsa: surely you should use Factjor
21:46bbloom [:dup-x2] [:jump-insn :IF_ACMPEQ ~fault-label] [:pop] would become dup-x2 IF_ACMPEQ fault-label jump-insn pop
21:46bbloommuch less garbage :-P
21:46bbloomalso, don't actually use Factjor
21:46bbloom:-)
21:46rhg135my eyes "P
21:46rhg135:P*
21:46rhg135grr
21:48bbloomBronsa: one thing that is interesting though is how much it uses syntax-quote
21:48bbloomthe syntax-quote implementation produces really naive concats
21:48Bronsabbloom: I actually like writing [[:foo ..] ..]. might be stockholm syndrome
21:49Bronsabbloom: that's why I'd expected it to be *much* slower with all those apply/concat
21:49bbloomBronsa: you should experiment with a (doseq [... (flatten ...
21:49bbloomBronsa: just say that seqs (not vectors) get spliced in and then flatten at the top level
21:49bbloommight speed it up quite a bit & clean up the syntax too
21:51Bronsathere's definitely a lot to do perf wise in both t.a and t.e. Right now I'm just trying to make everything work as easly as possible
21:51Bronsabtw, I really need to sleep now. bye!
21:52bbloomBronsa: do you actually need any quoted symbols ever? or do you always unquote?
21:52bbloomBronsa: gnight
21:52bbloombut if you always unquote, definitely try eliminating the syntax quoting :-)
21:52Bronsabbloom: no quoting actually needed. it's all vectors/keywords/strings/classes
21:53bbloomBronsa: yeah, then you can probably mechanically eliminate `, ~, and ~@, then just add a flatten to the top level
21:53bbloomwould be a huge perf & readability improvement
21:54BronsaI'll try that in the next days, thanks for the feedback.
21:54bbloomcool. good stuff man
21:54bbloomget some sleep :-)
21:54Bronsathanks, bye
22:13akhudekfor libraries, is the right thing to leave clojure out of the dependencies?
22:23elarsonwould someone mind clarifying why this happens? https://gist.github.com/ionrock/8661766
22:23akhudekelarson: map is lazy
22:23elarsoneffectively I'm doing (map println '(1 2 3 4)) and rather than seeing 1\n2\n3\n4\n I see what is in the paste
22:24elarsonakhudek: I'm not sure why that would inject those nil's then. do you mind explaining?
22:25akhudekhttps://www.refheap.com/28630
22:25akhudekwhen the reader tries to print the output if forces it to be computed at that time
22:25elarsonah ok
22:25elarsonthat is mixing the output with the newly created sequence
22:25elarsonakhudek: thanks!
22:26akhudekyou're welcome
22:48eraserhdI feel like I'm missing something about deftype.. If I use (ns foo) (deftype Foo ...), then I should later be able to do ^foo/Foo x, right?
22:49eraserhdDoes this require AOT compiling?
22:49nooniani think you might have to use import to bring it in, not sure
22:49hiredmaneraserhd: don't use deftype
22:50hiredmanuse a map
22:50eraserhdI'm pretty sure that's not a good idea for what I'm doing. (I'm implementing a binary tree variant.)
22:52hiredmaneraserhd: {:left … :right … :value …} once you have done it that way, if you profile it and it isn't as fast as you want, or if it uses more memory than you want, start using defrecord, and then if after profiling defrecord it isn't fast enough, then deftype
22:57gfrederickshaha hyperpolyglot does not think that clojure has not=
22:58tbaldridgeeraserhd: yes, you have to import the deftype, and you don't need AOT
23:01hiredmantbaldridge: did you read his question?
23:02hiredmaneraserhd: you don't type hint that way
23:03gfredericksyou don't?
23:03hiredmaneraserhd: foo/Foo is a clojure name, a namespace qualified symbol
23:03gfredericksoh hright
23:03hiredmaneraserhd: typing hinting is about host types, in this case the jvm
23:03hiredmanthe jvm classname is foo.Foo
23:04hiredmaneraserhd: as the only person who took the time to read through your question and see the real error, I suggest following my advice and sticking to maps, vectors, sets, seqs
23:06tbaldridgestill suggesting someone not use deftype to implement a binary tree is a bit off IMO.
23:06eraserhdfrustrating in fact.
23:06hiredmantbaldridge: deftype is just not something I would recommend to a novice clojure programmer in any case
23:07eraserhdmaps seem like a better idea for prototyping, honestly, and so I'm switching on that account.
23:08noonianunless you just want to learn about how deftype works
23:09eraserhdbut I still need to solve the original problem.
23:09socksyI have a list of maps from symbol to number ( [{symbol -> number}] ) — what's the most idiomatic way to get the symbol relating to the number found by (max (vals map))?
23:09socksyerr, not max vals map, but the english equivalent
23:09gfrederickssocksy: it's not clear what (max (vals map)) means since you have multiple maps
23:10hiredmannoonian: deftype has so many rough edges around it and how it interacts with other features by the time you start fiddling with it, to deal with those issues when they arise in your projects you better already know clojure and have some experience working with it and the tools you use with it
23:10gfrederickssocksy: or does each map have one entry?
23:10socksyeach map has one entry, but that's potentially easily changeable
23:10socksyusing for to construct the list, not really sure the best way to go about doing this
23:10hiredman,(doc max-key)
23:10clojurebot"([k x] [k x y] [k x y & more]); Returns the x for which (k x), a number, is greatest."
23:11devn(inc hiredman)
23:11lazybot⇒ 34
23:11eraserhdSo I'm just crazy that I can't (:import '[other.namespace DeftypeThingy])?
23:11gfredericksthat's the quote-or-not ns vs function confusion
23:12hiredmaneraserhd: there are a couple things, a. :import is just a keyword outside of the ns macro
23:12noonianyou should be able to, but if thats in a ns form you don't have to quote the vector
23:12hiredmanb. outside of the ns macro you just import
23:12eraserhdRight. I didn't quote it.
23:12hiredmanc. inside the ns macro with :import you don't need to quote things
23:12hiredmand. you need to load the namespace that defines the type first
23:14eraserhdOh, crap. Because ns declarations are order sensitive.
23:15eraserhdNow I understand.
23:15eraserhd(I was importing before requiring)
23:16hiredmanbasically, don't use deftype, you're gonna have a bad time, at least use defrecord, and the factory functions and keyword accessors
23:17tbaldridge*grumbles about telling people to use the wrong tool for the job *
23:17hiredmantbaldridge: then make tools they won't stub their toes on
23:18technomancyanyone actually qualified to use deftype is smart enough to ignore advice telling them not to
23:18hiredmanyou want a production quality binary tree, sure, you'll want deftype, but if you are creating a binary tree as a my first clojure project, don't use deftype
23:19devni want a production quality turing ball pit
23:20hiredmandeftype is just not a good intro to the language
23:21technomancyspeaking of the wrong tool for the job, someone should show tbaldridge how /me works =D
23:21tbaldridgeyeah, sorry, I'm not very good with chat programs from the 90's
23:21hiredman~gentlemen
23:21tbaldridge:-P
23:21clojurebotYou can't fight in here. This is the war room.
23:24eyepatchProject Euler 3 spoilers: http://ideone.com/6vSlaN The code works for small numbers, but is *way* too slow to work for large numbers. I understand how exponentially this grows as the number grows.
23:25eyepatchBut, I'm having difficulty coming up with an idiomatic alternative without turning imperative.
23:26eyepatchI understand that prime? only cares if there's a single result, but this will get all of them.
23:27eyepatchThat should be a *huge* reason for the slowness.
23:28eyepatchooh idea.
23:29tutysarastarting a toy clojure web project, like to what what stack people use in their projects
23:29eyepatchfeel free to spoil it for me.
23:30deadghostwhat what
23:31deadghosttutysara, http://i.imgur.com/8Dv3vst.png
23:31deadghostsomething I'm working on
23:31deadghostcompojure + enlive
23:32deadghostand libnoir
23:32tutysaraohh cool
23:33deadghosthiccup or another html lib might be a better choice than enlive
23:33tutysarais it available for us to use
23:33deadghostenlive is a bit difficult to use
23:33deadghosttutysara, not yet
23:33technomancyhiccup is great!
23:33hiredmaneyepatch: generally for euler problems the trick is to apply more math reasoning upfront
23:33deadghostI'm learning clojure webstack so I'd want to clean it up a bit
23:34deadghosttutysara, do you have a project in mind?
23:34eyepatchhiredman, there's quite a few of these that can be solved with a calculator. I'm using euler as a starting point to feel my way around clojure.
23:34tutysaraI find enliven more easier than generating html using hiccup
23:34eyepatchI've already solved all of these in golang. I figure if I can write the code to solve it in golang I should be able to do so in clojure.
23:35eyepatchI'm not expecting to do it faster, only more readable, and within a minute.
23:36tutysara I mostly did backend work and I am more comfortable taking a html page from some boilerplate code and replace elements in it :)
23:37tutysaradeadghost: I know about luminous and recently came across gizmo
23:37hiredmaneyepatch: you should be able to implement the same algorithm then, euler in clojure is kind of neat because you can have infinite lazy seqs, but it isn't like lazy seqs are super fast
23:38eyepatchhiredman, sure, I could write an imperative algorithm, but then I might as well work in an imperative language.
23:38eyepatchI'm looking for something a little more readable.
23:39tutysaradeadghost: did you know about gizmo, they use enlive as well
23:39eyepatchand Clojure does not make mutability very readable.
23:39deadghosttutysara, nope looking it over right now
23:41hiredmaneyepatch: the first thing you can do, is since you are looking for the largest, is generate factors in reverse, the next thing is there is a possible upper bound, both of which limit the search space
23:45tutysaradeadghost: give me you thoughts after see it, they compose pages from widgets and generate widgets by associating html snippets and data
23:45eyepatchhiredman, worst case would be 38. Where the largest prime is 38 / 2 = 19. So I only need to look for primes up to half.
23:46eyepatchSince I'm processing the whole list, order doesn't really matter.
23:47eyepatchI'm trying to figure out a way to not process the whole list.
23:49deadghosthmm tutysara I haven't looked into either thoroughly
23:50deadghostbut luminius is written by the author of the clojure web dev book I'm reading
23:50deadghostand seems very loosely coupled
23:50deadghostand aims for getting boilerplate out of the way
23:51tutysaradeadghost: yes, I too have a copy and have been reading it :)
23:51deadghostgizmo seems tighter coupled than I'd like, gizmos seem interesting but aren't they just enlive snippets?
23:52deadghosterr *widgets seem interesting
23:58deadghosttutysara, I'd go with luminus if I had to choose a microframework
23:58deadghostmostly because gizmo seems pretty opinionated
23:59eggheadwhen did all these clj frameworks start appearing
23:59deadghostand I'd want to have enough experience to know whether I agree with these opinions before using it