#clojure logs

2013-01-03

00:00technomancypostgres 9.1 with c.j.j 0.2.1
00:00technomancyapp is here: https://github.com/heroku/buildkits/blob/master/project.clj
00:00tufflaxAre there any clojure/conj 2012 videos out? I feel like watching some :P
00:06ihodestechnomancy: hah, using jdbc:postgresql:database-name works…except that it says that a relation i know exists does not exist.
00:06ihodesyeah this is wild. huh.
00:19ihodesokay
00:19ihodesi figured it out
00:19ihodesneeded the right combinations of versions
00:19ihodesand for some reason, can't connect to one of my DBs. not sure yet why.
00:27Sgeotechnomancy, you know what keeps getting me
00:27SgeoThe [ thing
00:27SgeoThere's no place where you have to use [ or anything, but stylistically it's suggested
00:27SgeoBut I'm still a bit iffy on where it's good style
00:28Sgeo[] is (almost. macros can detect the difference if they wish) the same as (), so there's no enforcement of whatever Racket style is
00:29technomancySgeo: do you see it much in code you read
00:29technomancy?
00:29SgeoHm? Yeah, Racket examples are always using []
00:29SgeoLike:
00:29Sgeo(let ([a 1] [b 2]) (+ a b)) might be an example
00:30SgeoThat's completely equivalent to (let ((a 1) (b 2)) (+ a b))
00:30technomancyIIRC allowing [] to be interchangable with () is part of RNRS, right?
00:30technomancybut from what I gather it's not that common in other schemes?
00:30SgeoI'm under the impression that it is Racket specific
00:31SgeoI could be wrong, I guess
00:31SgeoOh, r6rs does have [] interchangable
00:31SgeoBut r6rs is somewhat widely disliked
00:31technomancymostly for pushing racketisms on the wider scheme community from what I gather
00:32technomancywhich is understandable; the renaming was probably the only way to keep them from blows
00:33SgeoHuh, wasn't aware of that
00:33SgeoOf pushing Racketisms on the community
00:33technomancyr6rs had just been ratified when I was playing with implementing scheme
00:34technomancyfrom an implementor's perspective it was annoying; more junk I didn't care about
00:34technomancybut from the perspective of "I want to use Scheme to build useful stuff" it's understandable
00:43DeeceThe docs for deliver say that it will throw an exception if i deliver twice to the same promise, but doing so in my repl just returns nil. is this because it's an alpha thing?
00:43technomancy,(doto (promise) (deliver 1) (deliver 2))
00:43clojurebot#<core$promise$reify__3678@29b473e2: 1>
00:44technomancyhuh
00:44technomancyI guess so
00:44technomancyerr--I mean it's a bug
00:46bbloom,@(doto (promise) (deliver 1) (deliver 2))
00:46clojurebot1
00:47bbloom,(macroexpand '(doto (promise) (deliver 1) (deliver 2)))
00:47clojurebot(let* [G__86 (promise)] (deliver G__86 1) (deliver G__86 2) G__86)
00:47bbloomyup seems bugged to me :-)
00:50amalloyi think there's a jira issue to update the docs
00:50amalloythe behavior changed in, i think, 1.3? it now returns false if deliver failed, rather than throwing
00:59ivanfixed post-1.4 http://dev.clojure.org/jira/browse/CLJ-1038
01:03ivanwas changed to get rid of locks, I assume https://github.com/clojure/clojure/commit/57c5186972c9c0f03d4bb5d2445309f14405e098
01:03ihodestechnomancy: bam: working. http://copperthoughts.herokuapp.com/ thanks so much :) it looks like i needed to not use korma, and use a particular combination of versions. i'll investigate further later. got a rails app to finish now…
01:04ihodesi think i may be one of the few devs who went clojure -> ruby
01:04ihodes:\
01:04technomancyI maintain a big pile o ruby at work
01:05ihodeswhat's your day-to-day like nowadays? if you don't mine my asking
01:05ihodessounds like a cool place to work!
01:05technomancyI work on the git push pipeline at heroku primarily
01:06technomancyI work on lein maybe 20-25% of the time
01:06technomancyproblem is the adapter between lein and the heroku runtime is so small it's not enough to keep me busy
01:06ihodesah, interesting
01:06ihodesi use your work a lot…
01:07ihodesactually, for the past 3 or 4 years
01:07ihodesi'm either using lein
01:07ihodesor pushing to heroku
01:07ihodesso, thanks, a lot
01:07technomancywell I didn't write much of the git stuff; just keeping it running and experimenting with ways to replace some of the legacy bits
01:09ihodeshow big is that codebase?
01:09ihodesif you don't mind my asking
01:10technomancylooks like around 3kloc
01:10technomancythat's not including the individual buildpacks for each language, but I don't have to touch those that often
01:10ihodesyeah
01:11technomancyso just a bit bigger than lein =)
01:12ihodeshaha
01:12ihodesamazing how so little code can keep people so busy
01:13ihodesbut considering how long i've spent on a few lines of code before
01:18miqlJust barely started using lein and heroku, so thanks, too!
01:20Raynestechnomancy is singularly responsible for the 10 hour downtime refheap had recently.
01:20RaynesThat's the way I see it.
01:21technomancy(when (= (System/getenv "USER") "Raynes") (System/exit 255))
01:22Raynes!
01:24ivan [hickory.zip :refer [hickory-zip]]
01:24ivan [clojure.zip :as zip]
01:24ivan [me.raynes.laser.zip :as lzip]
01:24ivanthat's a lot of zips
01:25RaynesBahahaha
01:25RaynesLaser is pretty zippy, for sure.
01:25bbloomzippy? or is it ZAPpy!?
01:26Rayneshickory-zip gets me a zipper over a hickory representation of HTML, zip gets me normal zip functions (obviously) and lzip is stuff for post-order zipper walking.
01:27RaynesI like zippers, you see.
01:27RaynesI'm just sad I can't find undergarments with zippers.
01:33aphyrIs it just me, or is incanter's API... weird?
01:33technomancyaphyr: it's weird
01:33RaynesI heard it sing White and Nerdy recently.
01:33RaynesIt's pretty weird.
01:33aphyrOK. After 8 hours of trying to wrap my brain around it everything is looking a little questionable.
01:34aphyractually eight nested maps involved in turning... a few integer arrays into a chart
01:36Raynesaphyr: http://cdn.memegenerator.net/instances/400x/32826812.jpg
01:36RaynesI was going to do that and be all smug, but it covered up half of his face.
01:36Raynes:(
01:37aphyrhttps://www.refheap.com/paste/8050
01:38aphyrit's like wandering through a mansion with a flashlight... whenever I look at a function's docs it makes sense, but I have no idea if there are giant rooms full of the stuff I need
01:41Raynesaphyr: We should go haunted house touring together.
01:41RaynesYou sound like the kind of guy I could take a liking to.
01:43aphyrhaha well I'm really excited about getting graphs out of it! :)
01:43aphyrjust a little puzzled on the way there
01:44aphyrbuilding a tool to do things like "tell me the difference in performance between two git commits of a project"
01:44aphyrbasho-bench in erlang, kinda
01:45technomancyI kept meaning to write a lein plugin that would record that kind of data during CI runs back when I was working on a large project on a daily basis
01:48aphyr... wait there's such a thing as haunted house touring?
01:48aphyrif so I am totally in
01:49aaelonyaphyr: do you prefer incanter charting to d3 and (clj)js? what about stuff like this… http://bl.ocks.org/mbostock ...
01:49Raynesaphyr: They give tours of some places. Others are existing hotels or bed and breakfasts that we could just stay at.
01:50aphyrmbo is cool! Doesn't really matter to me, I just want to get some pngs out of it
01:50aphyrRaynes: curiosity piqued
01:51aphyrDo we have to stay long enough for the furnace fumes to cause us to hallucinate?
01:51RaynesI think we do.
02:14aphyr(record {:name "sleep 10" :f #(Thread/sleep 10) :n 1000 :threads 10}))
02:14aphyrhttp://aphyr.com/media/latency.png
02:15muhooi suspect this code is hideous: https://www.refheap.com/paste/8051
02:16muhooso i'm offering it here for amalloy to point that out.
02:16amalloywhat the hell is this?
02:17muhoohahahaa
02:17amalloytrans-fifo is some kind of mutable holder for dates, and you're spin-polling it?
02:17muhooit's my miserable attempt at trying to block waiting for a new thing to be added to a queue
02:18muhoonew, meaning after the "bench" date.
02:18amalloyhttps://github.com/flatland/useful/blob/develop/src/flatland/useful/state.clj#L54
02:19aphyrahem: OOOH
02:19aphyrsquirreling that away, can't count how many times I've written something like this
02:19muhoothe top level is: there's a callback in another thread dumping stuff into that fifo. there are multiple threads each waiting for something "new", which locally means after they ask, to be added
02:19muhooamalloy: wow, that's cool, thanks
02:22amalloythat code is the one time i've used promises for a good reason
02:23Raynesmuhoo: I recorded Over My Head by The Fray earlier. I'm in windows or I'd throw it at you.
02:23Ember-muhoo: also if you have a slightly easier situation you could just use seque http://clojuredocs.org/clojure_core/clojure.core/seque
02:26ejacksonstill hating on us old folks, eh Raynes ?
02:27Raynesejackson: Speak up, gramps, can't hear you.
02:28amalloyi think usually it goes the other way
02:29ejacksonwhat's that sonny, into my good ear !
02:29Raynesamalloy: That was kind of the joke. I suck at humor.
02:30Raynesamalloy: We were making jokes about how me turning 19 = one foot in the grave this morning.
02:30amalloyi remember you having a brief bout with ejackson but i must have missed that part
02:32muhooRaynes: kewl, i should set up my lurking irssi again so you can
02:32muhooEmber-: i started up with sequeu, but this wait-until is perfect
02:33muhoohttps://www.refheap.com/paste/8052 ... i'ma see if i can get it down to 3 lines
02:35muhoohttps://www.refheap.com/paste/8053 close enough
02:36amalloymuhoo: well, there's an easy one-line shrink that would also improve your correctness. instead of (wait-until ...) (dw @x), write (dw (wait-until ...))
02:36muhooamalloy: cool, will try. thanks again. this is just fantastic
03:24ebaxtI'm moving my application off webnoir (since it's deprecated), is ring.middleware.reload the preferred way to reload without restarting?
03:29bbloomdo protocols support type hints? or do i need to use definterface?
03:31Sgeo_Protocols create interfaces, don't they?
03:32bbloomSgeo_: I'd assume so
03:33bbloomi guess it doesn't matter... since a protocol compiles to a cast, followed by an interface dispatch
03:34bbloomi'm experimenting with some opengl stuff and i really wish i could just generate specialized code paths for every different type of vertex that i want to pump through the system
03:35bbloombut then i'd need to write pretty much my whole library inside some giant macros.... which may actually make sense
03:35bbloomi basically want multi-type-hints
03:35bbloom"recompile this function once for each of these types"
03:36bbloomwhich i suppose java does under the hood
03:36bbloombut i don't trust it at this level
03:39dbushenkois there a way to ahead-of-time compile records and protocols?
03:39bbloomhm, i don't know much about ahead-of-time compilation in clojure... i guess i should read up on it
03:40bbloomi kinda always equated that with generating named classes for use by java interop
03:40dbushenkothat's not an answer for your question, that's just my question too :-)
03:40dbushenkoI would appreciate if there was a way to aot-compile my records
03:41bbloomheh
04:00tsdhIs there a way to use multimethods dispatching on type if the type of an objects isn't manifested in its class? Basically, I need something like (defmulti foo class), but with my own class and isa? functions.
04:06tsdhI mean, I could use `make-hierarchy' and `derive' to convert the custom type hierarchy of the objects to a hierarchy suitable for isa?, but it doesn't feel right to duplicate that information...
04:06ejacksontsdh: sounds doable. Just use your the guts of your isa as the dispatch fn in your multi.
04:07ejacksonso long as you have a fn that can descriminate your types, you're golden.
04:10tsdhejackson: Well, I have a function (has-type? obj type), but I don't see how that helps me.
04:11ejacksonyou have a function that given an instance of your type returns a value that identifies it ?
04:12tomojbut you also need to set up a hierarchy?
04:12tsdhejackson: Well, yes. But if it returned Foo, a method defined for SuperTypeOfFoo should trigger if there's no method for Foo itself.
04:13tomojwhere is the information of the type hierarchy now?
04:13ejacksoni see, trickier.
04:13tsdhtomoj: The hierarchy is basically there. For every object, (.getType o) returns its type and for these types I have (.isSuperType t1 t2) and friends.
04:14tomojbut where? in java code?
04:14tsdhtomoj: Yes.
04:14tomojmy condolences
04:15tsdhSo if I could replace isa? with my own function, it'd be very easy.
04:15ejacksoncan you expose a method in those java objects that returns their type/super-type ?
04:15tomojI guess you could write a macro to which the input is a list of all the types
04:16tomojif the number of types squared is not very large, the macro could go through every pair and check .isSuperType
04:16tomojthen emit the necessary derives
04:16tomojnot sure why you'd want to do that though..
04:17tsdhtomoj: Yes, that would be possible, but I don't want to convert an existing hierarchy to another one. So probably I take the multimethods implementation and change it to my needs.
04:18tsdhejackson: As said, they already have these methods.
04:19ejacksonwhy can't you use them to dispatch ? (sorry if that's a stupid question)
04:21ejackson(defmulti mm [x] (.my-type-or-super-type x))
04:22tsdhejackson: Because multimethods use the function isa? to compare the defmethod dispatch-val with the value returned by the dispatch function. Instead of isa?, I'd need my own isa? that known about the type hierarchy of the objects.
04:22ejacksonthat way you can get the java hierarchy to do the inheritance dance for you
04:23bbloomtsdh: you could patch my use my dispatch-map project to support custom isa?
04:23bbloomtsdh: https://github.com/brandonbloom/dispatch-map
04:24bbloomhttps://github.com/brandonbloom/dispatch-map/blob/master/src/dispatch_map/core.clj#L102
04:24bbloomand line 106 just a few down
04:24bbloomthose could become (.isa? dm x y)
04:24bbloomif you add an isa? member to dispatch-map
04:24tsdhejackson: But the inheritance dance is not reflected in the classes. Just because (.isSuperType (.getType o1) (.getType o2)) is true doesn't imply that (class (.getType o1)) is a superclass of (class (.getType o2))). In fact, both classes are the same.
04:25tsdhbbloom: Thanks, I'll have a look at it.
04:25ejacksonok, gotcha. Could you get a java method to return a vector of the type and supertypes going back to Object ?
04:25bbloomtsdh: i don't have an implementation of multimethods yet, but they are trivial
04:26ejacksonthen you could recursively dispatch the multimethod on those until you get a hit ?
04:26ejacksonthat might just be crazy talk though
04:26bbloomejackson: the better thing to do is to use a pluggable implementation... which is what i'm offering he make out of mine :-)
04:26ejacksonhehehe, alrighty :)
04:26bbloomtsdh: i need a break from this other project, maybe i'll add the multimethod functions too... shouldn't take me long
04:31tsdhbbloom: That looks good. `dispatch-map' could then accept an additional isa?-fn to override the standard behavior?
04:31bbloomtsdh: yeah
04:31bbloomi'd take a pull request for that
04:32bbloomtsdh: actually, i can probably just do it for you, it's really quick
04:32bbloomi won't even invoice you :-)
04:33tsdh:-)
04:36ejacksonbbloom: that's an interesting lib
04:36ejacksoncool !
04:36muhooclojurebot: java logging
04:36clojurebotjava logging is clown shoes
04:37muhoohttp://www.slf4j.org/images/concrete-bindings.png hell yeh it is.
04:41bbloomejackson: thanks :-)
04:53borkdudeIs there already something like this "scopes" thing that Stuart Sierra mentions here? https://groups.google.com/forum/?fromgroups=#!topic/clojure/2JDLF9E934o
04:55bbloomi havent seen anything like it... rich released some stuff on streams a while back but it didn't seem to go anywhere. i think chunked sequences got most of the perf benefits and the resource management stuff wasn't big enough a problem to justify new features
04:57bbloomtsdh: i'm definitely going to do the features you need, but you may just want to check back tomorrow :-)
04:57tsdhbbloom: No problem, I'm not in a hurry.
04:57bbloomtsdh: easiest thing to do is to star the project :-)
04:58tsdhbbloom: Done.
04:59Raynestomoj: Don't know if you noticed, but I released a new version of laser with the select changes we talked about. Haven't done anyting with the attr= function and such though.
05:15grayzonehello to anyone : i've a problem with sqlite3 & org.clojure/java.jdbc "0.2.3" : IllegalStateException I/O in transaction clojure.java.jdbc/transaction* (jdbc.clj:369) : suggestions for a sample with create table on db sqlite3 ?
05:38svedubois(new topic) I have created a vector:
05:38svedubois(def idx (org.itk.simple.VectorUInt32.))
05:38sveduboisAnd I would like to print and modify the vector, but I it doesn't work.
05:38sveduboisWhen I do this:
05:38svedubois(println idx)
05:38sveduboisI obtain this:
05:38svedubois#<VectorUInt32 org.itk.simple.VectorUInt32@54ee4346>
05:38sveduboisThe javadoc of the class VectorUInt32 is here:
05:38sveduboishttp://jsfiddle.net/svedubois/WBvEt/
05:38sveduboisCan you give me some advice?
05:39tomojDo `(<= level conf)` and "Confidence is <= level." mean the same thing?
05:45bbloomtsdh: is your custom hierarchy immutable?
05:45bbloomwith java, if you redefine a type, it's a new type
05:45tsdhtsdh: Yes.
05:45bbloomtsdh: ok b/c i've got polymorphic isa? working (i think) with an IHierarchy protocol
05:45bbloombut you need to make sure that the result of your -isa protocol definition would be memoizable
05:46tsdhbbloom: Cool, I'll have a look later.
05:46bbloomnot published yet
05:46bbloomstill writing test cases
05:46bbloomtsdh: issue here: https://github.com/brandonbloom/dispatch-map/issues/1
05:46tsdhbbloom: Watching.
05:50augustlis there a small in-process document database for the JVM I can use for storing small things like user settings?
05:52sveduboisAny advice about how to print/modify a vector using org.itk.simple.VectorUInt32 ?
05:52noidiaugustl, if you don't need anything fancy, you could `pprint` the settings into a file and `read` them back
05:53augustlnoidi: ah, cool
05:53noidi,(require 'clojure.pprint)
05:53clojurebotnil
05:54noidi,(pprint "{:foo 123}")
05:54clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: pprint in this context, compiling:(NO_SOURCE_PATH:0)>
05:54noidi,(clojure.pprint/pprint {:foo 123})
05:54clojurebot{:foo 123}
05:54noidi,(with-out-str (clojure.pprint/pprint {:foo 123}))
05:54clojurebot"{:foo 123}\n"
05:57bbloomi apparently suck at spelling hierarchy
06:01grcI'm missing something obvious here: (def my-map {:a 1 :b 2}), (def my-list '(my-map)), (map? (first my-list)) => false
06:03AnonnyGo ahead and call my-list.
06:05grcAnonny: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn
06:05grcwhich seems reasonable: invoked as (my-list)
06:05AnonnyI had it show up (my-map)
06:06Anonny(def my-list (list my-map)) works however
06:06sveduboisI have created a java array called idx, when I write: (alength idx) I obtain an error. What I am doing wrong?
06:07grcAnonny: That's working here too. I have no idea why
06:08Anonnygrc: I think '(my-map) isn't actually capturing the value of the variable.
06:08Anonnygrc: It might just be capturing the literal name for the var.
06:09grcAnonny: You're right and I need to go and read up on quote again. Thanks
06:09Anonnygrc: But that's just a guess. I'm sure somebody has a real answer
06:09Anonnygrc: My pleasure.
06:09andrewmcveigh|wogrc: the symbol is not evaluated because you quoted it ##(symbol? (first '(my-map)))
06:09lazybot⇒ true
06:11grcandrewmcveigh|wo: Thanks.
06:12Anonnysvedubois: (.length idx)?
06:13sveduboisAnonny: java.lang.IllegalArgumentException: No matching field found: length for class org.itk.simple.VectorUInt32
06:14sveduboisThe javadoc of the class VectorUInt32 is here: http://jsfiddle.net/svedubois/WBvEt/
06:17Anonnysvedubois: Neither capacity or size do what you're looking for?
06:18Anonnynor size*
06:19sveduboisAnonny: Yes, (.capacity idx)
06:19svedubois(.size idx)
06:19sveduboisprint without error 0
06:20sveduboisHow I can set a vector for this java array?
06:28sveduboisI have created and image called imgx
06:28svedubois(def imgx (org.itk.simple.Image. 256 256 PixelIDValueEnum/sitkFloat32))
06:28sveduboisI am not sure that this is the Size:
06:28svedubois(.getSize imgx) ;-> #<VectorUInt32 org.itk.simple.VectorUInt32@23a647ea>
06:28svedubois(.size(.getSize imgx)) ;-> 2
06:28sveduboisThe javadoc of Image is here http://jsfiddle.net/svedubois/MdPWz/
06:31llasramsvedubois: So, .getSize is returning an array then? What's the problem?
06:32sveduboisllasram: I would like to (.getPixel imgx 0 0 0)
06:32svedubois(.setPixel imgx 0 0 0 1)
06:33sveduboisBut I don't know which method I have to use and how.
06:34sveduboisThere is not getPixel, there are different getPixels.
06:34sveduboisFor example, (.getPixelIDValue imgx 0 0 0)
06:34sveduboisAnd it gives and error
06:35llasramWell yeah -- your javadoc there says the getPixelIDValue method doesn't take any arguments
06:36llasramIt seems like you're having issues figuring out how to use this library at all vs using it in Clojure. I'd suggest getting help getting it working in Java, and asking further here if you have trouble translating what works in Java into Clojure
06:41svedubois(.getPixelIDValue imgx)
06:41svedubois;-> 6
06:46callenhugod: debugging. How do I get a debugging experience in Clojure like http://pypi.python.org/pypi/ipdb
07:13bbloomwhat do i do license-wise if i want to copy paste a big chunk of code out of clojure.core?
07:13bbloomdo i just put an inline attribution and assign copyrights to rich hickey? or what?
07:14callenbbloom: just wondering...why?
07:15bbloomi implemented multimethods on top of my dispatch-map and i want to copy 10+ tests over wholesale
07:27callenbbloom: why did you implement multimethods?
07:27bbloomcallen: because https://github.com/brandonbloom/dispatch-map made it easy & it seemed like fun? :-)
07:27bbloomalso tsdh needed custom isa?
07:28callensometimes I wonder if anybody here makes things that aren't experiments.
07:30bbloomdispatch-map isn't an experiment, i'm using it for a real project :-P
07:55bbloomtsdh: ok that took much longer than i expected... but it's done :-P
07:55tsdhbbloom: Thank you, I'll give it a try. :-)
07:55bbloomtsdh: if you have any issues, please report them on github
07:55tsdhI'll do if I find one.
07:56callenbbloom: you wouldn't happen to be aware of any good debuggers for Clojure, would you?
07:57bbloomcallen: no, but i haven't really felt the need for one since i can pprint any intermediate value. i generally prefer printf debugging anyway, but i'm a crazy person
07:58callenbbloom: I'm accustomed to having first-class in-langauge debugger/REPL combos from Common Lisp and Python
07:58callenbbloom: that I can't find one for a Lisp (Clojure) is appalling.
07:58algernoncallen: I've had reasonable success with yourkit's stuff. (but I mostly used it for profiling, for debugging, I usually abuse robert.hooke and pprint to my heart's content)
07:59callenalgernon: I don't really want to use software other people control.
07:59bbloomlolwut
07:59callenand I don't want a profiler, I want a native Clojure debugger/REPL.
08:00callenmy impression has been that YourKit is commercial but donates to open source projects.
08:00bbloomit's a profiler, you're not taking a dependency on it
08:00algernoncallen: you might want to have a look at https://github.com/pallet/ritz then
08:00dpwrighthello -- sure I must be doing something stupid here, but a project I've made which runs fine when I run "lein repl" and then (-main) fails with "No such namespace: goshiki" (where goshiki is a namespace defined in another file in my project) when I do "lein run"
08:00callenalgernon: I already have, or I wouldn't be asking
08:00callenI don't want a java debugger
08:00callenI want a Clojure debugger
08:00callenhttps://github.com/georgejahad/debug-repl <--- this is closer to my intent.
08:01bbloomdpwright: refheap your ns forms
08:02dpwright(more precisely, I have a namespace hotel-scraper.goshiki which is required thus '[hotel-scraper.goshiki :as goshiki]'
08:02hugodcallen: what didn't you like in ritz?
08:02dpwrightbbloom -- thank you, I will look up what that means and then try it ;-)
08:02bbloom~refheap
08:02clojurebotrefheap is gist
08:02bbloom~gist
08:02clojurebotgist is forget ~paste
08:02bbloom~paste
08:02clojurebotpaste is not gist.github.com
08:02bbloomLOL
08:02callenhugod: I can't figure out how to make it behave like a native Clojure REPL
08:02bbloomhttp://www.refheap.com
08:02dpwrightoh I see
08:03hugodcallen: in what way?
08:03callenhugod: if you can point to documentation that will let me do what I want, do so
08:03callenhugod: but when I looked, all I could find was shitty auto-generated crap.
08:04callenI don't use any java IDEs or any of that crap, so if using JPDA requires that, I'm out.
08:04hugodcallen: most of http://common-lisp.net/project/slime/doc/html/Debugger.html applies to ritz
08:04callenhugod: that is such a cop out. never mind then.
08:05callenhugod: I'm asking how to use *ritz*, not slime/swank.
08:05callenIf I use swank, I'm just going to use CDT.
08:05callenI'd rather use nREPL though.
08:05hugodcallen: it applies to ritz-nrepl too
08:05callenhugod: where's the documentation?
08:06algernonhttps://github.com/pallet/ritz/tree/develop/nrepl got me started, fwiw.
08:06algernon(linked from the main ritz readme)
08:07dpwrightbbloom https://www.refheap.com/paste/8059
08:07callenalgernon: I've seen that, I didn't see anything for dropping a REPL inline at runtime.
08:07bbloomdpwright: the filename must match the ns name
08:08bbloomdpwright: are those in a hotel_scraper directory ?
08:08dpwrightbbloom, yes -- core.clj was generated by leiningen, and I just added goshiki.clj next to it
08:08bbloomdo you have a hotel-scraper.util ?
08:08bbloomhotel_scraper/util.clj
08:09dpwrightyes, defined inside util.clj in the same directory
08:09bbloomand it's ns form ?
08:10bbloomits*
08:10dpwrighthttps://www.refheap.com/paste/8060
08:10dpwrightjust noticed, my project.clj doesn't specify a src directory
08:11dpwrightthe sources are in src/hotel_scraper, which I thought was the default, but..
08:11bbloomit is the default
08:11bbloomhm i'm not sure
08:11bbloombut i'm also exhausted, so my eyes might be useless
08:12bbloomsorry man, good luck! i'm off to bed
08:12dpwrightthanks for taking a look!
08:12dpwrightnight
08:15dpwrightah -- figured it out! I was doing an eval inside the code, running something read in from a config file. I guess when I ran it from the repl the namespaces were set up ok, but using "lein run" they weren't. At any rate, using the full namespace name in the config file rather than the shortened one I specified in the :require statement fixed it.
08:15dpwrightthanks again for your time bbloom
08:16dpwrighttime for me to head bedward too
08:20hugodcallen: the nearest is to set a breakpoint, and then use 'e' to evaluate arbitrary expressions within the context of any stack frame
08:24callenhugod: okay let me provide some contrast. first step: `pip install ipdb`
08:25callenhugod: second step: drop `ipdb.set_trace()` wherever you want a debugger/REPL to pop up. There is no third step.
08:31hugodcallen: sure, it is not super smooth to set up. Contributions welcome...
08:32callenhugod: is there a way to use it just from a running process?
08:33callenI'd rather experiment with it before shitting up my Emacs config.
08:34hugodcallen: it requires a jvm running with debug flags. At the moment it does that by controlling the process startup (with lein-ritz). Attaching to a running process is on the todo list.
09:22TimMctechnomancy: The lein-newnew changes will invalidate the leiningen.new tests -- perhaps those should live on newnew in the first place...
09:26marianoguerraI want to filter a map by some field on the value and then build a new map, I'm doing something like (apply hash-map (flatten (filter filter-fn (seq the-map))))
09:26marianoguerra(of course not as a one liner)
09:26marianoguerrais there another way?
09:51llasrammarianoguerra: ##(let [input {:a 1, :b 2, :c 3, :d 4}] (into {} (filter (comp odd? second) input)))
09:51lazybot⇒ {:a 1, :c 3}
09:52marianoguerrallasram: thanks
10:04bosieso, i am reading on macros in Clojure Programming and i enter the first macro they have in my REPL. it seems to work, i get #'user/reverse-it back. calling the macro though results in "unable to resolve symbol: nltnirp)
10:05bosiehttps://gist.github.com/4444022
10:06nDuffbosie: well, of course -- println reversed isn't something valid.
10:07jeremyheilerI think you're supposed to call it (reverse-it (nltnirp "foo"))
10:08nDuffbosie: ...it's not a macro that's expected to actually be very _useful_, but is a demonstration of the power/flexibility.
10:08bosienDuff: at this point it doesn't demonstrate anything to me
10:08bosienDuff: if i call the function walk/postwalk manually it works
10:08nDuffbosie: it demonstrates that a macro can rewrite the symbol "println" to be its reverse -- "nltnirp"
10:08bosieif i call it through the macro, it doesn't
10:08bosienDuff: no?
10:09nDuffbosie: so, the error itself demonstrates that the macro is working.
10:09nDuffbosie: because the code within the macro is rewritten according to its instructions.
10:09noidihere's a better demonstration of the power of lisp macros https://www.hackerschool.com/blog/13-list-comprehensions-in-eight-lines-of-clojure
10:09bosieah
10:09bosieso symbol executes/evaluates the method?
10:10nDuffno
10:10bosieno
10:10bosie(walk/postwalk #(if (symbol? %)
10:10bosie(symbol (str/reverse (name %)))
10:10bosie%)sorry
10:10bosieagain, i don't get it
10:10nDuffwhen you use a non-special name, that's a symbol
10:10nDufffor instance, in (println "foo"), println is a symbol
10:10noidibosie, the symbol println is turned into string "println", reversed into "nltnirp", and turned into symbol nltnirp
10:11bosienoidi: i get that. i don't get the error part
10:11nDuffso, the macro is creating a symbol "nltnirp", akin to the symbol "println" but not actually pointing to anything valid.
10:11noidiafter that the code is executed, as if you had written nltnirp instead of println
10:11nDuffand because "nltnirp" isn't valid, you get an error.
10:11bosiehttps://gist.github.com/4444089
10:11bosieexecuted by whom?
10:11nDuffExecuted?
10:11nDuffThis is a compile-time error.
10:11nDuffThere's no execution happening yet.
10:11bosieok
10:12noidisorry, s/executed/evaluated/
10:12bosieok
10:13noidi,(ntlirp "foo")
10:13clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ntlirp in this context, compiling:(NO_SOURCE_PATH:0)>
10:13bosieyup
10:14bosiebut i am not sure
10:14bosiewhy calling the method directly vs calling it through the macro results in 2 different results
10:14jonasencemerick: is this by design, or a bug in nrepl: https://www.refheap.com/paste/8057 ?
10:14nDuffbosie: well, you're not calling the same code through the macro
10:14nDuffbosie: macros rewrite their contents
10:15nDuffbosie: ...rewrite their contents at compile time, even. that's what they _do_, and what makes them fundamentally different from functions.
10:15nDuffbosie: so, the macro rewrites the code to replace all symbols with reversed versions of their names
10:15nDuffs/the/that particular/
10:15nDuffbosie: so it's no surprise that the rewritten code won't compile.
10:16bosienDuff: oh, so when i call the macro, it actually gets recompiled?
10:16bosieand rewritten
10:16bosie?
10:16bosiei thought only the macro itself gets rewritten
10:17nDuffbosie: well, when you enter _anything_ at the REPL, that thing gets compiled before it's executed. When you compile code that contains a macro call, though, the macro rewrites the code within it.
10:17noidibosie, the macro takes a data structure representing code that's read but not evaluated. it then transforms it into another data structure, which is then evaluated.
10:17bosiei see
10:17bosiegot it, thank you
10:17noidi,(read-string "(println \"foo\"")
10:17clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
10:18noidi,(read-string "(println \"foo\")")
10:18clojurebot(println "foo")
10:18noidithat's the read phase
10:18noidiit transforms your source code into a data structure
10:18noidi,(eval (read-string "(println \"foo\")"))
10:18clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
10:19noidiokay, that would've resulted in a println call if clojurebot would allow it :)
10:19bosiethanks a lot guys, really appreciated
10:19jkkrameryou are henceforth initiated into macro club
10:19jkkramerthe first rule of macro club is: don't write macros
10:20ohpauleezis the second rule about hygenic macros?
10:20nDuffohpauleez: that's the third rule. The second rule is also "don't write macros".
10:21ohpauleezahh right right :)
10:21ejacksonyou're not supposed to use because they're made from fat people, or something... i don't fully grok it.
10:22nDuffejackson: More about composability. Can't use macros as arguments to higher-order functions.
10:23ejacksonindeed, and they make your brains leak out your ears; upsets the cubicle-mates.
10:25nDuffbosie: ...by the way, you may have already gotten this, but just to amplify a bit re "when I call the macro" -- macros only take effect at compile time; there's no invocation/recompilation happening after that point.
10:32bosiejkkramer: why not?
10:32bosieok
10:33yogthosbosie: macros are considered to be more difficult to understand than regular functions
10:33jkkramerbosie: for the reason nDuff gave. Also, macros hijack evaluation and can make your code confusing to read if not used with care
10:33bosieyogthos: and i guess composability as mentioned by nDuff doesn't help either ;)
10:33yogthosbosie: so if you can just do it with a function it's probably more maintainable in the long run
10:34yogthosbosie: right :)
10:34nDuff...so, there are cases where macros _are_ appropriate -- but basically, those come down to "language features".
10:34nDuffAnything with short-circuiting evaluation, for instance.
10:34bosiewhy oculdn't i rewrite "for" as a function?
10:34jkkramermacros are good at removing syntactic boilerplate
10:35yogthosI like to think of macros as templating, if you have have some repeating code which is hard to abstract otherwise then macro is appropriate
10:35yogthosalso good for deferring evaluation
10:35nDuff...and there are also cases where functions would have more overhead (though there are hybrid approaches to that -- see ie. definline)
10:35dnolenthe list of things that macros are good at ... long list
10:36dnolenmy rule of thumb is if I can't interact w/ the basic api w/o macros - there's probably a problem.
10:36cemerickjonasen: a bit of a bug; keywords are just name'd upon serialization to bencode (which only supports strings, integers, lists (vectors), and maps)
10:36nDuffdnolen++
10:36jkkramerbosie: you can, but it wouldn't be pretty
10:37jkkramer&(macroexpand '(for [i (range 3)] (inc i)))
10:37lazybot⇒ (let* [iter__4468__auto__ (clojure.core/fn iter__141314 [s__141315] (clojure.core/lazy-seq (clojure.core/loop [s__141315 s__141315] (clojure.core/when-let [s__141315 (clojure.core/seq s__141315)] (if (clojure.core/chunked-seq? s__141315) (clojure.core/let [c__44... https://www.refheap.com/paste/8062
10:37cemerickjonasen: side effect of using the stringify and keywordize stuff in clojure.walk
10:39cemerickSome people have suggested the development of an edn transport, though that will leave out e.g. vim
10:41jonasencemerick: ok. How about a fressian transport? Anyone attempted that? I'd guess it would be a great fit
10:41cemerickjonasen: no, no one's done that one either
10:46silasdavisi'm using the lein ring plugin to start a server, could someone tell me how it goes about finding what file/code to run?
10:46weavejestersilasdavis: It should be in the README. It expects a key in your project.clj file telling it where the Ring handler function is.
10:48brainproxyweavejester: have you run into weirdness w/ lein-ring, auto-reload and clojure 1.5.0-RC1
10:48brainproxy?
10:48weavejesterbrainproxy: No, but I haven't used Clojure 1.5.0-RC1 with Ring yet. However, there is a pull request for ns-tracker that I'll merge tonight that I think some people were saying they needed
10:49brainproxysure, that might be related
10:49brainproxyweavejester: btw, with respect to lein-ring / ring, where is the source code that drives the behavior of auto-refresh
10:50brainproxyi went hunting for it the other day and couldn't find it
10:50weavejesterbrainproxy: https://github.com/weavejester/ring-refresh
10:51brainproxysure, I'm aware of that repo, but ... how is that getting pulled in by lein-ring / ring
10:51brainproxydidn't see the dep in project.clj
10:51silasdavisweavejester: ah yes it's in the install section, thanks
10:52weavejesterbrainproxy: Plugins operate in a separate classloader than the actual project itself
10:52weavejesterbrainproxy: So if you want a plugin to use library X in your project, it needs to be in the project's dependencies, not the plugin's
10:53brainproxywell i have auto-refresh working
10:53brainproxybut I'm not using that plugin
10:53brainproxyjust lein-ring
10:53weavejesterbrainproxy: lein-ring is injecting that dependency into your project map when "lein ring server" runs
10:54brainproxymakes sense, but what drives that functionalit w/in lein-ring, hunted in the source for it, must have missed something
10:56jcrossley3weavejester: i saw your comment on kognate's PR about :path-info. any chance of getting that and :context into the Ring spec?
10:56weavejesterbrainproxy: It's easy to miss. Let me find the line
10:57weavejesterjcrossley3: Why should it be in the Ring spec?
10:57weavejesterbrainproxy: https://github.com/weavejester/lein-ring/blob/master/src/leiningen/ring/server.clj#L17
10:58weavejesterAnd ring-server has the dependencies:
10:58weavejesterhttps://github.com/weavejester/ring-server/blob/master/project.clj
10:58brainproxyweavejester: ah, thanks
10:58jcrossley3weavejester: i figured it made sense if "official" ring middleware is referring to it.
10:59brainproxyweavejester: i don't think I ever made the connection between lein-ring and your ring-server thing
11:00brainproxyi was just bouncing back and forth between sources for lein-ring and ring proper
11:00weavejesterjcrossley3: The SPEC defines how to transform a HTTP request and response into Clojure maps
11:00weavejesterBut path-info and context are not part of HTTP
11:01weavejesterStrictly speaking, nor are URL-encoded parameters, cookies, sessions, and a lot of other things
11:01jcrossley3weavejester: sure, but i think it'd be useful to have a canonical list of what keys i can expect in the request. where is that if not the spec?
11:02weavejesterSo even though official Ring middleware will use these keys, they still shouldn't be part of the spec, because they're not something an adapter-writer should worry about.
11:02weavejesterIt's possible we could create a list of keys that the various Ring middleware adds
11:02yogthosI think at least the context needs to be in the spec, as it's something that's part of the servlet spec
11:02weavejesterBut this would be documentation, not specification.
11:03yogthosthis was a long time bug in noir where, it redirects ignored the context and if you deployed on something like tomcat your app would be broken
11:03weavejesterThe Ring spec is unrelated to the servlet spec.
11:03weavejesterThe Ring spec defines the mapping between HTTP and Clojure
11:03weavejesterOne of the problems with Java servlets is that it attempts to put too much in the same specification
11:04jcrossley3weavejester: the majority of the spec is a listing of the keys available in the request and response maps. :)
11:04yogthostrue
11:04weavejesterHTTP, cookies, parameters, sessions, long polling and so forth
11:04weavejesterThe Ring spec is *just* about HTTP and nothing more
11:04yogthosbut since ring runs on top of servlets, it's something that you do have to be aware of when working with ring
11:04weavejesteryogthos: Well, no, not really. Only if you deploy Ring to a legacy servlet container
11:05yogthosweavejester: well any container, like glassfish, jboss, tomcat, etc
11:05weavejesterIf you're just using Ring with the adapter, there shouldn't be anything you need to know about the underlying implementation
11:05yogthosI think most people run jetty standalone where it's not an issue
11:05jcrossley3i don't think ring necessarily runs on top of servlets, but it does concede inspiration from Rack and WSGI, both of which support :context and :path-info in addition to :uri, the latter being in the spec.
11:06weavejesterjcrossley3: It is inspired by those, but path-info and context shouldn't be in a spec that deals with HTTP
11:06jcrossley3weavejester: i gather you feel pretty strongly about this. :)
11:06yogthoshehe
11:07yogthoswhat about making context part of the implementation?
11:07yogthosnot expose it as a key, but if it is present it's probably should be part of any relative urls
11:07weavejesterWell, once upon a time I asked Mark the same thing: I wanted :context and :path-info in the SPEC
11:07yogthosthen it wouldn't be exposed to the user, but you'd still have correct behavior in case it is present
11:07weavejesterBut after some discussion I've changed my mind
11:08weavejesterFor Ring 1.2, middleware that used to access the :uri is now going to use the ring.util.request/path-info function
11:08weavejesterWhich is just (or (:path-info request) (:uri request))
11:09weavejesterSo the code will be aware of the :path-info key
11:09weavejesterAnd having documentation on all the keys that Ring middleware adds is a good idea
11:09weavejesterBut there's a difference between documentation and specification
11:09yogthosyeah that's a good point
11:10weavejesterThe former describes the code, and the latter is something from which code is derived
11:10weavejesterSo for the SPEC, that's a specification because you want all the adapters to share a common interface
11:10weavejesterBut for things like the :cookies key, there's no need for a specification
11:10weavejesterBecause we only need one wrap-cookies middleware
11:11yogthosright, it's not a common protocol that needs to be shared by different adapters
11:11weavejesterExactly :)
11:11yogthosyeah that's a good separation
11:11weavejesterBut *documenting* all the keys is definitely a good idea.
11:11yogthos:)
11:11weavejesterIt just shouldn't be a spec, because that's kinda like the tail wagging the dog.
11:12jcrossley3weavejester: i agree with all of that. i really just want all the ring middleware to work correctly with context paths. i still feel, as you once did, contexts should be a part of a spec that maps a "hypertext transport protocol" to what we now know as the "interwebs" but i respect your perspective there.
11:13weavejesterWell, there are two possibilities: create a spec which defines how :context and :path-info work, or create code that defines how they work
11:14yogthosbut is there any value in exposing the context to the user in the first place?
11:14jcrossley3weavejester: imagine how pissed you'd be if rack, wsgi, and servlets took the code approach. :)
11:15weavejesteryogthos: It's useful for links.
11:15Seba51Hi yogthos, nice to meet you.
11:15yogthosweavejester: a link to a different context on the same app server?
11:15yogthosSeba51: hello :)
11:16jcrossley3weavejester: folks will end up in the same place i am right now: debating whether to copy/rewrite/monkey-patch ring middleware until it catches up. if we're going to be data-driven, let's spec out the available data.
11:16weavejesterjcrossley3: I didn't mean have the definition scattered throughout the code
11:16silasdaviswhy does ((fn [] "string message")) work but (#("string message")) does not?
11:16weavejesterI mean, like wrap-cookies, you only need a single function to do that
11:16weavejesterSo you have a middleare function, wrap-context, that adds a :context and :path-info key
11:16weavejesterAnd the docstring describes how it works
11:17jlewissilasdavis: because #() anonymous functions try to apply the first exp inside of them as a function to the rest
11:17weavejesterSo effectively we constrain the definition of context to a single middleware
11:17yogthosI think that's fairly reasonable, and templates can be used to set it up correctly :)
11:18yogthosthat definitely provides a lot of granularity, you want context handling you wrap the middleware, you don't then you don't
11:18jcrossley3weavejester: yeah, i retract my last comment. i think making ring fully context-aware, whether spec'd or not is fine.
11:18silasdavisjlewis: and the rest in this context is? could you expand the #(...) to (fn ...)?
11:18jlewis#(...) is the same as (fn [] (...))
11:19jlewiswell, it might have arguments, but you get the picture
11:19weavejesterjcrossley3: The only thing I'm a little worried about is whether that approach will work for everything.
11:19silasdavisjlewis: um so I feel like my two expressions are the same, but the fn one works as expected
11:19jcrossley3weavejester: dammit! i was banking on YOUR confidence it will! don't make me worry about these things! ;)
11:19weavejesterjcrossley3: It might be that, for instance, it doesn't make sense for servlets to use wrap-context, but to get the context and path info from the servlet.
11:19silasdavisthe shorthand ones throws: ClassCastException java.lang.String cannot be cast to clojure.lang.IFn
11:20jlewisyes - note that the one you wrote with fn doesn't have any inner parens, like my example
11:20weavejesterjcrossley3: The only way to be sure is to implement it, and then see if we need multiple implementations.
11:20teromsilasdavis: they're not the same, (fn [] (...)) vs (fn [] ...)
11:20weavejesterjcrossley3: If we do, then it's time for a spec
11:20matthavenersilasdavis: the #("string") becomes (fn [] ("string")) and tries to execute "string"
11:20weavejesterjcrossley3: But only if we need multiple implementations. If we only have one, then there's not much point in writing a spec :)
11:20silasdavisoh right yes
11:21yogthossilasdavis: it's because #( ) expects a function name as the first item
11:21jcrossley3weavejester: true, but please just s/:uri/:path-info/ before your next release, k? :)
11:21hyPiRion,#([0] 0)
11:21matthavenersilasdavis: you can always do #(identity "string"), but thats longer than (fn [] "string") :)
11:21yogthossilasdavis: in case of #("foo") first item is a string, it tries to execute it as a function and fails
11:21clojurebot#<sandbox$eval27$fn__28 sandbox$eval27$fn__28@292d45ad>
11:21hyPiRion,(#([0] 0))
11:21clojurebot0
11:22weavejesterjcrossley3: That's the plan. It's worked well in Compojure for the past couple of years, so it makes sense to integrate it into Ring.
11:23silasdavisor (#(str "string))
11:23jcrossley3weavejester: agree. what release version of ring are you targetting?
11:23Seba51Being nosy: what is the context thing you are talking about?
11:24yogthosSeba51: in Java servlet spec you can have a context string, which specifies the context relative to the application server you're deploying on
11:24Seba51I know
11:25yogthosSeba51: ok so the problem is that if you don't specify the context in the url, then it won't work correctly in those situations
11:25yogthosSeba51: for example if you're doing a redirect
11:26Seba51Even worse, you can have a mod_jk or mod_proxy receiving a request on www.example.com and calling your jetty server on http://localhost:8080/myapp
11:26yogthosSeba51: right same problem ;)
11:26yogthosSeba51: although shouldn't apache rewrite the urls at that point?
11:27jcrossley3Seba51: yogthos: or mapping a uri path component to a file system or class path, in the case of wrap-file or wrap-resource.
11:28silasdavismore basic clojure non-understanding... when using moustache why does (app [""] "string") produce a working handler but (app [""] ((fn [] "string"))) does not?
11:29silasdavisI'm guessing because app is a macro it is able to not evaluate the function argument as I expect
11:29creesedid moustache development start up again?
11:29Seba51No
11:29silasdavisis moustache dead?
11:30creeselast I heard, it was suggested to use Compojure
11:30Seba51You would have to filter the html, analyse the Javascript, patch whatever is building a URL to finally have a correct HTML
11:30Seba51You will receive the context with different request parameters.
11:31Seba51Out of my mind, something like x_context
11:31silasdavisI actually was using compojure, but thought I try moustache for the hell of it. I see the last commit was a year ago. I'll switch back
11:31Seba51Only redirects are fixed
11:33Seba51See here: http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#request-bodies
11:34yogthossilasdavis: shameless plug :P http://luminus.herokuapp.com/
11:34yogthossilasdavis: trying to make a one stop shop for clojure web dev :)
11:35Seba51@yogthos Any reading is mod_jk: 3. Some applications might contain hard coded absolute links. In this case check, whether you find a configuration item for your web framework to configure the base URL. If not, your only chance is to parse all response content bodies and do search and replace. This is fragile and very resource intensive. If you really need to do this, you can use http://apache.webthing.com/mod_proxy_html/, http://httpd.ap
11:36silasdavisyogthos: that looks really useful thanks
11:36yogthossilasdavis: good to hear, and any feedback is welcome as I'm still working out long term direction for it
11:37silasdavisI started of with noir and then someone told me (in a pub surprisingly) that that was deprecated
11:37yogthosSeba51: yeah so long story short stay away from mod_jk if possible ;)
11:37systemfaultHmm, if noir is deprecated then what is the cool framework to use nowadays?
11:37yogthossilasdavis: yup, building on top of compojure is the recommended approach nowadays
11:37silasdavisso then I found a compojure/hiccup template, which was ok, then I read about moustache and enlive so tried all combinations therein
11:38systemfaultThanks
11:38silasdavisat some point I need to stop framework hoping and write some code :0
11:38creeseyogthos: why do you use hiccup as the default?
11:38silasdavispp*
11:38Ember-ooh dear
11:38Ember-4clojure admins here?
11:38Ember-504 Gateway Time-out
11:38yogthoscreese: it doesn't require learning new syntax
11:38silasdavisAny thoughts on https://github.com/clojure-liberator/liberator ?
11:39yogthoscreese: with something like enlive you have to learn how enlive works, with hiccup it's just standard clojure data structures, I figure it's more beginner friendly
11:39creeseyoghos: for a designer, it does. a designer won't know clojure
11:39yogthoscreese: arguably the designer shouldn't touch the markup and use css for styling
11:39silasdaviswhat I am building is a restful api, with some light templating for convenience, not sure whether I should work more directly with compojure or use that
11:40yogthossilasdavis: luminus primarily just sets up a good compojure template
11:40silasdavisyogthos: that's often pretty hard to do, particulary supporting many browsers...
11:40creeseyogthos: I'll have to think on that. Most of the designers in our shop do markup
11:40silasdavisyogthos: that is what I've been after. I think I can use both if I wish
11:41yogthoscreese: well the beauty of the whole scheme is that you can rip out hiccup very easily
11:41yogthoscreese: just dump the dependency and use any templating you like, but my experience is that it is a good practice to not mix markup and design
11:41jcrossley3yogthos: was recommending java.jdbc a deliberate decision, over something like korma?
11:42yogthosjcrossley3: I always found java.jdbc to be simple enough to use, but if there's interest in korma I could certainly add it in as a module
11:43yogthosjcrossley3: korma did recently get a maintainer :)
11:43silasdavisi'm planning on using monger
11:43jcrossley3yogthos: indeed, a good thing
11:43Seba51yogthos: I am not sure, if the persistence layer should be included.
11:44yogthosSeba51: it's not by default
11:44yogthosSeba51: basically if you do lein new luminus myapp you get barebones compojure app
11:44Seba51We will end up in a big fat framework where people struggle to rip out things.
11:44yogthosSeba51: if you add stuff like +postgres you get the db dependencies basic setup
11:44Seba51I mean there is mongo/couchdb/jdbc/JPA/in memory dbs etc
11:45yogthosSeba51: for most apps you'll need some sort of persistence at some point though, so I think it's better to template that than to have to roll it from scratch every time
11:46Seba51There is a german diction: You cannot see the forest because there are so many trees.
11:46yogthosSeba51: all of those can be added in as separate modules, so if you want mongo you do +mongo, you want couch you do +couch, etc
11:46Seba51Every option will make other stuff less visible.
11:46yogthosSeba51: how so?
11:47silasdavisit's appealing to have a minimal base that actually works, particularly for somone like me who is learning the language and the frameworks at the same time
11:47Seba51If I introduce a framework having 500 options and you are a struggling learner, you have to look through all of them.
11:47silasdavisSeba51: it should just default to something like sqlite
11:47yogthosSeba51: well you can organize them logically and provide sane defaults right
11:48yogthosSeba51: options aren't there so that you have to use them, they're there to override the default behavior if it's not working for you
11:48silasdavisyogthos: does your server.clj essentially provide a standalone alternative to lein ring server?
11:48yogthossilasdavis: yup
11:49yogthossilasdavis: you can just do lein run with it
11:49yogthossilasdavis: also setup for heroku :)
11:49silasdavisI couldn't decide whether to separate handlers in to separate 'controller' files
11:50silasdavisnot sure how much that pattern applies. I see you have a single handler to start with
11:50yogthossilasdavis: I find it's better to think in terms of routes
11:50yogthossilasdavis: for example say you have all your authentication routes such as register, login, logout
11:50yogthossilasdavis: I'd group those into a single namespace and then have all the logic around that workflow in one spot
11:51Seba51IMHO: less can sometimes be more. Because you will easily learn the frameworks and get a clear overview. But this is a matter of preference. There are many big frameworks like JEE, Ruby on Rails, which took the choice to provide all layers. Others are succesful to focus on something.
11:51silasdavisthat's essentially an authentication controller I suppose
11:51yogthossilasdavis: right
11:52yogthosSeba51: I do want to keep it somewhat minimalistic, but I also want to capture all the common tasks
11:52yogthosSeba51: part of it is also to make it easy for beginners to get bootstrapped
11:53silasdavisSeba51: I quite like the loosely coupled clojure web stack from what I've seen, so I'm not sure you'd want something like RoR, but having a fully working, if not fully functional setup is very useful
11:53yogthosSeba51: it can be frustrating having to hunt for how to do this or that, or having to figure out which library is the one people use for example
11:53silasdavisfor bootstrapping, yes
11:53Seba51I think you have been quite successful with this. ;-) (Leaving, children are waiting for dinner)
11:54silasdavismidn you I suppose you could leave persistence out of that. I just wanted to be able to do 'lein ring server' or similar and then start breaking things
11:54yogthosSeba51: thanks ;)
11:54yogthossilasdavis: that's the base template then :)
11:55yogthossilasdavis: if you just do lein new luminus myapp it won't put any persistence stuff in
11:55yogthossilasdavis: and it's ready to break out of the box ;)
11:57silasdavisactually it's not quite for me, I'm getting a class not found exeception for server
11:58silasdavisException in thread "main" java.lang.ClassNotFoundException: crosstalk.luminus.server
11:59silasdavislein 2
12:00yogthossilasdavis: oh interesting
12:00silasdavisit's the dots
12:00yogthoshow are you running it?
12:00silasdavisI called my app crosstalk.luminus
12:00yogthosah
12:00yogthosyeah I think the app name has to be just letters
12:01yogthossilasdavis: I don't think the templating handles the dots, might be something to fix in lein :)
12:01silasdavisnot sure how new works but it would be good if it could capture that, bit of an edge case though
12:01hyPiRionit's lein-newnew in that case
12:01yogthosyup
12:02yogthosyeah just tried it the template doesn't sanitize the .
12:02hyPiRionhttps://github.com/Raynes/lein-newnew/issues/57
12:02hyPiRionI suppose that's kind-of relevant
12:04yogthosyeah looks related
12:06silasdavisyogthos: will you keep the template update with the latest version of dependent libraries?
12:06silasdavisupdated*
12:06yogthossilasdavis: that's the plan :)
12:06yogthossilasdavis: I'm kind of invested in it, as I use it for work as well
12:07silasdavismight want to see if you can get it linked from: http://www.webnoir.org/
12:07silasdavisthere really should be a note on that site saying it is deprecated by the author
12:07silasdavisit's the top hit for 'clojure web framework'
12:07yogthossilasdavis: yeah next time Chris is on I could ask him about that
12:18callenyogthos: what?
12:19yogthoscallen: hey what's up
12:19callenyogthos: you must've meant ibdknox, n/m
12:19yogthoscallen: ah yes
12:19yogthoscallen: about the noir being deprecated :)
12:20callenRight.
12:20yogthossilasdavis: callen: so this should help keep the template up to date :) https://gist.github.com/4445009
12:22yogthoscan't really autoupdate them though, as there could be breaking stuff
12:27silasdavisyou could always maintain an auto-synced testing branch
12:27silasdavisother people could track that if they wanted
12:27yogthossilasdavis: yeah might be an idea, if nothing else this way I can easily check if stuff looks out of date
12:28yogthoscallen: oh yeah you want to add those env scripts?
12:28callenyogthos: no
12:30ppppaulcan someone give me a suggestion as to how i would write a test that mocks out rabbitMQ?
12:32ppppaulanyone?
12:32clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
12:32ppppaulhmm
12:33llasramppppaul: By using with-redefs...?
12:33yogthosppppaul: what are you trying to do with ti?
12:33technomancyyeah, with-redefs
12:33ppppauli understand that
12:33ppppauli'm just not very experienced with doing async stuff with clojure
12:33joegalloppppaul: are you using a library to interact with rabbitmq? if so, which one?
12:34llasramppppaul: If you're testing something which depends on exactly how your rabbitmq communication is async, then I'd suggest *not* mocking rabbitmq
12:34nDuff...btw, anyone know why futures are dispatched to a bounded pool?
12:34ppppaulhttp://clojurerabbitmq.info/
12:34llasramnDuff: You do. It's the same as the send-off pool?
12:34nDuffllasram: Ahh; that makes sense, then.
12:35nDuffllasram: ...though I don't understand _why_, as futures aren't typically going to be IO-bound. To prevent deadlocks if they call other futures, I suppose?
12:37llasramppppaul: If you're doing something straightforward which e.g. turns a sequence of received messages into a seq, then you can just mock there. Or do both for different tests!
12:37llasramnDuff: I definitely uses futures for IO-bound stuff
12:37llasramuse, even
12:38nDuffFair 'nuff.
12:38svedubois(New topic) I would like to print the origin of an image. With this line:
12:38svedubois(. image getOrigin)
12:38sveduboisI obtain this:
12:38svedubois#<VectorDouble org.itk.simple.VectorDouble@295f7c4b>
12:38sveduboisBut the real origin is [0.283453, 0.283453, 0.283453]
12:38sveduboisI obtain the origin from a long list using:
12:38svedubois(println image)
12:38sveduboisHow I can print the origin? And the origin in the x axe?
12:38sveduboisThe javadoc of Image http://jsfiddle.net/svedubois/MdPWz/
12:38sveduboisThe javadoc of the VectorUInt32 http://jsfiddle.net/svedubois/WBvEt/
12:39nDuffsvedubois: The first thing I'd try, without looking at those docs: (vec (. image getOrigin) )
12:40sveduboisnDuff: java.lang.RuntimeException: Unable to convert: class org.itk.simple.VectorDouble to Object[]
12:40nDuff...yeah, gathered that looking at the docs. A "container class" that doesn't implement any Java standard container interfaces? WTF?
12:41llasramIt's some sort of SWIG-generated cruft
12:43sveduboisllasram: Yes it is swig generated
12:43nDuffsvedubois: Huh. Well, you can extend Seqable to know how to handle it, if you want.
12:43llasramnDuff: Did Seqable become a protocol when I wasn't looking...?
12:45nDuffllasram: Oof -- my bad.
12:53ppppaulthanks llasram
12:54svedubois(defn seqable? [x] (instance? clojure.lang.Seqable x))
12:54svedubois(seqable? (. image getOrigin))
12:54svedubois;-> false
12:55hyPiRioneh
12:56hyPiRion,(instance? clojure.lang.Seqable "foobar")
12:56clojurebotfalse
12:56hyPiRion,(seq "foobar")
12:56clojurebot(\f \o \o \b \a ...)
12:57mattywwhy does (lazy-seq (slurp "some-large-file")) take much less time than (slurp "some-large-file")?
12:58hiredman1/win 15
13:01svedubois(seqable? (seq (. image getOrigin)))
13:01sveduboisjava.lang.IllegalArgumentException: Don't know how to create ISeq from: org.itk.simple.VectorDouble
13:01hyPiRion,(macroexpand-1 '(lazy-seq (slurp "some-large-file")))
13:01clojurebot(new clojure.lang.LazySeq (fn* [] (slurp "some-large-file")))
13:01nDuffsvedubois: I think you kinda' missed the point there.
13:02sveduboisHow I can print the origin and not the name vector ?
13:02nDuffsvedubois: ...well, you need to write code that describes how to decode the object, since it's not a type that Clojure knows anything about, and it doesn't implement any common Java interfaces Clojure could use to know what it is.
13:02hyPiRionmattyw: That's your reason - whenever creating a lazy-seq, you're not evaluating the contents until needed
13:03mattywso it really doesn't slurp the entire file until needed?
13:03silasdavisyogthos: not sure if the util.clj module belongs in luminus given that it's not used by the base pages and the functions are a bit arbitrary
13:04hyPiRionmattyw: exactly
13:04mattywhyPiRion, that's cool! Thanks very much, I had a feeling that's what it was doing but wasn't too sure - it's cool
13:04nDuffsvedubois: one approach would be to build a wrapper that extends ASeq.
13:05nDuffsvedubois: ...but no matter what, you're going to be writing code.
13:05hyPiRionmattyw: you're welcome :)
13:05sveduboisnDuff: Perhaps it is possible to decode the result #<VectorDouble org.itk.simple.VectorDouble@295f7c4b> with some method from the VectorDouble class http://jsfiddle.net/svedubois/RH5Mc/
13:05nDuff...
13:06nDuffsvedubois: No.
13:06yogthossilasdavis: yeah that could probably go
13:06nDuffsvedubois: No method in that class implements standard Java collection types.
13:06nDuffsvedubois: You are going to have to write code. You.
13:06nDuffs/implements/returns something that implements/
13:06sveduboisnDuff: With get(int i)?
13:07jkkramersvedubois: (mapv #(.get vd %) (range (.capacity vd)))
13:08jkkrameror .size or whatever
13:08sveduboisjkkramer: Thanks, that's work
13:08svedubois(mapv #(.get (. image getOrigin) %) (range (.capacity (. image getOrigin))))
13:08svedubois;-> [0.28345292806625366 0.28345292806625366 0.28345292806625366]
13:13marianoguerrais there a way to build a promise passing a list of promises and get it resolved as soon as the first one is resolved?
13:14yogthossvedubois: you can make it a bit cleaner with .. notation (mapv #(.. image getOrigin (get %)) (range (.. image getOrigin capacity)))
13:16silasdavisyogthos: is the timbre dependency being used (is any logging set up)?
13:17yogthossilasdavis: yeah http://luminus.herokuapp.com/docs/logging.md
13:17yogthosit logs to standard out by default
13:18technomancy:use?
13:18llasrammarianoguerra: Why not have just one promise?
13:20silasdavisyogthos: ah so should I add that manually?
13:21yogthossilasdavis: yeah sprinkle logs in as needed ;)
13:21yogthostechnomancy: you mean in the example? :)
13:22yogthostechnomancy: based it off the official docs ;)
13:24silasdavisIf I wanted default debug logging everywhere do I need to add the use directive to every file?
13:24marianoguerrallasram: because the other function is returning a promise for each item, but I can modify that to use one I pass as an optional param, thanks :)
13:33llasrammarianoguerra: Cool beans. Do be aware that different versions of Clojure react differently to re-`deliver`ing. The docstring still says it throws an exception, but starting with 1.[34]? it actually just silently does nothing
13:33yogthossilasdavis: as far as I know you do have to reference the libraries in each namespace
13:35llasramsilasdavis: You can use the fully-qualified name for a var once it's been loaded, but it isn't good practice, as you can't know if it's been loaded yet unless you do so in each using namespace
13:35ppppauli'm trying to use java.net.URI with (file) but it's giving me an exception saying that i don't have an absolute path
13:35technomancycan someone explain to me the point of git tags that have messages?
13:35ppppaulhow do i get an absolute path from a rel path
13:37joegalloppppaul: http://docs.oracle.com/javase/6/docs/api/java/io/File.html#getAbsolutePath%28%29
13:37ppppaul:D thanks
13:37llasramppppaul: Or (.toURI (clojure.java.io/file "example.txt"))
13:38sveduboisjkkramer: The Direction of an image is a matrix like this:
13:38svedubois1 0 0
13:38svedubois0 1 0
13:38svedubois0 0 1
13:38sveduboisSo I would like to obtain this vector so I write:
13:38svedubois(. image getDirection)
13:38svedubois;-> #<VectorDouble org.itk.simple.VectorDouble@6645add0>
13:38svedubois(mapv #(.. image getDirection (get %)) (range (.. image getOrigin capacity)))
13:38svedubois;-> [1.0 0.0 0.0]
13:38sveduboisIs there any kind of function like mapv to obtain the matrix and not the vector?
13:38hiredmansvedubois: read the docs for the library you are using
13:39jkkramersvedubois: see hiredman's response. if there's a way to get it out of the java api, you can use that to generate a clojure data structure
13:39hiredmanorg.itk.simple.VectorDouble is not a from clojure, so there are no clojure functions for doing anything with it, if you want to do anything with it you need to read the documentation
13:40hornairsanyone have any experience with giving ring an InputStream as a response body? i'm trying to get it to send data to the client as it gets written to the stream but it seems to wait until the stream is closed to send any
13:41hornairsthanks for any help anyone can give!
13:50jkkramerhornairs: in the past I've followed the pattern seen here: https://github.com/ring-clojure/ring/blob/master/ring-core/src/ring/util/io.clj#L10
13:50jkkrameri.e., create piped streams, start a thread to write to the output stream, return the input stream as the ring body
13:56llasramWeird though, it looks like if you're using ring's servlet wrapper, which is used by the jetty adapter, then it will read the entire stream before responding: https://github.com/ring-clojure/ring/blob/master/ring-servlet/src/ring/util/servlet.clj#L95
13:56yedidoes a clojure map have the same time characteristics as a conventional hashmap? (with constant time access)
13:57weavejesterllasram: What do you mean?
13:57weavejesteryedi: In theory, no. In practise, yes.
13:58weavejesteryedi: The Clojure map is effectively a tree of constant-time hash tables
13:58yedieven though clojure's immutable data structure implementation makes maps basically al inked list of other maps?
13:58yedioh it's a tree?
13:58weavejesteryedi: But the tree isn't that deep, so it's almost the same thing as a hashtable in practise
13:58llasramweavejester: Oh hey! I was have some similar issues to hornairs getting chunked encoding responses working recently, so just dove into the ring code
13:59weavejesterllasram: Could you explain the problem in more detail?
14:00hornairsdoes io/copy block on a read until the stream is closed?
14:00llasramweavejester: Oh, I see -- the response object isn't returned. It pre-exists, so the response can begin as soon as one begins writing to the response's output stream
14:00weavejesterhornairs: Yes, it's blocking I/O.
14:00weavejesterllasram: Right
14:01llasramOk, just injecting confusion then :-)
14:02hornairsllasram thanks for investigating though! my current symptom is an empty response with the content length header set to 0 which makes the client close the connection, so im not sure if my stream writes later ever make it out
14:05adu_technomancy: r7rs is better
14:31andrewmcveighUsing cemerik's friend, I want to keep track of all login attempts. Where would be the best place to do this? Create a wrapper fn for a workflow (currently using interactive-form)? Make my own workflow? Something in middleware?
14:34gtrakit depends on how folks log in... I ended up not using workflows at all, just a manual merge-authentication
14:36gtrakin a compojure route handler
14:37andrewmcveighI'm currently using the interactive form workflow, and it's working pretty well for me at the moment, so ideally I'm not wanting to write too much code to deal with this.
14:38gtrakthe docs say a workflow is a ring-handler except it may return an authentication map instead of a ring response, so a 'middleware' might do the trick
14:39andrewmcveighI mean I could write a little middleware, but it seems like it would be trivial to have it in friend itself.
14:39andrewmcveighhmm...
14:44andrewmcveighgtrak: thanks for the input :), I'll think about it a bit more.
14:44gtrakno prob, I'm sure I'll need to learn workflows at some point :-)
14:48ppppaulif anyone here uses clutch, i would be very greatful to get a link with an example of (put-attachment) using a inputstream. :)
14:48ppppauli'm looking at the source code and i can't seem to figure out how to use the function :(
14:59muhoodoes 126Kb sound normal/accepted for :advanced compilation of a cljs hello world?
14:59muhooalso, is it normal for :advanced mode to pretty-print the output?
15:00nDuffmuhoo: No, it's not.
15:00nDuffmuhoo: Are you sure it's actually being run through Google Closure?
15:01muhoonDuff: how would i determine that for certain?
15:01Raynestpope: http://stackoverflow.com/questions/14145425/vim-foreplay-is-really-slow-with-ruby-1-9-but-fast-with-ruby-1-8-on-windows
15:01nDuffmuhoo: ...well, if it's pretty-printed, it's definitely not. :)
15:01muhooright. here's the project: https://www.refheap.com/paste/8070
15:02muhoonDuff: and here's the minimal i need to get it to 130K https://www.refheap.com/paste/8071
15:04muhoopulling XhrIo out gets it down to 99k
15:06tpopeRaynes: geez, tufflax is everywhere :p
15:06Raynestpope: Did you see my comments on foreplay a little while ago? I pinged you, but I'm on the road so my internet probably dvanished.
15:06Raynesvanished*
15:07tpopeRaynes: did not see them
15:07Raynes[13:28:14] <Raynes> tpope: vim-foreplay uses Ruby?
15:07Raynes[13:28:55] <Raynes> I don't understand how you do it, man. I wrote like 20 lines of Ruby for a Vim plugin for refheap and even I couldn't get it to work on OS X and half the time on Linux boxes. Vim hates Ruby. Never had problems with Python support.
15:07muhooso the problem appears to be, no matter what i do, either google closure or lein-cljsbuild insists, despite all reason, to pretty print the output
15:08callenRaynes: you know the Red Bull Flugtag?
15:08RaynesNo.
15:08callenRaynes: google it for two seconds so I can make the reference.
15:08muhooit's definitely munging variable and object names though, so that part is working
15:08tpopeRaynes: it does hate ruby, and I've had other issues with python
15:09tpopeRaynes: I did the absolute minimum necessary. just a socket connection
15:09tpopeRaynes: and I fall back to shelling out, if necessary
15:09Raynescallen: Got it.
15:09Raynestpope: You're a good person.
15:09callenRaynes: the "vehicles" you see in the Flugtag? That's most Ruby software I've run into.
15:10tpopemy bencode implemention is pure viml
15:10RaynesYay language bashing!
15:10tpopeI'm fine with ruby, just not the vim interface to it
15:11tpopeplus, it's basically a money printing machine
15:15muhooyay, :pretty-print false is required, not default. ok, no prob. hello world now 72k
15:22dnolenmuhoo: yeah, I will say I don't think I've ever seen trivial CLJS programs smaller than 30k-40k after adv. compilation.
15:23systemfaultNot that bad.
15:24systemfaultYou will get about 50% compression with gzip
15:24systemfaultSo a 20k file isn't that bad.
15:25ejacksondnolen: don't tempt me with your devil words !
15:25callenisn't that 2/3s the size of Google's entire landing page?
15:26systemfaultYou're speaking as if there was a lot of content on it...
15:26systemfaultAn empty page is even lighter than google.com
15:26callenthe ideal Zen state.
15:27ibdknoxthere needs to be a separable advanced compilation mode
15:28ibdknoxthen this could be largely done away with
15:29ibdknoxmake cljs.core and the goog.* libs a CDN'd common dependency and call it a day
15:29ibdknoxfirst load you eat the 20k gzipped
15:29ibdknoxany cljs site thereafter? the tiny bit of code actually related to your project is all you'll eat
15:31ibdknoxwe actually need to do something like that for nodejs module sharing anyways.
15:40Raynesibdknox: Can I enable paren matching in lt?
15:44TimMc&(Double/parseDouble "-Infinity")
15:44lazybot⇒ -Infinity
15:44ziltiWhat can be the reasons for a "IllegalArgumentException: Parameter declaration when-not should be a vector"? I have that in one of my namespaces, and only there. Even when creating a (defn foo (when-not false 1)) I get that message. I eval'd each form separately and only get the message at the foo fn.
15:45TimMczilti: It's saying that it's expecting a parameter declaration.
15:46TimMcand that it should be a vector, but instead it has this "when-not" thing.
15:46ttimvisherzilti: you need to add a parameter declaration, like: (defn foo [] (when-not
15:46ttimvisher false 1))
15:47ziltittimvisher: Yes, sure. It does not change anything. Hm... Maybe I should restart the REPL, could help.
15:48ttimvisherzilti: you shouldn't have to but maybe
15:48ttimvisheri just did it at the REPL here
15:49ziltiWell it helped.
15:49ibdknoxRaynes: it should be enabled already
15:51ttimvisherzilti: rockin
15:52ibdknoxRaynes: depending on the theme, it may not be particularly visible, at some point I need to go through all the themes and set the match colors
15:55Raynesibdknox: In that case, my theme doesn't work with it.
15:55Raynesibdknox: Sorry for the suckage. ;)
15:56ibdknoxhaha
15:56ibdknoxRaynes: I'll take a look. I'm working on a major refactor and a *big* set of experience improvements right now. 0.3.0 is going to be an awesome release. :)
15:57Raynesibdknox: Refactor? How many times are you going to rewrite that thing?
15:57ibdknoxsame way of writing it, just fixing some of the stupid mistakes as I was learning how this methodology would work
15:58nDuffWhoa.
15:58hyPiRion(constantly :refactoring)
15:58nDuffSome shiny stuff going on in Incanter 1.5.
15:59llasramI just got the name: in-cant-R
15:59hyPiRionmore like I-can't-R
16:00ibdknoxnDuff: like what?
16:00ejacksonblas backend for the matrix stuff !
16:01ejacksonwoot
16:01llasramDoesn't it already use parallel colt, which can use a blas backend if available?
16:02ejacksonsortof. The idea was to build incanter w/o native deps.
16:03ejacksonso I'm not sure how easy it would be to get the PC going the native BLAS.
16:03llasramAh, gotcha
16:03ejacksonthe 1.5 stuff uses jblas, which keeps most of the numeric ops in java
16:03ejacksonbut farms out any non-linear time stuff (inversion etc) to fortran
16:04llasramNeat!
16:04ejacksonllasram: also, the name is a play on a Neal Stephenson novel
16:04ejacksonAnathem :)
16:05yogthosthat was a good book :)
16:05ejacksonindeed !
16:05yogthosanybody read his latest one?
16:05ejacksonmeh
16:05yogthosreamde?
16:05yogthosnot as epic?
16:06ejacksontoo epic, not as brilliant
16:06yogthosah
16:06yogthosreading this right now http://en.wikipedia.org/wiki/Quarantine_(Greg_Egan_novel) it's fantastic :)
16:06yogthosin a similar headspace as anathem
16:06ejacksonthanks.
16:13technomancybbloom: hey, did you want to meet up for dinner before seajure?
16:13technomancymy other friend isn't going to mke it
16:13technomancymake
16:20TimMc"Other friend"? HEY LOOK THIS GUY HAS > 1 FRIENDS
16:20Seba51Can I do something like (let [{:keys [[x :as foo] y] } point] to extract key :x but bind it to foo?
16:21technomancyheh
16:21pjstadigtechnomancy: you know i'd totally do dinner with you if I didn't live 3,000 mi away
16:21hyPiRionTimMc: Other clojure friend within driving distance
16:21technomancypjstadig: it's mongolian BBQ; totally worth the trip.
16:21amalloySeba51: yes, but not with the keys shorthand
16:22TimMc,(let [{foo :x, y :y} {:x 1 :y 2}] [foo y])
16:22clojurebot[1 2]
16:23Seba51Thanks, I knew the other but are still learning ;-)
16:23hyPiRion,(let [{foo :x, :keys [y]} {:x 1, :y 2}] [foo y])
16:23clojurebot[1 2]
16:23dhm_technomancy: what place? not that i would crash, just love mongolian bbq
16:24Seba51This community is amazing. Thankfully, I do not have to pay a beer for every response. :-D
16:24ihodesactually, Seba51, you do
16:24technomancydhm_: Ruzhen on University Way: https://plus.google.com/101916490585616946067/about?gl=us&amp;hl=en
16:24dhm_technomancy: cool, thx
16:24TimMcihodes: Incorrect, I accept chocolate as an alternative.
16:25technomancydhm_: happy to have you at seajure if you're local
16:25ihodesTimMc: chocolate stout. i understand.
16:25dhm_technomancy: thanks, been a few times and loved it (darren)
16:25technomancyah, cool
16:26hornairsi am struggling to get streamed output working with ring, if anyone has any pointers I would super appreciate it! https://gist.github.com/4447300
16:27hornairsi get a 0 content length output immediately instead of seeing my two stream writes
16:28justincampbellis there a way to async/background something in clojure?
16:28hyPiRionagents?
16:28justincampbelllike, i just want a form that executes and returns right away
16:28justincampbellmaybe?
16:28justincampbellill look them up
16:28technomancyprobably futures for that
16:30justincampbell(future …) is perfect, thanks!
16:30amalloyhuh, i didn't know about ring.util.io/piped-input-stream
16:31TimMc&(nth (nth (destructure '[{:keys {b a}} 1]) 5) 2)
16:31lazybot⇒ :[b a]
16:31TimMcI'm not really sure how it came up with that.
16:32TimMcI suppose ##(-> '{b a} first str keyword).
16:32lazybot⇒ :[b a]
16:32amalloyhornairs: i bet the outputstream doesn't have a .write(String) method
16:32amalloyoutput streams generally don't
16:33hornairsamalloy: wouldn't i get loud complaints if that was the case?
16:34amalloyyes and no. you'll get an exception in the thread where that writing is happening
16:34llasram(inc amolloy)
16:34lazybot⇒ 1
16:34llasramhah
16:34llasram(inc amalloy)
16:34lazybot⇒ 38
16:34amalloyand exceptions on another thread vanish into nothing unless you ask for them
16:34hornairsdo you have to do something special to get exceptions from threads spawned by futures?
16:34hornairsaha!
16:34gtrakhornairs: when you deref it, the exception will propagate
16:35amalloyhe doesn't have access to the future object, though. it's created and managed by someone else
16:35gtrakoh, nevermind
16:36hornairsmaybe ill do my own try/catch and log em?
16:38hornairsthanks amalloy, that was silly of me
16:46mpanis there an easier way to have a function that takes either [x y z] or [x z] than to specify it as [& xs] and counting them?
16:47dhm_mpan: you can supply an ([x z] ...) version and invoke the ([x y z] ...) version with the default value of z
16:49mpandoes just fn support that? or is that something that defn does for you?
16:49terommpan: (defn f ([x z] ...) ([x y z] ...))
16:50dhm_yeah what terom said
16:50hornairsso I still can't get ring to flush the first part of the stream, it seems to wait until the stream has been closed to send anything to the client https://gist.github.com/4447544#file-core-clj
16:50terommpan: yeah, fn supports it also
16:50mpanthank you all
16:50hornairsi have a sneaking suspicion it might be because ring wants to calculate the length of the response for the Content-Length header
16:51nDuffibdknox: Matrix types (via clatrix) that are both fast (native BLAS types) and seq-able.
16:53hiredmanhornairs: piped streams have a buffer size, your test almost certainly doesn't fill the buffer
16:53hiredmanalso your paren placement is bad
16:55Seba51Green bar, beer and chocolate is fine. Are there any Clojure conferences where people meet?
16:58TimMcihodes: I'd prefer a stout chocolate, really.
17:02nDuffSeba51: there's the conj and Clojure/west every year.
17:15loganlinnare there any good open-source tools for inspecting/visualizing JVM stats?
17:16nDuffHrm. Free-of-cost, maybe, but nothing open-source that I know of.
17:16loganlinnfree will do
17:16nDuffFree for production use, or is free for development use good enough?
17:17nDuffIf the latter, I've been pretty happy with the tools that ship with JRockit
17:17loganlinndevelopment use for now
17:17loganlinnok, cool. ill check it out — thanks!
17:18nDuff...it at least used to be that JRockit's advanced tooling was free-to-use with the restriction that it would require JVM shutdown after 30 minutes to prevent production use without buying a license.
17:18yogthosloganlinn: have you tried jvisualvm?
17:18nDuff(production use of the advanced tooling, that is, not the base VM)
17:19mich2VisualVM?
17:19yogthosmich2: yeah, I've used it for profiling before
17:20yogthosmich2: it can check threads, memory usage, etc. can also connect to remote vms which is nice
17:20mich2Ah my mistake
17:33hiredmanob
17:35zoldarHello. Is there a way in Clojurescript to mock a function (from a different, required namespace) in a away similar to with-redefs-fn?
17:38loganlinnmich2: VisualVM is exactly what I wanted. Thanks
17:39jjl__what's best practice on config files for web apps? obviously i need to have something outside of the jar file. but shouldn't i have some sort of hook that installs a default one if there isn't one? and where should i place it?
17:40XPheriorjjl__, Are you using Immutant, Noir, or something like that?
17:41jjl__no, i'm using compojure
17:41hiredmanhttps://github.com/sonian/carica
17:41hiredmanmerges maps of configurations found on the classpath
17:42jjl__sorry, i'm quite new to jvm things. i thought the classpath was purely for code?
17:43XPheriorClasspath can be for any files.
17:45jjl__sorry if i sound a bit thick, but how do i reference non-code files that are on the classpath?
17:46weavejesterjjl__: clojure.java.io/resource
17:46XPheriorjjl__, I don't have a lot of experience with this either. But seems like either through Carica (above) or Java resources.
17:46XPheriorYeah, that one. ^
17:47weavejesterBe aware that resources do *not* have a beginning /
17:47weavejesterSo if you have a file resources/public/css/foo.css
17:47weavejesterYou'd get the URL of it with (io/resource "public/css/foo.css")
17:48weavejesterWhich you could then read with clojure.core/slurp or any one of the clojure.java.io functions
17:48jjl__okay, so that could be in my jar file or if i had an entry in the classpath that was just a directory, relative to there too?
17:49jjl__and carioca would merge them so i could provide defaults?
17:49weavejesterRight
17:49jjl__sweet
17:49jjl__is this a typical way of doing config in jvm languages?
17:49weavejesterWell……..
17:49jjl__(i come from a dynamic language background, so much of this is new to me)
17:50weavejesterSome Java libraries, particularly older ones, tend to favor XML
17:50weavejesterWhich you obviously want to avoid ;)
17:50jjl__like the plauge
17:50jjl__plague(
17:50arrdemhahaha
17:51jjl__i've yet to find a satisfactory xml library in any language. i suspect it's not possible
17:51weavejesterThe Heroku guys put forward a suggestion at 12factor.net that server-side apps should be configured via environment variables
17:51XPheriorIt's not the library that's the problem, jjl__.
17:51weavejesterWhich is the approach I currently favour
17:51jjl__weavejester: haha. and when you have a complex app that has nested sections, that's going to go down well
17:52nDuffjjl__: I'm pretty happy with lxml.etree (Python).
17:52weavejesterjjl__: True, but it does force you to simplify your config
17:52jjl__nDuff: thanks for the pointer. if i have to do xml stuff in python again, i'll take a look. i think i used one of the core things last time
17:52nDuff...not that human-generated configuration is anywhere remotely close to XML's sweet spot...
17:53weavejesterAnother option is to look for a config file. I guess really it depends on what your app does.
17:53nDuffjjl__: FYI, the Python standard library now contains ElementTree, which lxml.etree is an extension of.
17:53weavejesterTerminal apps usually have config files in their home directory
17:53jjl__nDuff: elementtree rings a bell
17:53nDuffjjl__: ...but yes, the several other options in core besides that one all suck.
17:53weavejesterServer side apps often have an argument or environment variable you can set to point to a config file
17:53jjl__nDuff: i think elementtree is what i ended up using last time
17:53nDuffjjl__: ...and ElementTree isn't that great either (doesn't support real XPath, for instance)
17:54jjl__nDuff: my needs were simple. xpath has a habit of complicating things unless the xml is silly complex
17:54nDuffEh? XPath is simple. XQuery is where things get interesting. :)
17:55jjl__xpath is sufficiently complicated. most of the time i'd be happier writing css-style selectors, which some libraries handily provide
17:55weavejesterIn Clojure zippers are a more generic alternative to XPath
17:55nDuffjjl__: ...yes, lxml.etree does provide css-style selectors.
17:55jjl__i don't do much python anymore, but i'll note it down. thanks for the tip
17:56jjl__i have a more obscure question too...
17:56nDuffweavejester: I'm not sure how I feel about zippers. XQuery and XPath are amenable to high-performance processing with pre-indexed documents. Zippers feel like they preclude that.
17:56weavejesternDuff: I guess it depends on how big your XML document is.
17:57weavejesternDuff: If it's large enough that you need a lot of indexing, then maybe you need to load it into a proper DB
17:57nDuffweavejester: well, yes. I'm talking about this in the context of an XML-aware database. :)
17:57jjl__i'm building a webapp i want to be extensible with plugins. i'm assuming most users of it won't be clueful enough with clojure and will want something more java-esque, but i want to preserve all the handy thread local stuff clojure does for me and manage access to shared data with STM. as a result i'm going to write a compiler for some other language that compiles down into clojure, and then turn that into class files. is there some nice api for driving the cloj
17:57nDuffs/database/datastore/
17:58nDuffweavejester: ...or, to clarify: I'd rather be writing my queries in a way that can port over to a high-performance datastore.
17:58nDuffweavejester: ...given that I do actually have and use one. :)
17:59weavejesterjjl__: Why not just create a Java interface that talks to Clojure underneath?
17:59weavejesternDuff: I wonder how easily one could turn Datomic into an an XML indexer
18:00jjl__weavejester: hrm. i'm wondering what i'd need to provide through that and if it may turn out to be a lot of work. i presume that would allow people to use scala etc. as well though?
18:00nDuffweavejester: *nod*; it's an interesting thought.
18:01jjl__weavejester: i'm guessing i'd have to make wrappers over everything i wanted them to have access to?
18:01weavejesterjjl__: Sure. I mean, it depends on what you want to do, but every (most?) JVM languages can create an object that implements an interface.
18:02nDuff...even Jython can do that, and its integration with the JVM's object system is otherwise awful.
18:02weavejesterjjl__: Yes… but are there that many things you need to do that for?
18:03jjl__weavejester: it's going to be a big app. but i suppose it's worth the effort
18:03weavejesterjjl__: Another option is have the plugins interact through a web service.
18:03jjl__that sounds terribly inefficient. not at all something i'd do in a dynamic language
18:04jjl__i suppose i have the luxury in that case of mandating people use that language though, hrm...
18:05weavejesterjjl__: If you look at apps for systems like Facebook, that's how they operate.
18:05jjl__part of the thing is that i'm designing it so that the core of the application is utterly minimal and most of the code that ships with the app is distributed in plugins as well
18:05kovasis there a good clojure lib for manipulating sql schemas? looking at lobos, wondering if theres others
18:05jjl__facebook doesn't exactly have a choice :)
18:06jjl__kovas: lobos + korma was the best i found. but it seems to lack a lot of things :/
18:06kovasjjl__: anything in particular that sucks?
18:06jjl__well, i wanted to use postgis columns and i couldn't figure out how
18:07kovasjjl__: ok. I'm gonna be working with mysql so maybe ill be ok
18:07jjl__mysql is much less complicated in general
18:07nDuff*shudder*
18:08XPheriorHaha
18:08XPheriorWar story, nDuff!
18:09jjl__i can go several steps further than that, but this isn't really a channel for hating on poor technology is it?
18:09kovassometimes we gotta do data analysis on the databases we have, not the ones we want..
18:09nDuffXPherior: Which one do you want? My MySQL war stories go back to the one in the mid-90s about a car dealership running their finances with no relational integrity...
18:10jjl__but mysql is nothing compared to what people try and make it do that it can't ;)
18:10XPheriornDuff: Any of them result in limb loss?
18:10nDuffXPherior: None that good, no.
18:11snowylikebut i want to hear about that car dealership
18:11jjl__nDuff: that's boring compared to the 3 table database i used to work with. an EAV store with values in blob columns. that could be foreign keys. and 3 joins sent it into exponential time
18:11XPheriornDuff: You're not a *real* software engineer until you've lost a digit or two on the job.
18:11snowylikeXPherior: does RSI count as limb loss?
18:12XPheriorOnly if it turned blue, snowylike
18:12yogthosmy question is why use mysql when postgres exists
18:12yogthos:)
18:12jjl__yogthos: and a good one to ask the boss when they insist on mysql
18:12ibdknoxI've seen some "amazing" things done with mysql databases lol
18:12yogthosjjl__: ha!
18:13jjl__next week i shall mostly be fixing mysql performance problems ;)
18:14ibdknoxonce upon a time ago, I was asked to fix the slowness of a company's PHP website. Turns out they were executing over 2400 queries per page load.. these queries joined on *regular expressions*
18:14technomancykovas: I would avoid lobos; they appear to be working under the misconception that it's possible to abstract over the differences between DBs
18:14yogthosoh my
18:14kovastechnomancy: yeah, so it seems :/
18:14technomancyclojurebot: clojars migrations?
18:14clojurebotnext-gen clojars is a proposal for a revamped Clojars repository with higher standards: http://groups.google.com/group/clojars-maintainers/browse_thread/thread/77c1cd77e478bb0f
18:14XPheriortechnomancy: It's gotta get solved someday.
18:14arrdemtechnomancy: idk... I managed to abstract away my transiton from ibdknox's SimpleDB to Mongo...
18:15kovasall i want is to get the mysql schema as a reasonable clojure data structure.
18:15jjl__technomancy: for the most part, it is. DBIx::Class (perl) manages except for really complex stuff
18:15nDuff ibdknox: Been there, done that... though it was Django, not PHP.
18:15technomancyarrdem: it's possible, for trivial programs
18:15technomancyand lucky programs
18:15technomancykovas: I recommend just writing the SQL
18:15technomancyhere's what clojars does: this is
18:15technomancyerr--https://github.com/ato/clojars-web/blob/master/src/clojars/db/migrate.clj
18:15jjl__ibdknox: how about some php that generated 101 queries and unioned them together?
18:15Foxborontechnomancy, any plans fixing lein for windows?
18:16technomancyFoxboron: not really, but I'll take a patch
18:16kovastechnomancy: thnx
18:16Foxborontechnomancy, but batch is so ugly ._.
18:16ibdknoxjjl__: heh I've seen it all ;) My PHP days were darker times.
18:16yogthoshaha I worked on the opposite end of the stick from that, had an overactive oracle dba once :)
18:16jjl__ibdknox: apparently i have some queries that do full table scans to look at next week. that should be fun
18:16yogthoshalf the application lived in stored procs
18:17yogthoswhich he managed with notepad more or less
18:17ibdknoxlol
18:17yogthosno source control nothing
18:17yogthosit was fast, but completely and utterly unmaintainable by anybody but him
18:17technomancyclojurebot: clojars migration is done simply with a bunch of sql defns in a single namespace: https://github.com/ato/clojars-web/blob/master/src/clojars/db/migrate.clj
18:17clojurebotOk.
18:17ibdknoxjob security!
18:17yogthosindeed :)
18:17yogthosmaybe he knew what he was doing after all :P
18:18ibdknoxthe most ridiculous db I worked with was for wines
18:18jjl__you'd be surprised how often "write more stored procs" is a good answer
18:18ibdknoxto my knowledge it was the single largest data collection on wines in existence
18:18jjl__particularly if you have a lot of apps in different technologies
18:18yogthosjjl__: oh stored procs can be very handy
18:19ibdknoxto get the information for a single wine its entirety required a query that was a couple pages long
18:19yogthosjjl__: but there is a line you cross somewhere when they start outgrowing the actual application :)
18:19ibdknoxin its*
18:19jjl__if you've got complex validation logic, for example, across several apps, sometimes it's good to get the database to do it
18:20yogthosibdknox: people do some weird stuff with dbs ;)
18:20jjl__that said, these days i'd probably shove a webservice in front of it instead
18:20yogthosjjl__: that would be my preference as well, db should worry about the actual storage
18:20zoldarsorry for repeating myself, but how to approach function mocking in cljs? I've seen somebody using goog.testing/createMethodMock, however I couldn't sort out how it actually works.
18:21yogthosjjl__: it also makes it pretty tricky to figure out what the actual business logic is when some of it is sprinkled in db and some in the app
18:21mpanis it possible to evaluate arbitrary clojurescript determined at runtime? does the compiler being in clojure prevent that?
18:21jjl__yogthos: you also have to love when the only place the stored procs are is the database and you can't see the code
18:22mpanas in, I would like the user to specify some code at runtime, and then eval that
18:22callenibdknox: why was it so complicated?
18:22ibdknoxcallen: outsourced to a team of idiots
18:23jjl__mpan: i don't know if it's the 'right' answer as i don't use clojurescript, but you could ship the compiler source?
18:23ibdknoxtheir naming strategy was comical
18:23ibdknoxthere were 3 wine tables
18:23ibdknoxWine
18:23mpanbasically, my use-case is that I want people to be able to just run this in their browser without setup
18:23ibdknox_wine and __Wine
18:23mpanpreferably without resorting to a server-side compiling service
18:24callenibdknox: Right. right. Figures.
18:24yogthosibdknox: this is shaping up great already :P
18:24jjl__ibdknox: a crappy attempt at sharding?
18:24mpan(because honestly I'm not even sure how that would fit in)
18:24yogthosibdknox: does the number of underscores signify some perverted naming convention?
18:24jjl__mpan: compile clojurescript with clojurescript?
18:25ibdknoxyogthos: that would be giving them too much credit. I'm pretty sure this was their attempt at doing something like wine2 and wine3
18:25yogthosibdknox: brilliant!
18:25ibdknoxall the tables contained wildly different information and used different kinds of keys
18:25mpanwait, you can compile cljs in cljs now?
18:25ibdknoxmpan: not reliably
18:26ibdknoxmpan: and no, there's no way to do what you want (yet) without a server
18:26ibdknoxkanaka is the closest
18:26ibdknoxmpan: https://github.com/kanaka/clojurescript
18:26mpanthanks
18:27ibdknoxbut that has a good ways to go
18:27mpanso, my specific use-case is to create something resembling netlogo ( http://ccl.northwestern.edu/netlogo/ ) but on top of a general-purpose language
18:27ibdknoxyogthos: but yeah, just joining those 3 tables together required the use of 4 other tables.
18:28mpanmajor part of that is to eval user-supplied code to determine what the turtles do
18:28ibdknoxmpan: just use the compiler as a service
18:28yogthosibdknox: that's something alright, I imagine that ran at blazing speeds :)
18:28zilti"Today I learned that a function called init without any arguments gets executed each time the ns gets required or used."
18:29mpanis that doable even if I need the user-supplied code to be able to reference code from the library and code supplied earlier?
18:29ibdknoxmpan: yeah, that's fine
18:29mpanis himera the example I should be looking at?
18:29ibdknoxmpan: as long as the compiled JS is already on the client it won't matter
18:30ibdknoxmpan: you can only do simple optimization for that though
18:30ibdknoxmpan: himera is a good start, yeah
18:30mpanthat's great
18:30mpanthanks!
18:31ibdknoxyogthos: if I remember correctly a full query joined on 25 tables. So yeah - blazing ;)
18:31yogthosibdknox: rofl
18:31ibdknoxthis is when I learned to hate SQL
18:32kovasi think i started hating SQL when i learned of the join table concept
18:32ibdknoxthousands upon thousands of lines were devoted just to handwritten SQL queries (ORM's didn't really exist then)
18:32ibdknoxeven if they had, I don't think they could've handled what we were doing lol
18:33yogthosyeah that's one thing that happens with orms often, you start out with small data sets and it's all peachy
18:33yogthosthen you get close to production time and start testing with some real data and find out the the orm generated queries are... not optimal
18:33ibdknoxI've written 3 :) and then whatever Korma is
18:33yogthosmy primary experience is with hibernate
18:34yogthosthe things I've seen done with hibernate *shudder*
18:34ibdknoxhaha
18:34ibdknoxKorma was intentionally not an ORM
18:34ibdknoxrather an efficient means to generate SQL
18:34yogthosyup
18:34ibdknoxthe ORM abstraction *always* broke down
18:34nDuffEh.
18:35yogthoswell there's a fundamental mismatch between object trees and relational tables
18:35nDuff...mind you, that's the _only_ ORM I've ever been happy with
18:35jjl__ibdknox: oh korma is yours?
18:35nDuff...and it has a very extensive "SQL builder" layer that has nothing to do with object mapping...
18:35nDuff...and it's a huge, insane amount of code and trouble...
18:35nDuffbut it's an existence proof that such things can be done well, even so.
18:36nDuff(err, trouble for its maintainer, who does a very good job)
18:36ibdknoxjjl__: originally, Alex Baranosky is driving it now
18:36jjl__nDuff: there's an awesome new perl library that does this properly. any day now
18:36nDuffjjl__: You expect _anything_ to be well-designed in Perl?!
18:37jjl__nDuff: quite a lot of things are actually. just nothing older than the last 5 years.
18:37jjl__nDuff: perl has the best ORM of any language i've worked with
18:38jjl__nDuff: and it now has a library for implementing a CLOS-like object system
18:41ibdknoxit's a different language these days
18:41jjl__it's a really nice language these days
18:43jjl__if it weren't for silly enormous scaling problems on the project i'm working on, i wouldn't have bothered learning clojure and just done it all in perl
18:43technomancygood perl people do have a way of just quietly getting stuff done
18:45jjl__cpan is fantastic too. there are only two areas where the libraries are better in other languages IMO (rabbitmq and soap client). both of which are better in python (libamqp, suds)
18:45technomancyheh; suds
18:45snowylikeperl has changed much since they started work on perl 6
18:45jjl__perl 6 has been great for getting new shiny into perl 5
18:45nDuffIs suds actually decent these days?
18:46jjl__but i do hope they never finish it
18:46snowylikewhy?
18:46clojurebotsnowylike: because you can't handle the truth!
18:46snowylikenow that was not the response i expected
18:46jjl__perl6 made the same mistakes perl5 did, only a thousand times worse
18:46snowylikefor example?
18:47nDuffIsn't perl6 the one that finally has a formally defined syntax?
18:47jjl__minor things can make big differences
18:47jjl__groovy has done this to some extent as well
18:47nDuffI mean, that's a hard prerequisite before I consider a language worth even thinking about potentially learning.
18:47nDuff(and became one after prior experience with Perl).
18:47jjl__in practice it's not a big problem, actually
18:47jjl__it was a major problem when me and a friend tried to port perl to the jvm
18:48snowylikeoh, well
18:48jjl__but other than that, it's of no consequence
18:48snowylikeperl and the jvm aren't on friendly terms
18:48jjl__nDuff: much better these days
18:49jjl__nDuff: they've really sorted out the compile process. in fact installing a new perl these days is so easy it's been automated by perlbrew
18:52nDuffjjl__: As of which releases? I'm seeing reports as recent as 5.14.2 that miniperl is still used to run tests that are intended to apply to the target on the host.
18:53jjl__nDuff: hrm, that's possible. i'm not a core hacker. i know around 5.15 they made some changes to reduce the amount that miniperl did
18:53jjl__nDuff: irc.perl.org#p5p would be the place to ask
18:53aphyrSo... Incanter's (scatter-plot) is a *macro* which takes variable argument options, like (scatter-plot ... :x-label "hi" :y-label "sup")
18:54SegFaultAXDoes riemann use an in-memory database for its index?
18:54SegFaultAXOr does it use eg redis as the storage mechanism?
18:54aphyrSo if I want to call scatter-plot and change those options, am I forced to use a macro as well?
18:54aphyrobviously you can't apply a macro :(
18:54aphyrSegFaultAX: the index protocol is pluggable, default implementation is Cliff Click's nonblockinghashmap
18:56hiredmanaphyr: have you looked at using jfreecharts directly? incanter's charting is a fairly limiting wrapper around it
18:56gtrakhas anyone ever done parallel builds in clojure?
18:56aphyrYeah I probably should, just... so much boilerplate
18:57aphyrSegFaultAX: if you wanted to use redis it is possible, though you might have an interesting time compiling queries for it.
18:57aphyrMaintaining inverted index consistency can be tricky
18:58hiredmanaphyr: https://gist.github.com/3949532 is an example of creating a live (updating) time series chart, which isn't too bad
18:59aphyrThanks for the sample, hiredman. Pretty close to dropping incanter and just doing that.
19:00hiredmanI had trouble getting incanter to create a time series chart and just ended up having unix timestamps as numbers on the axis instead of dates
19:00SegFaultAXaphyr: Is Riemann applicable to generic real-time analytics? statsd/gaug.es/etc.
19:00aphyrSegFaultAX: short answer, yes. If you want to talk over in #riemann I can explain at a little more length.
19:03jjl__any reason why i should stick with lein 1.x instead of upgrading to 2?
19:04hyPiRionjjl__: There's no reason to no move to lein2 now
19:04technomancyjjl__: none whatsoever
19:04hyPiRionnot moce*
19:11tufflaxjjl__: I like to have both, save lein 1.7 as `lein1` because some projects out there use it
19:12jjl__technomancy: is there a reason i shouldn't bump lein to 2.x in homebrew?
19:12technomancyjjl__: I don't know much about homebrew. there is still one breaking change in the plan before the final 2.0.0 release
19:12jjl__aha
19:12jjl__it has a devel version available. (2.0.0-preview10)
19:12technomancyhttps://github.com/technomancy/leiningen/issues/241
19:13hyPiRiontechnomancy: Actually, there's two
19:13technomancyhyPiRion: remind me of the other?
19:13hyPiRionhttps://github.com/technomancy/leiningen/issues/885
19:14hyPiRionYou cannot upload the jar without fixing that one
19:14technomancyah, true
19:14hyPiRionWhich means bash script updates etc.
19:14technomancythough it shouldn't be relevant to downstream packagers
19:15hyPiRionTrue
19:15jjl__i'll leave it for now
19:16technomancyI hope to get preview11 out soon, but I'm stuck debugging a segfault in the horrible sqlite jdbc drivers that clojars is using
19:19TimMctechnomancy: xerial?
19:19technomancyTimMc: ayup
19:20technomancyhttps://github.com/ato/clojars-web/issues/115
20:01AimHereHmm, how do I tell if an object out of Javaland is a member of a subclass of some particular set X?
20:01AimHere*particular class X
20:01tomoj&(let [bar 3] `(foo ~`(bar ~bar)))
20:01lazybot⇒ (clojure.core/foo (clojure.core/bar 3))
20:02tomojI always thought bindings only went 1 level deep in nested `/~
20:02tomojmaybe I'm confused
20:02TimMcAimHere: instance?, I think
20:03TimMctomoj: I don't htink bindings have anything to do with it.
20:03TimMcEach symbol is either quoted or evaluated.
20:04tomojwhen building macros in the past I've avoided nesting `/~ in some cases where it seemed convenient, thinking that if I nested too far I'd lose access to the local bindings above
20:04AimHereinstance? looks like it does the trick. Thanks, TimMc
20:04tomojcrazy, must have just assumed that to be the case due to unrelated errors on some broken macro I was writing
20:05technomancytomoj: the only thing you lose is gensym consistency
20:05TimMctomoj: You can run into issues with gensyms.
20:05technomancyjinx
20:05tomojoh, hopefully that's what I was thinking of..
20:24bbloomibdknox: when you did some of your game stuff, how did you find perf with small vectors?
20:26bbloomi'm considering doing an implementation of gvec for small vectors: ie 2, 3, or 4 elements. it would be nice to generate generate types for vectors, simple shapes, colors, etc, and have them all implement IPersistentVector and friends
20:26tomojI've wondered why there isn't an analogue to PersistentArrayMap for vectors
20:26hiredmanhttps://github.com/hiredman/tuples
20:27bbloomtomoj: isn't there tho? VectorChunk or something?
20:27bbloomhiredman: ah cool, let me peek at it
20:27hiredmanthere is an open design question in tuples about caching the hash code
20:27hiredmanit is a big digusting macro
20:27bbloomhiredman: yeah, it would have to be lol
20:28bbloomtuples is definitely the word my brain was searching for tho
20:28hiredmanit would be interesting to do a vector impl that was all classes and fields instead of arrays in fields
20:28tomojbbloom: well, I dunno, it's not an analogue exactly the way I was thinking, since (vector 1) is a PersistentVector, not a PersistentArrayVector or whatever
20:29bbloomtomoj: i think the reason is that it wouldn't yield significant performance improvement
20:29bbloombasically PersistentVector's Node inner class could also be a persistent vector
20:29tomojyeah, I figured if I understood how PersistentVector worked, I'd see why
20:29bbloombut it would save you only 3 or 4 words of overhead
20:30bbloomprobably not worth doing while PersistentVector is still defined in java
20:30hiredmanyou have 2 design axes, element access speed, and size of structure in memory
20:30bbloomhiredman: what are you using your tuples library for?
20:30hiredmannothing
20:30bbloomheh
20:31bbloomhiredman: so i want a little more flexibility than get12 etc
20:31hiredmanbbloom: flexibility in what way?
20:32hiredmanthe gets all provide the fastest possible access, while nth is fast for tuples, it is not as fast as the gets
20:32bbloomhmmm i guess extend-protocol would do what i want
20:32bbloombasically, i want to be able to do something like:
20:32bbloom(defvector RectangleF [left right top bottom])
20:32hiredman:(
20:32hiredmanjust use a deftype
20:33hiredmanor defrecord
20:33bbloombut then i'd also need to (extend-protocol Rectangle RectangleF ...)
20:33bbloomyeah, but i want fast field access
20:33hiredmanuh
20:33bbloomgenerically, if possible :-)
20:33hiredmanboth defrecord and deftype give you that
20:33bbloomwell and a persistent vector implementation lol
20:33hiredmannamed tuple types are gross
20:34bbloomthey are gross for most use cases, but a 3d graphics library needs fast Vector2f, Rectangle, Circle, etc
20:34hiredmanbbloom: deftype and defrecord will do that
20:35bbloomit would also be nice if i could somehow make it so that (= Vector3f (conj (Vector2f. 5 10) 15))
20:35bbloomie define a range of small vectors
20:35hiredmantuples does that, but not super well
20:36hiredmanactually, it might do it ok, the call to tuples make get inlined in to a direct constructor call by the clojure compiler
20:38bbloomok, thanks for showing me this
20:38tomojwonder if there is some reason not to make vars named https://www.refheap.com/paste/a5545e10e63a1fa688fd9276a
20:38bbloomhiredman: do you mind if i chop it up and adapt it for my needs and publish my changes?
20:39hiredmanbbloom: sure, enjoy
20:39bbloomhiredman: thanks
20:39hiredmantomoj: not all vars have names
20:39hiredmanit is possible to have "anonymous" vars
20:39tomojnot all symbols have namespaces
20:40tomojI noticed that --unnamed-- case, but how do you create them?
20:40technomancywhat always weirded me out was that namespaces aren't named
20:40tomojit's weird maybe that Named includes getNamespace
20:40hiredmanyou have to interop on the Var class
20:41hiredmanthe compiler uses lots of anonymous vars, it is very gross
20:41tomoj..or for a Namespace, would (= (name ns) (namespace ns))?
20:41karpovhi all. (newbie question warning!) - would anyone be willing to take a quick look at a 4-line long gist, and tell me why does it throw? https://gist.github.com/4449117
20:41hiredmanthe namespace for a namespace is obviously the classloader that loaded it, not a symbol, so it cannot use the Named interface anyway
20:41bbloomkarpov: laziness
20:41bbloomkarpov: try mapv
20:41hyPiRionkarpov: You're opening a file, making a lazy list, then close the file
20:42hyPiRionBy making the list lazy, you're trying to read from a closed stream.
20:42karpovoooh. so it's closed by the time I attempt to actually read from it during realization?
20:42hyPiRionyup
20:42tomojhiredman: :)
20:42karpovlol... well that's good to know, thank you all
20:43hiredmanyou should, of course, be using reducers for io instead of lazy seqs https://gist.github.com/4075459
20:44hiredmanI guess that is not technically a reducer? it is jsut using coll-reduce
20:44karpovfunny, I was *just* thinking that maybe reducing would be a better option... but my toolkit is just starting to grow. thanks, will check it out
20:45tomoj'reducer' to me means 'something that implements CollReduce'
20:45hiredmankarpov: I am sort of joking, no one actually does that, but I think it is sort of a chicken and egg problem, no one has written a library for it because no one does it, because no one has a library …
20:46karpovok then, checking out mapv )
20:47bbloomkarpov: mapv is just (comp vec map)
20:47bbloomkarpov: vectors are not lazy
20:48bbloomyou can use vec any time you have a sequence and want to force it to be realized completely
20:48technomancyeh
20:48technomancyif you are just interested in forcing a seq it's clearer to use doall
20:48karpovhiredman: I do wonder though - why is it that doing something 'inside' the scope of with-open is running into a closed file? that doesn't sound very intuitive...
20:48technomancyvec does more than just force the seq
20:49hiredmankarpov: map is produces a sequence of lazily computed results (a lazy-seq)
20:49hiredmankarpov: so until you force the sequence the actually mapping has not happened
20:49hiredmanhttp://clojure.org/sequences
20:50karpovoh.. so it's not the 1st lazy sequence (of lines from file), but 2nd one (of map results), that causes a problem?
20:50hiredmanI dunno, I haven't looked at your code, I am just going by the general reaction to it
20:50karpovhm no, based on exception, it's the file ones alright..
20:51mpanI added a resource path to my project.clj and I can see it if I launch a new repl with "lein repl" but new repls launched inside eclipse ccw still can't see this change
20:51karpovlike, double-laziness
20:51mpanhow can I force eclipse ccw or the relevant parts to reload project.clj?
20:52hiredmaninstead of mapping over the values you returned a closure that called .read on the reader
20:52hiredmanit is sort of like the upwards funarg problem
20:52karpovyeah that's what I am thinking now, right
20:54mpaneven restarting eclipse doesn't seem to work, so I'm confused what I'm doing wrong
20:54technomancympan: :resource-paths ["something"]?
20:54mpanif I start a new repl with "lein repl" then it works
20:55mpanyes, I added a new resource-paths declaration to project.clj
20:55mpanbut nothing I've tried so far has gotten the repls I start inside eclipse ccw to pick up on this
20:55tomoj#(if-let [v (resolve %)] (symbol (name (ns-name (.ns v))) (name (.sym v))) %)
20:55tomoj:/
20:56mpanso I test this by evaluating (clojure.java.io/resource "favicon.ico"), which works properly if I start a repl with "lein repl", but fails if I start a repl inside eclipse ccw (even though I just closed and restarted eclipse)
20:57karpovtechnomancy: oh, thanks for the doall tip too (and for leiningen =P)
20:57mpanoh, hm that's confusing
20:57mpanI have no idea why, but refreshing eclipse w/ f5 fixed it
20:58technomancykarpov: np =)
20:58marcellus1Anyone know of any decent guides or advice to help me better understand how/when to use agents?
20:58marcellus1Just read the section in Clojure Programming on them, and I sense that I need them in a problem I'm working on, but yet still don't "get" them enough to get any code written
20:59technomancymarcellus1: agents are a reference type, so you would use them when you need a stable identity whose value changes over time. but also they're asynchronous, so that plays into it too.
21:00aaelonymarcellus1: +1 for me as well. I'm starting to use agents for distibuted writing to files, see http://lethain.com/a-couple-of-clojure-agent-examples/
21:01aaelonyalso: http://stackoverflow.com/questions/8741514/maintaining-multiple-open-files-for-writing-clojure
21:01marcellus1sweet thanks guys
21:04aaelonythere's also a few new functions for agents in 1.5 i think
21:18ppppauli have a (println) in a thread that i want to have printing to my repl, how would i do so?
21:27jballanc*sigh* I feel like I've asked this before, but I think I'm still not clear: defrecord vs deftype?
21:27ppppaulmap
21:27jballancis there more than "deftype can have mutable fields" and "defrecord gets free intefaces"
21:27ppppaulrecords have brought me much pain
21:27jballancinterfaces
21:27jballancppppaul: how so?
21:28ppppaulhard to do transformations on them or something
21:28ppppauli wrote my first clojure program using them, and near the end i removed all of the records completely
21:28xeqihttp://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/
21:28ppppaulit was years ago, though
21:29jballancxeqi: thanks! I knew I had read something like that in the past
21:30ppppaulif anyone can help me figure out how to get my threads writing to the same emacs repl i would be able to die happy :D
21:31xeqippppaul: ##(doc bound-fn) ?
21:31lazybot⇒ "Macro ([& fntail]); Returns a function defined by the given fntail, which will install the same bindings in effect as in the thread at the time bound-fn was called. This may be used to define a helper function which runs on a different thread, but needs the same bindings in place."
21:32ppppaul:D
21:33ppppauli'm doing this:
21:33ppppaul(Thread. (bound-fn (fn []
21:33ppppaul (lc/subscribe ch queue-name message-handler :auto-ack true))))
21:33xeqi&(doto (Thread. (bound-fn [] (println "hi")) .start)
21:33lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
21:33xeqi&(doto (Thread. (bound-fn [] (println "hi"))) .start)
21:33ppppaulooooh
21:34lazybot⇒ hi #<Thread Thread[Thread-44305,5,sandbox]>
21:34ppppaul^_^
21:35xeqigiven it looks like you're doing a pub/sub thing, still might not be sufficient
21:35ppppaulyeah, it isn't working
21:35ppppaul:(
21:35xeqimight need to wrap message-handler
21:35ppppaulin a bound-fn or binding ?
21:36hyPiRionSince when did lazybot accept threads? I thought it didn't
21:36xeqihyPiRion: I think its just direct Thread interaction. Though I did try to get Raynes to block it
21:37hyPiRionhm,
21:38amalloyhyPiRion: clojurebot successfully blocks threads; lazybot doesn't, partly because it's hard and partly because that makes him less useful
21:38hyPiRionI see
21:38ppppaulhttps://gist.github.com/4449412
21:42ppppaulhow would i change message-handler to get it to print to my repl?
21:42xeqippppaul: I'm surprised to see the thread started for the consumer, I would have thought the mq would do the callback in a thread
21:43ppppaulthis is an example right off the site for this lib
21:43ppppauli'm surprised too
21:43xeqiah, the "hello world" example
21:44ppppaulhave a better way to do this? please enlighten me (i haven't done concurrency with clojure cept for future and a tiny bit with refs)
21:45xeqiah, subscribe is a blocking call
21:45ppppaulblocking sexiness
21:46ppppaulmaybe i do a bound-fn with &args and apply args to message-handler
21:46xeqicould try (bound-fn [& args] (apply message-handler args)) ... I'm almost tempted to say the bound-fn is needed in both places
21:46ppppaul^_^
21:48ppppaulthanks xeqi. it works
21:48xeqihurray
21:49ppppauli guess their hello world example is meant to run via lein run
21:49mpanthinking of trying an alternate approach: does someone know if you can ask quil to draw on arbitrary buffers e.g. the innards of some swing component?
21:50devnfastest way to get a clojure blog that runs on heroku by forking an existing project?
21:50mpansince if I can use a java applet then I can work with clojure-jvm and it would be taking on fewer unfamiliar things at once
21:50xeqidevn: https://github.com/yogthos/yuggoth ?
21:51xeqinot that I can vouch for the project, I just know it exists
21:51devnxeqi: appreciated. i guess i may as well just make this quick. i don't want one that uses noir
21:52devnjust a simple skeleton with lib-noir, hiccup, etc.
21:54xeqidevn: http://www.luminusweb.net/docs ?
21:54devnwhere'd you find this?
21:54xeqiwell, that has a few more things.. and not postgres
21:55devnI feel like I fell off the bus. I used to follow disclojure.org and planet clojure pretty closely
21:55devni'm still on the list, just curious how you found that repo
21:55xeqiheh, I think I saw that on r/clojure, which I've just started following a couple weeks ago
21:56devnman, reddit has never been in my daily visits list
21:56xeqihttp://www.reddit.com/r/clojure
21:56devni know of r/clojure -- just have never been able to open it
21:56devni think i was scarred by digg
21:56devnand slashdot before it
21:56xeqiheh, just ignore the rest of the site
21:56devnhacker news is the only thing i can stomach, but even that i go to sparingly nowadays
21:57devnprobably due to me working with and being around nerds all the time -- no reason to spend time filtering when other people do it for me
21:58devnused to the be the case that someone who was into clojure and followed the list, etc. was like a unicorn to me
21:58xeqiI null hosted hn to try and be more productive. when I view it every couple days I realize I haven't really missed anything
21:58devnxeqi: surprising eh?
21:58devnyou missed the pre-order for a kinect-controlled gyrocopter
21:59devnor some shit like that
22:00xeqithink the rails vuln was the only one recently... but really just missed the drama and saw the good explination
22:00devnthere's some cool stuff on there, though. i miss having the time to read literally everything on it over the course of a day. i learned a lot there.
22:00devnThe "Every NFL play for the past 10 years in CSV format" was kind of cool
22:01devnI'm always in the market for some large data sets
22:09bobajettnoob question: Im trying to use a math library (https://github.com/clojure/math.numeric-tower). I've added to my lein dependencies [org.clojure/math.numeric-tower "0.0.2"]
22:09bobajettis there something I have to tell lein to do to fetch that library so I can use it at the repl?
22:10bobajettat the reply I get this: (require '[math.numeric-tower :as math]) |[1 of 1] Compiling Main ( foo.hs, interpreted )
22:10bobajettFileNotFoundException Could not locate math/numeric_tower__init.class
22:11jkkramerbobajett: the namespace is clojure.math.numeric-tower - you're missing the "clojure." prefix
22:13bobajett(:require [clojure.math.numeric-tower :as math]))
22:13bobajettFileNotFoundException Could not locate clojure/math/numeric_tower__init.class
22:14bobajettjkkramer: will the repl automatically fetch/pull in the library or do I have to tell that before I fire up the repl?
22:16jkkramerbobajett: pretty sure lein repl pulls them in for you. are you using lein 2?
22:16hyPiRionbobajett: should fire up automatically for both lein1 and 2
22:16bobajettuser=> user=> Bye for now![07:06P]basic$ lein version
22:16bobajettLeiningen 2.0.0-preview10 on Java 1.6.0_37
22:19jkkramerbobajett: do you see numeric tower when you run `lein deps :tree`?
22:21karpovI just tried adding that dependency, and it seems to work... I did start a fresh repl after adding it though.
22:23karpovyou may want to check it got pulled into your .m2/repository/org/clojure, perhaps?
22:41bobajettjkkramer: karpov: thanks guys! (face-palm with-meta {:embarrased "red"} "I was in the stupid wrong project directory")
22:55Sgeo_Would it be trolling to have a blog post comparing Clojure and Racket show up on Planet Racket?
22:55Sgeo_erm, Planet Clojure
22:55Sgeo_Planet Racket isn't a blog aggregator
22:58jyfl987oop, found it,http://en.wikipedia.org/wiki/Scheme_Requests_for_Implementation
22:59jyfl987http://srfi.schemers.org/srfi-49/srfi-49.html
23:35tomojuser> (into {} (map #fn[% %] (range 5)))
23:35tomoj{0 0, 1 1, 2 2, 3 3, 4 4}
23:36tomoji.e. (into {} (map (fn [x] [x x]) (range 5))) or (into {} (map #(vector % %) (range 5)))
23:46callentomoj: Clojure needs the LOOP macro.
23:48tomojmeh