#clojure logs

2012-04-28

00:11mudphoneIs there something similar to "clojure-version" for required namespaces? For example, finding the version of a project.clj dependency from the running program?
00:12xeqinothing in a running program
00:13mudphonexeqi: ok, thanks
00:13xeqilein2 has `lein deps :tree`, mvn has `mvn dependency:tree`
00:13mudphonei suppose I could use whatever lein is using?
00:13mudphoneor shell out
00:14xeqilein uses pomegranate underneath
00:14mudphone$ lein deps :tree
00:14mudphoneWARNING: passing an argument to deps is deprecated.
00:15xeqibut it works on the dependency graph and coordinate info from project.clj
00:15jonasendoes lein-noir work with lein2?
00:15xeqi`lein version` ?
00:15mudphone1..0
00:15mudphone1.7.0
00:15Raynesjonasen: It is being rewritten as a newnew template, so yes, but not at the moment.
00:16Raynesibdknox: ^ Need to do whatever we're going to do with the noir template btw.
00:16xeqilein deps :tree is new in lein 2
00:16jonasenRaynes: ok. is the template work on github somewhere?
00:17mudphonexeqi: ah, thanks
00:17Rayneshttps://github.com/ibdknox/lein-noir/pull/6
00:23emezeskeAnyone know of a good way to avoid lots of nested when-let forms, when the bindings for each one depend on some previous when-let succeeding? E.g. (when-let [a (f)] (when-let [b (h a)] ...))
00:24emezeskeIt seems like there must be some way to keep that flatter, but I haven't found it yet
00:25xeqi.. maybe-m ?
00:26emezeskexeqi: Thanks... I guess it's time for me to get over my fear of macros :)
00:28emezeskexeqi: Err, I have no fear of macros, I meant monads!
00:28xeqiheh
00:29xeqiI'm also pretty sure you could write a when-let*
00:29xeqias a macro
00:29emezeskexeqi: That was my first instinct; I was wondering if maybe that existed already
00:32eggsbyhmm, finished my homework, could this have been done more elegantly? https://refheap.com/paste/2412
00:32eggsbynot sure I'm familiar enough w/ clojure to even recognize a better solution :(
00:48xeqieggsby: have you seen ##(doc every?)
00:48lazybot⇒ "([pred coll]); Returns true if (pred x) is logical true for every x in coll, else false."
00:49bbloomeggsby: search for "destructuring" on this page: http://clojure.org/special_forms
00:51eggsbythanks xeqi and bbloom
00:55xeqieggsby: this is homework?
00:55eggsbyxeqi: mm, I'm taking an online clojure course
00:57rlandereggsby: where?
00:58eggsbyrlander: http://codelesson.com/courses/view/introduction-to-clojure luckily work paid for it...
01:00rlanderoh, cool. Just read Amit's book, fantastic.
01:02eggsbyya, the course is largely readings from and extensions to the book
01:02emezeskeDamnit, macros are cool
01:03emezeskexeqi: This is what I came up with, w.r.t the problem you commented on earlier: https://refheap.com/paste/2413
01:03xeqimacros or monads?
01:03emezeskeMacros :)
01:04emezeskeThe maybe-m monad was almost what I wanted, except I wanted *any* falsey value to terminate, not just nil
01:04emezeskeI could have probably made a monad for that, if I was more knowledgable about them. Instead, I made a macro
01:06xumingmingvI followed the instructions from https://github.com/technomancy/swank-clojure
01:06xumingmingvwhy there is no clojure-jack-in command
01:09creesedoes anyone know why my classes directory gets clobbered every time I start the swank repl?
01:09creeseIs that suppose to happen?
01:10mmarczykemezeske: an (untested) alternative -- (defmonad possibly-m [m-zero nil m-result identity m-bind #(if % %) m-plus #(first (drop-while not %))])
01:10eggsbyxeqi: bbloom is this better? https://refheap.com/paste/2414
01:11xeqieggsby: not quite what I had in mind w/ every?
01:11xeqihave they introduced map?
01:11emezeskemmarczyk: Neato! Thanks for the example. I need to study it...
01:12xeqisince this is week1 I'm not sure
01:12eggsbyxeqi: yah I'm familiar with map
01:12eggsbyah, I always forget that map can take two sequences...
01:13xeqiyeah, gotta be careful about the empty basecase
01:13xeqibut you're traversal in match? looks alot like what map will do
01:13xeqi*your
01:21xeqiargh, refheap won't let me middle click paste
01:34xeqieggsby: I'm gonna be off, and since its homework I'm leary of dropping a final solution, but if you ask me again in a few days I'll show you how I would write it
01:34bbloomeggsby: nitpick: outdend the body of the match? function two spaces, so that it lines up with the argument list
01:35bbloomeggsby: also, atom? is a core fn, so you may want to call your complement not-seq? or something like that
01:35muhooeggsby: you're taking a class where they're teaching clojure? at which school?
01:35eggsbythanks xeqi
01:37bbloomeggsby: especially since your comment says "if the pattern isn't a sequence"… you could just delete that comment and write (not (seq? x)) :-)
01:38eggsbyheh :)
01:38bbloomin general, as you gain experience, you'll use comments more sparingly. See: http://c2.com/cgi/wiki?CommentCostsAndBenefits
01:48seancorfieldquick emacs Q - i have a file with DOS line endings (boo!), and i want to convert it to unix line endings... googling suggests set-file-buffer-coding-system but that does not seem to actually convert the ^M chars into ^J
01:49bbloomseancorfield: shell out to dos2unix :-)
01:50muhooif it's dos, the ^J's are already there, you just want to get rid of the ^M's, so "replace-string" works too
01:56xeqieggsby: did you say this was homework for a training class?
01:56xeqinot for a school
02:01seancorfieldmuhoo: no, it only seems to have ^M, no ^J
02:01seancorfieldbbloom: that might work
02:02seancorfieldah, on mac there is no dos2unix
02:02bbloomseancorfield: brew install dos2unix
02:03bbloomi use it from vim all the time with :'<,'>!dos2unix
02:05seancorfieldi don't have brew
02:05seancorfieldi converted it with TextMate :)
02:05eggsbyhmm, how can I tell if something is 'deeply' true
02:05bbloom*cringe*
02:06bbloomseancorfield: you really aught to install an osx package manager, preferably brew
02:06eggsby(true (true (true true))) should evaluate to true for instance, but not (true (true [hello world]))
02:06bbloomeggsby: what do you mean by "deeply"?
02:06eggsbyi.e. how can I recursively ensure the value of something.. hm
02:07bbloomeggsby: that doesn't seem like a common notion of truthiness, you'd need to implement that yourself… if you actually do need that
02:07bbloomeggsby: backup a step, why do you need that?
02:07bbloomeggsby: see http://richhickey.github.com/clojure/clojure.walk-api.html for easy recursion of tree structures
02:07lazybotNooooo, that's so out of date! Please see instead http://clojure.github.com/clojure/clojure.walk-api.html and try to stop linking to rich's repo.
02:08bbloomhaha thanks lazybot, i blame google
02:08bbloom,(inc lazybot)
02:08clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: lazybot in this context, compiling:(NO_SOURCE_PATH:0)>
02:08bbloom%(inc lazybot)
02:08bbloom*shrug*
02:08bbloom&(inc lazybot)
02:08lazybotjava.lang.RuntimeException: Unable to resolve symbol: lazybot in this context
02:09bbloom*sigh* (dec bbloom)
02:09ben_m@inc bbloom
02:09ben_maww.
02:09eggsbybbloom: i'm still struggling with a better way to do this problem :)
02:10xeqithis was for training, not school?
02:10eggsbyya
02:11xeqithen https://refheap.com/paste/2418 is how I would do it
02:11xeqinot worried if its not for a grade
02:11seancorfieldbbloom: why? i've never needed a package manager on os x before - in all my years of developing on os x
02:12seancorfield(that's a genuine Q btw, curious about what benefit a package manager brings to os x)
02:15xeqiI used it to handle dependencies, and to have something that could manage uninstall
02:15xeqiwhen I was on osx
02:15xeqiwould hate to build and install rmagick on its own for example
02:15bbloomseancorfield: it's just really convenient when you want to install software…. saaaayyy dos2unix for example
02:15xeqi*imagemagick
02:16bbloomxeqi: looks nice, but i'd have avoided the (map = […] …) because it makes it harder to tell which ones map to which. especially as you add more test cases
02:17xeqibbloom: I didn't want to figure out how to run expectations
02:17bbloomrepeating "(assert (=" down the left column is a little ugly, but it produces nicer error messages and it easier for random access when editing test cases
02:17xeqiso it was a quick port of his tests to something I could hit in a repl easy
02:18xeqibut yeah, if it was real it would go into a test file somewhere
02:18eggsbythank you xeqi I was working towards something like that :)
02:18eggsbysome sort of ugly cond + anon func block though :(
02:19xeqiI'm surprised every? doesn't take a varargs of cols like map
02:20bbloomxeqi: hmm would you expect that to test every? against a vector? or test every element of every collection argument?
02:21bbloomxeqi: seems ambiguous, better to explicitly use (every? pred (concat …)) or (every? pref (map …))
02:22eggsbythank you for that 'every? identity' trick xeqi, I'd been going (every? #(= true) ,,,)
02:23xeqiI would expect the (every? pred (map ...)) variation
02:23xeqiwhere it does the implicit zipWith
02:23xeqilike map does
02:23bbloomxeqi: that would cause a lot of subtle bugs because people would call (every? identity 1 2) expecting (every? identity [1 2])
02:24bbloomxeqi: if you assume the zip-with variant, then you get (every? identity [[1] [2]]) which is always true
02:24bbloomxeqi: better to throw an error :-)
02:25xeqiah, I see
02:25xeqiits the naming thing, like contains?
02:25bbloomnot sure what you mean
02:26xeqiwell, not directly equivalent
02:28muhoowhat's the clojure-ish place to save global application state, like, db connection handles, etc?
02:28muhoostuff i'd need to get to from a bunch of ns'es in the app, and perhaps multiple threads as well (running app, repl connection, etc)
02:40bbloommuhoo: isn't that what Vars are for?
02:40bbloom:-P
02:41_KY_How do I convert a set to a seq?
02:42bbloom_KY_: the same way you convert anything to a seq
02:42bbloomhttp://clojure.org/cheatsheet
02:42_KY_Is there a function for that?
02:43bbloom_KY_: read the cheatsheet, you'll find it. it's worth your time
02:44_KY_It's "seq" I guess
02:45bbloom_KY_: bingo
02:50creeseI broke my repl attempting to upgrade. Anyone know how to install slime/swank in emacs?
02:52madsy_creese: Install swank/slime via leinigen
02:54madsy_And get clojure-mode from marmalade
02:55madsy_Then when you do "Ctrl-M clojure-jack-in", the slime version from leinigen gets used
02:56creesewhen I do clojure-jack-in, I get an error
02:57creese"Could not start swank server"
02:58madsy_What happens if you start swank yourself outside of emacs?
02:59creeselein swank?
02:59creeseit says Listening for at… and Connection opened… port 4005
02:59madsy_yes
03:00madsy_Try doing "lein swank" in a terminal, and then do a slime-connect
03:00creeseprior to this, I was use M-x silme-connect
03:01creeseI have slime-connect anymore, I removed it
03:01creesedont
03:02madsy_Oh, right. You haven't run M-x clojure-jack-in successfully yet
03:02creesenope
03:02madsy_Because that installs slime
03:03madsy_Make sure leinigen is in your PATH
03:03madsy_So emacs can call it
03:03creeseif I can 'which' it is that good enough?
03:04madsy_huh?
03:04creesewhich lein
03:04creesegives, /usr/local/bin/lein
03:05madsy_I guess.
03:05creeseit's in my path
03:05creesewhat else could be wrong?
03:05madsy_I'm not sure. The error description wasn't very useful
03:06creeseIt takes a long time to give me the error
03:06creeseit's like it's timing out
03:06madsy_It might be that the version of swank/slime you have downloaded with leinigen doesn't like your version of emacs
03:07madsy_The system isn'tt extremely robust :P
03:07madsy_-t
03:07madsy_The only other thing I can think of is that you're connecting to a different port than swank listens to.
03:08creesedo I need to specify the port in project.clj?
03:09madsy_No
03:10madsy_Preferably don't add anything in your leinigen project
03:10madsy_You want to install swank/slime for your system, not on a per-project basis
03:10madsy_If you have slime/swank mentioned in your leinigen project, remove that
03:11madsy_http200://dev.clojure.org/display/doc/Getting+Started+with+Emacs
03:14creesewhen I run 'lein plugin install' for swank-clojure 1.4.2, I get an error
03:14creeseUnable to find resource 'swank-clojure:swank-clojure:jar:1.4.2' in repository central (http://repo1.maven.org/maven2)
03:15creesethen it installs some jars
03:16creesedo I need to start swak from the shell if I'm using clojure-jack-in? or is that just with slime-connect?
03:20Madsycreese: When it works you don't have to do anything else than "clojure-jack-in"
03:21MadsyIt will start a swank server and connect to it for you
03:25Madsycreese: I have to go, but I'll be back later. Meanwhile make sure your old slime install is purged from the system. And try an older version of clojure-swank
03:28MadsyEmacs 23.1.1 + swank-clojure-1.4.2 is what I use. I'm lagging a bit behind on the emacs version.
03:42wmealingjustified.
05:22madsyWhy doesn't seq split up the string here? https://gist.github.com/2517259
05:32Vinzentmadsy, what do you mean?
05:35AimHereI think he wants the function to count up the items in the string
05:36AimHereIn which case, maybe he needs to '(apply my-count 0 (seq x))' instead
05:37madsyAimHere: Yeah, I'm following the 4clojure puzzles
05:38AimHereseq is splitting up the string, but the function is just counting up the number of lists
05:38VinzentAh, right - apply. I just didn't understand what he means by split up. Btw, there is no need for handling strings specially
05:38madsyVinzent: Right, so how do I handle strings when they aren't collections?
05:38madsyThey don't return true for the coll? predicate
05:38AimHere,(count "Hello")
05:39clojurebot5
05:39madsyYes, but I can't use count in the 4clojure exercise :)
05:39AimHereIndeed
05:39madsyAnd the source for count uses a built-in function
05:40Vinzent,(reduce (fn [cnt next] (inc cnt)) 0 "foo")
05:40clojurebot3
05:41madsyAh, so apply did work for strings too. Not sure how I missed that
05:42Vinzentmadsy, all functions working on seqs convert argument to seq first, so you never have to handle strings\arrays whatever separately
05:42madsyVinzent: Thanks.
05:42Vinzent,(next "123")
05:42clojurebot(\2 \3)
05:42Vinzent,(next (into-array [1 2 3]))
05:42clojurebot(2 3)
05:42AimHereHe does need to detect stringiness seperately, as far as I can tell
05:43Vinzentwhy?
05:43clojurebotwhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
05:43AimHere,(or (seq? "Test") (sequential? "Test"))
05:43clojurebotfalse
05:43madsyAimHere: No, it just had to work on all the common containers :)
05:43AimHereRight, but is there a predicate that is true for all the common containers?
05:44AimHereI.e. something that returns true if the argument is a collection or a string
05:44madsyOh, you mean the predicate. I don't know
05:44Vinzentyes
05:44Vinzentthere was something, but I can't remember the name
05:45Vinzent,search "123" true
05:45clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: search in this context, compiling:(NO_SOURCE_PATH:0)>
05:45Vinzenthm, or how this thing works...
05:47raek$findfn "123" true
05:47lazybot[clojure.core/== clojure.core/string? clojure.core/distinct? clojure.core/boolean clojure.core/< clojure.core/= clojure.core/> clojure.core/>= clojure.core/<=]
05:47Vinzentraek, yeah, thanks! But that predicate isn't listed here
05:48AimHereI don't see anything obvious in the clojure cheatsheet
05:48raekwell, coll? returns true for all _clojure_ containers
05:49AimHere(or (coll? foo) (string? foo)) seems to be the best bet so far
05:51Vinzenthttp://stackoverflow.com/questions/4019249/clojure-finding-out-if-a-collection-is-seq-able - found it
05:51Vinzentbut it's in contrib
05:51Vinzentin incubator actually
05:57sandaemcHello guys, is it possible if I can know if the SQLite database is lock from sqlite-jdbc 4? Thanks.
06:00sandaemcHmm.. ignore this.
08:58IPmongerHi all! I'm having difficulty with understanding what happened to the scripts that used to be part of clojure-contrib for starting clojure more conveniently. Can someone point me in the right direction? I cloned clojure/clojure.git from github.
09:00raekIPmonger: most people use Leiningen these days. the launch scripts that circulated in the early days tend to be very limiting (e.g. no support for source file directories or external dependencies)
09:01raekIPmonger: https://github.com/technomancy/leiningen/blob/preview/doc/TUTORIAL.md
09:02IPmongerthanks raek!
09:04raekwhen you have Leiningen installed, just use "lein repl" to start a clojure repl. if you need to control the clojure version, load code from source files, or use libraries, then it's time to create a project
09:05IPmongerok - thanks again!
09:06TimMcHmm, how do I get the Class object representing an array type?
09:07TimMcLet's say I have the class Void, how do I get the one representing Void[]? I'd rather not do terrible things like ##(class (into-array Void []))
09:07lazybot⇒ [Ljava.lang.Void;
09:08sattvikTimMc: Aside from that, you could try (Class/forName "[Ljava.lang.Void;").
09:09sattvikI'm not sure there is a more direct way.
09:09TimMcEw, that works too.
09:09TimMcThanks. I think I'll use into-array for now. :-P
09:10fliebelTimMc: What a waste of memory :P
09:13sattvikWell, it could be done as a macro, I think.
10:22menguhi. i was reading the programming clojure book but i failed to understand a part. can anyone walk me through these codes? http://pastebin.com/apueKjbw
10:36TimMcsattvik: No macro necessary. It's to work around a stupid clojure.reflect thing.
10:41TimMc,(:parameter-types (first (filter #(= 'getChars (:name %)) (:members (clojure.reflect/reflect String)))))
10:41clojurebot[char<> int]
10:42TimMc,(:parameter-types (first (filter #(= 'format (:name %)) (:members (clojure.reflect/reflect String)))))
10:42clojurebot[java.lang.String java.lang.Object<>]
10:43hcumberdaleHi ;)
10:43hcumberdaleSunny day wooohooo!
10:43hcumberdaleCan I print my "use" / "include" / "require" structure as a tree in leiningen ?
11:00fliebelhcumberdale: What do you mean by "in leiningen"?
11:14hcumberdalewith leiningen :)
11:14hcumberdalefliebel
11:14hcumberdalewrap-multipart-params
11:14hcumberdale<< does it really parse the request?
11:21hcumberdaleparse-multipart-params << http://clojuredocs.org/ring/ring.middleware.multipart-params/parse-multipart-params
11:21hcumberdaleSeems to use a file?
11:52sandaemcTesting
12:07chousersandaemc: Succeeding
12:16sandaemcThree months learning Clojure and this is what I got: https://github.com/smaak/iphpdoc
12:18hcumberdaleyeah sandaemc, I don't write php anymore
12:19sandaemcThe company I'm working with still uses PHP. I wish I can do Clojure more in work, so I'm starting by creating tools I can think of.
12:20hcumberdaleI'm still writing a blog in clojure
12:20hcumberdaleWant to get the first release till the end of next week
12:21sandaemcWhere is your blog?
12:22hcumberdalehttps://github.com/kremers/cblog
12:23hcumberdaleIt is running on heroku
12:24hcumberdalewith mongodb,... the s3 media section is "work in progress"
12:27sandaemchcumberdale, I'm still figuring out how to shift my mind on building a website with Clojure. Why you did not use noir?
12:28hcumberdalesandaemc, I still think web applications should be as simple as possible
12:28hcumberdalenoir does not introduce a straigt way to do things
12:29hcumberdalebut the "default" noir does not statisfy my needs
12:29hcumberdaleI don't like hiccup that much. From everything I learned mixing up sourcecode and markup does not seem right
12:30hcumberdaleI don't like the way how applications are build by default (local storage / scalability,...)
12:31fliebelhcumberdale: Do you know about enlive?
12:31hcumberdaleStoring no absolute no "has to be shared" information with the application feels good
12:31hcumberdaleI tried to get in touch with enlive
12:31hcumberdaleMy first thougts: "wow, nice concept, seperation of concerns, ..."
12:32hcumberdaleThen I tried to modify pages the way enlive likes it (all that #id selector clone/copy stuff)
12:32alexbaranoskysecond thoughts?
12:32alexbaranoskyhcumberdale, there's always StringTemplate :)
12:32sandaemchcumberdale, about your project, is there a pattern there? like MVC? I'm used to that.
12:32hcumberdaleI feelt uncomfortable about having that strong binding to css (yeah not really css but the bindings there)
12:33hcumberdalesandaemc, kind of that
12:33hcumberdaleStringTemplate, yeah!
12:33hcumberdaleI use mustache for templates
12:33hcumberdaleSince it is supported through different programming languages client and server side
12:34hcumberdaleit is fast, and does not let people put in code into pages
12:34menguhi. i was reading the programming clojure book but i failed to understand a part. can anyone walk me through these codes? http://pastebin.com/apueKjbw i got that indexed is a mirror function returning the map-indexed function
12:34fliebelhcumberdale: So what did you want to do with ns declarations in lein?
12:34mengubut i have not understood the second function
12:34alexbaranoskyisn't the nice thing about Enlive that the html itself doesn't have to specify which spots will have values inserted?
12:34hcumberdaleyes alexbaranosky, that is the nice thing about Enlive
12:35alexbaranoskyMustache or StringTemplate require you to specify the location in the template to insert the data
12:35alexbaranoskyI haven't done a ton of web programming in Clojure :)
12:35hcumberdaleYeah! But that "feels" better.
12:35hcumberdaleAll my experience coming from php with smarty, over jsp's, struts, the ugly jsf to ruby on rails
12:36alexbaranoskyit depends on what your feelings mean
12:36fliebelmengu: You know the syntax used by for, and how the regular filter works?
12:36alexbaranoskydoes feeling better me *is* better? I dunno... :|
12:37alexbaranoskyit seems to me that Mustache creates more coupling
12:37hcumberdaleYeah! you are right alexbaranosky. I have to talk about facts... feelings are only the results of what I've seen and what I discover
12:37sandaemchcumberdale, does your project can be easily run in google app engine?
12:37hcumberdalesandaemc, haven't tried it yet but I think it shouln't be a problem
12:37alexbaranoskybecause botht he template and whoever populates the template have to agree on where to insert the values
12:38hcumberdalealexbaranosky, mustache is simply about (template + data)
12:38hcumberdaleSo what I do is to write a default template that contains a container which does not escape html
12:39hcumberdaleand render the pages (user click flow over the application) into that template
12:39hcumberdaleSo templates stay DRY
12:40alexbaranoskythey still have to have spots with {{ foo }} where the data goes
12:40sandaemcquit
12:41hcumberdaleYes, with enlive instead you have to write a lot of logic which does exactly the same
12:41hcumberdaleonly to not touch the html structure
12:41alexbaranoskyhcumberdale, ok thinking about it the difference seems to be if you want the change to be on the template itself, or in the application logic that populates the HTML (alla Enlive)
12:42hcumberdalewhere you can use a simple <ul>{{structure}}<li>{{item}}</li>{{/strcuture}}</ul> in the document you have to write "code" for positioning things in your template?!
12:42alexbaranoskymakes sense
12:42alexbaranoskyI like Mustache, it is very clean
12:42hcumberdalealexbaranosky, yes! And it is also about a clear cut of logic and design
12:42alexbaranoskyI'v used it for a tiny PHP project
12:43alexbaranoskyhave you used it with Noir?
12:43alexbaranoskyI know Noir is supposed to be pluggable, but haven't tried
12:43mengufliebel: the book showed some basic usage of for
12:43mengubut this i'm not familiar with
12:43hcumberdalealexbaranosky, yes it is but the defaults are so far away from what I use that nearly no noir exists anymore after "plugging"
12:44alexbaranoskymight as well use Compojure
12:44hcumberdaleWhen clojure maps instead of objects are used with monger (which works with maps) to populate mustache templates (which are based on maps)... it feels so straight forward
12:45hcumberdalealexbaranosky, I'm using compojure there
12:46hcumberdaleBut a framework lives from it's defaults. When somebody is asking about "noir" he means in general hiccup templates and the noir defaults.
12:46hcumberdaleI can plug around until only compojure and some things are there,... but I do not see the benefit of it
12:46alexbaranoskyhcumberdale, that's true -- people gravitate to the defaults
12:47hcumberdaleAlso mongodb as default session store is important for me
12:47alexbaranoskyI wonder why he went with Hiccup a default. I agree it is kinda, meh
12:47hcumberdaleto have applications that "really" scale,... not like JSF :D
12:48hcumberdaleHiccup is nice to write a prototype,... but if the markup grows you'll get crazy
12:48hcumberdaleget<>go
12:50hcumberdalealexbaranosky, each "web framework" carries some tradeoffs :)
12:51alexbaranoskyhcumberdale, what is the project you are working on?
12:51hcumberdaleThe question is about what are you going to accept. The clear seperation of data and design is something that is missing in enlive (since you'll find only examples with a kind of mediator page)
12:52hcumberdalealexbaranosky, a blog... likely a wordpress clone but only which features that are really needed. You'll find it at https://github.com/kremers/cblog
12:52hcumberdaleThere is an older instance of it running on heroku
12:53hcumberdaleIf you want to contribute. I'll be very thankful
12:54alexbaranoskyI'll consider it but, I barely have time to do the things I am already involved in, so don't count on me :)
12:54hcumberdalehttp://furious-fog-1667.herokuapp.com/
12:54hcumberdalethat's an older version
12:54hcumberdaleyou can login into the admin console under /admin with admin:12345678
12:55alexbaranoskylots of German and French
12:56hcumberdale:) yah
12:56hcumberdalehttp://www.martinkremers.de/blog/ << the server is going offline in a few month
12:56hcumberdaleso I'll migrate my "private homepage" to heroku & cblog
12:58alexbaranoskynow I'm reading your blog
13:00alexbaranoskyyou forgot to test your blog code ;)
13:00hcumberdaleyeah :) I know
13:00alexbaranoskyHave you seen: Midje? https://github.com/marick/Midje
13:01alexbaranoskyI work on it. My experience is that people seem to either love it or hate it
13:01hcumberdaleThen trying it is a "must" on my todo list
13:02hcumberdalea friend of mine is working on cucumber for clojure
13:02alexbaranoskycucumber-jvm already works with Clojure I thought
13:02mdeboardI really like Midje-cascalog
13:02hcumberdaleStuart Halloway is a Contributor ,... nice
13:02alexbaranoskythe Midje wiki on github is very extensive: https://github.com/marick/Midje/wiki
13:02mdeboardtherefore by the commutative propert I probably enjoy midje
13:02jappinenhttps://github.com/teatrove/teatrove/ is a template language we use at espn/disney. It has a fantastic classfile api. A servlet. And wonderful "profiling" admin pages. It gives a control panel view of your service. I am now working in clojure, but I still love tea... perhaps there is an elegant way to make it clojure friendly... i.e. invokable from clojure (ability to invoke a template)... make a ClojureContext that jum
13:02jappinenp back into clojure code
13:03alexbaranoskyHalloway has contributed maybe a small commit or something a long time ago
13:04hcumberdalealexbaranosky, have you seen the diy things on my blog
13:04alexbaranoskyhcumberdale, no, link?
13:05alexbaranoskyI'm actually reading the article about why Scala stinks
13:05fliebelmengu: Still around? I can explain the fn if you want.
13:06hcumberdalemeaning the whole "Do it yourself" category in the right top of the page
13:07alexbaranoskyneat
13:07alexbaranoskyI see it now
13:09hcumberdaleThere is also welding stuff under "Nice to know"
13:10madsyWhat am I missing here? https://gist.github.com/2520200
13:11fliebelmadsy: indentaion is weird... are you sure it's correct?
13:12fliebelmadsy: Your cond doesn't have an else.
13:13fliebelmadsy: What happens when y is not empty, but the first y is not the last x?
13:15madsyfliebel: Ah, doh. Thanks.
13:15SurlyFrogHello all. I've never worked with Clojure (but do a lot in Common Lisp and Python). An upcoming project is going to involve some web-crawling and indexing. It appears that Apache nutch->tika->solr/lucene might be a really good option for me. Does anyone have experience using those libraries from Clojure?
13:15madsyI forgot about the other case
13:16sadgerHello! Please could someone tell me how might I add a single java file to my classpath in leingigen so I can use it in the repl for a project
13:17hcumberdalelucene <<< argh
13:18SurlyFroghcumberdale: is that "lucene + clojure = argh" or, just argh in general ? :-)
13:19hcumberdaleargh in general. Never had good experience with lucene
13:19hcumberdaleOnly had problems
13:19hcumberdaleI'm out for an ice cream
13:19SurlyFroghmmm….
13:19hcumberdalesee you later
13:19SurlyFrogthanks
13:19alexbaranoskyadios
13:22Frozenlocksadger: you could add it in your project dependencies and manually put it in the lib directory. Hacky, but quick.
13:24sadgerFrozenlock: could you give me an example say I had a file called Sadger.java with package sadger.core what would I add?
13:24Frozenlockoh! Apologies, I thougth your java file was a .jar
13:25FrozenlockI've never played with .java directly
13:25sadgerhmm I heard something about :java-source flag in the project.clj
13:25sadgeras of yet not got it to work
13:26sadgertechnomancy might know?
13:26FrozenlockVery probable.
13:27sadgerthanks anyway I can always resort to packaging it in a jar and adding a dep
13:40pellebHi guys, I've released this currency and money library bux https://github.com/pelle/bux I'm mostly happy with the clojure dsl, which I'm going to be using in some payment related apps I'm working. Anyway I'd appreciate feedback.
13:42Frozenlockpelleb: I hope it supports bitcoin :P
13:43pellebFrozenlock: of course (btc 123.1)
13:43fliebelpelleb: Do you know Frink/j?
13:43fliebelhttps://github.com/martintrojer/frinj
13:44FrozenlockBtw, anybody knows if there'a clojure wrapper for the bitcoin4j library?
13:45fliebelhttp://futureboy.us/frinkdocs/
13:46pellebFrozenlock: I've started one https://github.com/pelle/bitcljoin
13:46pellebWill need to do some more work on it soon.
13:47pellebfliebel: I will look at integrating with frink for doing conversions
13:47Frozenlockpelleb: Nice!
13:47fliebelpelleb: What does bux offer over frinj?
13:48pellebBux isn't really about conversions. It's about doing correct calculations and formatting things. I haven't really looked at frinj though.
13:49pellebI needed a simple way of dealing with currencies.
13:50fliebelpelleb: Ah, ok, so (eur 12) => €12,-
13:50pellebYes
13:50fliebelah, sweet
13:51pellebDifferent currencies have different decimal points and rounding rules that are quite important.
13:52pellebWith bux you could dynamically bind $ to your users default currency per request and bux will format and calculate currencies correctly.
13:52FrozenlockIndeed. I once bidded an item 120 thousands USD on ebay because it thought that commas were for thousands, instead of decimals.
13:53Frozenlock(hopefully this has been fixed since then)
13:54jonasendnolen: How do you run the clojurescript test suite?
13:55fliebelpelleb: What is the weirdest case you found so far? I'd imagine people grow a lot of weird formatting over time.
13:55pellebFrozenlock: I would welcome help on https://github.com/pelle/bitcljoin if you're game.
13:56Frozenlockpelleb: I was planing on looking at it later today :)
13:57FrozenlockI was looking for a payment processing mechanism not so long ago... BTC would have been so much simplier to use.
13:57pellebI'm also starting libraries this weekend for http://opentransact.org
13:59sadgerbrb
14:02sadgerback
14:03dnolencjfrisz: since your CPSer is so code transformation oriented, it should work seemlessly with CLJS.
14:04dnolencjfrisz: is your CPSer general enough to build delimited continuations on?
14:04cjfriszdnolen: That and full call/cc
14:04dnolencjfrisz: excellent, I wrote something called delimc years ago but it's pretty weak comapred to what you're doing.
14:05cjfriszdnolen: call/cc and shift/reset are definitely on the to-do list after about a million other things I want to get done
14:06dnolencjfrisz: call/cc shift/reset is a big one for JS
14:06cjfriszdnolen: I've also thought briefly about the implications of CTCO for CLJS, but too thoroughly
14:06dnolencjfrisz: I'm assuming your code is good enough to do a lot of the optimizations that Dan talks about in his books?
14:06cjfriszdnolen: But now that you mention it, I think it's all a matter of writing a new parser, and the back-end does the rest
14:07dnolencjfrisz: well CLJS is just Clojure. why do yo need a new parser?
14:07cjfriszdnolen: You'll have to remind me about which optimizations :-)
14:07cjfriszdnolen: For some reason I was thinking you'd want to parse JS code, but you're right; it just needs to handle Clojure
14:07dnolencjfrisz: if I recall they did somethings in EoPL Ed 3 where the CPSed code is much cleaner.
14:07dnolencjfrisz: yep
14:08dnolencjfrisz: so you're CPSer works *today* with CLJS
14:08cjfriszdnolen: I believe that's true
14:08cjfriszWith respect to the CPS optimization, I think that refers to the Danvy algorithm it's already using
14:08cjfriszThere's another CPS transform via Andrew Kennedy that I need to read through and see if it's appropriate for this context
14:09cjfriszI also really need to do more work on the thunkifier
14:09cjfriszThere's a paper by Danvy about minimal thunkification
14:09dnolencjfrisz: this is really exciting stuff!
14:10dnolencjfrisz: I don't know if you're up for it but this would be pretty cool to get into Clojure contrib as an official lib.
14:10cjfriszdnolen: My friend Andy who's working with Kent Dybvig on Chez Scheme also told me about some loop analysis that he thinks could work both in CTCO and the Clojure compiler proper
14:10cjfriszdnolen: I wouldn't be opposed to adding it to contrib at all
14:12dnolencjfrisz: you should send in your CA and get on the dev list and propose it.
14:12dnolencjfrisz: I would love to see this to be a goto solution for people needing a CPS tool.
14:13dnolencjfrisz: would be particularly useful in the context of CLJS where async programming is absolutely required.
14:13cjfriszdnolen: Oh, you're right, I do need to send in my CA
14:13cjfriszI had been thinking of it, but didn't know whether I should until Dan was ready for us to share this
14:14cjfriszI'll print it off and send it in ASAP
14:14dnolencjfrisz: sweet!
14:17dnolencjfrisz: "CPS transformation after strictness analysis" is that the Danvy paper?
14:17cjfriszdnolen: Dan pointed me to "A First-Order One-Pass CPS Transformation"
14:17cjfriszIt's linked off of the README at the bottom of the Github page
14:18cjfriszI actually haven't read the one you mentioned
14:20dnolencjfrisz: thanks, saved!
14:20ijtHiya. I'm curious if there is any interest in seeing a port of Clojure to Go.
14:21ijtThat would allow Clojure to have a very fast start time, and access to Go's nice libraries.
14:21dnolenibdknox: btw, any particular reason the analyzer needs to be in it's own lib?
14:21dnolenijt: why not?
14:21ijtdnolen: Would you use it if it existed?
14:21dnolenijt: probably worth waiting for the CLJS compiler to be pluggable tho.
14:22dnolenijt: probably not, for server side stuff CLJ on the JVM is quite good - for quick start up time and C interop - my fingers are cross for Lua backend.
14:22ibdknoxdnolen: I guess not, that would mean all implementations would have to have CLJS as a dependency though, right? doesn't really make sense for JS emiting code to come with it
14:22dnolenijt: but that's me, I'm sure others might use it!
14:23dnolenibdknox: sure, but the jar is 90k
14:23ibdknoxdnolen: I didn't say my argument was practical ;) haha
14:23sadgerah now that people are about perhaps someone might assit me with my problem, I want to use a single java file in a lein project and somehow need to include it in the classpath for import into the REPL using lein
14:24dnolenibdknox: I also imagine once we separate out the backends, people can avoid loading the emitters.
14:24ibdknoxdnolen: I was thinking some utilities would spring up for it as well, but there's no reason those can't live there too I guess
14:24ijtdnolen: Any idea how long it will be before the CLJS compiler will be pluggable? I wouldn't mind helping out with that, but I'm new to Clojure.
14:25dnolenijt: raph_amiard has started but it's a GSoC project, so probably late August.
14:26dnolenijt: actually make it the CLJS pluggable will probably land sooner, we want to keep things simple for raph_amiard.
14:26dnolen"making CLJS pluggable" I mean
14:27ijtdnolen: That's exciting. I'm looking forward to the day when I can write Clojure code and expect to run it on just about anything.
14:28mengufliebel: right now, i am. are you available? )
14:29dnolenijt: yes, "pick your platform"
14:29dnolenibdknox: do you want to shed some light on the :children issue?
14:29dnolenibdknox: what exactly is convenient / not convenient about it?
14:29dnolenibdknox: I haven't been consuming the analyzer results beyond the CLJS compiler so I don't see the issues clearly.
14:29jonasendnolen: ibdknox: I'd like to hear that too..
14:29ibdknoxdnolen: the idea is really nice, you should be able to traverse the tree without having to know how each node stores its children
14:30ibdknoxdnolen: the problem comes from keeping duplicate nodes in sync
14:30ibdknoxdnolen: I was looking at how the python AST stuff handles this
14:31jonasenmy criteria for :children is: Is it possible to walk the ast with (tree-seq :children :children ast) and have every node visited (only once)?
14:32dnolenibdknox: so are you saying currently :children duplicates information?
14:32cshellsadger: Sadger, you can look at one of the responses here http://bit.ly/IfVvel for your answer.
14:32ibdknoxdnolen: yes
14:32jonasenright now it stops when reaching an :fn
14:32ibdknoxjonasen: we should just implement a visitor for the tree
14:32ibdknoxjonasen: or something visitor-like
14:33sadgercshell: I think that uses the old lein.javac library which is now merged with lein
14:33sadgercshell: I have an idea now I can try let me see..
14:33jonasenibdknox: it's easy to do with a multimethod
14:33ibdknoxjonasen: yep :D That's my suggestion
14:33ibdknoxdnolen: basically children is inconsistent and duplicates information
14:34dnolenibdknox: so what's convenient about it?
14:34ibdknoxdnolen: it almost lets you walk the whole tree without knowing anything :)
14:34ibdknoxdnolen: ambrose's does
14:35dnolenibdknox: would it be any less convenient with a children multimethod?
14:35ibdknoxdnolen: not at all
14:35ibdknoxdnolen: that seems the best solution to me
14:36dnolenjonasen: ibdknox: k, if someone puts together a patch removing children and extracting it out into a multimethod, I'll happily assess.
14:36ibdknoxpython's AST stuff is really nice actually
14:36dnolenmy only concern would be performance - but I suspect it won't make much of a difference perf wise.
14:36ibdknoxit's not something we should copy exactly by any means
14:36jonasendnolen: I've already started :D
14:36dnolenjonasen: great!
14:37ibdknoxbut doing things like collecting all the defs out of the tree is unbelievably trivial
14:41faust45hi guy's
14:42ibdknoxdnolen: jonasen: another thing that bothered me about children is that it really clutters things up if you try to just look at the tree while working with it.
14:43dnolenibdknox: yeah I've noticed.
14:43jonasenibdknox: yes, it gets huge! But most of it is the environment
14:44dnolenibdknox: jonasen: funny enough I don't think the compiler ever actually uses :children
14:45ibdknoxdnolen: it was added for convenience I think, the compiler has to know how to traverse each node type
14:45jonasenibdknox: at least in CLJS. Ambrose's analyze doesn't really have a useful :env, so there all you see is :children :D
14:45ibdknoxjonasen: yeah, I've been using his the most, but I would much rather work with the CLJS one
14:45dnolenibdknox: but the compiler doesn't actully traverse w/ :children
14:46ibdknoxdnolen: yeah, that's what I'm saying it was there for convenience for folks like us
14:46ibdknoxdnolen: though it turns out to not be that convenient
14:46dnolenibdknox: oh yeah, yes.
14:47dnolenibdknox: which means no performance hit to change to multimethods :)
14:47ibdknoxdnolen: hah, right. :)
14:47faust45just have a question
14:48faust45how i can do in clojure this:
14:48faust45new HttpResponseInterceptor[] {
14:48faust45 new ResponseDate(),
14:48faust45 new ResponseServer(),
14:48faust45 new ResponseContent(),
14:48faust45 new ResponseConnControl()
14:48faust45 }
14:48faust45i mean this https://friendpaste.com/4OzVMOWaDnAnFhUten2Cbi
14:50faust45how i can initialize java array in clojure?
14:51faust45is it possible?
14:51Bronsa,(object-array 23)
14:51clojurebot#<Object[] [Ljava.lang.Object;@70e83a>
14:52joegallo,(doc int-array)
14:52clojurebot"([size-or-seq] [size init-val-or-seq]); Creates an array of ints"
14:53joegallooh, okay, let's see what that does...
14:53joegallo,(int-array 5)
14:53clojurebot#<int[] [I@1f4f5d0>
14:53joegallohmmm... that doesn't print well, let's try something else.
14:53joegallo,(seq (int-array 5))
14:53clojurebot(0 0 0 0 0)
14:53joegalloah, okay, that prints better then.
14:53joegallo,(seq (int-array 5 3))
14:53clojurebot(3 3 3 3 3)
14:53faust45for instance i need write in clojure this java code https://friendpaste.com/4OzVMOWaDnAnFhUten2C3W
14:53joegalloah, so that's what it must mean by init-val.
14:53faust45how i can do that?
14:53joegallo,(seq (int-array 5 [1 2 3 4 5]))
14:53clojurebot(1 2 3 4 5)
14:54joegalloand i guess that's what i means by seq...
14:54joegallo,(doc into-array)
14:54clojurebot"([aseq] [type aseq]); Returns an array with components set to the values in aseq. The array's component type is type if provided, or the type of the first value in aseq if present, or Object. All values in aseq must be compatible with the component type. Class objects for the primitive types can be obtained using, e.g., Integer/TYPE."
14:55joegallo,(seq (into-array java.util.Date [(java.util.Date.) (java.util.Date.)]))
14:55clojurebot(#inst "2012-04-28T18:46:28.153-00:00" #inst "2012-04-28T18:46:28.153-00:00")
14:55joegallothe seq, of course, is just so it prints nicely here.
14:59dnolencjfrisz: one question, any particular reason you are using refs?
14:59dnolencjfrisz: don't you just need something settable?
14:59sadgerhmm still a bit lost, right, when I call "lein javac" where does it look for files?
15:06stirfoohttp://www.4clojure.com/problem/95 -- Is the 6th test correct?
15:07cjfriszdnolen: There wasn't a particular
15:07cjfriszdnolen: Rich Hickey pointed me to atoms, which I already made that change
15:07cjfriszI think it's in the master branch now
15:07dnolencjfrisz: ah, so the README is out of date.
15:08dnolencjfrisz: I would change. refs are really heavy weight.
15:08cjfriszdnolen: So it seemed
15:08dnolencjfrisz: as a Clojure programmer if I saw you were using those under the hood I'd spit my coffee.
15:08faust45if i need to define array of java objects how i can do that?
15:08cjfriszdnolen: I did some time tests on them last week and was amazed at how slow they were
15:09dnolencjfrisz: they need to be transactional and all.
15:09xeqistirfoo: yes, if the right child is an node representing an empty tree
15:09cjfriszdnolen: Right. I'm glad to have some direction on this stuff now.
15:09cjfriszdnolen: Years of Scheme and some Emacs Lisp only takes me so far.
15:11dnolencjfrisz: yeah I would update the README so folks don't scratch their heads when they come to your repo.
15:14stirfooxeqi: ohhh... thanks
15:15stirfoofaust45: (make-array Object n) ?
15:15faust45stirfoo: thanks
15:25cjfriszdnolen: I managed to get my commits mixed up between computers, but both the code and README reflect that there are no more refs
15:26dnolencjfrisz: you still need to remove dosync
15:26dnolencjfrisz: dosync is only for transactions
15:27cjfriszdnolen: I didn't know that. I will make that change right away
15:31cjfriszdnolen: Whoa...I need to do more testing, but I think that just bumped the speed of the emitted code by quite a lot.
15:34dnolencjfrisz: yep
15:40menguwhat does #{\z \a} mean?
15:40menguwhere i can learn about this syntax?
15:40xeqithe set with z and a characters
15:42xeqihttp://clojure.org/reader
15:50menguxeqi: thanks. another question: is (#{\z \a} \a) looking for if \a in that set?
15:51xeqi&(#{\z \a} \a)
15:51lazybot⇒ \a
15:51RaynesYes.
15:51xeqi&(#{\z \a} \c)
15:51lazybot⇒ nil
15:51xeqiyes
15:51menguinteresting
15:52mengunow everything makes sense. after 6 hours i finally understood this code:
15:52menguhttp://pastebin.com/apueKjbw
15:52menguthe index-filter function especially.
15:53menguso "(for [[idx elt] (indexed coll) :when (pred elt)] idx)))" simply maps idx and elt to the collection returned from indexed function and if the set has the element it returns the index of it
15:54xeqimaps idx and elt to each element in the collection
15:54xeqibinds is probably the better term there
15:55menguokay, that's better
16:00faust45i try use into-array fun https://friendpaste.com/4OzVMOWaDnAnFhUtemtVtJ but fail with error
16:00faust45CompilerException java.lang.IllegalArgumentException: array element type mismatch, compiling:(http.clj:39)
16:00faust45can any one help me
16:00faust45?
16:07xeqifaust45: use (def headers [(ResponseDate.)])
16:08xeqi&'(ResponseDate.)
16:08lazybot⇒ (ResponseDate.)
16:09faust45xeqi: thanks, its works, but why?
16:09xeqi&(class '(ResponseDate.))
16:09lazybot⇒ clojure.lang.PersistentList
16:10xeqibecause '(ResponseDate.) returns a list of a symbol ResponseDate.
16:10xeqiwhere the vector one calls the ResponseDate. constructor
16:11xeqiuseing (list (ResponseDate.)) should also work
16:11faust45xeqi: but '((ResponseDate.)) not working too
16:11faust45&'((ResponseDate.))
16:11lazybot⇒ ((ResponseDate.))
16:12faust45&[(ResponseDate.)]
16:12lazybotjava.lang.IllegalArgumentException: Unable to resolve classname: ResponseDate
16:12xeqi'((ResponseDate.)) returns a list with an element of a list with an element of the symbol 'ResponseDate.
16:13faust45xeqi: oh
16:15faust45xeqi: but how i can add more elements in this case? (list (ResponseDate.))
16:15xeqi&(list 1 2 3 4)
16:15lazybot⇒ (1 2 3 4)
16:16faust45xeqi: thanks
16:26hcumberdaleI'm back
16:27cshellwelcome back
16:29hcumberdalecshell, how are you?
16:30creeseI need some help with calling java from clojure. I'm still getting an exception.
16:30hcumberdaleis there a parallel IO Mapping lib for clojure? Like that thing from widefinder2
16:31creesecan not access a member of class com.name.game.Game with modifiers \"public\",
16:31hcumberdalecreese, https://refheap.com
16:31clj_newbHi, what's the difference between defn and defn- ?
16:31arohnerclj_newb: defn- is private
16:31hcumberdaleyes, clj_newb
16:31clj_newbthank you arohner
16:31hcumberdalesee documentation: same as defn, yielding non-public def
16:32clj_newb&(doc defn-)
16:32lazybot⇒ "Macro ([name & decls]); same as defn, yielding non-public def"
16:32clj_newbsorry about missing that!
16:32hcumberdale,(doc defn-)
16:32clojurebot"([name & decls]); same as defn, yielding non-public def"
16:32clj_newbthank you hcumberdale ç
16:33hcumberdaleclj_newb what are you working on?
16:33clj_newbjust learning clojure
16:33hcumberdalecreese why do you need the java interop?
16:33hcumberdaleAre you using leiningen?
16:34creeseyes
16:34clj_newbas a pet project consuming an http connection and processing what`s come down it with aleph
16:35creeseThis isn't the real code. It's just skeleton that mimics it. The real code is longer.
16:41hcumberdalecreese seems it is a problem with namespaces
16:41Raynesclojure.java.io/do-copy is false!?!?
16:42creeseWhat did you have to change to get it to work?
16:42hcumberdalehttps://groups.google.com/forum/?fromgroups#!topic/clojure/oeL8pFr2wa8
16:43hcumberdaletry (def z (.getDeclaredMethod ... (.setAccessible z true)
16:43RaynesEr, heh. I mean 'private'. Not sure why I said false.
16:43RaynesI think this heat is getting to me.
16:44creeseI have commented out. I can't even get the (ns … :import …) to work
16:44hcumberdalemaybe something is not working with your project structure?
16:44creeseso the with just the first line, it works for you?
16:45hcumberdaleyou have a structure like / [project.clj ,...] [java] and under java: com/name/game ?
16:46creesejava/com/name/game/Game.java
16:46creeseis where the java code is
16:47creeseproject.clj is at the same level as java (the directory)
16:47hcumberdaleand even the include does not work?
16:47creeseright
16:47hcumberdalelein clean && lein compile
16:47hcumberdale?
16:47creeseI'll try that
16:48creesethat did it
16:48creesedo I have to compile before I start the repl?
16:53creeseis the problem that the instance variables are declared 'final'?
17:03hcumberdalemaybe creese
17:03hcumberdaletry to change them not to be final and test again
17:04hcumberdaleWhy does ring wrap-file-info middleware return "text/html" mimetypes for ".js" files?
17:07creesewhen I remove 'final' it won't even compile
17:09creesethis is really hit-and-miss
17:10creeseI got it work this time, but I can't tell you what's different
17:10creesebut (def game (Game. "test" 2)) still cause an error
17:11creesecannot access a member of com.name.game.Game with modifiers "public"
17:20tmcivercreese: can you post your code to refheap.com?
17:20creesehttps://refheap.com/paste/2428
17:22tmcivercreese: and you've run 'lein javac' and gotten Game.class in classes/com/name/game?
17:22creesewhat does leon javac do?
17:23tmcivercreese: compiles your java class
17:24tmcivercreese: also, your core file should be in a directory named game_test
17:24creeseI thought the repl was doing that for me
17:24creeseit is
17:24creeseunderscore?
17:24tmciveryup.
17:24creeseit is
17:25creesehow does lein javac differ from lein jar?
17:26tmciver'lein javac' only compiles java classes; 'lein jar' creates are jar of all your code (and it probably calls javac too)
17:28creesethat doesn't seem to make a difference
17:29hcumberdalebut lein javac does not write out error messages?
17:29tmcivercreese: give me a sec, I'll try to reproduce this
17:38creeseI got it
17:38creesethe java class needs to be declared 'public'
17:38hcumberdalecreese, what was the problem?
17:38hcumberdaleawwwww!!
17:38creeseor I can't get at it from clojure
17:39hcumberdaleif it's not scope is package
17:39hcumberdalejava default scope is package. damn
17:39creesewhat does that mean?
17:39hcumberdalethere are different levels of isolation
17:39creeseyou have to be in the same package to use it?
17:39hcumberdalepublic, package, private, protected
17:39hcumberdaleyes! creese
17:40hcumberdalepackage scope is default in java (public in groovy)
17:40creesewhich can only be another java class
17:40hcumberdaleAnd so you have to be in the same package or declare a class as public
17:40hcumberdalene creese
17:40hcumberdaleI think a clojure class can also be in the same package
17:40tmcivercreese: I just got 'lein jar' to work as well. I also had to change :java-source-paths to :java-source-path in project.clj and put "java" (no vector) for it to work.
17:40hcumberdaleif the clojure namespace corresponds with it
17:41tmciverI recall having to this for another project recently.
17:41hcumberdaleyes creese, I've only found java-source-path in my project.clj
17:41tmciverto do*
17:41hcumberdaledon't know where you found "paths"<< lein2?
17:41creeseyeah, lein 2
17:41hcumberdaleahh!
17:41creesewhich is what I have
17:41creesenot sure it this is a new syntax?
17:41hcumberdaleIs there a nice way to pretty print a incoming HTTP Request?
17:42hcumberdaleI've the output as map, but it is ugly to see it without idention
17:42creesetmciver: do you think I need to change the java source line?
17:42wkmanireHowdy folks.
17:42tmciverhcumberdale: have you tried clojure.pprint/pprint?
17:42hcumberdalenop
17:43tmcivercreese: not if it works for you. It must be a lein2 thing; I'm still using lein1
17:43hcumberdaleyes, I am also using lein1
17:43creeseI'm going to try changing my ns so its the same as the java package
17:43tmcivercreese: but I also made the java class public.
17:43creeseright
17:43hcumberdalecause lein2 ever uses another env var to check if no snapshots are used for my build
17:43hcumberdale;)
17:44creesethanks, folks
17:44hcumberdaleI don't like this func. cause the snapshots are kind of stable for the most frameworks I use and it is simply a dev env.
17:45hcumberdalenice clojure.pprint/pprint returns "nil"
17:47wkmanireHow do I mock a function for the scope of a unit test?
17:48wkmanireI have a function that uses slurp and I just want to assert it is called with the correct file name.
17:49pandeirohow would i coerce a string to a boolean?
17:50pandeiro"true" -> true and "false" -> false i mean
17:51hcumberdaleAhhh pprint does directly IO
17:51hcumberdaleis there a pprint that only returns the pretty structure?
17:51hcumberdaleso I can use it with existing logging framework functionality?
17:52pandeirohcumberdale: (with-out-str (pprint ...)) i think is what you're after
17:52wkmanirepandeiro: (if (= "true" "true") true false) ?
17:53wkmanireYou could do some massaging so that it throws if you try to compare against a string that doesn't contain "true" or "TrUe" or "false" or whatever.
17:53pandeirowkmanire: works but was hoping for a better way
17:53pandeiroactually since this is form data from an http request, i may just pass it to boolean
17:54pandeiroa checked check-box in noir/ring has a value of "true" instead of the boolean
17:54pandeirobut unchecked is nil
17:54tmciverpandeiro: ##(Boolean "true")
17:54lazybotjava.lang.RuntimeException: Expecting var, but Boolean is mapped to class java.lang.Boolean
17:54wkmanireReally?
17:54tmciverpandeiro: ##(Boolean. "true")
17:54lazybot⇒ true
17:54wkmanireI haven't started messing with noir yet.
17:54pandeirotmciver: why not just (boolean "true")
17:54pandeiro?
17:55pandeiro(i don't know the advanced reader syntax)
17:55tmciverpandeiro: oh, that does seem to work
17:55tmciverpandeiro: oops, no it doesn't
17:55tmciver##(boolean "false")
17:55lazybot⇒ true
17:56tmciverpandeiro: looks like (boolean ...) is coercing nil and false to false and everything else to true.
17:56pandeirotmciver: yeah but my case is that there will either be a "true" string or nil, so (boolean ...) is fine
17:57hcumberdaleIs there a way to "pipe" a input stream to an output stream?
17:57tmciverpandeiro: ah, good then.
17:57wkmanirepandeiro: I think that answers the question as to why Noir ring works the way it does with checkboxes then.
17:57hcumberdaleI want to read from the servlet input stream and write directly to amazon s3
17:57pandeirowkmanire: about mocking functions, there's a chapter on it in _Clojure in Action_
17:58pandeirowkmanire: hmm, not sure a boolean wouldn't be more useful
17:59pandeiroif i were using the value in a condition it would be fine, but i am putting it into a database, so i need to do the extra conversion step
18:07hcumberdale??
18:07lazybothcumberdale: Definitely not.
18:07hcumberdaleis anyone into streams & clojure?
18:15wkmanireSo clojure.contrib used to be one big package, but it has been split up into many different modules?
18:15wkmanireIs that correct?
18:15cshellyes
18:15wkmanireI want to use the mock library
18:15wkmanireWhat do I need to add to my project.clj?
18:17cshellnot sure, sorry
18:27jimi_hendrixwhat is the best way to break out of a while?
18:27jimi_hendrixi noticed there is no analog of a break statement
18:29xeqi~contrib
18:29clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
18:30wkmanirexeqi: Thanks.
18:30emezeskejimi_hendrix: You could throw an exception, but it might be worth considering a different approach to your problem than while
18:31xeqifor mock, it looks like no one has taken over maintainership to pull it out
18:31wkmanireReally?
18:31wkmanireIs it uncommon to use mocks for unit testing in clojure?
18:32wkmanireI was looking at the API and it seems to be exactly what I want.
18:32xeqiI know midje will do that
18:32xeqiand its not hard to use either (binding [..] ..) or with-redefs
18:32raekjimi_hendrix: in this case, it's probably better to use manual iteration rather than 'while'
18:33emezeskewkmanire: I highly recommend midje, it makes mocking ridiculously easy
18:33wkmanireemezeske, xeqi: Thanks.
18:34raekthat is, (loop [...] (if <loop-condition> <expression-to-be-returned> (recur ...)))
18:36emezeskeraek: Without knowing what jimi_hendrix is trying to do, who knows what's best?
18:37raek'while' is not one of the primitive looping constructs. it's just a shorthand useful for certain control flows
18:37yoklovjimi_hendrix: while isn't really idiomatic, i'd follow raek's suggestion if you need to break.
18:37raekif you need to break, then your control flow does not fit what while offers
18:38yoklovnot unless clojure gets continuations :p
19:08hcumberdaleawwwwww
19:08hcumberdaleWARNING: No content length specified for stream data. Stream contents will be buffered in memory and could result in out of memory errors.
19:15uvtcHi #clojure. Are there any statistics available on how many and which packages lein installs most often?
19:19wkmanireuvtc: That'd be interesting to know
19:19hcumberdaleAhh uvtc, I was searching for something like this
19:19hcumberdaleI think there are no such statistics
19:20hcumberdaleEven you have not to confirm that statistics are send
19:20hcumberdaletechnomancy may add such a feature in the near future?
19:20uvtcI ask because, I just discovered github.com/Raynes/fs and thought, "Wow! Glad I stumbled upon this!". Having statistics on lein installs might help folks stumble upon useful packages.
19:21hcumberdaleyes uvtc! But it also introduces a "everyone uses xyz, I'll do it also regardless if it is good or not"
19:21hcumberdalecontent-length << the parameter in my ring header differs from that what is actually in :body
19:21uvtcI can't recall the details, but I think I've heard that a new clojars.org is in the works. Perhaps if that's the case, we'll see a "top 100" sort of feature.
19:21hcumberdalehow to calc how big the input stream in :body actually is?
19:22hcumberdalereq - headers = body ?
19:22emezeskeuvtc: There is clojuresphere.herokuapp.com, which gives you *some* info about how many people use things
19:22hcumberdaleuvtc but not everything is just from clojars
19:22emezeskeuvtc: Unfortunately, it hasn't been updated in FOREVER
19:22hcumberdaleit will be nice if the new clojars has such a statistics tracking
19:22uvtchcumberdale, Yes, I agree. Though, I think that can be mitigated if there's a package ratings site, like http://cpanratings.perl.org
19:23weavejesterhcumberdale: Where does your input stream come from?
19:23hcumberdalejetty
19:24hcumberdaleHey weavejester, nice to see you! I'm using your s3 api
19:24weavejesterhcumberdale: No, I mean, what's generating it? Is it a file or resource?
19:24weavejesterhcumberdale: Oh, from S3?
19:25hcumberdaleweavejester, https://github.com/weavejester/clj-aws-s3 << a documentation problem there! (s3/allow :all-users should be (s3/grant :all-users :read) I think
19:25hcumberdaleI want to pipe an upload directly to s3
19:25weavejesterhcumberdale: Ah, you're right, it should be.
19:25hcumberdalewithout storing it in memory
19:25hcumberdaleApr 29, 2012 1:10:31 AM com.amazonaws.services.s3.AmazonS3Client putObject
19:25hcumberdaleWARNING: No content length specified for stream data. Stream contents will be buffered in memory and could result in out of memory errors.
19:26weavejesterhcumberdale: Hm… Well, it depends on how it's uploaded. If it's uploaded as a multipart, sometimes the content-length isn't set.
19:26jimi_hendrixsorry for the late response. i previously asked "how can i break from a while". I am writing an IRC bot, and I need to keep it alive unless i send it a quit command. In an imperative/OO language, i would do something like "while (true) { ... if (message_says_quit) break; }"
19:26uvtcemezeske, Yes, thanks for that link. I don't know what the "used by" data means. Will have to take a closer look.
19:26hcumberdaleSo, exaclty this is what I do not want (memory buffering) espc. for attachments bigger than 2gb
19:26weavejesterhcumberdale: And for some reason, S3 requires a content-length
19:26weavejesterhcumberdale: So under some circumstances, I think you have to buffer. I could be wrong, though.
19:26hcumberdalemhhh, it feels wrong
19:26hcumberdaleI have a header value clength
19:27hcumberdaleINFO cblog.media - clength? 30958 = 29301
19:27hcumberdalebut it does not seem to be the length of the body
19:27hcumberdalesecond is a slurp (:body req)
19:27hcumberdalecontent-length seems to be the overall length
19:28hcumberdalemaybe the headers are exactly that difference
19:28hcumberdale,(- 30958 29301)
19:28clojurebot1657
19:29hcumberdaleI'll check it
19:30hcumberdaleis it possible to provide the length of the stream in your API ?
19:32weavejesterhcumberdale: Well, a stream from a HTTP request can have a content length header
19:32weavejesterhcumberdale: But… if there's gzip encoding, I think the content-length is the zipped size, IIRC
19:32weavejesterhcumberdale: And not all requests need to have a content-length
19:33weavejesterhcumberdale: So there's no foolproof way of telling how large a request is.
19:33jimi_hendrixso, does anyone have advice for that situation?
19:34hcumberdalein which situation is a content-length attribute missing?
19:34weavejesterhcumberdale: Oh, it looks like you can use S3's multipart upload functionality to do it.
19:34weavejesterhcumberdale: Multipart uploads, I believe
19:34emezeskejimi_hendrix: I see. You might want to look into loop/recur, and just don't call recur if message_says_quit.
19:35tmciverjimi_hendrix: how are you reading the incoming messages? I imagine a function that takes a message as input; you can simply check if it is the quit message and, say, return nil if it is...
19:35weavejesterhcumberdale: But currently the aws-clj-s3 library doesn't support multipart uploads
19:35hcumberdalewavejester, I'm using https://github.com/valums/file-uploader
19:35hcumberdaleSo I know that i do not miss the content-length attribute
19:35mmarczykjimi_hendrix: while accepts a condition argument, you can use something like @continue? w/ continue? an atom holding true initially; reset to false when you want out
19:36jimi_hendrixemezeske, good idea
19:36jimi_hendrixtmciver, reading lines from a socket via BufferedReader
19:36jimi_hendrixoh misread your question
19:37jimi_hendrixyeah
19:37jimi_hendrixmmarczyk, what is @continue?
19:38hcumberdaleweavejester, are you going to add support multipart upload in aws-clj-s3?
19:38mmarczykjimi_hendrix: I mean you can (def continue? (atom true)) and then say (while @continue? (do-stuff)); (reset! continue? false) when you want to stop looping
19:39jimi_hendrixi see
19:39mmarczykjimi_hendrix: not saying this is better than an explicit loop/recur, just another option.
19:39jimi_hendrixwhat exactly does that @ do?
19:39mmarczykshorthand for deref, reads value of a reference type
19:39mmarczyksee (doc deref) at the repl
19:40weavejesterhcumberdale: Probably at some point, but patches are welcome :)
19:42hcumberdaleweavejester and if I know the size of the request there is no way to handle it by aws-clj-s3, right?
19:42hcumberdale=> size of the :body
19:42weavejesterhcumberdale: If you know the size you can just pass it in as metadata
19:42weavejesterhcumberdale: The problem is that normal S3 uploads require a content-length, and that streaming uses a different API
19:43weavejesterhcumberdale: But if you know the content-length, everything's fine.
19:43hcumberdale(defn put-object << [cred bucket key value]
19:43hcumberdaleadd things to value?
19:45hcumberdale put-object << where to pass the metadata?
19:45weavejesterhcumberdale: Hm, oh, I thought there was a metadata argument in put-object… but maybe I was wrong.
19:46weavejesterhcumberdale: Again, patches are welcome :)
19:47hcumberdaleI do not know how to add it ;(
19:47hcumberdaleI'm not experienced with the s3 api
19:51weavejesterhcumberdale: I'll likely need to add in support for S3 uploads for my own projects
19:51hcumberdaleyeah!
19:51weavejesterhcumberdale: So I'll work on the problem tomorrow and see if I can't get metadata on put-object at least.
19:52hcumberdalethx! I'll try to get the correct size of "content-length"
19:52hcumberdaleIs there a way to forbid gzip?
19:52hcumberdaleIt is maybe expensive for a browser to gzip 2gb and more?
19:53yoklovis there still no clj->js in clojurescript?
19:53yoklov:/
19:54weavejesterhcumberdale: Not sure… I don't know whether gzip applies to uploads.
19:54weavejesterhcumberdale: I know how it works when receiving a response. I'd have to look up how uploads operate
19:56jimi_hendrixalso, can cond only execute one call per condition?
19:57jimi_hendrixor am i missing something
19:57mmarczykyoklov: there isn't, but probably mostly because it's not completely clear what it should do in the general case (non-string keys? a separate issue: symbol/keyword keys, so technically strings, but not really convenient to use from JS -- should we call cljs.core/name on them? should this only handle maps and vectors and throw on other composite types? or only convert maps and vectors and pass-through other composite types? etc.)
19:57emezeskejimi_hendrix: You probably want (do (x) (y) (z))
19:57jimi_hendrixah yes
19:57mmarczykyoklov: worth discussing on the dev list probably
19:58jimi_hendrixi didnt see a do in the clojure core
19:58yoklovmmarczyk: symbols/keywords being strings is an implementation detail
19:58yoklovbut you're right, there are definitely issues wrt what is the "right" thing to do for it
19:59mmarczykyoklov: an implementation detail, so we should pretend they're not strings and throw?
19:59mmarczykyoklov: or the opposite? :-)
19:59yoklovmmarczyk: call (name) on them
20:00mmarczykyoklov: an document {"foo" 1 :foo 2} as asking for trouble?
20:00mmarczyk^and
20:00yoklovhm
20:00yoklovyeah, probably
20:00yoklovit's a hard problem
20:01yoklovbut clojure has come up with very many elegant solutions to hard problems (along the same lines as this, i think) in the past, so it seems doable
20:02yoklovhm
20:02mmarczykI thought I'd just write a clj->js when removing uses of .-strobj from TwitterBuzz, but it turned out to be rather too involved to have that particular ticket wait for an acceptable implementation
20:02mmarczykagreed on that one
20:03mmarczykI think there's no clj->js *now* just because there's a general feeling that this can be solved correctly and that it is the correct solution that is worthy of cljs.core/clj->js being bound to it ;-)
20:03hcumberdale(count does not seem to work well on binary things
20:03mmarczykon the other hand I also think that maybe the sane thing to do is to implement a simple conversion function taking maps w/ string keys to objects and vectors to arrays and not caring about anything else
20:03yoklovhaha, so we're waiting for the One True cljs.core/clj->js Implementation
20:04kovasbyes its certainly something that gets reimplemented over and over
20:04kovasbthere was talk of js object / array literals
20:04kovasbwhich would help some
20:05yoklovkovasb: the syntax for their creation improved
20:05kovasbyoklov: what is the new syntax? i think i missed that
20:05mmarczykoh yes, and much glory and related perks to whoever steals the clj->js flame from the firey bowels of V8 (or wherever one steals that sort of secrets from) and brings it to us
20:06kovasbthe web gods
20:06yoklovkovasb: oh, just that js-obj can take args, i think. maybe something else too?
20:07yoklovalso you can use doto on them now better.
20:07gtoastHow would I "use" just the sqrt symbol from the clojure contrib library from within an ns declaration?
20:07mmarczykyeah, js-obj takes args and is backed by a compiler macro to which produces JS literals in the non-higher-order case
20:08mmarczykgtoast: (:use [lib-name :only [var-name ...]])
20:09mmarczykgtoast: w/ Clojure 1.4 also (:require [lib-name :refer [var-name ...]])
20:09mmarczyk^which produces
20:10yoklovgtoast: also clojure contrib is deprecated
20:10yoklov~contrib
20:10clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
20:11gtoastmmarczyk: This is what I'm using now: (:use [clojure.contrib.math :only [sqrt]])
20:11hcumberdale,(- 59993 56550)
20:11clojurebot3443
20:11mmarczykgtoast: you should probably switch to https://github.com/clojure/math.numeric-tower
20:11hcumberdale,(- 30958 29301)
20:11clojurebot1657
20:11mmarczykgtoast: because of what yoklov says
20:11mmarczykgtoast: otherwise your :use syntax is fine
20:12creesehow can I convert a clojure string to a java character?
20:12hcumberdale,(/ 59993 56550)
20:12clojurebot59993/56550
20:12yoklov,(first "f")
20:12clojurebot\f
20:12mmarczykcreese: you mean take the first character of a string? (first "asdf"), (nth "asdf" 0), (.charAt "asdf" 0)
20:12yoklov,(type (first "f"))
20:12clojurebotjava.lang.Character
20:12yoklovdarn
20:12yoklov,(type (.charValue (first "f")))
20:12clojurebotjava.lang.Character
20:12yoklovhm
20:13yoklovi wonder if type always returns a class
20:13yoklov,(char? (first "f"))
20:13clojurebottrue
20:13creeseI have a java function that only accepts characters
20:13yoklovyeah, just call first on it
20:13yoklovif it's a string
20:13creeseok
20:13mmarczykyoklov: no, it prefers :type metadata if present
20:14mmarczyk&(type ^{:type "asdf"} {})
20:14lazybot⇒ clojure.lang.PersistentArrayMap
20:14mmarczyk!?
20:14clojurebotCLABANGO!
20:14mmarczyknot sure what lazybot is up to, but that looks different at my repl :-P
20:15mmarczykmy 1.4.0 repl, just to be clear
20:15mmarczyk&(type (with-meta {} {:type "asdf"}))
20:15lazybot⇒ "asdf"
20:15mmarczykoh good.
20:19hcumberdale(* 100 (/ 59993 1024))
20:19hcumberdale,(* 100 (/ 59993 1024))
20:19clojurebot1499825/256
20:30jonny_Hey, I'm trying to use clj-record and I'm getting this exception: No suitable driver found for jdbc:mysql
20:30jonny_anybody know why that is?
20:35wkmanireHow I kill the slime-repl from emacs?
20:36netrinojonny_: maybe you should add mysql as a dependency
20:36jonny_that's a good idea
20:36jonny_not sure how to do that though
20:37wkmanirenvm
20:39creese, 'quit'
20:39clojurebotquit'
20:41jonny_netrino: Would you be able to tell me how to add mysql as a dependency?
20:41jonny_I'm pretty lost here
20:41yoklovcreese: strings use double quotes
20:42yoklovotherwise you're just quoting the next form. 'form becomes (quote form) during reading
20:42ibdknoxjonny_: jdbc requires a driver for whatever database you're using
20:43ibdknoxif you look up mysql jdbc driver you'll likely find the thing you need
20:43creesethe person asking how to kill the slime repl
20:43creesecomma 'quit'
20:43yoklovoh, haha
20:43ibdknoxjonny_: then you'll add that in your project.clj
20:43ibdknoxjonny_: btw, you might want to look at Korma instead of clj-record: http://sqlkorma.com
20:43muhooso is it good and proper to put the mysql-jdbc-connector into :dependencies in project.clj, or should that be a plugin stuffed in ~/.lein/plugins instead?
20:43creeseI can't figure out how to cast my string so the java function will take it
20:43creesejava.lang.String cannot be cast to clojure.lang.IFn
20:44ibdknoxmuhoo: dependencies
20:44muhoothx
20:44yoklovcreese: is the string one character?
20:44yokloverr
20:44creesenot this time, now its more than one
20:44yoklovand you only wnat to use the first one?
20:44creeseno, I want to send them all
20:44netrino_jonny_: you can use maven repository for that. If you use leiningen, you can do it with something like that (in to the depencies section) [mysql/mysql-connector-java "5.1.19"]
20:44yoklovcreese: as what sort of data structure
20:45jonny_ibdknox: thanks for heads up on Korma! I'll definitely check that out
20:45jonny_netrino_: Okay, I'll try that
20:47yoklov,(every? char? (char-array "foo"))
20:47clojurebottrue
20:47jonny_netrino_: Yaayy! it totally worked! thanks so muhc
20:47jonny_Super easy once you know what to do
20:48jonny_though I wonder why this was never mentioned on java.jdbc or clj-record
20:49jonny_idbknox: oh wow, korma looks really awesome. definitely going to be using that instead
20:49jonny_oh, and look at that. you seem to be the creator. awesome work!
20:50muhoohmm https://refheap.com/paste/2431
20:50wkmanireEvery bit, every byte, that I program is right. Although you may be in denial, all of my programs compile. Every loop that I do is that much better than you. Haven't you heard that I'm a qbasic nerd? http://www.youtube.com/watch?v=Mal6XbN5cEg
20:50muhooack
20:50muhooneveermind
20:50wkmanire:D Happy saturday folks.
20:51creeseyoklov: the java function expects a string, but it's not getting one. It's getting a clojure.lang.IFn (whatever that is)
20:51yoklova function
20:51netrino_jonny_: your welcome. well, i think it's expected behavior of the user - satisfy all the dependencies
20:52yoklovcreese: https://refheap.com/paste
20:52yoklovsounds like you aren't calling whatever you're passing to the java method. clojure strings are java strings, so there shouldn't be any issue
20:52creeseI know
20:55jonny_netrino_: you're totally right, but usually the docs explicitly mention what the dependencies are, and i wasn't aware of mysql/mysql-connector-java. how did you come to learn about that? maybe i need to brush up on some of my basics
20:56muhooalthough, it's kind of getting annoying to get org.apache.maven:super-pom:pom:2.0
20:56muhooerrors all the time
20:59creesehttps://refheap.com/paste/2432
20:59mmarczykcreese: you need to remove the parens around w
20:59mmarczykin (GuessWord. (w))
21:00creesebecause I sent it a list with a string inside
21:00creesethats what I get for cut and paste
21:00creese\]
21:01yoklovcreese: sorry if this comes off as pedantic, but you put parentheses around something when its a function which you want to call
21:01creeseyeah, someone else just told me…
21:02yoklovcreese: sorry then
21:02netrino_jonny_: had similar problems in the past. most of libraries, which wraps the database interaction, don't mention dependency on the drivers, in my experience. mostly because they don't know which database you will use, I think.
21:03jonny_ahhh, yeah, that does make sense
21:13wkmanireI just looked over the features for midge.
21:13wkmaniremidje
21:13wkmanirebleh, looks great.
21:13wkmanireI didn't see a code coverage tool however.
21:13wkmanireIs there one for clojure?
21:19jonny_wkmanire: have you checked out https://github.com/technomancy/radagast
21:20wkmanirejonny_: Poifect!
21:20jonny_great!
21:31felideonin emacs, once I'm 'jacked in' to a clojure project, how do I load it so I can eval stuff at the repl defined in the project?
21:32felideoni.e. i get an error "Unable to resolve symbol: defentity in this context"
21:32wkmanirefelideon: Use require for clojure stuff or import for java stuff.
21:32wkmanireYou can also use :use, but I would be careful with that because it puts everything in the same scope.
21:32wkmanirefelideon: (require 'myproject.foo :reload :verbose)
21:32wkmanireLoad everything from that namespace and show me as you do it.
21:34felideonso e.g. https://github.com/ibdknox/korma.incubator/blob/master/src/korma/incubator/schema.clj
21:34wkmanirefelideon: I found this article to be very helpful. http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html
21:36beffbernardfelideon: Do you just want to eval functions in the namespace in the repl?
21:36felideonyes
21:36beffbernardJust change the namespace
21:37beffbernardThis is what I do
21:37beffbernardM-x clojure-jack-in
21:37beffbernardOnce it's loaded
21:37beffbernardC-c C-k
21:37beffbernardto compile the file
21:37beffbernardC-c M-p to change the namespace in the repl
21:37beffbernardC-c C-z to switch to the repl
21:38felideonbeffbernard: ah, that's what i needed :)
21:38beffbernardfelideon: NP
21:38beffbernardalso: https://github.com/technomancy/swank-clojure
21:38beffbernardthe commands I mentioned are there
21:39felideonyeah, C-c C-k didnt occur to me
21:39felideonbut what if it was multiple files?
21:39felideonhow do you compile the project from the REPL
21:39beffbernardThe whole project?
21:39felideonyeah
21:40wkmanirebeffbernard: Thanks for the pointers. That looks like a much better work cycle than what I was doing.
21:40beffbernardNot sure about the whole project thing but I've never had to worry about it
21:41beffbernardIf I'm working in a different file, I just compile that file and change the ns
21:41felideonin lisp I use asdf:load-op or more commonly, require, or more recently, quickload.
21:41beffbernardalso in the reply you can (ns user)
21:41beffbernards/reply/repl/
21:42wkmanireCan lein rename my project?
21:42wkmanireI named my project address_book and am regretting it.
21:42wkmanireI want to change it to addressbook
21:42xeqiwkmanire: nope
21:43wkmanirexeqi: So the fastest route would be to make a new project, copy across the source files and replace address_book with addressbook in them?
21:44beffbernardwkmanire: or change the name in project.clj and change the structure appropriately in src/
21:44wkmanireokeydokey.
21:44xeqiI'd just manually move it like beffbernard mentions
21:45wkmanireGonna have some git fallout to deal with too.
21:45wkmanire:/
21:45xeqior try and make find, rename, and sed to do it
21:45xeqibut that would take longer
21:45beffbernardwkmanire: re git.. git add .; git add -u .
21:46beffbernardthe -u flag will pick up the deleted files
21:48felideonbeffbernard: so for instance, the file i compiled depends on a different project/namespace
21:49felideonwouldn't i need to load that entire project?
21:50beffbernardfelideon: I don't know the internals of swank-clojure but I'm sure someone else can give you an accurate answer
21:50beffbernardbut if it's defined in project.clj, I would think lein will take care of that for you
21:51xeqifelideon: if you do a C-c C-k it will pull in the transative dependencies of that file
21:52wkmanirexeqi, beffbernard: That turned out to be pretty easy thanks to you two.
21:52felideonxeqi: https://github.com/ibdknox/korma.incubator/blob/master/src/korma/incubator/schema.clj
21:52felideonif i C-c C-k that file, and then try to eval the defentity form,
21:53felideoni get Unable to resolve symbol: defentity in this context
21:54xeqiwhat namespace are you in?
21:54wkmanireback in a few
21:54xeqiah
21:55xeqibecause that is in a comment the file you loaded doesn't have to require that function
21:56xeqiprolly easiest to (use 'korma.core) in that namespace.. I think
21:56felideonso even though korma.core is 'used' at the top
21:56felideonit doesnt load all of core's symbols?
21:56xeqiit is (:use .. :only [..])
21:56wkmanireback
21:56xeqithe :only means only bring in these functions
21:56felideonohh
21:57felideonif :only I had seen that
21:57felideon(da dum psh)
21:58wkmanirefelideon: CompilerException java.lang.RuntimeException: Unable to resolve symbol: da in this context, compiling:(NO_SOURCE_PATH:1)
21:58felideonyay
22:06muhoowhere's an idiomatically clojure-ish place to store global things like db handles, etc?
22:06muhoo @projectname.core/someatom ?
22:08xeqikorma uses (defonce _default (atom nil)), clojure.java.jdbc uses (def *db* {..})
22:08xeqiso that looks like an ok place to me
22:08muhoothanks
22:09muhooand from different ns's, i'd do somens/*db* ?
22:12xeqidoes it make sense to be used from multiple namespaces
22:12xeqior should the functions that want it live in the same namespace
22:13xeqiand those be called from elsewhere?
22:13muhoothere are lots of ns'es that'll need to hit the db
22:13muhooexample, in a web app, all the model/foo.clj will need to hit the same global database
22:13felideondo you guys call it 'lisping' when hacking in clojure?
22:14muhooso in some cases the ns'es are broken up by different functions rather than whether or not they are doing db io
22:16xeqiyou can access it as any other var in a namespace using use/require
22:17muhoothat's even better. (:use appname.dbstuff :only *db*]) etc
22:18xeqi(.. :only [*db*])
22:20yoklovhm
22:20yoklovwhy isn't the reader syntax for regexs implemented in cljs?
22:20mmarczykyoklov: I'd be very interested in your opinion re: http://dev.clojure.org/jira/browse/CLJS-190 & http://dev.clojure.org/jira/browse/CLJS-213 if you have the time to take this for a spin (190 applies on top of 213 currently)
22:21mmarczykyoklov: it is, with the caveat that there are some issues due to the fact that Java regexes support different flags to JS regexes
22:21yoklovmmarczyk: taking a look
22:21mmarczykyoklov: great, thanks
22:21yoklovand oh, for some reason i thought it wasnt
22:24mmarczykyoklov: I'll be doing some jsPerf tests sometime soon, but it would be great to have some real-world impressions
22:25yoklovyeah, I only really have one project where it might make a difference (tend to prefer records over maps when they're small and it needs to be fast), but i'm trying it out now
22:28mmarczykcool
22:38lynaghk`yoklov, mmarczyk: have either of you written anything to deal with mapping over large collections in cljs?
22:39yoklovlynaghk`: deal in terms of? performance?
22:39lynaghk`e.g., like in JS how you'd use setTimeout to yield control so the UI doesn't lock up
22:39yoklovoh
22:39yoklovno
22:39lynaghk`and/or something with webworkers to actually spin up a new thread
22:39mmarczykno
22:39lynaghk`I looked around Google Closure and didn't see any helpers for that proble
22:39yoklovi'd still use setTimeout
22:40lynaghk`yoklov: just implement my own yieldmap, then? Yeah. I just wanted to check and see if there was something in Closure or ClojureScript that I had missed
22:41mmarczykyieldmap, sounds good
22:41yoklovyeah, or see if I can do it fast enough to not cause a noticable delay
22:41yoklovby using some arrays or something
22:41lynaghk`yoklov: yeah, that was approach one---I'm working on a half-baked profiling library to figure out what part is actually slow
22:41mmarczykseems like it could be a nice addition to cljs
22:42yoklovlynaghk: in my experience, since you said mapping, i'd suspect seqs
22:43lynaghk`yoklov: The actual iteration over the seq is the slow part (we're talking a few dozen entries), it's the calculation
22:43yoklovi see
22:43lynaghk`https://github.com/lynaghk/c2/blob/master/src/cljx/c2/geo/core.cljx
22:44yoklovcljx? weird.
22:44felideonwhoa
22:44felideonwhy are docstrings before function args
22:44lynaghk`but I'm not going to try and optimize that without a proper profiling library, and thus far I've found the webkit stuff pretty useless for CLJS
22:44lynaghk`yoklov: yeah, that's a hack to do clojure/clojureScript code sharing.
22:45yoklovmmarczyk: alright, just got it to build with new cljs, should i try it out on advanced compilation or standard?
22:45mmarczykyoklov: advanced, I guess
22:45lynaghk`felideon: isn't that typically how they're done?
22:46yoklovlynaghk`: weird, inner defs?
22:47sandaemcIs there away I can color what is print to STDOUT from Clojure?
22:47lynaghk`yoklov: I think they're nicer than using lets to name functions.
22:47yoklovlynaghk: without running i can't say much. I see you do a lot of mapping and sequence stuff, tragically i've found that stuff to be quite slow in cljs when it gets big
22:47felideonlynaghk`: not in common lisp, but i found the reason why
22:47yoklovlynaghk`: yeah but they aren't equivalent
22:48lynaghk`yoklov: what's the difference?
22:48yoklovlynaghk`: defs are always top level, though it doesn't seem to make a difference
22:48yoklovfor your use case
22:48yoklovbut if you had a toplevel (polygon-area) that was different than the one inside area, it'd be clobbered when you called area
22:49lynaghk`yoklov: ah. yeah, that could be trouble in the future. Thanks for the tip.
22:49yoklovnp
22:50lynaghk`yoklov: with the sequences, I wonder how much of it is the iteration and how much of it is the allocations. Also, in this particular case, whether it'd make sense to drop to the JavaScript native functions for string join
22:51yoklovoh
22:51yoklovyou're doing str?
22:51yoklovstr is painfully slow
22:51lynaghk`yeah, the function I'm using in this file is geo->svg, which takes an array of coordinates and returns an SVG string
22:52yoklovyeah, its probably worth swapping that out with (.join … "") if it doesn't break things
22:53lynaghk`yoklov: hmm. I'll definitely look into that, thanks.
22:54lynaghk`I'm not sure how far I want to go chasing performance though---I don't want to litter the code with tons of special cases to use js/array over seqs. Then again, I think most people will be using this stuff with completely realized, finite data sets, so it's worth investigating.
22:54wkmanireThis exception is throwing me "lib names inside prefix lists must not contain periods"
22:54wkmanireI know it has to do with my ns call, what should I be looking to correct?
22:55yoklovlynaghk`: right, especially when a lot of this stuff is getting faster
22:55mmarczykwkmanire: stuff like (:require (clojure [java.io :as io]))
22:56wkmanirehttps://refheap.com/paste/2433
22:56mmarczykwkmanire: which would need to become (:require (clojure.java [io :as io]))
22:57mmarczykwkmanire: remove the [] from around seesaw.core and addressbook.ui in the second ns, I guess
22:57lynaghk`yoklov: do you have any tips for doing profiling?
22:58mmarczykwkmanire: the error message means the ns macro thinks you were trying to require seesaw.core.addressbook.ui and split the name at non-final dot
22:58lynaghk`yoklov: what I'm working on now is something that will basically wrap all forms with (time), then aggregate the listings and show you what's what form-by-form.
22:58yoklovlynaghk: googles chrome's profiler is awesome
22:59yoklovgoogle*
22:59yoklovfirefox's is much less awesome, but i tend to run on both because ff wont be slow on the same parts as chrome
22:59wkmaniremmarczyk: Oh! jeese. I didn't even consider that.
22:59wkmanirethanks.
22:59mmarczyknp
23:00lynaghk`yoklov: usually whenever I run it I find out that 50% of my time is spent in "seq". It doesn't seem very useful at all.
23:00yoklovyeah it is
23:00yoklovthat means you're using too many seqs.
23:00lynaghk`heh
23:00yoklovbut you can exclude things from the view
23:00lynaghk`and just dig up the call stack until I get to my fns?
23:01yoklovbasically. it'll be more accurate than time.
23:01yoklovtry changing it to top down or to bottom up if you can't find your functions
23:02yoklovreally though, if it says 50% of your time is in seq, that means you should use map less
23:02lynaghk`yoklov: yeah, I'll give it another shot.
23:02yoklovseqs in cljs aren't chunked yet (at least, i hope not, i'm banking on them getting faster eventually)
23:03lynaghk`yoklov: I definitely know wrapping everything with "time" is not going to be very accurate, but as long as it illuminates hotspots accurately it'll work.
23:04yoklovlynaghk`: why not use a real profiler?
23:04lynaghk`yoklov: I'm hoping to get C2 to be just one order of magnitude slower than D3 (the JavaScript-inspiration)
23:04lynaghk`yoklov: I'd like to be able to see (rough) timing data directly on the code
23:05yoklovat the end of the day there are probably going to be some parts of your code which you need to write at a lower level than cljs's seq abstraction to get them to be faster
23:05lynaghk`yoklov: be able to pull up a file, see all of the forms colored by the time they take, number of times called, mouseover to see distributions, &c.
23:05yoklovnot your whole code base, obviously, but if you are smart about the problem areas you should be able to do it exactly as fast as d3
23:06lynaghk`yoklov: yeah, definitely. What's tricky in this case is that I'm targeting both platforms, and it's totally fast to use seq on JVM Clojure
23:06yoklovah, yeah thats rough
23:06yoklovespecially because js and java arrays are so different
23:06lynaghk`but, yeah, I'm hopeful that I should be able to find a handful of hotspots and optimize for CLJS. I just haven't started looking until yesterday.
23:07yoklovyou're probably going to have to break code compatibility
23:07yoklovto speed it up
23:07yoklovor use macro magic somehow.
23:07lynaghk`yoklov: Since I'm using CLJX I can write totally independent definitions when I need to
23:08lynaghk`yoklov: you annotate toplevel forms, and it'll include/exclude those forms as appropriate in the platform-specific generated code.
23:08mmarczykhttp://jsperf.com/cljs-maps-access-4 -- more to come
23:10yoklovmmarczyk: cant make it compile on advanced anymore ;_;, i'll let you know about the perf. on normal compilation soon
23:12mmarczykyoklov: :-( do you think it's because of map impl chaos?
23:12yoklovmmarczyk: nope just got it to work
23:12mmarczykwhew :-)
23:14mmarczykand another jsperf test http://jsperf.com/cljs-complex-maps-access-4 -- will post a larger batch later
23:14yoklovmmarczyk: well, this is without your patches, actually.
23:14yoklovmmarczyk: so what order should i apply the patches in?
23:15mmarczykyoklov: 213, 190
23:15yoklovk
23:19yoklovmmarczyk: hm, seems to be faster
23:19mmarczykyoklov: oh? fantastic!
23:19yoklovactually seems to be even faster than the records were
23:19yoklovwhen i'm using get on them
23:19yoklovbut
23:20yoklovmaybe same speed
23:20mmarczykwell, that's more fantastic, so to say :-)
23:20yoklovcertainly is not slower at all.
23:21mmarczykvery cool
23:21mmarczykhm, I'll link to this conversation from the ticket
23:21yoklovwell, note that this is my totally unscientific opinion
23:21mmarczykduly noted :-)
23:23yoklovlynaghk`: you should try to make your library as fast as D3 :)
23:25yoklovi mean, 1 order of magnitude slower? cljs can do better than that.
23:26mmarczykhope the summary is ok: http://dev.clojure.org/jira/browse/CLJS-190
23:29yoklovlooks good to me
23:31mmarczykgreat
23:31felideonanyone know of a good way to debug connection errors thought korma? I can connect from multiple clients but from korma i get "Connections could not be acquired from the underlying database!"
23:31felideonconnection string seems fine.
23:37kovasblynaghk`: shouldn't something like mapv be a lot faster, since you can pre-allocate the destination and can dispense with seq?
23:39lynaghk`kovasb: I've never used mapv on clj or cljs, thanks for pointing it out
23:39yoklovdoes cljs have mapv?
23:40kovasblynaghk`: don't know if the implementation does it currently, but seems like it should be possible. (can also write your own)
23:40lynaghk`yoklov, kovasb: eh, cljs doesn't seem to have mapv
23:41kovasbI'm gonna guess it is in there soon :)
23:41kovasbrate of development is pretty crazy..
23:41yoklovyeah
23:41lynaghk`yoklov: actually, C2 is a few orders of magnitude slower than D3 right now.
23:42yoklovlynaghk`: yeah, i bet you can make it faster
23:42lynaghk`yoklov: depends on what you're doing, though.
23:42felideonoh silly me.
23:42lynaghk`yoklov: oh yeah, definitely. It has been a non priority up until now (because of this mapping project)
23:43yoklovlynaghk`: in my experience, if you're willing to work at a similar level, cljs is exactly as fast as js
23:43lynaghk`yoklov: yep. I'd be okay to do that, I just want to have some good tooling to do benchmarking before I start changing around the otherwise halfway clean code.
23:44ivanhuh, I thought CLJS had mapv, what's the *v it does have?
23:44yoklovlynaghk`: i can't say enough good things about chrome's profiler.
23:45yoklovlynaghk`: i'm just saying it would be awesome to have a fast cljs visualization library
23:45ivancljs.org confused me with:
23:45ivan**** non-lazy mapping/filtering or mapv, filterv
23:45ivan***** can make it back into Clojure
23:47lynaghk`yoklov: "pull requests welcome"
23:47lynaghk`= )
23:47lynaghk`yoklov: Top two fns according to the chrome profiler (6% of time each) are lookups in cljs.core
23:48lynaghk`I take it switching to records will help a lot there?
23:48yoklovyes
23:50yoklovand if necessary you can get even more speed by switching (record :foo) to (.-foo record). avoid (:foo record), as that's in fact slower than (record :foo) due to implementation details involving extending native prototypes
23:51yoklovthough
23:51lynaghk`yoklov: awesome, thanks for the tips. Do you have a blog?
23:51yoklov6% is really nothing
23:51yoklovi do not
23:51yoklovthe rest is (program)?
23:52lynaghk`yeah, 90%
23:53yoklovyou should select that and hit the x at the bottom to exclude it
23:54winkywoosternoir question.. i'm trying to figure out why a static item in the resources directory isn't being served. any recommendations on debugging the resources routes?
23:58lynaghk`yoklov: I think that geo->svg function could be cleaned up a ton with JS perf improvements. I'll tackle that tomorrow. Thanks for your help this.
23:58yoklovlynaghk`: no problem, good luck
23:59lynaghk`yoklov: I'd like to do an official 0.1.0 release for C2 though, since I haven't actually announced it on the mailing list or anything. Namely, go through and remove any extra cruft, clean up docstrings, and actually writeup a list of what useful things are in there.
23:59yoklovlynaghk`: sounds like not a bad idea
23:59lynaghk`yoklov: after that, performance improvements. If you have time to dive in and poke around, I'd love to hear your opinion about some of it
23:59yoklovoh, sure.