#clojure log - Apr 28 2012

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:11 mudphone: Is there something similar to "clojure-version" for required namespaces? For example, finding the version of a project.clj dependency from the running program?

0:12 xeqi: nothing in a running program

0:13 mudphone: xeqi: ok, thanks

0:13 xeqi: lein2 has `lein deps :tree`, mvn has `mvn dependency:tree`

0:13 mudphone: i suppose I could use whatever lein is using?

0:13 or shell out

0:14 xeqi: lein uses pomegranate underneath

0:14 mudphone: $ lein deps :tree

0:14 WARNING: passing an argument to deps is deprecated.

0:15 xeqi: but it works on the dependency graph and coordinate info from project.clj

0:15 jonasen: does lein-noir work with lein2?

0:15 xeqi: `lein version` ?

0:15 mudphone: 1..0

0:15 1.7.0

0:15 Raynes: jonasen: It is being rewritten as a newnew template, so yes, but not at the moment.

0:16 ibdknox: ^ Need to do whatever we're going to do with the noir template btw.

0:16 xeqi: lein deps :tree is new in lein 2

0:16 jonasen: Raynes: ok. is the template work on github somewhere?

0:17 mudphone: xeqi: ah, thanks

0:17 Raynes: https://github.com/ibdknox/lein-noir/pull/6

0:23 emezeske: Anyone 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)] ...))

0:24 It seems like there must be some way to keep that flatter, but I haven't found it yet

0:25 xeqi: .. maybe-m ?

0:26 emezeske: xeqi: Thanks... I guess it's time for me to get over my fear of macros :)

0:28 xeqi: Err, I have no fear of macros, I meant monads!

0:28 xeqi: heh

0:29 I'm also pretty sure you could write a when-let*

0:29 as a macro

0:29 emezeske: xeqi: That was my first instinct; I was wondering if maybe that existed already

0:32 eggsby: hmm, finished my homework, could this have been done more elegantly? https://refheap.com/paste/2412

0:32 not sure I'm familiar enough w/ clojure to even recognize a better solution :(

0:48 xeqi: eggsby: have you seen ##(doc every?)

0:48 lazybot: ⇒ "([pred coll]); Returns true if (pred x) is logical true for every x in coll, else false."

0:49 bbloom: eggsby: search for "destructuring" on this page: http://clojure.org/special_forms

0:51 eggsby: thanks xeqi and bbloom

0:55 xeqi: eggsby: this is homework?

0:55 eggsby: xeqi: mm, I'm taking an online clojure course

0:57 rlander: eggsby: where?

0:58 eggsby: rlander: http://codelesson.com/courses/view/introduction-to-clojure luckily work paid for it...

1:00 rlander: oh, cool. Just read Amit's book, fantastic.

1:02 eggsby: ya, the course is largely readings from and extensions to the book

1:02 emezeske: Damnit, macros are cool

1:03 xeqi: This is what I came up with, w.r.t the problem you commented on earlier: https://refheap.com/paste/2413

1:03 xeqi: macros or monads?

1:03 emezeske: Macros :)

1:04 The maybe-m monad was almost what I wanted, except I wanted *any* falsey value to terminate, not just nil

1:04 I could have probably made a monad for that, if I was more knowledgable about them. Instead, I made a macro

1:06 xumingmingv: I followed the instructions from https://github.com/technomancy/swank-clojure

1:06 why there is no clojure-jack-in command

1:09 creese: does anyone know why my classes directory gets clobbered every time I start the swank repl?

1:09 Is that suppose to happen?

1:10 mmarczyk: emezeske: an (untested) alternative -- (defmonad possibly-m [m-zero nil m-result identity m-bind #(if % %) m-plus #(first (drop-while not %))])

1:10 eggsby: xeqi: bbloom is this better? https://refheap.com/paste/2414

1:11 xeqi: eggsby: not quite what I had in mind w/ every?

1:11 have they introduced map?

1:11 emezeske: mmarczyk: Neato! Thanks for the example. I need to study it...

1:12 xeqi: since this is week1 I'm not sure

1:12 eggsby: xeqi: yah I'm familiar with map

1:12 ah, I always forget that map can take two sequences...

1:13 xeqi: yeah, gotta be careful about the empty basecase

1:13 but you're traversal in match? looks alot like what map will do

1:13 *your

1:21 argh, refheap won't let me middle click paste

1:34 eggsby: 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

1:34 bbloom: eggsby: nitpick: outdend the body of the match? function two spaces, so that it lines up with the argument list

1:35 eggsby: also, atom? is a core fn, so you may want to call your complement not-seq? or something like that

1:35 muhoo: eggsby: you're taking a class where they're teaching clojure? at which school?

1:35 eggsby: thanks xeqi

1:37 bbloom: eggsby: especially since your comment says "if the pattern isn't a sequence"… you could just delete that comment and write (not (seq? x)) :-)

1:38 eggsby: heh :)

1:38 bbloom: in general, as you gain experience, you'll use comments more sparingly. See: http://c2.com/cgi/wiki?CommentCostsAndBenefits

1:48 seancorfield: quick 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

1:49 bbloom: seancorfield: shell out to dos2unix :-)

1:50 muhoo: if it's dos, the ^J's are already there, you just want to get rid of the ^M's, so "replace-string" works too

1:56 xeqi: eggsby: did you say this was homework for a training class?

1:56 not for a school

2:01 seancorfield: muhoo: no, it only seems to have ^M, no ^J

2:01 bbloom: that might work

2:02 ah, on mac there is no dos2unix

2:02 bbloom: seancorfield: brew install dos2unix

2:03 i use it from vim all the time with :'<,'>!dos2unix

2:05 seancorfield: i don't have brew

2:05 i converted it with TextMate :)

2:05 eggsby: hmm, how can I tell if something is 'deeply' true

2:05 bbloom: *cringe*

2:06 seancorfield: you really aught to install an osx package manager, preferably brew

2:06 eggsby: (true (true (true true))) should evaluate to true for instance, but not (true (true [hello world]))

2:06 bbloom: eggsby: what do you mean by "deeply"?

2:06 eggsby: i.e. how can I recursively ensure the value of something.. hm

2:07 bbloom: eggsby: that doesn't seem like a common notion of truthiness, you'd need to implement that yourself… if you actually do need that

2:07 eggsby: backup a step, why do you need that?

2:07 eggsby: see http://richhickey.github.com/clojure/clojure.walk-api.html for easy recursion of tree structures

2:07 lazybot: Nooooo, 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.

2:08 bbloom: haha thanks lazybot, i blame google

2:08 ,(inc lazybot)

2:08 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: lazybot in this context, compiling:(NO_SOURCE_PATH:0)>

2:08 bbloom: %(inc lazybot)

2:08 *shrug*

2:08 &(inc lazybot)

2:08 lazybot: java.lang.RuntimeException: Unable to resolve symbol: lazybot in this context

2:09 bbloom: *sigh* (dec bbloom)

2:09 ben_m: @inc bbloom

2:09 aww.

2:09 eggsby: bbloom: i'm still struggling with a better way to do this problem :)

2:10 xeqi: this was for training, not school?

2:10 eggsby: ya

2:11 xeqi: then https://refheap.com/paste/2418 is how I would do it

2:11 not worried if its not for a grade

2:11 seancorfield: bbloom: why? i've never needed a package manager on os x before - in all my years of developing on os x

2:12 (that's a genuine Q btw, curious about what benefit a package manager brings to os x)

2:15 xeqi: I used it to handle dependencies, and to have something that could manage uninstall

2:15 when I was on osx

2:15 would hate to build and install rmagick on its own for example

2:15 bbloom: seancorfield: it's just really convenient when you want to install software…. saaaayyy dos2unix for example

2:15 xeqi: *imagemagick

2:16 bbloom: xeqi: 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

2:17 xeqi: bbloom: I didn't want to figure out how to run expectations

2:17 bbloom: repeating "(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

2:17 xeqi: so it was a quick port of his tests to something I could hit in a repl easy

2:18 but yeah, if it was real it would go into a test file somewhere

2:18 eggsby: thank you xeqi I was working towards something like that :)

2:18 some sort of ugly cond + anon func block though :(

2:19 xeqi: I'm surprised every? doesn't take a varargs of cols like map

2:20 bbloom: xeqi: hmm would you expect that to test every? against a vector? or test every element of every collection argument?

2:21 xeqi: seems ambiguous, better to explicitly use (every? pred (concat …)) or (every? pref (map …))

2:22 eggsby: thank you for that 'every? identity' trick xeqi, I'd been going (every? #(= true) ,,,)

2:23 xeqi: I would expect the (every? pred (map ...)) variation

2:23 where it does the implicit zipWith

2:23 like map does

2:23 bbloom: xeqi: that would cause a lot of subtle bugs because people would call (every? identity 1 2) expecting (every? identity [1 2])

2:24 xeqi: if you assume the zip-with variant, then you get (every? identity [[1] [2]]) which is always true

2:24 xeqi: better to throw an error :-)

2:25 xeqi: ah, I see

2:25 its the naming thing, like contains?

2:25 bbloom: not sure what you mean

2:26 xeqi: well, not directly equivalent

2:28 muhoo: what's the clojure-ish place to save global application state, like, db connection handles, etc?

2:28 stuff 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)

2:40 bbloom: muhoo: isn't that what Vars are for?

2:40 :-P

2:41 _KY_: How do I convert a set to a seq?

2:42 bbloom: _KY_: the same way you convert anything to a seq

2:42 http://clojure.org/cheatsheet

2:42 _KY_: Is there a function for that?

2:43 bbloom: _KY_: read the cheatsheet, you'll find it. it's worth your time

2:44 _KY_: It's "seq" I guess

2:45 bbloom: _KY_: bingo

2:50 creese: I broke my repl attempting to upgrade. Anyone know how to install slime/swank in emacs?

2:52 madsy_: creese: Install swank/slime via leinigen

2:54 And get clojure-mode from marmalade

2:55 Then when you do "Ctrl-M clojure-jack-in", the slime version from leinigen gets used

2:56 creese: when I do clojure-jack-in, I get an error

2:57 "Could not start swank server"

2:58 madsy_: What happens if you start swank yourself outside of emacs?

2:59 creese: lein swank?

2:59 it says Listening for at… and Connection opened… port 4005

2:59 madsy_: yes

3:00 Try doing "lein swank" in a terminal, and then do a slime-connect

3:00 creese: prior to this, I was use M-x silme-connect

3:01 I have slime-connect anymore, I removed it

3:01 dont

3:02 madsy_: Oh, right. You haven't run M-x clojure-jack-in successfully yet

3:02 creese: nope

3:02 madsy_: Because that installs slime

3:03 Make sure leinigen is in your PATH

3:03 So emacs can call it

3:03 creese: if I can 'which' it is that good enough?

3:04 madsy_: huh?

3:04 creese: which lein

3:04 gives, /usr/local/bin/lein

3:05 madsy_: I guess.

3:05 creese: it's in my path

3:05 what else could be wrong?

3:05 madsy_: I'm not sure. The error description wasn't very useful

3:06 creese: It takes a long time to give me the error

3:06 it's like it's timing out

3:06 madsy_: It might be that the version of swank/slime you have downloaded with leinigen doesn't like your version of emacs

3:07 The system isn'tt extremely robust :P

3:07 -t

3:07 The only other thing I can think of is that you're connecting to a different port than swank listens to.

3:08 creese: do I need to specify the port in project.clj?

3:09 madsy_: No

3:10 Preferably don't add anything in your leinigen project

3:10 You want to install swank/slime for your system, not on a per-project basis

3:10 If you have slime/swank mentioned in your leinigen project, remove that

3:11 http200://dev.clojure.org/display/doc/Getting+Started+with+Emacs

3:14 creese: when I run 'lein plugin install' for swank-clojure 1.4.2, I get an error

3:14 Unable to find resource 'swank-clojure:swank-clojure:jar:1.4.2' in repository central (http://repo1.maven.org/maven2)

3:15 then it installs some jars

3:16 do I need to start swak from the shell if I'm using clojure-jack-in? or is that just with slime-connect?

3:20 Madsy: creese: When it works you don't have to do anything else than "clojure-jack-in"

3:21 It will start a swank server and connect to it for you

3:25 creese: 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

3:28 Emacs 23.1.1 + swank-clojure-1.4.2 is what I use. I'm lagging a bit behind on the emacs version.

3:41 * bbloom thinks "i went out two nights this week. it's totally OK that I stayed in on friday night and made two patches to CLJS"

3:42 wmealing: justified.

5:22 madsy: Why doesn't seq split up the string here? https://gist.github.com/2517259

5:32 Vinzent: madsy, what do you mean?

5:35 AimHere: I think he wants the function to count up the items in the string

5:36 In which case, maybe he needs to '(apply my-count 0 (seq x))' instead

5:37 madsy: AimHere: Yeah, I'm following the 4clojure puzzles

5:38 AimHere: seq is splitting up the string, but the function is just counting up the number of lists

5:38 Vinzent: Ah, right - apply. I just didn't understand what he means by split up. Btw, there is no need for handling strings specially

5:38 madsy: Vinzent: Right, so how do I handle strings when they aren't collections?

5:38 They don't return true for the coll? predicate

5:38 AimHere: ,(count "Hello")

5:39 clojurebot: 5

5:39 madsy: Yes, but I can't use count in the 4clojure exercise :)

5:39 AimHere: Indeed

5:39 madsy: And the source for count uses a built-in function

5:40 Vinzent: ,(reduce (fn [cnt next] (inc cnt)) 0 "foo")

5:40 clojurebot: 3

5:41 madsy: Ah, so apply did work for strings too. Not sure how I missed that

5:42 Vinzent: madsy, all functions working on seqs convert argument to seq first, so you never have to handle strings\arrays whatever separately

5:42 madsy: Vinzent: Thanks.

5:42 Vinzent: ,(next "123")

5:42 clojurebot: (\2 \3)

5:42 Vinzent: ,(next (into-array [1 2 3]))

5:42 clojurebot: (2 3)

5:42 AimHere: He does need to detect stringiness seperately, as far as I can tell

5:43 Vinzent: why?

5:43 clojurebot: why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone

5:43 AimHere: ,(or (seq? "Test") (sequential? "Test"))

5:43 clojurebot: false

5:43 madsy: AimHere: No, it just had to work on all the common containers :)

5:43 AimHere: Right, but is there a predicate that is true for all the common containers?

5:44 I.e. something that returns true if the argument is a collection or a string

5:44 madsy: Oh, you mean the predicate. I don't know

5:44 Vinzent: yes

5:44 there was something, but I can't remember the name

5:45 ,search "123" true

5:45 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: search in this context, compiling:(NO_SOURCE_PATH:0)>

5:45 Vinzent: hm, or how this thing works...

5:47 raek: $findfn "123" true

5:47 lazybot: [clojure.core/== clojure.core/string? clojure.core/distinct? clojure.core/boolean clojure.core/< clojure.core/= clojure.core/> clojure.core/>= clojure.core/<=]

5:47 Vinzent: raek, yeah, thanks! But that predicate isn't listed here

5:48 AimHere: I don't see anything obvious in the clojure cheatsheet

5:48 raek: well, coll? returns true for all _clojure_ containers

5:49 AimHere: (or (coll? foo) (string? foo)) seems to be the best bet so far

5:51 Vinzent: http://stackoverflow.com/questions/4019249/clojure-finding-out-if-a-collection-is-seq-able - found it

5:51 but it's in contrib

5:51 in incubator actually

5:57 sandaemc: Hello guys, is it possible if I can know if the SQLite database is lock from sqlite-jdbc 4? Thanks.

6:00 Hmm.. ignore this.

8:58 IPmonger: Hi 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.

9:00 raek: IPmonger: 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)

9:01 IPmonger: https://github.com/technomancy/leiningen/blob/preview/doc/TUTORIAL.md

9:02 IPmonger: thanks raek!

9:04 raek: when 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

9:05 IPmonger: ok - thanks again!

9:06 TimMc: Hmm, how do I get the Class object representing an array type?

9:07 Let'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 []))

9:07 lazybot: ⇒ [Ljava.lang.Void;

9:08 sattvik: TimMc: Aside from that, you could try (Class/forName "[Ljava.lang.Void;").

9:09 I'm not sure there is a more direct way.

9:09 TimMc: Ew, that works too.

9:09 Thanks. I think I'll use into-array for now. :-P

9:10 fliebel: TimMc: What a waste of memory :P

9:13 sattvik: Well, it could be done as a macro, I think.

10:22 mengu: hi. 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:36 TimMc: sattvik: No macro necessary. It's to work around a stupid clojure.reflect thing.

10:41 ,(:parameter-types (first (filter #(= 'getChars (:name %)) (:members (clojure.reflect/reflect String)))))

10:41 clojurebot: [char<> int]

10:42 TimMc: ,(:parameter-types (first (filter #(= 'format (:name %)) (:members (clojure.reflect/reflect String)))))

10:42 clojurebot: [java.lang.String java.lang.Object<>]

10:43 hcumberdale: Hi ;)

10:43 Sunny day wooohooo!

10:43 Can I print my "use" / "include" / "require" structure as a tree in leiningen ?

11:00 fliebel: hcumberdale: What do you mean by "in leiningen"?

11:14 hcumberdale: with leiningen :)

11:14 fliebel

11:14 wrap-multipart-params

11:14 << does it really parse the request?

11:21 parse-multipart-params << http://clojuredocs.org/ring/ring.middleware.multipart-params/parse-multipart-params

11:21 Seems to use a file?

11:52 sandaemc: Testing

12:07 chouser: sandaemc: Succeeding

12:16 sandaemc: Three months learning Clojure and this is what I got: https://github.com/smaak/iphpdoc

12:18 hcumberdale: yeah sandaemc, I don't write php anymore

12:19 sandaemc: The 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:20 hcumberdale: I'm still writing a blog in clojure

12:20 Want to get the first release till the end of next week

12:21 sandaemc: Where is your blog?

12:22 hcumberdale: https://github.com/kremers/cblog

12:23 It is running on heroku

12:24 with mongodb,... the s3 media section is "work in progress"

12:27 sandaemc: hcumberdale, I'm still figuring out how to shift my mind on building a website with Clojure. Why you did not use noir?

12:28 hcumberdale: sandaemc, I still think web applications should be as simple as possible

12:28 noir does not introduce a straigt way to do things

12:29 but the "default" noir does not statisfy my needs

12:29 I don't like hiccup that much. From everything I learned mixing up sourcecode and markup does not seem right

12:30 I don't like the way how applications are build by default (local storage / scalability,...)

12:31 fliebel: hcumberdale: Do you know about enlive?

12:31 hcumberdale: Storing no absolute no "has to be shared" information with the application feels good

12:31 I tried to get in touch with enlive

12:31 My first thougts: "wow, nice concept, seperation of concerns, ..."

12:32 Then I tried to modify pages the way enlive likes it (all that #id selector clone/copy stuff)

12:32 alexbaranosky: second thoughts?

12:32 hcumberdale, there's always StringTemplate :)

12:32 sandaemc: hcumberdale, about your project, is there a pattern there? like MVC? I'm used to that.

12:32 hcumberdale: I feelt uncomfortable about having that strong binding to css (yeah not really css but the bindings there)

12:33 sandaemc, kind of that

12:33 StringTemplate, yeah!

12:33 I use mustache for templates

12:33 Since it is supported through different programming languages client and server side

12:34 it is fast, and does not let people put in code into pages

12:34 mengu: hi. 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:34 fliebel: hcumberdale: So what did you want to do with ns declarations in lein?

12:34 mengu: but i have not understood the second function

12:34 alexbaranosky: isn't the nice thing about Enlive that the html itself doesn't have to specify which spots will have values inserted?

12:34 hcumberdale: yes alexbaranosky, that is the nice thing about Enlive

12:35 alexbaranosky: Mustache or StringTemplate require you to specify the location in the template to insert the data

12:35 I haven't done a ton of web programming in Clojure :)

12:35 hcumberdale: Yeah! But that "feels" better.

12:35 All my experience coming from php with smarty, over jsp's, struts, the ugly jsf to ruby on rails

12:36 alexbaranosky: it depends on what your feelings mean

12:36 fliebel: mengu: You know the syntax used by for, and how the regular filter works?

12:36 alexbaranosky: does feeling better me *is* better? I dunno... :|

12:37 it seems to me that Mustache creates more coupling

12:37 hcumberdale: Yeah! 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:37 sandaemc: hcumberdale, does your project can be easily run in google app engine?

12:37 hcumberdale: sandaemc, haven't tried it yet but I think it shouln't be a problem

12:37 alexbaranosky: because botht he template and whoever populates the template have to agree on where to insert the values

12:38 hcumberdale: alexbaranosky, mustache is simply about (template + data)

12:38 So what I do is to write a default template that contains a container which does not escape html

12:39 and render the pages (user click flow over the application) into that template

12:39 So templates stay DRY

12:40 alexbaranosky: they still have to have spots with {{ foo }} where the data goes

12:40 sandaemc: quit

12:41 hcumberdale: Yes, with enlive instead you have to write a lot of logic which does exactly the same

12:41 only to not touch the html structure

12:41 alexbaranosky: hcumberdale, 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:42 hcumberdale: where 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:42 alexbaranosky: makes sense

12:42 I like Mustache, it is very clean

12:42 hcumberdale: alexbaranosky, yes! And it is also about a clear cut of logic and design

12:42 alexbaranosky: I'v used it for a tiny PHP project

12:43 have you used it with Noir?

12:43 I know Noir is supposed to be pluggable, but haven't tried

12:43 mengu: fliebel: the book showed some basic usage of for

12:43 but this i'm not familiar with

12:43 hcumberdale: alexbaranosky, yes it is but the defaults are so far away from what I use that nearly no noir exists anymore after "plugging"

12:44 alexbaranosky: might as well use Compojure

12:44 hcumberdale: When 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:45 alexbaranosky, I'm using compojure there

12:46 But a framework lives from it's defaults. When somebody is asking about "noir" he means in general hiccup templates and the noir defaults.

12:46 I can plug around until only compojure and some things are there,... but I do not see the benefit of it

12:46 alexbaranosky: hcumberdale, that's true -- people gravitate to the defaults

12:47 hcumberdale: Also mongodb as default session store is important for me

12:47 alexbaranosky: I wonder why he went with Hiccup a default. I agree it is kinda, meh

12:47 hcumberdale: to have applications that "really" scale,... not like JSF :D

12:48 Hiccup is nice to write a prototype,... but if the markup grows you'll get crazy

12:48 get<>go

12:50 alexbaranosky, each "web framework" carries some tradeoffs :)

12:51 alexbaranosky: hcumberdale, what is the project you are working on?

12:51 hcumberdale: The 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:52 alexbaranosky, 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:52 There is an older instance of it running on heroku

12:53 If you want to contribute. I'll be very thankful

12:54 alexbaranosky: I'll consider it but, I barely have time to do the things I am already involved in, so don't count on me :)

12:54 hcumberdale: http://furious-fog-1667.herokuapp.com/

12:54 that's an older version

12:54 you can login into the admin console under /admin with admin:12345678

12:55 alexbaranosky: lots of German and French

12:56 hcumberdale: :) yah

12:56 http://www.martinkremers.de/blog/ << the server is going offline in a few month

12:56 so I'll migrate my "private homepage" to heroku & cblog

12:58 alexbaranosky: now I'm reading your blog

13:00 you forgot to test your blog code ;)

13:00 hcumberdale: yeah :) I know

13:00 alexbaranosky: Have you seen: Midje? https://github.com/marick/Midje

13:01 I work on it. My experience is that people seem to either love it or hate it

13:01 hcumberdale: Then trying it is a "must" on my todo list

13:02 a friend of mine is working on cucumber for clojure

13:02 alexbaranosky: cucumber-jvm already works with Clojure I thought

13:02 mdeboard: I really like Midje-cascalog

13:02 hcumberdale: Stuart Halloway is a Contributor ,... nice

13:02 alexbaranosky: the Midje wiki on github is very extensive: https://github.com/marick/Midje/wiki

13:02 mdeboard: therefore by the commutative propert I probably enjoy midje

13:02 jappinen: https://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:02 p back into clojure code

13:03 alexbaranosky: Halloway has contributed maybe a small commit or something a long time ago

13:04 hcumberdale: alexbaranosky, have you seen the diy things on my blog

13:04 alexbaranosky: hcumberdale, no, link?

13:05 I'm actually reading the article about why Scala stinks

13:05 fliebel: mengu: Still around? I can explain the fn if you want.

13:06 hcumberdale: meaning the whole "Do it yourself" category in the right top of the page

13:07 alexbaranosky: neat

13:07 I see it now

13:09 hcumberdale: There is also welding stuff under "Nice to know"

13:10 madsy: What am I missing here? https://gist.github.com/2520200

13:11 fliebel: madsy: indentaion is weird... are you sure it's correct?

13:12 madsy: Your cond doesn't have an else.

13:13 madsy: What happens when y is not empty, but the first y is not the last x?

13:15 madsy: fliebel: Ah, doh. Thanks.

13:15 SurlyFrog: Hello 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:15 madsy: I forgot about the other case

13:16 sadger: Hello! 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:17 hcumberdale: lucene <<< argh

13:18 SurlyFrog: hcumberdale: is that "lucene + clojure = argh" or, just argh in general ? :-)

13:19 hcumberdale: argh in general. Never had good experience with lucene

13:19 Only had problems

13:19 I'm out for an ice cream

13:19 SurlyFrog: hmmm….

13:19 hcumberdale: see you later

13:19 SurlyFrog: thanks

13:19 alexbaranosky: adios

13:22 Frozenlock: sadger: you could add it in your project dependencies and manually put it in the lib directory. Hacky, but quick.

13:24 sadger: Frozenlock: could you give me an example say I had a file called Sadger.java with package sadger.core what would I add?

13:24 Frozenlock: oh! Apologies, I thougth your java file was a .jar

13:25 I've never played with .java directly

13:25 sadger: hmm I heard something about :java-source flag in the project.clj

13:25 as of yet not got it to work

13:26 technomancy might know?

13:26 Frozenlock: Very probable.

13:27 sadger: thanks anyway I can always resort to packaging it in a jar and adding a dep

13:40 pelleb: Hi 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:42 Frozenlock: pelleb: I hope it supports bitcoin :P

13:43 pelleb: Frozenlock: of course (btc 123.1)

13:43 fliebel: pelleb: Do you know Frink/j?

13:43 https://github.com/martintrojer/frinj

13:44 Frozenlock: Btw, anybody knows if there'a clojure wrapper for the bitcoin4j library?

13:45 fliebel: http://futureboy.us/frinkdocs/

13:46 pelleb: Frozenlock: I've started one https://github.com/pelle/bitcljoin

13:46 Will need to do some more work on it soon.

13:47 fliebel: I will look at integrating with frink for doing conversions

13:47 Frozenlock: pelleb: Nice!

13:47 fliebel: pelleb: What does bux offer over frinj?

13:48 pelleb: Bux isn't really about conversions. It's about doing correct calculations and formatting things. I haven't really looked at frinj though.

13:49 I needed a simple way of dealing with currencies.

13:50 fliebel: pelleb: Ah, ok, so (eur 12) => €12,-

13:50 pelleb: Yes

13:50 fliebel: ah, sweet

13:51 pelleb: Different currencies have different decimal points and rounding rules that are quite important.

13:52 With bux you could dynamically bind $ to your users default currency per request and bux will format and calculate currencies correctly.

13:52 Frozenlock: Indeed. I once bidded an item 120 thousands USD on ebay because it thought that commas were for thousands, instead of decimals.

13:53 (hopefully this has been fixed since then)

13:54 jonasen: dnolen: How do you run the clojurescript test suite?

13:55 fliebel: pelleb: What is the weirdest case you found so far? I'd imagine people grow a lot of weird formatting over time.

13:55 pelleb: Frozenlock: I would welcome help on https://github.com/pelle/bitcljoin if you're game.

13:56 Frozenlock: pelleb: I was planing on looking at it later today :)

13:57 I was looking for a payment processing mechanism not so long ago... BTC would have been so much simplier to use.

13:57 pelleb: I'm also starting libraries this weekend for http://opentransact.org

13:59 sadger: brb

14:02 back

14:03 dnolen: cjfrisz: since your CPSer is so code transformation oriented, it should work seemlessly with CLJS.

14:04 cjfrisz: is your CPSer general enough to build delimited continuations on?

14:04 cjfrisz: dnolen: That and full call/cc

14:04 dnolen: cjfrisz: excellent, I wrote something called delimc years ago but it's pretty weak comapred to what you're doing.

14:05 cjfrisz: dnolen: call/cc and shift/reset are definitely on the to-do list after about a million other things I want to get done

14:06 dnolen: cjfrisz: call/cc shift/reset is a big one for JS

14:06 cjfrisz: dnolen: I've also thought briefly about the implications of CTCO for CLJS, but too thoroughly

14:06 dnolen: cjfrisz: I'm assuming your code is good enough to do a lot of the optimizations that Dan talks about in his books?

14:06 cjfrisz: dnolen: 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:07 dnolen: cjfrisz: well CLJS is just Clojure. why do yo need a new parser?

14:07 cjfrisz: dnolen: You'll have to remind me about which optimizations :-)

14:07 dnolen: For some reason I was thinking you'd want to parse JS code, but you're right; it just needs to handle Clojure

14:07 dnolen: cjfrisz: if I recall they did somethings in EoPL Ed 3 where the CPSed code is much cleaner.

14:07 cjfrisz: yep

14:08 cjfrisz: so you're CPSer works *today* with CLJS

14:08 cjfrisz: dnolen: I believe that's true

14:08 With respect to the CPS optimization, I think that refers to the Danvy algorithm it's already using

14:08 There's another CPS transform via Andrew Kennedy that I need to read through and see if it's appropriate for this context

14:09 I also really need to do more work on the thunkifier

14:09 There's a paper by Danvy about minimal thunkification

14:09 dnolen: cjfrisz: this is really exciting stuff!

14:10 cjfrisz: 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:10 cjfrisz: dnolen: 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:10 dnolen: I wouldn't be opposed to adding it to contrib at all

14:12 dnolen: cjfrisz: you should send in your CA and get on the dev list and propose it.

14:12 cjfrisz: I would love to see this to be a goto solution for people needing a CPS tool.

14:13 cjfrisz: would be particularly useful in the context of CLJS where async programming is absolutely required.

14:13 cjfrisz: dnolen: Oh, you're right, I do need to send in my CA

14:13 I had been thinking of it, but didn't know whether I should until Dan was ready for us to share this

14:14 I'll print it off and send it in ASAP

14:14 dnolen: cjfrisz: sweet!

14:17 cjfrisz: "CPS transformation after strictness analysis" is that the Danvy paper?

14:17 cjfrisz: dnolen: Dan pointed me to "A First-Order One-Pass CPS Transformation"

14:17 It's linked off of the README at the bottom of the Github page

14:18 I actually haven't read the one you mentioned

14:20 dnolen: cjfrisz: thanks, saved!

14:20 ijt: Hiya. I'm curious if there is any interest in seeing a port of Clojure to Go.

14:21 That would allow Clojure to have a very fast start time, and access to Go's nice libraries.

14:21 dnolen: ibdknox: btw, any particular reason the analyzer needs to be in it's own lib?

14:21 ijt: why not?

14:21 ijt: dnolen: Would you use it if it existed?

14:21 dnolen: ijt: probably worth waiting for the CLJS compiler to be pluggable tho.

14:22 ijt: 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:22 ibdknox: dnolen: 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:22 dnolen: ijt: but that's me, I'm sure others might use it!

14:23 ibdknox: sure, but the jar is 90k

14:23 ibdknox: dnolen: I didn't say my argument was practical ;) haha

14:23 sadger: ah 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:24 dnolen: ibdknox: I also imagine once we separate out the backends, people can avoid loading the emitters.

14:24 ibdknox: dnolen: 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:24 ijt: dnolen: 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:25 dnolen: ijt: raph_amiard has started but it's a GSoC project, so probably late August.

14:26 ijt: actually make it the CLJS pluggable will probably land sooner, we want to keep things simple for raph_amiard.

14:26 "making CLJS pluggable" I mean

14:27 ijt: dnolen: 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:28 mengu: fliebel: right now, i am. are you available? )

14:29 dnolen: ijt: yes, "pick your platform"

14:29 ibdknox: do you want to shed some light on the :children issue?

14:29 ibdknox: what exactly is convenient / not convenient about it?

14:29 ibdknox: I haven't been consuming the analyzer results beyond the CLJS compiler so I don't see the issues clearly.

14:29 jonasen: dnolen: ibdknox: I'd like to hear that too..

14:29 ibdknox: dnolen: the idea is really nice, you should be able to traverse the tree without having to know how each node stores its children

14:30 dnolen: the problem comes from keeping duplicate nodes in sync

14:30 dnolen: I was looking at how the python AST stuff handles this

14:31 jonasen: my 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:32 dnolen: ibdknox: so are you saying currently :children duplicates information?

14:32 cshell: sadger: Sadger, you can look at one of the responses here http://bit.ly/IfVvel for your answer.

14:32 ibdknox: dnolen: yes

14:32 jonasen: right now it stops when reaching an :fn

14:32 ibdknox: jonasen: we should just implement a visitor for the tree

14:32 jonasen: or something visitor-like

14:33 sadger: cshell: I think that uses the old lein.javac library which is now merged with lein

14:33 cshell: I have an idea now I can try let me see..

14:33 jonasen: ibdknox: it's easy to do with a multimethod

14:33 ibdknox: jonasen: yep :D That's my suggestion

14:33 dnolen: basically children is inconsistent and duplicates information

14:34 dnolen: ibdknox: so what's convenient about it?

14:34 ibdknox: dnolen: it almost lets you walk the whole tree without knowing anything :)

14:34 dnolen: ambrose's does

14:35 dnolen: ibdknox: would it be any less convenient with a children multimethod?

14:35 ibdknox: dnolen: not at all

14:35 dnolen: that seems the best solution to me

14:36 dnolen: jonasen: ibdknox: k, if someone puts together a patch removing children and extracting it out into a multimethod, I'll happily assess.

14:36 ibdknox: python's AST stuff is really nice actually

14:36 dnolen: my only concern would be performance - but I suspect it won't make much of a difference perf wise.

14:36 ibdknox: it's not something we should copy exactly by any means

14:36 jonasen: dnolen: I've already started :D

14:36 dnolen: jonasen: great!

14:37 ibdknox: but doing things like collecting all the defs out of the tree is unbelievably trivial

14:41 faust45: hi guy's

14:42 ibdknox: dnolen: 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:43 dnolen: ibdknox: yeah I've noticed.

14:43 jonasen: ibdknox: yes, it gets huge! But most of it is the environment

14:44 dnolen: ibdknox: jonasen: funny enough I don't think the compiler ever actually uses :children

14:45 ibdknox: dnolen: it was added for convenience I think, the compiler has to know how to traverse each node type

14:45 jonasen: ibdknox: at least in CLJS. Ambrose's analyze doesn't really have a useful :env, so there all you see is :children :D

14:45 ibdknox: jonasen: yeah, I've been using his the most, but I would much rather work with the CLJS one

14:45 dnolen: ibdknox: but the compiler doesn't actully traverse w/ :children

14:46 ibdknox: dnolen: yeah, that's what I'm saying it was there for convenience for folks like us

14:46 dnolen: though it turns out to not be that convenient

14:46 dnolen: ibdknox: oh yeah, yes.

14:47 ibdknox: which means no performance hit to change to multimethods :)

14:47 ibdknox: dnolen: hah, right. :)

14:47 faust45: just have a question

14:48 how i can do in clojure this:

14:48 new HttpResponseInterceptor[] {

14:48 new ResponseDate(),

14:48 new ResponseServer(),

14:48 new ResponseContent(),

14:48 new ResponseConnControl()

14:48 }

14:48 i mean this https://friendpaste.com/4OzVMOWaDnAnFhUten2Cbi

14:50 how i can initialize java array in clojure?

14:51 is it possible?

14:51 Bronsa: ,(object-array 23)

14:51 clojurebot: #<Object[] [Ljava.lang.Object;@70e83a>

14:52 joegallo: ,(doc int-array)

14:52 clojurebot: "([size-or-seq] [size init-val-or-seq]); Creates an array of ints"

14:53 joegallo: oh, okay, let's see what that does...

14:53 ,(int-array 5)

14:53 clojurebot: #<int[] [I@1f4f5d0>

14:53 joegallo: hmmm... that doesn't print well, let's try something else.

14:53 ,(seq (int-array 5))

14:53 clojurebot: (0 0 0 0 0)

14:53 joegallo: ah, okay, that prints better then.

14:53 ,(seq (int-array 5 3))

14:53 clojurebot: (3 3 3 3 3)

14:53 faust45: for instance i need write in clojure this java code https://friendpaste.com/4OzVMOWaDnAnFhUten2C3W

14:53 joegallo: ah, so that's what it must mean by init-val.

14:53 faust45: how i can do that?

14:53 joegallo: ,(seq (int-array 5 [1 2 3 4 5]))

14:53 clojurebot: (1 2 3 4 5)

14:54 joegallo: and i guess that's what i means by seq...

14:54 ,(doc into-array)

14:54 clojurebot: "([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:55 joegallo: ,(seq (into-array java.util.Date [(java.util.Date.) (java.util.Date.)]))

14:55 clojurebot: (#inst "2012-04-28T18:46:28.153-00:00" #inst "2012-04-28T18:46:28.153-00:00")

14:55 joegallo: the seq, of course, is just so it prints nicely here.

14:59 dnolen: cjfrisz: one question, any particular reason you are using refs?

14:59 cjfrisz: don't you just need something settable?

14:59 sadger: hmm still a bit lost, right, when I call "lein javac" where does it look for files?

15:06 stirfoo: http://www.4clojure.com/problem/95 -- Is the 6th test correct?

15:07 cjfrisz: dnolen: There wasn't a particular

15:07 dnolen: Rich Hickey pointed me to atoms, which I already made that change

15:07 I think it's in the master branch now

15:07 dnolen: cjfrisz: ah, so the README is out of date.

15:08 cjfrisz: I would change. refs are really heavy weight.

15:08 cjfrisz: dnolen: So it seemed

15:08 dnolen: cjfrisz: as a Clojure programmer if I saw you were using those under the hood I'd spit my coffee.

15:08 faust45: if i need to define array of java objects how i can do that?

15:08 cjfrisz: dnolen: I did some time tests on them last week and was amazed at how slow they were

15:09 dnolen: cjfrisz: they need to be transactional and all.

15:09 xeqi: stirfoo: yes, if the right child is an node representing an empty tree

15:09 cjfrisz: dnolen: Right. I'm glad to have some direction on this stuff now.

15:09 dnolen: Years of Scheme and some Emacs Lisp only takes me so far.

15:11 dnolen: cjfrisz: yeah I would update the README so folks don't scratch their heads when they come to your repo.

15:14 stirfoo: xeqi: ohhh... thanks

15:15 faust45: (make-array Object n) ?

15:15 faust45: stirfoo: thanks

15:25 cjfrisz: dnolen: I managed to get my commits mixed up between computers, but both the code and README reflect that there are no more refs

15:26 dnolen: cjfrisz: you still need to remove dosync

15:26 cjfrisz: dosync is only for transactions

15:27 cjfrisz: dnolen: I didn't know that. I will make that change right away

15:31 dnolen: Whoa...I need to do more testing, but I think that just bumped the speed of the emitted code by quite a lot.

15:34 dnolen: cjfrisz: yep

15:40 mengu: what does #{\z \a} mean?

15:40 where i can learn about this syntax?

15:40 xeqi: the set with z and a characters

15:42 http://clojure.org/reader

15:45 * dnolen is hot on the trail of dog slow rest fns in CLJS

15:50 mengu: xeqi: thanks. another question: is (#{\z \a} \a) looking for if \a in that set?

15:51 xeqi: &(#{\z \a} \a)

15:51 lazybot: ⇒ \a

15:51 Raynes: Yes.

15:51 xeqi: &(#{\z \a} \c)

15:51 lazybot: ⇒ nil

15:51 xeqi: yes

15:51 mengu: interesting

15:52 now everything makes sense. after 6 hours i finally understood this code:

15:52 http://pastebin.com/apueKjbw

15:52 the index-filter function especially.

15:53 so "(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:54 xeqi: maps idx and elt to each element in the collection

15:54 binds is probably the better term there

15:55 mengu: okay, that's better

16:00 faust45: i try use into-array fun https://friendpaste.com/4OzVMOWaDnAnFhUtemtVtJ but fail with error

16:00 CompilerException java.lang.IllegalArgumentException: array element type mismatch, compiling:(http.clj:39)

16:00 can any one help me

16:00 ?

16:07 xeqi: faust45: use (def headers [(ResponseDate.)])

16:08 &'(ResponseDate.)

16:08 lazybot: ⇒ (ResponseDate.)

16:09 faust45: xeqi: thanks, its works, but why?

16:09 xeqi: &(class '(ResponseDate.))

16:09 lazybot: ⇒ clojure.lang.PersistentList

16:10 xeqi: because '(ResponseDate.) returns a list of a symbol ResponseDate.

16:10 where the vector one calls the ResponseDate. constructor

16:11 useing (list (ResponseDate.)) should also work

16:11 faust45: xeqi: but '((ResponseDate.)) not working too

16:11 &'((ResponseDate.))

16:11 lazybot: ⇒ ((ResponseDate.))

16:12 faust45: &[(ResponseDate.)]

16:12 lazybot: java.lang.IllegalArgumentException: Unable to resolve classname: ResponseDate

16:12 xeqi: '((ResponseDate.)) returns a list with an element of a list with an element of the symbol 'ResponseDate.

16:13 faust45: xeqi: oh

16:15 xeqi: but how i can add more elements in this case? (list (ResponseDate.))

16:15 xeqi: &(list 1 2 3 4)

16:15 lazybot: ⇒ (1 2 3 4)

16:16 faust45: xeqi: thanks

16:26 hcumberdale: I'm back

16:27 cshell: welcome back

16:29 hcumberdale: cshell, how are you?

16:30 creese: I need some help with calling java from clojure. I'm still getting an exception.

16:30 hcumberdale: is there a parallel IO Mapping lib for clojure? Like that thing from widefinder2

16:31 creese: can not access a member of class com.name.game.Game with modifiers \"public\",

16:31 hcumberdale: creese, https://refheap.com

16:31 clj_newb: Hi, what's the difference between defn and defn- ?

16:31 arohner: clj_newb: defn- is private

16:31 hcumberdale: yes, clj_newb

16:31 clj_newb: thank you arohner

16:31 hcumberdale: see documentation: same as defn, yielding non-public def

16:32 clj_newb: &(doc defn-)

16:32 lazybot: ⇒ "Macro ([name & decls]); same as defn, yielding non-public def"

16:32 clj_newb: sorry about missing that!

16:32 hcumberdale: ,(doc defn-)

16:32 clojurebot: "([name & decls]); same as defn, yielding non-public def"

16:32 clj_newb: thank you hcumberdale ç

16:33 hcumberdale: clj_newb what are you working on?

16:33 clj_newb: just learning clojure

16:33 hcumberdale: creese why do you need the java interop?

16:33 Are you using leiningen?

16:34 creese: yes

16:34 clj_newb: as a pet project consuming an http connection and processing what`s come down it with aleph

16:35 creese: This isn't the real code. It's just skeleton that mimics it. The real code is longer.

16:41 hcumberdale: creese seems it is a problem with namespaces

16:41 Raynes: clojure.java.io/do-copy is false!?!?

16:42 creese: What did you have to change to get it to work?

16:42 hcumberdale: https://groups.google.com/forum/?fromgroups#!topic/clojure/oeL8pFr2wa8

16:43 try (def z (.getDeclaredMethod ... (.setAccessible z true)

16:43 Raynes: Er, heh. I mean 'private'. Not sure why I said false.

16:43 I think this heat is getting to me.

16:44 creese: I have commented out. I can't even get the (ns … :import …) to work

16:44 hcumberdale: maybe something is not working with your project structure?

16:44 creese: so the with just the first line, it works for you?

16:45 hcumberdale: you have a structure like / [project.clj ,...] [java] and under java: com/name/game ?

16:46 creese: java/com/name/game/Game.java

16:46 is where the java code is

16:47 project.clj is at the same level as java (the directory)

16:47 hcumberdale: and even the include does not work?

16:47 creese: right

16:47 hcumberdale: lein clean && lein compile

16:47 ?

16:47 creese: I'll try that

16:48 that did it

16:48 do I have to compile before I start the repl?

16:53 is the problem that the instance variables are declared 'final'?

17:03 hcumberdale: maybe creese

17:03 try to change them not to be final and test again

17:04 Why does ring wrap-file-info middleware return "text/html" mimetypes for ".js" files?

17:07 creese: when I remove 'final' it won't even compile

17:09 this is really hit-and-miss

17:10 I got it work this time, but I can't tell you what's different

17:10 but (def game (Game. "test" 2)) still cause an error

17:11 cannot access a member of com.name.game.Game with modifiers "public"

17:20 tmciver: creese: can you post your code to refheap.com?

17:20 creese: https://refheap.com/paste/2428

17:22 tmciver: creese: and you've run 'lein javac' and gotten Game.class in classes/com/name/game?

17:22 creese: what does leon javac do?

17:23 tmciver: creese: compiles your java class

17:24 creese: also, your core file should be in a directory named game_test

17:24 creese: I thought the repl was doing that for me

17:24 it is

17:24 underscore?

17:24 tmciver: yup.

17:24 creese: it is

17:25 how does lein javac differ from lein jar?

17:26 tmciver: 'lein javac' only compiles java classes; 'lein jar' creates are jar of all your code (and it probably calls javac too)

17:28 creese: that doesn't seem to make a difference

17:29 hcumberdale: but lein javac does not write out error messages?

17:29 tmciver: creese: give me a sec, I'll try to reproduce this

17:38 creese: I got it

17:38 the java class needs to be declared 'public'

17:38 hcumberdale: creese, what was the problem?

17:38 awwwww!!

17:38 creese: or I can't get at it from clojure

17:39 hcumberdale: if it's not scope is package

17:39 java default scope is package. damn

17:39 creese: what does that mean?

17:39 hcumberdale: there are different levels of isolation

17:39 creese: you have to be in the same package to use it?

17:39 hcumberdale: public, package, private, protected

17:39 yes! creese

17:40 package scope is default in java (public in groovy)

17:40 creese: which can only be another java class

17:40 hcumberdale: And so you have to be in the same package or declare a class as public

17:40 ne creese

17:40 I think a clojure class can also be in the same package

17:40 tmciver: creese: 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:40 hcumberdale: if the clojure namespace corresponds with it

17:41 tmciver: I recall having to this for another project recently.

17:41 hcumberdale: yes creese, I've only found java-source-path in my project.clj

17:41 tmciver: to do*

17:41 hcumberdale: don't know where you found "paths"<< lein2?

17:41 creese: yeah, lein 2

17:41 hcumberdale: ahh!

17:41 creese: which is what I have

17:41 not sure it this is a new syntax?

17:41 hcumberdale: Is there a nice way to pretty print a incoming HTTP Request?

17:42 I've the output as map, but it is ugly to see it without idention

17:42 creese: tmciver: do you think I need to change the java source line?

17:42 wkmanire: Howdy folks.

17:42 tmciver: hcumberdale: have you tried clojure.pprint/pprint?

17:42 hcumberdale: nop

17:43 tmciver: creese: not if it works for you. It must be a lein2 thing; I'm still using lein1

17:43 hcumberdale: yes, I am also using lein1

17:43 creese: I'm going to try changing my ns so its the same as the java package

17:43 tmciver: creese: but I also made the java class public.

17:43 creese: right

17:43 hcumberdale: cause lein2 ever uses another env var to check if no snapshots are used for my build

17:43 ;)

17:44 creese: thanks, folks

17:44 hcumberdale: I 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:45 nice clojure.pprint/pprint returns "nil"

17:47 wkmanire: How do I mock a function for the scope of a unit test?

17:48 I have a function that uses slurp and I just want to assert it is called with the correct file name.

17:49 pandeiro: how would i coerce a string to a boolean?

17:50 "true" -> true and "false" -> false i mean

17:51 hcumberdale: Ahhh pprint does directly IO

17:51 is there a pprint that only returns the pretty structure?

17:51 so I can use it with existing logging framework functionality?

17:52 pandeiro: hcumberdale: (with-out-str (pprint ...)) i think is what you're after

17:52 wkmanire: pandeiro: (if (= "true" "true") true false) ?

17:53 You 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:53 pandeiro: wkmanire: works but was hoping for a better way

17:53 actually since this is form data from an http request, i may just pass it to boolean

17:54 a checked check-box in noir/ring has a value of "true" instead of the boolean

17:54 but unchecked is nil

17:54 tmciver: pandeiro: ##(Boolean "true")

17:54 lazybot: java.lang.RuntimeException: Expecting var, but Boolean is mapped to class java.lang.Boolean

17:54 wkmanire: Really?

17:54 tmciver: pandeiro: ##(Boolean. "true")

17:54 lazybot: ⇒ true

17:54 wkmanire: I haven't started messing with noir yet.

17:54 pandeiro: tmciver: why not just (boolean "true")

17:54 ?

17:55 (i don't know the advanced reader syntax)

17:55 tmciver: pandeiro: oh, that does seem to work

17:55 pandeiro: oops, no it doesn't

17:55 ##(boolean "false")

17:55 lazybot: ⇒ true

17:56 tmciver: pandeiro: looks like (boolean ...) is coercing nil and false to false and everything else to true.

17:56 pandeiro: tmciver: yeah but my case is that there will either be a "true" string or nil, so (boolean ...) is fine

17:57 hcumberdale: Is there a way to "pipe" a input stream to an output stream?

17:57 tmciver: pandeiro: ah, good then.

17:57 wkmanire: pandeiro: I think that answers the question as to why Noir ring works the way it does with checkboxes then.

17:57 hcumberdale: I want to read from the servlet input stream and write directly to amazon s3

17:57 pandeiro: wkmanire: about mocking functions, there's a chapter on it in _Clojure in Action_

17:58 wkmanire: hmm, not sure a boolean wouldn't be more useful

17:59 if 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:07 hcumberdale: ??

18:07 lazybot: hcumberdale: Definitely not.

18:07 hcumberdale: is anyone into streams & clojure?

18:15 wkmanire: So clojure.contrib used to be one big package, but it has been split up into many different modules?

18:15 Is that correct?

18:15 cshell: yes

18:15 wkmanire: I want to use the mock library

18:15 What do I need to add to my project.clj?

18:17 cshell: not sure, sorry

18:27 jimi_hendrix: what is the best way to break out of a while?

18:27 i noticed there is no analog of a break statement

18:29 xeqi: ~contrib

18:29 clojurebot: Monolithic 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:30 wkmanire: xeqi: Thanks.

18:30 emezeske: jimi_hendrix: You could throw an exception, but it might be worth considering a different approach to your problem than while

18:31 xeqi: for mock, it looks like no one has taken over maintainership to pull it out

18:31 wkmanire: Really?

18:31 Is it uncommon to use mocks for unit testing in clojure?

18:32 I was looking at the API and it seems to be exactly what I want.

18:32 xeqi: I know midje will do that

18:32 and its not hard to use either (binding [..] ..) or with-redefs

18:32 raek: jimi_hendrix: in this case, it's probably better to use manual iteration rather than 'while'

18:33 emezeske: wkmanire: I highly recommend midje, it makes mocking ridiculously easy

18:33 wkmanire: emezeske, xeqi: Thanks.

18:34 raek: that is, (loop [...] (if <loop-condition> <expression-to-be-returned> (recur ...)))

18:36 emezeske: raek: Without knowing what jimi_hendrix is trying to do, who knows what's best?

18:37 raek: 'while' is not one of the primitive looping constructs. it's just a shorthand useful for certain control flows

18:37 yoklov: jimi_hendrix: while isn't really idiomatic, i'd follow raek's suggestion if you need to break.

18:37 raek: if you need to break, then your control flow does not fit what while offers

18:38 yoklov: not unless clojure gets continuations :p

18:38 * yoklov can dream

19:08 hcumberdale: awwwwww

19:08 WARNING: No content length specified for stream data. Stream contents will be buffered in memory and could result in out of memory errors.

19:15 uvtc: Hi #clojure. Are there any statistics available on how many and which packages lein installs most often?

19:19 wkmanire: uvtc: That'd be interesting to know

19:19 hcumberdale: Ahh uvtc, I was searching for something like this

19:19 I think there are no such statistics

19:20 Even you have not to confirm that statistics are send

19:20 technomancy may add such a feature in the near future?

19:20 uvtc: I 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:21 hcumberdale: yes uvtc! But it also introduces a "everyone uses xyz, I'll do it also regardless if it is good or not"

19:21 content-length << the parameter in my ring header differs from that what is actually in :body

19:21 uvtc: I 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:21 hcumberdale: how to calc how big the input stream in :body actually is?

19:22 req - headers = body ?

19:22 emezeske: uvtc: There is clojuresphere.herokuapp.com, which gives you *some* info about how many people use things

19:22 hcumberdale: uvtc but not everything is just from clojars

19:22 emezeske: uvtc: Unfortunately, it hasn't been updated in FOREVER

19:22 hcumberdale: it will be nice if the new clojars has such a statistics tracking

19:22 uvtc: hcumberdale, Yes, I agree. Though, I think that can be mitigated if there's a package ratings site, like http://cpanratings.perl.org

19:23 weavejester: hcumberdale: Where does your input stream come from?

19:23 hcumberdale: jetty

19:24 Hey weavejester, nice to see you! I'm using your s3 api

19:24 weavejester: hcumberdale: No, I mean, what's generating it? Is it a file or resource?

19:24 hcumberdale: Oh, from S3?

19:25 hcumberdale: weavejester, 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:25 I want to pipe an upload directly to s3

19:25 weavejester: hcumberdale: Ah, you're right, it should be.

19:25 hcumberdale: without storing it in memory

19:25 Apr 29, 2012 1:10:31 AM com.amazonaws.services.s3.AmazonS3Client putObject

19:25 WARNING: No content length specified for stream data. Stream contents will be buffered in memory and could result in out of memory errors.

19:26 weavejester: hcumberdale: Hm… Well, it depends on how it's uploaded. If it's uploaded as a multipart, sometimes the content-length isn't set.

19:26 jimi_hendrix: sorry 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:26 uvtc: emezeske, Yes, thanks for that link. I don't know what the "used by" data means. Will have to take a closer look.

19:26 hcumberdale: So, exaclty this is what I do not want (memory buffering) espc. for attachments bigger than 2gb

19:26 weavejester: hcumberdale: And for some reason, S3 requires a content-length

19:26 hcumberdale: So under some circumstances, I think you have to buffer. I could be wrong, though.

19:26 hcumberdale: mhhh, it feels wrong

19:26 I have a header value clength

19:27 INFO cblog.media - clength? 30958 = 29301

19:27 but it does not seem to be the length of the body

19:27 second is a slurp (:body req)

19:27 content-length seems to be the overall length

19:28 maybe the headers are exactly that difference

19:28 ,(- 30958 29301)

19:28 clojurebot: 1657

19:29 hcumberdale: I'll check it

19:30 is it possible to provide the length of the stream in your API ?

19:32 weavejester: hcumberdale: Well, a stream from a HTTP request can have a content length header

19:32 hcumberdale: But… if there's gzip encoding, I think the content-length is the zipped size, IIRC

19:32 hcumberdale: And not all requests need to have a content-length

19:33 hcumberdale: So there's no foolproof way of telling how large a request is.

19:33 jimi_hendrix: so, does anyone have advice for that situation?

19:34 hcumberdale: in which situation is a content-length attribute missing?

19:34 weavejester: hcumberdale: Oh, it looks like you can use S3's multipart upload functionality to do it.

19:34 hcumberdale: Multipart uploads, I believe

19:34 emezeske: jimi_hendrix: I see. You might want to look into loop/recur, and just don't call recur if message_says_quit.

19:35 tmciver: jimi_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:35 weavejester: hcumberdale: But currently the aws-clj-s3 library doesn't support multipart uploads

19:35 hcumberdale: wavejester, I'm using https://github.com/valums/file-uploader

19:35 So I know that i do not miss the content-length attribute

19:35 mmarczyk: jimi_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:36 jimi_hendrix: emezeske, good idea

19:36 tmciver, reading lines from a socket via BufferedReader

19:36 oh misread your question

19:37 yeah

19:37 mmarczyk, what is @continue?

19:38 hcumberdale: weavejester, are you going to add support multipart upload in aws-clj-s3?

19:38 mmarczyk: jimi_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:39 jimi_hendrix: i see

19:39 mmarczyk: jimi_hendrix: not saying this is better than an explicit loop/recur, just another option.

19:39 jimi_hendrix: what exactly does that @ do?

19:39 mmarczyk: shorthand for deref, reads value of a reference type

19:39 see (doc deref) at the repl

19:40 weavejester: hcumberdale: Probably at some point, but patches are welcome :)

19:42 hcumberdale: weavejester and if I know the size of the request there is no way to handle it by aws-clj-s3, right?

19:42 => size of the :body

19:42 weavejester: hcumberdale: If you know the size you can just pass it in as metadata

19:42 hcumberdale: The problem is that normal S3 uploads require a content-length, and that streaming uses a different API

19:43 hcumberdale: But if you know the content-length, everything's fine.

19:43 hcumberdale: (defn put-object << [cred bucket key value]

19:43 add things to value?

19:45 put-object << where to pass the metadata?

19:45 weavejester: hcumberdale: Hm, oh, I thought there was a metadata argument in put-object… but maybe I was wrong.

19:46 hcumberdale: Again, patches are welcome :)

19:47 hcumberdale: I do not know how to add it ;(

19:47 I'm not experienced with the s3 api

19:51 weavejester: hcumberdale: I'll likely need to add in support for S3 uploads for my own projects

19:51 hcumberdale: yeah!

19:51 weavejester: hcumberdale: So I'll work on the problem tomorrow and see if I can't get metadata on put-object at least.

19:52 hcumberdale: thx! I'll try to get the correct size of "content-length"

19:52 Is there a way to forbid gzip?

19:52 It is maybe expensive for a browser to gzip 2gb and more?

19:53 yoklov: is there still no clj->js in clojurescript?

19:53 :/

19:54 weavejester: hcumberdale: Not sure… I don't know whether gzip applies to uploads.

19:54 hcumberdale: I know how it works when receiving a response. I'd have to look up how uploads operate

19:56 jimi_hendrix: also, can cond only execute one call per condition?

19:57 or am i missing something

19:57 mmarczyk: yoklov: 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:57 emezeske: jimi_hendrix: You probably want (do (x) (y) (z))

19:57 jimi_hendrix: ah yes

19:57 mmarczyk: yoklov: worth discussing on the dev list probably

19:58 jimi_hendrix: i didnt see a do in the clojure core

19:58 yoklov: mmarczyk: symbols/keywords being strings is an implementation detail

19:58 but you're right, there are definitely issues wrt what is the "right" thing to do for it

19:59 mmarczyk: yoklov: an implementation detail, so we should pretend they're not strings and throw?

19:59 yoklov: or the opposite? :-)

19:59 yoklov: mmarczyk: call (name) on them

20:00 mmarczyk: yoklov: an document {"foo" 1 :foo 2} as asking for trouble?

20:00 ^and

20:00 yoklov: hm

20:00 yeah, probably

20:00 it's a hard problem

20:01 but 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:02 hm

20:02 mmarczyk: I 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:02 agreed on that one

20:03 I 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:03 hcumberdale: (count does not seem to work well on binary things

20:03 mmarczyk: on 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:03 yoklov: haha, so we're waiting for the One True cljs.core/clj->js Implementation

20:04 kovasb: yes its certainly something that gets reimplemented over and over

20:04 there was talk of js object / array literals

20:04 which would help some

20:05 yoklov: kovasb: the syntax for their creation improved

20:05 kovasb: yoklov: what is the new syntax? i think i missed that

20:05 mmarczyk: oh 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:06 kovasb: the web gods

20:06 yoklov: kovasb: oh, just that js-obj can take args, i think. maybe something else too?

20:07 also you can use doto on them now better.

20:07 gtoast: How would I "use" just the sqrt symbol from the clojure contrib library from within an ns declaration?

20:07 mmarczyk: yeah, js-obj takes args and is backed by a compiler macro to which produces JS literals in the non-higher-order case

20:08 gtoast: (:use [lib-name :only [var-name ...]])

20:09 gtoast: w/ Clojure 1.4 also (:require [lib-name :refer [var-name ...]])

20:09 ^which produces

20:10 yoklov: gtoast: also clojure contrib is deprecated

20:10 ~contrib

20:10 clojurebot: Monolithic 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:11 gtoast: mmarczyk: This is what I'm using now: (:use [clojure.contrib.math :only [sqrt]])

20:11 hcumberdale: ,(- 59993 56550)

20:11 clojurebot: 3443

20:11 mmarczyk: gtoast: you should probably switch to https://github.com/clojure/math.numeric-tower

20:11 hcumberdale: ,(- 30958 29301)

20:11 clojurebot: 1657

20:11 mmarczyk: gtoast: because of what yoklov says

20:11 gtoast: otherwise your :use syntax is fine

20:12 creese: how can I convert a clojure string to a java character?

20:12 hcumberdale: ,(/ 59993 56550)

20:12 clojurebot: 59993/56550

20:12 yoklov: ,(first "f")

20:12 clojurebot: \f

20:12 mmarczyk: creese: you mean take the first character of a string? (first "asdf"), (nth "asdf" 0), (.charAt "asdf" 0)

20:12 yoklov: ,(type (first "f"))

20:12 clojurebot: java.lang.Character

20:12 yoklov: darn

20:12 ,(type (.charValue (first "f")))

20:12 clojurebot: java.lang.Character

20:12 yoklov: hm

20:13 i wonder if type always returns a class

20:13 ,(char? (first "f"))

20:13 clojurebot: true

20:13 creese: I have a java function that only accepts characters

20:13 yoklov: yeah, just call first on it

20:13 if it's a string

20:13 creese: ok

20:13 mmarczyk: yoklov: no, it prefers :type metadata if present

20:14 &(type ^{:type "asdf"} {})

20:14 lazybot: ⇒ clojure.lang.PersistentArrayMap

20:14 mmarczyk: !?

20:14 clojurebot: CLABANGO!

20:14 mmarczyk: not sure what lazybot is up to, but that looks different at my repl :-P

20:15 my 1.4.0 repl, just to be clear

20:15 &(type (with-meta {} {:type "asdf"}))

20:15 lazybot: ⇒ "asdf"

20:15 mmarczyk: oh good.

20:19 hcumberdale: (* 100 (/ 59993 1024))

20:19 ,(* 100 (/ 59993 1024))

20:19 clojurebot: 1499825/256

20:30 jonny_: Hey, I'm trying to use clj-record and I'm getting this exception: No suitable driver found for jdbc:mysql

20:30 anybody know why that is?

20:35 wkmanire: How I kill the slime-repl from emacs?

20:36 netrino: jonny_: maybe you should add mysql as a dependency

20:36 jonny_: that's a good idea

20:36 not sure how to do that though

20:37 wkmanire: nvm

20:39 creese: , 'quit'

20:39 clojurebot: quit'

20:41 jonny_: netrino: Would you be able to tell me how to add mysql as a dependency?

20:41 I'm pretty lost here

20:41 yoklov: creese: strings use double quotes

20:42 otherwise you're just quoting the next form. 'form becomes (quote form) during reading

20:42 ibdknox: jonny_: jdbc requires a driver for whatever database you're using

20:43 if you look up mysql jdbc driver you'll likely find the thing you need

20:43 creese: the person asking how to kill the slime repl

20:43 comma 'quit'

20:43 yoklov: oh, haha

20:43 ibdknox: jonny_: then you'll add that in your project.clj

20:43 jonny_: btw, you might want to look at Korma instead of clj-record: http://sqlkorma.com

20:43 muhoo: so 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:43 creese: I can't figure out how to cast my string so the java function will take it

20:43 java.lang.String cannot be cast to clojure.lang.IFn

20:44 ibdknox: muhoo: dependencies

20:44 muhoo: thx

20:44 yoklov: creese: is the string one character?

20:44 err

20:44 creese: not this time, now its more than one

20:44 yoklov: and you only wnat to use the first one?

20:44 creese: no, I want to send them all

20:44 netrino_: 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:44 yoklov: creese: as what sort of data structure

20:45 jonny_: ibdknox: thanks for heads up on Korma! I'll definitely check that out

20:45 netrino_: Okay, I'll try that

20:47 yoklov: ,(every? char? (char-array "foo"))

20:47 clojurebot: true

20:47 jonny_: netrino_: Yaayy! it totally worked! thanks so muhc

20:47 Super easy once you know what to do

20:48 though I wonder why this was never mentioned on java.jdbc or clj-record

20:49 idbknox: oh wow, korma looks really awesome. definitely going to be using that instead

20:49 oh, and look at that. you seem to be the creator. awesome work!

20:50 muhoo: hmm https://refheap.com/paste/2431

20:50 wkmanire: Every 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:50 muhoo: ack

20:50 neveermind

20:50 wkmanire: :D Happy saturday folks.

20:51 creese: yoklov: the java function expects a string, but it's not getting one. It's getting a clojure.lang.IFn (whatever that is)

20:51 yoklov: a function

20:51 netrino_: jonny_: your welcome. well, i think it's expected behavior of the user - satisfy all the dependencies

20:52 yoklov: creese: https://refheap.com/paste

20:52 sounds 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:52 creese: I know

20:55 jonny_: 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:56 muhoo: although, it's kind of getting annoying to get org.apache.maven:super-pom:pom:2.0

20:56 errors all the time

20:59 creese: https://refheap.com/paste/2432

20:59 mmarczyk: creese: you need to remove the parens around w

20:59 in (GuessWord. (w))

21:00 creese: because I sent it a list with a string inside

21:00 thats what I get for cut and paste

21:00 \]

21:01 yoklov: creese: sorry if this comes off as pedantic, but you put parentheses around something when its a function which you want to call

21:01 creese: yeah, someone else just told me…

21:02 yoklov: creese: sorry then

21:02 netrino_: 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:03 jonny_: ahhh, yeah, that does make sense

21:13 wkmanire: I just looked over the features for midge.

21:13 midje

21:13 bleh, looks great.

21:13 I didn't see a code coverage tool however.

21:13 Is there one for clojure?

21:19 jonny_: wkmanire: have you checked out https://github.com/technomancy/radagast

21:20 wkmanire: jonny_: Poifect!

21:20 jonny_: great!

21:31 felideon: in 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:32 i.e. i get an error "Unable to resolve symbol: defentity in this context"

21:32 wkmanire: felideon: Use require for clojure stuff or import for java stuff.

21:32 You can also use :use, but I would be careful with that because it puts everything in the same scope.

21:32 felideon: (require 'myproject.foo :reload :verbose)

21:32 Load everything from that namespace and show me as you do it.

21:34 felideon: so e.g. https://github.com/ibdknox/korma.incubator/blob/master/src/korma/incubator/schema.clj

21:34 wkmanire: felideon: 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:35 * felideon reads it

21:36 beffbernard: felideon: Do you just want to eval functions in the namespace in the repl?

21:36 felideon: yes

21:36 beffbernard: Just change the namespace

21:37 This is what I do

21:37 M-x clojure-jack-in

21:37 Once it's loaded

21:37 C-c C-k

21:37 to compile the file

21:37 C-c M-p to change the namespace in the repl

21:37 C-c C-z to switch to the repl

21:37 * wkmanire learns avidly.

21:38 felideon: beffbernard: ah, that's what i needed :)

21:38 beffbernard: felideon: NP

21:38 also: https://github.com/technomancy/swank-clojure

21:38 the commands I mentioned are there

21:39 felideon: yeah, C-c C-k didnt occur to me

21:39 but what if it was multiple files?

21:39 how do you compile the project from the REPL

21:39 beffbernard: The whole project?

21:39 felideon: yeah

21:40 wkmanire: beffbernard: Thanks for the pointers. That looks like a much better work cycle than what I was doing.

21:40 beffbernard: Not sure about the whole project thing but I've never had to worry about it

21:41 If I'm working in a different file, I just compile that file and change the ns

21:41 felideon: in lisp I use asdf:load-op or more commonly, require, or more recently, quickload.

21:41 beffbernard: also in the reply you can (ns user)

21:41 s/reply/repl/

21:42 wkmanire: Can lein rename my project?

21:42 I named my project address_book and am regretting it.

21:42 I want to change it to addressbook

21:42 xeqi: wkmanire: nope

21:43 wkmanire: xeqi: 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:44 beffbernard: wkmanire: or change the name in project.clj and change the structure appropriately in src/

21:44 wkmanire: okeydokey.

21:44 xeqi: I'd just manually move it like beffbernard mentions

21:45 wkmanire: Gonna have some git fallout to deal with too.

21:45 :/

21:45 xeqi: or try and make find, rename, and sed to do it

21:45 but that would take longer

21:45 beffbernard: wkmanire: re git.. git add .; git add -u .

21:46 the -u flag will pick up the deleted files

21:48 felideon: beffbernard: so for instance, the file i compiled depends on a different project/namespace

21:49 wouldn't i need to load that entire project?

21:50 beffbernard: felideon: I don't know the internals of swank-clojure but I'm sure someone else can give you an accurate answer

21:50 but if it's defined in project.clj, I would think lein will take care of that for you

21:51 xeqi: felideon: if you do a C-c C-k it will pull in the transative dependencies of that file

21:52 wkmanire: xeqi, beffbernard: That turned out to be pretty easy thanks to you two.

21:52 felideon: xeqi: https://github.com/ibdknox/korma.incubator/blob/master/src/korma/incubator/schema.clj

21:52 if i C-c C-k that file, and then try to eval the defentity form,

21:53 i get Unable to resolve symbol: defentity in this context

21:54 xeqi: what namespace are you in?

21:54 wkmanire: back in a few

21:54 xeqi: ah

21:55 because that is in a comment the file you loaded doesn't have to require that function

21:56 prolly easiest to (use 'korma.core) in that namespace.. I think

21:56 felideon: so even though korma.core is 'used' at the top

21:56 it doesnt load all of core's symbols?

21:56 xeqi: it is (:use .. :only [..])

21:56 wkmanire: back

21:56 xeqi: the :only means only bring in these functions

21:56 felideon: ohh

21:57 if :only I had seen that

21:57 (da dum psh)

21:58 wkmanire: felideon: CompilerException java.lang.RuntimeException: Unable to resolve symbol: da in this context, compiling:(NO_SOURCE_PATH:1)

21:58 felideon: yay

22:06 muhoo: where's an idiomatically clojure-ish place to store global things like db handles, etc?

22:06 @projectname.core/someatom ?

22:08 xeqi: korma uses (defonce _default (atom nil)), clojure.java.jdbc uses (def *db* {..})

22:08 so that looks like an ok place to me

22:08 muhoo: thanks

22:09 and from different ns's, i'd do somens/*db* ?

22:12 xeqi: does it make sense to be used from multiple namespaces

22:12 or should the functions that want it live in the same namespace

22:13 and those be called from elsewhere?

22:13 muhoo: there are lots of ns'es that'll need to hit the db

22:13 example, in a web app, all the model/foo.clj will need to hit the same global database

22:13 felideon: do you guys call it 'lisping' when hacking in clojure?

22:14 muhoo: so in some cases the ns'es are broken up by different functions rather than whether or not they are doing db io

22:16 xeqi: you can access it as any other var in a namespace using use/require

22:17 muhoo: that's even better. (:use appname.dbstuff :only *db*]) etc

22:18 xeqi: (.. :only [*db*])

22:20 yoklov: hm

22:20 why isn't the reader syntax for regexs implemented in cljs?

22:20 mmarczyk: yoklov: 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:21 yoklov: it is, with the caveat that there are some issues due to the fact that Java regexes support different flags to JS regexes

22:21 yoklov: mmarczyk: taking a look

22:21 mmarczyk: yoklov: great, thanks

22:21 yoklov: and oh, for some reason i thought it wasnt

22:24 mmarczyk: yoklov: I'll be doing some jsPerf tests sometime soon, but it would be great to have some real-world impressions

22:25 yoklov: yeah, 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:28 mmarczyk: cool

22:38 lynaghk`: yoklov, mmarczyk: have either of you written anything to deal with mapping over large collections in cljs?

22:39 yoklov: lynaghk`: deal in terms of? performance?

22:39 lynaghk`: e.g., like in JS how you'd use setTimeout to yield control so the UI doesn't lock up

22:39 yoklov: oh

22:39 no

22:39 lynaghk`: and/or something with webworkers to actually spin up a new thread

22:39 mmarczyk: no

22:39 lynaghk`: I looked around Google Closure and didn't see any helpers for that proble

22:39 yoklov: i'd still use setTimeout

22:40 lynaghk`: 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:41 mmarczyk: yieldmap, sounds good

22:41 yoklov: yeah, or see if I can do it fast enough to not cause a noticable delay

22:41 by using some arrays or something

22:41 lynaghk`: yoklov: yeah, that was approach one---I'm working on a half-baked profiling library to figure out what part is actually slow

22:41 mmarczyk: seems like it could be a nice addition to cljs

22:42 yoklov: lynaghk: in my experience, since you said mapping, i'd suspect seqs

22:43 lynaghk`: yoklov: The actual iteration over the seq is the slow part (we're talking a few dozen entries), it's the calculation

22:43 yoklov: i see

22:43 lynaghk`: https://github.com/lynaghk/c2/blob/master/src/cljx/c2/geo/core.cljx

22:44 yoklov: cljx? weird.

22:44 felideon: whoa

22:44 why are docstrings before function args

22:44 lynaghk`: 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:44 yoklov: yeah, that's a hack to do clojure/clojureScript code sharing.

22:45 yoklov: mmarczyk: alright, just got it to build with new cljs, should i try it out on advanced compilation or standard?

22:45 mmarczyk: yoklov: advanced, I guess

22:45 lynaghk`: felideon: isn't that typically how they're done?

22:46 yoklov: lynaghk`: weird, inner defs?

22:47 sandaemc: Is there away I can color what is print to STDOUT from Clojure?

22:47 lynaghk`: yoklov: I think they're nicer than using lets to name functions.

22:47 yoklov: lynaghk: 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:47 felideon: lynaghk`: not in common lisp, but i found the reason why

22:47 yoklov: lynaghk`: yeah but they aren't equivalent

22:48 lynaghk`: yoklov: what's the difference?

22:48 yoklov: lynaghk`: defs are always top level, though it doesn't seem to make a difference

22:48 for your use case

22:48 but if you had a toplevel (polygon-area) that was different than the one inside area, it'd be clobbered when you called area

22:49 lynaghk`: yoklov: ah. yeah, that could be trouble in the future. Thanks for the tip.

22:49 yoklov: np

22:50 lynaghk`: 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:51 yoklov: oh

22:51 you're doing str?

22:51 str is painfully slow

22:51 lynaghk`: yeah, the function I'm using in this file is geo->svg, which takes an array of coordinates and returns an SVG string

22:52 yoklov: yeah, its probably worth swapping that out with (.join … "") if it doesn't break things

22:53 lynaghk`: yoklov: hmm. I'll definitely look into that, thanks.

22:54 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:54 wkmanire: This exception is throwing me "lib names inside prefix lists must not contain periods"

22:54 I know it has to do with my ns call, what should I be looking to correct?

22:55 yoklov: lynaghk`: right, especially when a lot of this stuff is getting faster

22:55 mmarczyk: wkmanire: stuff like (:require (clojure [java.io :as io]))

22:56 wkmanire: https://refheap.com/paste/2433

22:56 mmarczyk: wkmanire: which would need to become (:require (clojure.java [io :as io]))

22:57 wkmanire: remove the [] from around seesaw.core and addressbook.ui in the second ns, I guess

22:57 lynaghk`: yoklov: do you have any tips for doing profiling?

22:58 mmarczyk: wkmanire: 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:58 lynaghk`: 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:58 yoklov: lynaghk: googles chrome's profiler is awesome

22:59 google*

22:59 firefox's is much less awesome, but i tend to run on both because ff wont be slow on the same parts as chrome

22:59 wkmanire: mmarczyk: Oh! jeese. I didn't even consider that.

22:59 thanks.

22:59 mmarczyk: np

23:00 lynaghk`: 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:00 yoklov: yeah it is

23:00 that means you're using too many seqs.

23:00 lynaghk`: heh

23:00 yoklov: but you can exclude things from the view

23:00 lynaghk`: and just dig up the call stack until I get to my fns?

23:01 yoklov: basically. it'll be more accurate than time.

23:01 try changing it to top down or to bottom up if you can't find your functions

23:02 really though, if it says 50% of your time is in seq, that means you should use map less

23:02 lynaghk`: yoklov: yeah, I'll give it another shot.

23:02 yoklov: seqs in cljs aren't chunked yet (at least, i hope not, i'm banking on them getting faster eventually)

23:03 lynaghk`: 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:04 yoklov: lynaghk`: why not use a real profiler?

23:04 lynaghk`: yoklov: I'm hoping to get C2 to be just one order of magnitude slower than D3 (the JavaScript-inspiration)

23:04 yoklov: I'd like to be able to see (rough) timing data directly on the code

23:05 yoklov: at 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:05 lynaghk`: 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:05 yoklov: not 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:06 lynaghk`: 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:06 yoklov: ah, yeah thats rough

23:06 especially because js and java arrays are so different

23:06 lynaghk`: 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:07 yoklov: you're probably going to have to break code compatibility

23:07 to speed it up

23:07 or use macro magic somehow.

23:07 lynaghk`: yoklov: Since I'm using CLJX I can write totally independent definitions when I need to

23:08 yoklov: you annotate toplevel forms, and it'll include/exclude those forms as appropriate in the platform-specific generated code.

23:08 mmarczyk: http://jsperf.com/cljs-maps-access-4 -- more to come

23:10 yoklov: mmarczyk: cant make it compile on advanced anymore ;_;, i'll let you know about the perf. on normal compilation soon

23:12 mmarczyk: yoklov: :-( do you think it's because of map impl chaos?

23:12 yoklov: mmarczyk: nope just got it to work

23:12 mmarczyk: whew :-)

23:14 and another jsperf test http://jsperf.com/cljs-complex-maps-access-4 -- will post a larger batch later

23:14 yoklov: mmarczyk: well, this is without your patches, actually.

23:14 mmarczyk: so what order should i apply the patches in?

23:15 mmarczyk: yoklov: 213, 190

23:15 yoklov: k

23:19 mmarczyk: hm, seems to be faster

23:19 mmarczyk: yoklov: oh? fantastic!

23:19 yoklov: actually seems to be even faster than the records were

23:19 when i'm using get on them

23:19 but

23:20 maybe same speed

23:20 mmarczyk: well, that's more fantastic, so to say :-)

23:20 yoklov: certainly is not slower at all.

23:21 mmarczyk: very cool

23:21 hm, I'll link to this conversation from the ticket

23:21 yoklov: well, note that this is my totally unscientific opinion

23:21 mmarczyk: duly noted :-)

23:23 yoklov: lynaghk`: you should try to make your library as fast as D3 :)

23:25 i mean, 1 order of magnitude slower? cljs can do better than that.

23:26 mmarczyk: hope the summary is ok: http://dev.clojure.org/jira/browse/CLJS-190

23:29 yoklov: looks good to me

23:31 mmarczyk: great

23:31 felideon: anyone 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:31 connection string seems fine.

23:37 kovasb: lynaghk`: shouldn't something like mapv be a lot faster, since you can pre-allocate the destination and can dispense with seq?

23:39 lynaghk`: kovasb: I've never used mapv on clj or cljs, thanks for pointing it out

23:39 yoklov: does cljs have mapv?

23:40 kovasb: lynaghk`: don't know if the implementation does it currently, but seems like it should be possible. (can also write your own)

23:40 lynaghk`: yoklov, kovasb: eh, cljs doesn't seem to have mapv

23:41 kovasb: I'm gonna guess it is in there soon :)

23:41 rate of development is pretty crazy..

23:41 yoklov: yeah

23:41 lynaghk`: yoklov: actually, C2 is a few orders of magnitude slower than D3 right now.

23:42 yoklov: lynaghk`: yeah, i bet you can make it faster

23:42 lynaghk`: yoklov: depends on what you're doing, though.

23:42 felideon: oh silly me.

23:42 lynaghk`: yoklov: oh yeah, definitely. It has been a non priority up until now (because of this mapping project)

23:43 yoklov: lynaghk`: in my experience, if you're willing to work at a similar level, cljs is exactly as fast as js

23:43 lynaghk`: 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:44 ivan: huh, I thought CLJS had mapv, what's the *v it does have?

23:44 yoklov: lynaghk`: i can't say enough good things about chrome's profiler.

23:45 lynaghk`: i'm just saying it would be awesome to have a fast cljs visualization library

23:45 ivan: cljs.org confused me with:

23:45 **** non-lazy mapping/filtering or mapv, filterv

23:45 ***** can make it back into Clojure

23:47 lynaghk`: yoklov: "pull requests welcome"

23:47 = )

23:47 yoklov: Top two fns according to the chrome profiler (6% of time each) are lookups in cljs.core

23:48 I take it switching to records will help a lot there?

23:48 yoklov: yes

23:50 and 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:51 though

23:51 lynaghk`: yoklov: awesome, thanks for the tips. Do you have a blog?

23:51 yoklov: 6% is really nothing

23:51 i do not

23:51 the rest is (program)?

23:52 lynaghk`: yeah, 90%

23:53 yoklov: you should select that and hit the x at the bottom to exclude it

23:54 winkywooster: noir 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:58 lynaghk`: 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:58 yoklov: lynaghk`: no problem, good luck

23:59 lynaghk`: 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:59 yoklov: lynaghk`: sounds like not a bad idea

23:59 lynaghk`: 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:59 yoklov: oh, sure.

Logging service provided by n01se.net