#clojure log - Apr 25 2012

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

0:44 jedahu: any users of clutch about?

0:46 sritchie: jedahu: yeah, I've been using it a bit

0:46 what's up?

0:47 jedahu: how do you go about saving design documents so your views aren't recalculated from scratch each time your server restarts?

0:48 I'm considering writing a save-versioned-view function

0:48 but want to see if there's something I'm missing first :)

0:51 sritchie: just wondering what the usual practise is

0:51 sritchie: ah

0:51 jedahu: yeah, I've just been putting them in a namespace and running them myself when I want to create them

0:51 rather than leaving it as a bare form in the code or something

0:52 create a "populate-views" function

0:52 jedahu: are you writing your views in clojure or clojurescript?

0:53 jedahu: clojurescript and javascript

0:53 sritchie: I'll be writing that function then

0:53 sritchie: jedahu: I've been using the cljs views as well

0:53 yeah, same thing with view destruction, I think

0:54 I do all of that stuff from the repl, rather than hooking it up to some web trigger

0:54 jedahu: sritchie: I want something a little less prone to catastrophe when I inevitably forget to update views before running new code

0:55 sritchie: jedahu: yeah, I hear you -- I'm just not sure how to check if the view's actually changed or not

0:56 you could check the actual string of code itself, but that'll change every time you change the cljs dependency

0:56 jedahu: sritchie: I'm assuming one can add a "code-version" field to the design doc and check that?

0:56 sritchie: yeah, probably

0:56 you could wrap the "create-view" function to modify that design doc entry as well

0:57 I don't think couchdb cares about extra fields in those docs

1:06 jedahu: sritchie: save-design-document merges the old document with the new; seems like an odd thing to do

1:07 sritchie: maybe in case you added other fields, like that version you mentioned?

1:07 oh

1:07 design docs can have lots of views

1:07 a merge would bump out an old version,or add on a new

1:07 here's an idea --

1:08 you could generate a view-query function that automatically appends a version onto the end of a view name

1:08 and then have a save-view function that runs on server startup, but ONLY saves a view if it doesn't exist in the design doc yet

1:09 jedahu: so you go change all your code, then bump some global variable with a version and everyone gets saved again

1:09 not quite perfect, but it's an idea :)

1:10 jedahu: sritchie: thanks, but I think I'll pursue the extra field implementation for now

1:10 sritchie: cool

2:35 robertstuttaford: anyone with knowledge of clojurescript in?

2:44 emezeske: robertstuttaford: I have some such knowledge

2:48 robertstuttaford: i'm completely new to clj and cljs. been reading the new programming clojure book.

2:49 i do already use google closure lib+compiler with advanced mode compilation.

2:49 my question: does cljs use type annotations when producing js for the gclosure compiler?

2:50 i've been checking ClojureScript One out, and i notice that although the app is trivial, the mainp.js output file is rather large

2:52 emezeske: robertstuttaford: To my knowledge, it does not

2:52 robertstuttaford: I just checked an intermediate js file, and I don't see any

2:53 robertstuttaford: that's a pity. type annotations certainly help the compiler to produce tighter code.

2:53 how long have you been using cljs, emezeske?

2:53 emezeske: Hmm, I've been using it seriously for a few months, unseriously for a little longer

2:54 robertstuttaford: so it's capable of producing production ready apps?

2:54 emezeske: Oh, definitely. The language itself works great, I think most of the pain is in lack of documentation, examples, etc

2:54 And the tooling still has a ways to go

2:55 robertstuttaford: super! i'm guessing that all of that is steadily improving, though, as more folks start using it

2:56 i'm very interested in cljs because right now, the JS i'm writing (so that i get really small, performant JS on mobile web) is incredibly verbose and painstaking to write

2:56 emezeske: Yeah, for sure.

2:57 Well, cljs is great for not being verbose. I can't speak too much to the performance, other than to say that recently there has been a lot of progress in the compiler to make the persistent data structures perform better.

2:57 robertstuttaford: aside from clojurescript one, can you recommend any other resources that are particularly useful

2:57 emezeske: I'm a bit biased toward recommending https://github.com/emezeske/lein-cljsbuild

2:57 robertstuttaford: ah, that's you!

2:58 emezeske: :)

2:58 robertstuttaford: came across that last night

2:58 Raynes: Yeah, surprised me too. All those phoney emezeskes out there.

2:58 * emezeske makes sure his disguise is on correctly.

2:58 robertstuttaford: so this is an alternative to cljs-one

2:58 emezeske: I wish there were more examples of full apps that I could point to

2:58 Raynes: cljs-one is something that everybody seems to think is something it isn't.

2:59 emezeske: Yeah, although I still totally recommend cljs-one as a piece of documentation

2:59 Raynes: cljsbuild is something entirely different from cljs-one

2:59 robertstuttaford: i like c-one's repl <=> browser mechanic

3:00 lein-cljsbuild is like guard from ruby

3:00 emezeske: Raynes: Yeah, that is true

3:00 robertstuttaford: watch for changes and build stuff when they occur

3:00 emezeske: robertstuttaford: Yeah, although it has support for browser REPLs and testing and some other stuff

3:01 But the rebuild-on-change is the main thing

3:01 Are you planning to write your backend in clojure?

3:03 robertstuttaford: it's a definite possibility

3:03 emezeske: I'd recommend taking a look at cljs-template then

3:03 robertstuttaford: does cljs support real-time stuff, like socket.io from node.js?

3:03 or has no one gotten there yet

3:04 emezeske: I don't know about that. I know there is goog.net.WebSocket, but maybe that's lower level than what you're talking about?

3:05 robertstuttaford: it is. socket.io is a node lib for websockets, with code for both client and server. i'm guessing it wouldn't be too difficult to do with clj/cljs

3:06 emezeske: I wouldn't be surprised if someone's working on that, but I also haven't heard anything

3:06 robertstuttaford: back to lein-cljsbuild: so repl-launch is the one that gives you the repl-into-browser situation that cljs-one has

3:07 emezeske: Yeah, repl-launch, or the lower-level repl-listen

3:09 robertstuttaford: well, i've a long way to go. still need to learn the fundamentals of clj itself. very exciting. i've done so much OO style code, this whizzbang FP thing is like a breath of fresh air

3:10 emezeske: Yeah, I hear you there! I've been having a blast with it so far.

3:10 robertstuttaford: after watching a couple of rhickey's talks, i'm very eager to learn to thinking in FP and immutable types. so tired of fixing the same old OO spaghetti bugs

3:11 emezeske: He's a damn good speaker.

3:11 By which I mean that he is a good thinker :)

3:12 robertstuttaford: he is. i've tried to get into FP before, but i've only usually found the dry, academic, first-do-5-years-of-CS-at-university type stuff. this new Programming Clojure book is superb because it leaves all that alone and just deals with the practicalities

3:16 does repl-launch work with chrome, too? i notice firefox is mentioned

3:16 i use chrome canary for its excellent dev tools

3:17 emezeske: Actually, I don't think so (unfortunately)

3:19 The REPL stuff is actually part of the clojurescript compiler package, and lein-cljsbuild just provides a frontend to it

3:20 I doubt it would be hard to make it work on chrome... Maybe I'll take a look at that sometime (I favor chrome as well).

3:20 In case you're curious, here's the browser repl implementation: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/repl/browser.clj

3:20 robertstuttaford: when you develop cljs, are you using such a repl?

3:20 emezeske: On and off

3:21 Personally, with the auto-build-on-modify feature, I tend to not need it much

3:21 robertstuttaford: oh, that code is still a little beyond me :-) only yesterday did i learn how to def and fn and defn. no clue about how macros or atoms work yet

3:21 emezeske: Heh, you'll understand it soon!

3:22 robertstuttaford: got a 5 day long weekend starting Friday. i will consume that book by the end of it!

3:22 emezeske: Nice.

3:22 Well, I'm out of here, good luck with your cljs adventure!

3:22 robertstuttaford: thanks. sleep well

4:17 McMass0ud: &(str (symbol "str"))

4:17 lazybot: ⇒ "str"

4:17 McMass0ud: &(str (symbol "I worship his shadow"))

4:17 lazybot: ⇒ "I worship his shadow"

4:17 McMass0ud: Well, that was sort of to be expected

4:17 &(str (symbol [1 2 3 4]))

4:17 lazybot: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.String

4:24 angerman: does clojure 1.4 allow to simply print "YYYY-MM-DD HH:SS" from a java.util.Date. (or java.util.sql) ?

5:32 gavilanc`: I would like to use the latest lein-newnew in lein2, but I can't seem to ge lein2 to use the setting in my profiles.clj.

5:32 s/ge/get/

6:07 Borkdude: why does deftest not take a docstring

6:08 I did smth like this: (deftest foo "this test blablabla" (is …))

6:09 it runs perfectly but that's just because the string expression is evaluated and ignored ;)

6:27 is there smth to pretty-print html generated by hiccup?

6:50 ambrosebs: is there an "update-meta" function?

6:52 clgv: ambrosebs: vary-meta

6:52 ambrosebs: clgv: cheers!

7:08 Borkdude: hmm, defpartial doesn't support dispatch on arity...

7:10 dmi3y: probably a dumb question, but does anyone know what font is used in recently published 'Clojure Programming' book for code examples ?

7:12 cemerick: dmi3y: Just Courier New AFAIK

7:14 laurus: How does one do docstrings in defn?

7:15 dmi3y: cemerick: thanks

7:15 laurus: Ah, finally it worked.

7:20 progo: it's not Courier New.

7:21 can't put my finger on it but it looks like the traditional O'Reilly fixed width font

7:24 laurus: Is there any way to convert a map into a sorted-map?

7:25 vijaykiran: dmi3y: my What Font plugin says it is Ubuntu Mono

7:26 http://cl.ly/2n1J0d2E2l3l1W0O3U1f

7:28 laurus: Are people still working on and/or using Incanter? It seems to have had no updates for a while.

7:31 vijaykiran: laurus: I think should be possible using sorted-map-by

7:31 laurus: vijaykiran, thanks

7:32 dmi3y: vijaykiran: ah, cool, thanks a lot

7:36 clgv: laurus: there was an incanter release with clojure 1.3 support in the last 30 days

7:42 laurus: clgv, wow, okay!

7:43 By the way, is there a better way to read a file in than slurp?

7:43 clgv: laurus: what do you want to do?

7:43 laurus: clgv: (clojure-csv.core/parse-csv myfile)

7:59 clgv: laurus: there is no slurp in it...

7:59 what's the limitation with slurp in your opinion?

7:59 gfredericks: not lazy?

8:00 vijaykiran: laurus: you should use buffered reader, if the file is too big

8:00 s/should/can

8:01 laurus: vijaykiran, ok. That works better :)

8:01 clgv, for big files it seems to hang

8:01 Wow, that laziness really works.

8:02 clgv: gfredericks: there is no lazy file reading function in clojure afaik.

8:13 babilen: clgv: It's relatively easy to accomplish with line-seq + java.io.reader (cf. http://clojuredocs.org/clojure_core/clojure.core/line-seq)

8:13 clgv: babilen: but you can only define it lazily if you know that you will read it all - otherwise you will never know when to close the resource

8:27 Borkdude: I have a project.clj with these two dependencies:

8:27 [org.clojure/clojure "1.2.0"]

8:27 [noir "1.2.0"]

8:27 then why the … does it download clojure 1.2.1? not really a problem, but just wondering why

8:34 clgv: Borkdude: maybe it's a dependency of noir

8:34 Borkdude: clgv: how does it work when there are conflicting dependencies?

8:34 clgv: Borkdude: you can define :exclusions

9:04 the-kenny: (= (netwars.aw-map/coord 1 1) nil) works fine while (= nil (netwars.aw-map/coord 1 1)) throws an error in Clojurescript. (coord is a function returning a Coordinate, defined by defrecord). Is this intended behavior?!

9:09 fliebel: the-kenny: Is the only difference the order? I'd say that's a bug...

9:18 the-kenny: What is the error?

9:20 Fullmoon: How would I go about keeping per-connection state in a network server? Keeping a socket connection id <-> data map somewhere? Any ideas?

9:23 fliebel: Fullmoon: There is a Ring middleware for sessions, which you could have a look at.

9:24 Fullmoon: I think the connection ID map sounds okay. Another idea would be to store the data with the connection?

9:25 (defrecord conn [c d])

9:38 bhenry: why? http://i.imgur.com/oT7xz.png

9:40 vijaykiran: , (doc coll?)

9:41 clojurebot: "([x]); Returns true if x implements IPersistentCollection"

9:41 vijaykiran: probably Array isn't one

9:41 bhenry: yeah.

9:41 vijaykiran: and [] is literal for vector

9:41 which is IPersistentCollection

9:42 the-kenny: fliebel: Yup, the only difference is the order of arguments. Let me get the backtrace.

9:42 fliebel: https://gist.github.com/2489503

9:43 bhenry: ibdknox: i used a remote on a (jayq/val $elem) but there is an array in there and i can only see that as the cause for the Unreadable form error, but i can't figure out how to change it.

9:45 this freezes my cljs repl: http://i.imgur.com/YjLhY.png

9:46 the-kenny: fliebel: The generated code is simply missing a nil check

9:46 Ah, forgot to mention: This is clojurescript HEAD

9:50 fliebel: weird...

9:51 the-kenny: I'll file a bug. It's wasy to reproduce

9:59 dnolen: the-kenny: a nil check where?

10:03 the-kenny: in IEquiv _equiv generated for defrecords in Clojurescript

10:03 There might be a better solution for it

10:03 dnolen: (= (netwars.aw-map/coord 1 1) nil) works fine while (= nil (netwars.aw-map/coord 1 1)) throws an error in Clojurescript. (coord is a function returning a Coordinate, defined by defrecord). Is this intended behavior?!

10:06 This is also reproducible if you add a test for comparision with nil to the clojurescript test suite

10:12 dnolen: the-kenny: huh, what error for the second case?

10:12 the-kenny: dnolen: See here: https://gist.github.com/2489503

10:13 dnolen: the-kenny: oh you mean the first case throws an error

10:14 the-kenny: dnolen: You can also add the following around line 1122 to core_tests.cljs: (assert (= false (= fred nil))) (assert (= false (= nil fred)))

10:14 dnolen: Huh, I might have confused both, yes.

10:15 But shouldn't = be transitive in Clojure & Clojurescript?

10:17 pasg: I have a wierd problem regarding protocols. I can't seem to impement a method with more than one argument (this) when the protocol is another ns than the implementing record. Anyone know why this is?

10:19 dnolen: the-kenny: fixed in master thx.

10:19 the-kenny: dnolen: awesome, thanks :)

10:20 pasg: when i try to implement a method with more than the this argument, i am given this message: CompilerException java.lang.IllegalArgumentException: Can't define method not in interfaces: doStuff

10:21 strangely i can implement that method (which has 3 arguments) with just this instead.

10:21 huangjs: i need to do some html parsing, what library would you recommend?

10:31 timvisher: can anyone point me to :repository specification documentation for lein2?

10:44 ah, it's not actually changed to a vector. mind the question mark.

10:52 pasg: I have a wierd problem regarding protocols. I can't seem to impement a method with more than one argument (this) when the protocol is another namespace than the implementing record. Anyone know why this is?

10:57 ngw: is there a way to call js code from clojure?

10:57 should I use rhino, for example?

10:57 fliebel: pasg: You mean... (foo [this] ...) works, but (bar [this args argd] ...) does not?

10:58 ngw: yea, rhino should work. Or maybe you can do something fancy with a cljs browser repl?

10:58 ngw: fliebel: I'm a noob, no fancy for me, just learning :p

10:59 I want to call less.js from clojure and make it easy to use from webnoir and compojure apps

10:59 to have those css static, less.js is kind of slow if not made static

10:59 pasg: fliebel: yes indeed. Say to have (defprotocol prot (foo [this one two three]) defined in ns1, if i then try to make a record in ns2 implementing prot like so: (defrecord rec [] prot (foo [this one two three]...)) i get an error

11:00 fliebel: ngw: This might give you some ideas: http://briancarper.net/blog/415/

11:00 pasg: fliebel: strange thing is that i can implement foo with just this as an arg without error

11:01 fliebel: (defrecord rec [] prot (foo [this]...)) that is

11:01 ngw: fliebel I wish to port less.js after reading the same blog

11:01 thanks I will start from there

11:02 fliebel: pasg: Have you tried getting the namespace out of the equation? Just copy the protocol over and see if it still breaks.

11:02 also, what is the error?

11:03 pasg: fliebel: yeah that works fine if the protocol and record is in the same ns

11:03 CompilerException java.lang.IllegalArgumentException: Can't define method not in interfaces: doStuff

11:04 fliebel: that's the error i get, so it isn't finding the right method in the protocol for some reason

11:04 fliebel: pasg: are you importing the interface or the protocol?

11:05 pasg: fliebel: i am just using the ns with the protocol in it. Dunno if that is the correct way tbh, but importing it like a class (or record) doesn't work

11:06 fliebel: any chance you could try one your end? Just seem so wierd i must be doing something wrong.

11:06 Lajjla: (= .toString str)

11:06 &(= .toString str)

11:06 lazybot: java.lang.RuntimeException: Unable to resolve symbol: .toString in this context

11:06 pasg: *on

11:06 fliebel: pasg: sure. have some code?

11:06 Lajjla: Well that's apparently not how it works

11:06 pasg: fliebel: yeah one sec

11:07 fliebel: pasg: have you tried rebooting your computer? :D

11:09 pasg: fliebel: i'll try that if this works on your end :P

11:09 fliebel: in one ns do this: (defprotocol IStep (execute [this uuid order data]))

11:10 fliebel: in another do this: (defrecord testrec [] IStep (execute [this uuid order data] (prn "args" this)))

11:10 require the first ns in the second :)

11:11 fliebel: also, try this in the second: (defrecord testrec [] IStep (execute [this] (prn "args" this)))

11:11 fliebel: it shouldn't work because the function has wrong arity, but it does :S

11:13 fliebel: pasg: yea, breaks, but works when I add the args.

11:13 pasg: fliebel: which one works?

11:14 fliebel: https://gist.github.com/87ca4283c1813e426f51

11:18 pasg: fliebel: hmm, yeah that works for me too, but not when i have them in separate files :/

11:22 fliebel: pasg: So I would say your require/use statement is to blame.

11:22 Are you using, or requiring?

11:23 pasg: fliebel: i am using, does that make a difference?

11:23 fliebel: basicly i get the error when i use the second ns with the record

11:24 fliebel: pasg: Try require, use adds extra magic.

11:25 pasg: fliebel: just tried, require doesn't make a difference either

11:26 fliebel: pasg: I'm out of ideas...

11:26 pasg: fliebel: i'll just try to create a new project, so see if mine is broken

11:26 fliebel: yeah, i understand, thanks for your time though :)

11:26 fliebel: you could maybe print the protocol, to see if its the same thing in both namespaces

11:31 pasg: fliebel: yeah, it's the same: {:on-interface order.flow.IStep, :on order.flow.IStep, :sigs {:execute {:doc nil, :arglists ([this uuid order data]), :name execute}}, :var #'order.flow/IStep, :method-map {:execute :execute}, :method-builders {#'order.flow/execute #<flow$eval168$fn__169 order.flow$eval168$fn__169@cd2192>}}

11:31 fliebel: weird...

11:31 pasg: fliebel: even prints the arglist

11:32 fliebel: yeah, very

11:32 fliebel: i'll have to look at it again tomorrow with fresh eyes i think. Thanks again for your time

11:47 rhickey: dnolen: here

11:48 dnolen: rhickey: what do you think about emitting JS primitive arithmetic ops only under *unchecked-math* ? we add math protocols - then we can do Ratio, BigInt, throw in NaN, Infinity etc.

11:48 throw on

11:50 rhickey: dnolen: seems ok, would be nice to have all the semantics. I'd pay attention to the double dispatch mechanisms used by Clojure - protocols are single dispatch (as are the interfaces used in clojure.lang.Numbers) so you'd have to do something similar

11:52 dnolen: but you don't want math to suck by default either

11:52 dnolen: @rhickey: suck as in performance?

11:52 rhickey: @dnolen yes

11:53 might want to make sure ^double hint works

11:53 TimMc: Maybe have *unchecked-math* default to true?

11:54 dnolen: rhickey: yeah, it would be much slower - albeit safer. I'm not convinced common JS applications need fast math - if they do they can use *unchecked-math* like we do internally.

11:54 rhickey: yes, will make sure ^double works.

11:54 rhickey: @dnolen it's not quite the same as all the types are present with or without unchecked math

11:55 are you proposing to switch between 1 = someLongType and 1 = double with *unchecked-math* ?

11:55 "I'm not convinced common JS applications need fast math" is a very dangerous way to think

11:56 People building cool libs like C2 might care quite a bit

11:56 dnolen: rhickey: of course, and we provide something reasonable for those libs.

11:56 rhickey: It's something that needs careful thought

11:56 dnolen: rhickey: again we could just move forward with what we have, but now seems like a good time to decide.

11:57 rhickey: You need to have a set of objectives

11:57 safety, perf, richer semantics etc

11:57 compatbility

11:58 dnolen: rhickey: yeah compatibility is a big one, people will have have to convert when interacting with JS libs.

11:58 which is pretty yucky

11:59 rhickey: and you need to carefully define what the semantics of *unchecked-math* would be

11:59 I'm not sure it's the same flag at all

11:59 dnolen: rhickey: agreed.

11:59 rhickey: let's call it math-flag for the moment

12:00 will math-flag toggle the integer/double interpretation of 42?

12:00 the result type of ops?

12:00 It has a lot less to do with the js primitiveness at some level

12:00 dnolen: rhickey: k one more question - opinion about the other less ambitious approach I took? Just inline numeric checks like we do w/ truth. that is check if number, check not NaN not Infinity.

12:01 JS numeric perf is about 2-3X slower, but not horrible, good interop story. Get rid of nasty JS edge cases.

12:01 (+ "1" 1)

12:01 stuff like that.

12:01 rhickey: You are hurting good code to protect bad

12:02 Don't do (+ "1" 1)

12:02 dnolen: rhickey: makes sense.

12:02 rhickey: Protecting people from themselves while hurting people who are writing correct programs is not the Clojure way

12:03 dnolen: rhickey: jumping back a bit - I didn't really think about enforcing long / double semantics, since I don't see how that could be done w/o slowing things down a lot.

12:03 rhickey: dnolen: Google Clojure has a Long API, which has been carefully thought out afaict

12:04 Closure

12:04 http://closure-library.googlecode.com/svn/docs/class_goog_math_Long.html

12:04 lots of attention to perf details

12:05 We could adopt as default for 42 and say fastest cljs code uses doubles, e.g. write 42.0

12:05 then less semantic mismatch with Clojure code

12:06 dnolen: rhickey: yes, looks comprehensive like it but still it would be quite slow compared to what we're currently doing.

12:06 rhickey: not slow compared to 42.0

12:06 Lajjla: ##(+ "1" 1) actually works?

12:06 lazybot: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number

12:06 Fossi: in cljs i guess

12:06 rhickey: dnolen: again, what are the objectives?

12:06 Fossi: in javascript that "works"

12:07 dnolen: rhickey: yes - was mostly wondering how important it is to get Ratio, BigInt in there. Though that could be handled by libs.

12:08 rhickey: if it's not important - then I think what we have is OK.

12:09 rhickey: dnolen: I think it is worth considering, but the objectives have to be clear, and the tradeoffs too - only then could an approach be assessed

12:09 eggsby: I've been hesistant about cljs, that synonyms page was kind of a smack in the face/wake up call, however.

12:09 dnolen: eggsby: good to hear!

12:10 rhickey: k thanks for your time.

12:10 eggsby: http://himera.herokuapp.com/synonym.html for those who haven't yet seen it

12:10 rhickey: dnolen: yes, and the most impressive parts of the synonyms are the ones only supported due to Clojure semantics

12:11 felideon: that's always nice.

12:11 rhickey: so one thought experiment is - how can we support Clojure numerics semantics (which we've punted on so far), and then, how do we get back perf?

12:11 ben_m: Does anyone have experience with Parenscript? If so, how does Cljs compare to it?

12:12 dnolen: ben_m: Parenscript is quite a bit less ambitious

12:12 S11001001: ben_m: not really alike at all. parenscript is sugar with macros for JS

12:12 felideon: ben_m: it's completely different.

12:13 ben_m: Now I feel stupid for asking :D

12:14 felideon: ben_m: nah, I didn't 'get it' at first either.

12:16 ben_m: "ParenScript (or CoffeeScript) is not the same as ClojureScript. ParenScript "transforms" a subset of CL to JS, while ClojureScript is a full-fledged target runtime for Clojure."

12:17 ^ someone said to me once

12:28 ben_m: felideon, I was aware of that but temporarily forgot that it would make comparisons hard to make. :)

12:30 felideon: ben_m: and in any case, to answer your question more directly, a lot of (common) lispers just write javascript anyway

12:31 that i know of at least.

12:40 nDuff: .getURLs on clojure.lang.DynamicClassLoader is just returning nils; is there a way to see the classpath?

12:41 technomancy: nDuff: IIRC you need to traverse the parents' as well

12:42 (apply concat (map (memfn getURLs) (take-while identity (iterate (memfn getParent) (.getContextClassLoader (Thread/currentThread))))))

12:42 daniel_: I'm trying to create bitboards for a chess program, I get an error use (Integer. "00000000...") what number type do I want here?

12:42 here's my function https://gist.github.com/2491133

12:43 (vct->bb [\p \p \- \-] \p) gives -> 1100

12:43 but length 64 is obviously too big for Int

12:44 raek: nDuff: if you are in a leiningen project, `lein classpath` might be enough

12:44 technomancy: daniel_: numbers beginning with zero get interpreted by the reader as being octal; not sure if the Integer constructor feels the same way

12:44 AimHere: Prefix it with '2r' and you'll get it in binary

12:46 also, the 'read-string' function will shove your number into an appropriate type, as long as your string is formatted properly

12:56 pandeiro: does clojure.pprint have anything that can just produce a formatted string instead of actual output?

12:57 mknoszlig: pandeiro: you could wrap it in with-out-str

12:57 TimMc: pandeiro: Use with-out-str.

13:01 pandeiro: thanks, useful macro that

13:04 ben_m: I'm on Windows and since upgrading lein, I get ^M in the swank REPL. Probably an encoding issue, but I don't know how to get rid of it :/

13:37 technomancy: about to wipe the insecure password hashes on clojars; log in to re-hash if you haven't already

13:40 nDuff: Hmm.

13:40 clojure.lang.DynamicClassLoader.getURLs() is always coming up empty for me, even after I do an addURL() call (and can, in practice, import classes from the added jar)

13:40 technomancy: *nod*, I am traversing the parents...

13:41 technomancy: ...but I'd expect the addURL to be to the immediate classloader, rather than to its parent.

13:41 raek: a leiningen project would be much easier -- I'm actually escaping from an OSGi sandbox.

13:42 * nDuff isn't exactly thrilled to be writing code which will break as soon as someone else fixes their bugs, but... eh, such is life.

14:15 beffbernard: This is a noir/compojure question. How do you handle a variable number of form inputs on a post?

14:15 I tried using the same :name and :value *hoping* they would come back in a list

14:18 ben_m: I'm on Windows and since upgrading lein, I get ^M in the swank REPL. Probably an encoding issue, but I don't know how to get rid of it. Asked this before, but that was over an hour ago, so I hope it's okay if I ask again.

14:23 ibdknox: beffbernard: name="somename[]"

14:24 fliebel: ibdknox: Cool. I always wondered whether that was a PHP-ism or a HTML/HTTP thing.

14:25 dnolen: `fogus: nice post!

14:25 metajack: Is there an easy way in compojure to map two routes to the same function? Aside from simply copying the function (or factoring it out and still having two routes point to the factored version)?

14:26 S11001001: it's a phpism

14:26 beffbernard: ibdknow: worked like a charm

14:27 ibdknox: ^

14:29 jsabeaudry: Does it matter openjdk6 or openjdk7 with clojure?

14:29 dnolen: jsabeaudry: should not

14:31 ibdknox: dnolen: to your knowledge is anyone de-JSing the CLJS analyzer?

14:32 dnolen: ibdknox: a necessary step for pluggability, so should fall out of GSoC

14:32 ibdknox: that said, I don't think the analyzer has too many JS specific bits.

14:32 ibdknox: dnolen: not particularly, no :)

14:33 dnolen: any idea when and where that'd happen?

14:33 I'll likely need it in not too long

14:33 and I don't want to have two efforts for the same thing :)

14:33 dnolen: ibdknox: Raphael Amiard is starting to look into the compiler so in the near future.

14:34 ibdknox: but if you know what bits you'd like to see changed now, bring it up.

14:34 ibdknox: dnolen: haven't looked too hard at it yet. I'll probably know more later in the week

14:34 jonasen: dnolen: is there a repo on github that Raphael is using for his work?

14:34 dnolen: jonasen: he just has his own fork.

14:34 ibdknox: cool

14:35 jonasen: dnolen: found it. Thanks

14:35 muhoo: is there an imagemagick-like java library that will work on cloudy things like heroku?

14:35 all i want to do is resize profile pics after people upload them :-(

14:35 ibdknox: jonasen: link?

14:36 jonasen: https://github.com/raph-amiard/clojurescript

14:36 ibdknox: thanks

14:36 fliebel: S11001001: But then, it is a PHP-ism shared by noir/compojure?

14:36 ibdknox: fliebel: most of the industry picked it up

14:36 I actually thought it originally came from perl

14:37 muhoo: jmagick appears to just be a JNI interface to the c library

14:37 ibdknox: but I might be making that up :)

14:39 muhoo: hmm, nevermind: http://briancarper.net/blog/465/

14:40 :-)

14:41 daniel_: AimHere: technomancy thanks for your answers earlier...i had to dash off

14:42 muhoo: it's so sad when i find the simple easy answer to what i need to do, and the answer is "use clojure.contrib"

14:42 in this case i think i can go around it tho

14:45 solussd_: trying to use something of the form (defmacro blah [arg1 arg2 & {:keys [a b c] :or {a 1 b 2 c 3}] …) if I pass a, b, or c in a map as the last arg I get this error: "No value supplied for key <the map I tried to pass>". ideas?

14:45 daniel_: AimHere: your binary suggestion, how would i add the prefix 2r to make it binary?

14:45 amalloy: macros only take literal map objects. you can't do (let [m {:a 1}] (blah m))

14:46 solussd_: amalloy: I am passing it a map literal

14:46 amalloy: oh. then drop the & from your signature

14:46 solussd_: but the map is optional. :/

14:46 ibdknox: or do & [{...}]

14:46 solussd_: ok

14:48 daniel_: can anyone tell me how i can convert a string of number "0010101010111110000" into binary representation?

14:48 solussd_: ibdknox: & [{..}] didn't work. here's the code, it's for my noir usage. https://gist.github.com/422e9bcefc4102527b96

14:49 ibdknox: solussd_: I don't see the vector around it

14:49 solussd_: i took it out. :)

14:49 doesn't work with it though

14:50 jsabeaudry: daniel_, parseLong(String s, int radix)

14:50 daniel_, in your case the radix is 2

14:50 daniel_: thanks jsabeaudry

14:51 ,(parseLong. "100011" 2)

14:51 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: parseLong, compiling:(NO_SOURCE_PATH:0)>

14:51 ibdknox: solussd_: works just fine for me with the change I suggested

14:51 daniel_: ,(.parseLong "100011" 2)

14:51 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: parseLong for class java.lang.String>

14:51 jsabeaudry: ,(java.lang.Long/parseLong "0110" 2)

14:51 clojurebot: 6

14:51 solussd_: ibdknox: … wtf. ill try again I guess!

14:51 daniel_: ah ;)

14:52 ibdknox: solussd_: I simplified your case, but here's what the params look like: https://refheap.com/paste/2352

14:52 solussd_: ibdknox: i did this: https://gist.github.com/513d360c15bb1f15827a

14:53 daniel_: jsabeaudry: ends up looking like 71776119061217280, how do i see it in 1's and 0's?

14:54 jsabeaudry: daniel_, you want to print it or you want to parse it?

14:54 daniel_: both :D

14:54 i want to do bitwise operations on them and also print them

14:55 jsabeaudry: ,(.toBinaryString 44)

14:55 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: toBinaryString for class java.lang.Long>

14:55 jsabeaudry: ,(toBinaryString 44)

14:55 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: toBinaryString in this context, compiling:(NO_SOURCE_PATH:0)>

14:55 ibdknox: solussd_: your exact code works for me. How are you calling it?

14:56 daniel_: ,(toBinaryString. 44)

14:56 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: toBinaryString, compiling:(NO_SOURCE_PATH:0)>

14:56 jsabeaudry: ,(java.lang.Long/toBinaryString 44)

14:56 clojurebot: "101100"

14:56 daniel_: oh yay

14:56 ibdknox: solussd_: do you only have one form for your body?

14:57 solussd_: also are you sure you picked up the code changes?

14:57 solussd_: ibdknox: here's how i'm calling it: https://gist.github.com/513d360c15bb1f15827a

14:58 ibdknox: changed code and ran lein run

14:58 timvisher: anyone know if it's possible to tell leiningen about hosts it shouldn't run through the proxy?

14:59 ibdknox: solussd_: you invocation works for me too

14:59 your*

15:00 solussd_: maybe you didn't save the file or something?

15:00 solussd_: ibdknox: saved. :) so confused.. lein clean

15:00 ibdknox: im runing clojure 1.3, if that matters

15:01 ibdknox: me too

15:04 timvisher: hmm... leiningen 2 fails to create a new project? https://gist.github.com/2492242

15:05 technomancy: timvisher: standard "download bin/lein" install, or are you running from a checkout?

15:05 AimHere: daniel_, Something like (read-string (apply str (cons "2r" (map #(if (= % piece) 1 0) vct))))) seems to do what I think you want

15:06 timvisher: technomancy: standard

15:06 technomancy: timvisher: any profiles active?

15:06 timvisher: got yesterday i think, so i should be after the bugs here https://encrypted.google.com/search?hl=en&q=%22java.lang.IllegalArgumentException%3A%20No%20implementation%20of%20method%3A%20%3Amake-reader%20of%20protocol%3A%20%23%27clojure.java.io%2FIOFactory%20found%20for%20class%3A%20nil%22

15:07 pandeiro: is there some kind of order-keys fn to convert a hash-map to a sorted-map?

15:07 technomancy: timvisher: oh, yeah if you're on windows you might need a newer lein-newnew

15:07 try putting 0.2.7 in :plugins in the :user profile

15:09 timvisher_: technomancy: sorry, got kicked or something

15:09 fliebel: pandeiro: you could do (apply sorted-map m) I think.

15:09 timvisher_: newer newnew?

15:09 carllerche: is it possible to get a 3rd party java class to behave like a fn?

15:09 technomancy: timvisher_: try putting [lein-newnew "0.2.7"] in :plugins in the :user profile

15:09 fliebel: no...

15:10 Vinzent: carllerche, I think you can implement clojure.lang.IFn or something

15:10 carllerche: Vinzent: Yeah… which unfortunately only works if i have control of the class :-/

15:10 amalloy: not a 3rd-party class

15:12 Vinzent: carllerche, ah, yeah, only if you proxy it. Too bad it's not a protocol

15:12 timvisher_: is it possible to specify ntlm authentication using lein2?

15:17 * nDuff ponders moving from nREPL to swank-clojure; emacs support is a shiny, shiny draw.

15:18 di-csuehs: Is there a more appropriate idiom for def'ing a connection to a service such that the service need not be available at compile time other than (delay... ?

15:19 gfredericks: di-csuehs: someone said the other day you can do (when-not *compile-files* ...)

15:20 hiredman: di-csuehs: I really recommend against making that kind of thing a global

15:20 di-csuehs: gfred: ;) yeah.

15:20 hiredman: I'm all ears...

15:21 daniel_: thanks AimHere

15:21 di-csuehs: hireman: this kind of issue around configuration and instanciation of collaborative service connections is going to be a theme in the work I do.

15:21 hiredman: di-csuehs: hmmm?

15:21 solussd__: ibdknox: you'll never guess what was wrong………. I was ssh'd into another machine w/ the same repo checked out. I was running 'lein run' on the other machine while editing the code in another window in emacs on my local machine. I feel dumb…. :D

15:22 hiredman: di-csuehs: so, to run a program you have some entry function, right? main or whatever

15:22 di-csuehs: hiredman: yes.

15:22 hiredman: main or whatever can create a connection and pass it to the functions it calls

15:23 I know, it's kind of nuts, and out there

15:24 di-csuehs: hiredman: I've considered it. I'll end up having several services I am passing in.

15:24 hiredman: sounds good

15:25 di-csuehs: hiredman really seems to ugly up the code

15:25 hiredman: have you decided what you are going to do when the a global component fails?

15:25 TimMc: solussd__: That's quite a special case of "forgetting to save the buffer". :-)

15:25 well, rather "editing the wrong file"

15:25 solussd__: TimMc: ;)

15:26 di-csuehs: hiredman: so far, 2 of 3 have a pooling mechanism, but one is subject to failure.

15:26 TimMc: I've definitely edited the wrong project.clj before. 20 minutes down the drain...

15:26 hiredman: di-csuehs: pooling doesn't protect against all possible failures

15:26 di-csuehs: hiredman: I've had other projects that only had pooled db connections. but I know this will not be the case most of the time.

15:27 hiredman: what if your machine's network hiccups for some reason, and the network connection to the pooled resources is unreliable?

15:27 di-csuehs: hiredman: sure, but it allowed me to be lazy and not address it because it was good enough for now. I no longer have that luxury, so...I feel a "functional programming inspired mind shift" coming.

15:28 hiredman: (someone fat fingers a iptables rule in chef or whatever)

15:28 timvisher_: don't mean to spam, but has anyone configured authentication for a proxy in leiningen 2?

15:29 di-csuehs: hiredman: I'm sold on the idea of improving the mechanism, just not sure which way to go yet.

15:29 hiredman: I (think) I don't want to re-establish the connection each call.

15:29 hiredman: di-csuehs: one way to go that is sort of a middle ground is using binding

15:30 di-csuehs: but you connection pooling

15:30 have

15:31 di-csuehs: hiredman: sure...but let's say I don't...because that is also representative of services I expect to use in the future.

15:32 zamaterian: timvisher_, I have made some changes to pomegrante - that enables it to use proxy authentication - but that part is not implemented in lein2.

15:32 hiredman: di-csuehs: what kind of app is this?

15:32 di-csuehs: hiredman: it seems like there should be a well-known functional programming pattern for working with a service that may need to be initialized. I'm just not realizing what to look for OR I am bringing OO baggage and not thinking about it the right way.

15:33 timvisher_: zamaterian: ah...

15:33 hiredman: di-csuehs: this isn't about functional programming, it's about building reliable systems

15:33 di-csuehs: hiredman: this one is a RESTful api.

15:33 * timvisher_ sighs. the joys of working with open source java tools from behind a corporate firewall...

15:33 hiredman: you need to isolate components to isloate failure

15:33 yoklov: I know this is a weird question, but is there any way I can use macros to unbox a vector/array/any representation of 3 numbers at compile time? (specifically in clojurescript, though i dont see why the answer would be cljs-specific)

15:34 hiredman: globals are not isolated

15:34 di-csuehs: hiredman: sure...they are shared, allowing failure to affect all threads and collaborations.

15:34 hiredman: di-csuehs: put a queue between access to the resource and the web requests

15:34 di-csuehs: hiredman: interesting.

15:35 zamaterian: timvisher_, see https://github.com/technomancy/leiningen/blob/master/leiningen-core/src/leiningen/core/main.clj#L131 and https://github.com/technomancy/leiningen/blob/master/leiningen-core/src/leiningen/core/classpath.clj#L82

15:35 hiredman: whatever processes the queue will need to know how to handle connection failures, etc, but the webrequest doesn't need to care

15:35 dnolen: yoklov: do you mean generate the code to extract the fields?

15:36 yoklov: dnolen: I guess, though I know destructuring is very doable. Right now the boxing and unboxing around function calls is a big slowdown

15:36 though that's with records

15:37 di-csuehs: hiredman: so establishment and release of the connection is managed by the queue processor...it could drop it when it sees fit and start it up when it needs it.

15:38 hiredman: right

15:38 di-csuehs: hiredman: the web request might call code that eventually depends on a promise or a future, etc. ?

15:38 hiredman: unfortunately I don't know of a nice way to avoid making the queue global

15:38 di-csuehs: right

15:38 yoklov: dnolen: hm. basically my question is whether or not there's a way for me to say something like (point-add p1 p2), and have in the code it deal with 3 variables instead of some type

15:38 hiredman: di-csuehs: and can include a timeout

15:39 the global queue thing is sort of an artifact of existing clojure web stuff

15:39 not a limitation of the design

15:39 yoklov: dnolen: or do you think i wouldn't have a noticable performance difference between 3-element js arrays and unboxed values

15:40 hiredman: none of them (that I know of) let you specify an init function and then pass the value of that init function to handlers

15:40 timvisher_: zamaterian: interesting behavior. if i specify a user name and empty password, i seem to get in through the proxy, but now i'm back to the original problem i had with no proper implementation of :make-reader

15:40 hiredman: that might be an interesting addition to defroutes

15:40 timvisher_: but progress, nonetheless! ^_^

15:40 hiredman: "compute this once, and pass it to everything under this route"

15:42 di-csuehs: hiredman: It seems like there should be some idioms around such services (even if they never go out of process/machine).

15:42 dnolen: yoklov: if you want absolute speed you could write an interesting macro DSL like i said before. (vec-add2 p1 p2) could be a macro.

15:42 yoklov: dnolen: yeah, that's what i'm doing

15:42 dnolen: yoklov: oh, k. so what's the issue then?

15:43 yoklov: arrays and defrecord should be equivalent in perf as long as you not doing keyword lookup and using field access instead with .-

15:43 you're not

15:43 yoklov: dnolen: how to store the points internally, mostly

15:44 would arrays be slow?

15:44 di-csuehs: hiredman: Thank you, very much. That's been helpful. If I recode this, I'll have to sanitize it and post it.

15:44 yoklov: probably not

15:44 dnolen: yoklov: I don't think so, but I think types/record w/ field access would be faster.

15:44 yoklov: huh, really?

15:44 dnolen: yoklov: I think so, can't know for sure w/o benching tho.

15:45 yoklov: V8 I know optimized array of fixed sizes, I don't think the other engines do.

15:45 optimizes

15:53 yoklov: I did a quick test, deftype/record seem to have an edge on V8 and JavaScriptCore

15:53 yoklov: dnolen: wow, really? that is extremely surprising

15:56 dnolen: yoklov: https://gist.github.com/2492799

15:57 yoklov: that's with simple optimizations - with advanced optimizations GClosure just eliminates the type perf test :P

15:59 yoklov: did you get that gist?

15:59 yoklov: dnolen: yeah

15:59 amalloy: hey TimMc, remember a year ago when you referred me to a story re: turkish dotless-i localization? it came up in conversation today, but i can't find any credible sources for it. do you know if it's an actual true story?

15:59 yoklov: dnolen: http://jsperf.com/array-vs-obj-vs-unboxed

16:00 though, to be fair those are mutable

16:01 amalloy: (original conversation at http://lazybot.org/logs/#clojure/2011-04-12 for reference)

16:01 arohner: amalloy: http://www.moserware.com/2008/02/does-your-code-pass-turkey-test.html?

16:01 yoklov: dnolen: i'm assuming the cljs gets compiled to something similar.

16:01 amalloy: so far i've found the story republished on gizmodo, dailymail, and the inquirer. not very encouraging

16:03 dnolen: yoklov: my macro suggestion was to unbox and not create intermediate values, and only construct a value at the very end.

16:04 yoklov: dnolen: okay, yeah, that sounds fast

16:04 hm.

16:04 * yoklov ponders

16:04 dnolen: yoklov: and being a macro it would be portable to Clojure - it's also interesting enough for a pretty cool blog post I think :)

16:05 yoklov: dnolen: haha, it would be.

16:05 daniel_: ,(bit-shift-right 2r001110 2)

16:05 clojurebot: 3

16:06 amalloy: arohner: that looks like a reasonable article on the things you have to do to be really i18n correct, but i was currently looking for confirmation of http://gizmodo.com/382026/a-cellphones-missing-dot-kills-two-people-puts-three-more-in-jail, which would be a more compelling argument that it's important to be i18n correct

16:06 daniel_: ,(java.lang.Long/toBinaryString (bit-shift-right 2r001110 2))

16:06 clojurebot: "11"

16:06 daniel_: hmmmmm

16:07 how can i get from 001110 to 000011? thats what i was trying above

16:07 dnolen: yoklov: another option would thinking about transients I could imagine - (persistent! (unit (mul (add (transient v1) v2) 2.5))

16:07 daniel_: ,(java.lang.Long/toBinaryString (bit-shift-right 001110 2))

16:07 clojurebot: "10010010"

16:08 amalloy: you want...padding with zeroes, daniel_?

16:08 daniel_: yeah, and for it to remain the same length

16:09 its for a chess bitboard, so i can shift 8 for a pawn move (for example)

16:09 yoklov: dnolen: transients are still probably not as fast as native arrays though

16:09 amalloy: *shrug* write padding yourself. it's not very surprising that no built-ins do this, because they deal with actual numbers, and you care about the particular textual representation

16:09 daniel_: the c++ implementation i saw was very simple

16:09 00010110 << 2 something like that

16:09 beffbernard: so what piece are you tring to move daniel_?

16:09 pawn?

16:10 and which is a1 and h8 in your bitboard?

16:10 daniel_: beffbernard: thats not the issue at the moment, i just want to shift a 64-bit binary number a certain number of bits left and right

16:10 and pad with 0's and if something goes off the end its lost forever

16:10 dnolen: yoklov: transient are just mutable types, I don't see how they would be any slower than a mutable type.

16:10 daniel_: 2 secs, brb

16:10 amalloy: storing a chess board as a bitstring sounds like a severe case of premature optimization

16:10 hiredman: daniel_: there are no unsigned numbers on the jvm

16:11 amalloy: I don't believe he wants it as a string

16:11 beffbernard: amalloy: it's conceptually simple

16:11 hiredman: I believe he wants it unsigned and he was demonstrating the signed nature by converting it to a string

16:11 beffbernard: he just wants a long.. doesn't matter if it's signed

16:11 hiredman: hard to say, some times people are weird

16:11 yoklov: dnolen: oh, I though you could only have transient collections, not transient types from deftype

16:12 amalloy: hiredman: no, i realize he wants an N-bit integer

16:12 a bitmask instead of a bitstring, might be better in my sentence

16:12 hiredman: beffbernard: oh, right, because they are unsigned shifting operations

16:12 there

16:12 so the number being signed or not doesn't matter

16:13 beffbernard: hiredman: you got it

16:13 dnolen: yoklov: it's just a protocol. Though of coursed unboxed everything would probably win.

16:14 yoklov: this is definitely an interesting approach in the context of games - and it seems like more than a couple of people are interesting in doing games w/ Clojure/Script ;)

16:14 hiredman: beffbernard: so what's his problem then?

16:14 beffbernard: so a pawn move is bit-shift-left 8 for that bit the pawn is on

16:15 yoklov: dnolen: i wouldnt really know how to go about unboxed everything, to be honest. protocols carry a performance overhead that i'd want to avoid in the inner part of of a rendering loop

16:16 dnolen: arrays might allow me to swap out easily with Float32Array for potentially(?) increased performance

16:16 dnolen: yoklov: gotta run, if I find some time I'll write down how I think this can be done.

16:16 beffbernard: ,(java.lang.Long/toBinaryString (bit-shift-left 1 8))

16:17 clojurebot: "100000000"

16:17 yoklov: dnolen: cool, I'll see if I can do it with just arrays. I think I'd know how to go about that

16:17 beffbernard: it's moved from "1"

16:18 hiredman: ,(count (.getBytes "c4"))

16:18 clojurebot: 2

16:22 daniel_: beffbernard: thats what im doing, and it causes there to be 0's added or removed from the right

16:22 which is not exactly what i want, i need 64 bits at all times to represent the board

16:22 beffbernard: daniel_: are you using a long to represent your bitboard?

16:23 or some sort of string representation?

16:23 daniel_: i havent decided yet, whatever works

16:23 i have it in string form atm and am converting to binary

16:24 beffbernard: I wrote a bitboard chess engine when I was in uni and I store it in a long

16:24 0 implies each position is empty

16:25 daniel_: yeah, a long would work

16:25 but then how can i do the bitshift

16:25 beffbernard: with start bitwise operations

16:26 standard*

16:26 so it's easy to test whether a move is legal

16:26 I store my board like this.. it was in java at the time

16:27 for each piece.. pawn, rook, knight, etc.. I had a bitboard… then I had a board for each color.. which was simply all the pieces and'ed

16:27 daniel_: yep, thats what i plan on doing, i think thats the idea of a bitboard

16:27 12 different boards

16:28 beffbernard: I added two more.. one for each color

16:28 makes it slightly more convenient

16:29 daniel_: a board for each piece of each colour = 12 boards

16:30 beffbernard: Yes you're correct.. but I also added all the black occupied spaces and white occupied spaces

16:32 daniel_: ah, ok

16:33 i suppose if it was Java they were all mutable, how would you keep the state in clojure?

16:33 and did you store the bitboards in a size 14 array?

16:33 beffbernard: they can stil be immutable...

16:33 yup

16:34 daniel_: i guess i will have to use an atom to record the current state of the game

16:34 beffbernard: (let world (atom []))

16:34 daniel_: ja

16:34 beffbernard: yeah

16:35 (let [world (atom [])] …) is what i wanted to type

16:35 daniel_: ok, i'll try changing my code to use Longs and see if the bit-shift works as i need

16:36 i get this java.lang.NumberFormatException: For input string: "0000000011111111000000000000000000000000000000000000000000000000" (NO_SOURCE_FILE:0)

16:37 unless i do (java.lang.Long/parseLong bitboard 2)

16:37 beffbernard: I wouldn't use any string representation unless it was to print the board

16:37 daniel_: then i lose the 0's at the start

16:37 beffbernard: im using longs and then java.lang.Long/getBinaryString to print

16:38 beffbernard: im using longs and then java.lang.Long/toBinaryString* to print

16:39 patchwork: How do I change the directory from within a lein plugin?

16:39 I want it to run a command in the context of a subproject

16:40 daniel_: how can i evaluate the type of something? (typeOf. 2) for example

16:40 patchwork: daniel_: (class 2)

16:40 technomancy: patchwork: in lein2 you can rebind *dir* in leiningen.core.eval

16:40 Raynes: ibdknox: You're dangerously close to your target. It would be real sad to see it fail at this point.

16:40 technomancy: patchwork: but that only works for new subprocesses; you can't change the JVM's current directory

16:41 daniel_: thanks patchwork

16:41 Raynes: ibdknox: Who can we solicit to tweet about it? I'll see if I can find Bill Gate's phone number.

16:41 patchwork: technomancy: So I am starting a jetty server from the context of the subproject, does that count as a subprocess?

16:41 technomancy: patchwork: if you're changing the dir in leiningen and running the code in eval-in-project it should work

16:42 patchwork: technomancy: Cool thanks!

16:42 I'll give that a shot

17:06 solussd: can I capture a gensym in a macrolet'd macro?

17:07 technomancy: macrolet?

17:08 solussd: clojure.tools.macro/macrolet

17:09 * technomancy learns something new

17:09 solussd: :D

17:12 amalloy: technomancy: macrolet is fab

17:13 solussd: you can do anything in macrolet you could do in a defmacro

17:13 Raynes: macrolet is pretty cool.

17:13 Never had occasion to use it though.

17:13 But I don't really ever use macros anymore either.

17:14 solussd: amalloy: i've only played with in in the context of LOL; wondering, can I capture a gensym from within my defmacro within a syntax quote in my macrolet'd macro?

17:14 felideon: wait till you hear about symbol-macrolet

17:14 (not really)

17:15 amalloy: solussd: foo# gensyms are specific to the syntax-quote they're in

17:15 zakwilson: I have actually used symbol-macrolet in real code.

17:15 felideon: zakwilson: me too. i regret it though. :)

17:15 amalloy: this is entirely unrelated to macrolet though

17:15 zakwilson: I don't. It did what I wanted.

17:16 felideon: zakwilson: ah cool

17:16 amalloy: indeed, i stole a cool use of symbol-macrolet from chouser

17:16 https://github.com/flatland/useful/blob/develop/src/useful/utils.clj#L201

17:16 zakwilson: I'm trying to remember exactly what I used it for or find the code.

17:20 Raynes: To whom it my concern: I just graduated high school.

17:20 cshell: congrats:)

17:20 rhc: Raynes: congrats

17:20 pipeline: definitely preferable to the alternative

17:20 Raynes: Heh

17:20 jodaro: i'm concerned

17:20 congrats

17:20 dnolen: Raynes: congrats!

17:21 zakwilson: http://pastebin.com/cW4XBZwR <-- found it. Not only did I use symbol-macrolet, but I used it inside a macro. Enough meta?

17:21 Raynes: proof that on the internet, nobody knows you're a dog!

17:21 metellus: a dog graduating high school would be pretty impressive

17:22 Raynes: Indeed.

17:22 jodaro: sounds like a good basis for a disney movie

17:22 High School Spot

17:22 Raynes: AirBud Goes To High School

17:22 Wild_Cat: they already made a dozen Air Bud movie, why not this one? :p

17:22 amalloy: zakwilson: symbol-macrolet is primitive enough that you'd almost-always use it from a macro

17:22 it's more of a building-block than a real tool

17:23 zakwilson: I *thought* I had used it in something higher-level. I haven't done any CL in ages.

17:24 amalloy: zakwilson: well, tools.macro adds symbol-macrolet as well as macrolet

17:24 so it doesn't have to be in CL

17:25 zakwilson: You just HAD to tell me that. Now I'm going to end up using it. In production code.

17:26 solussd: it's in my production code. being the only *lisp programmer at your company has its perks- no one will ever ask me wtf it is

17:27 zakwilson: Well, my projects tend to be freelance with just me as a programmer, or personal projects that are entirely mine.

17:28 dnolen: ibdknox: light table kickstarter is just rolling along now it seems

17:32 cshell: did it get 200K?

17:34 metajack: 114k right now. almost broke 1k $15 backers too

17:35 cshell: wow, crazy

17:35 jodaro: hopefully ibdknox will blow some of it on a 'got funded' party

17:35 cshell: it looks like it could be pretty cool

17:35 lol

17:42 solussd: noir question- why can't I have a page route of /blah/:id and /blah/search/ (that takes a query string)? the first route eats everything that should go to the second too. :/

17:43 amalloy: don't put them in that order

17:43 * mefesto finally tinkers with ClojureScript :)

17:44 solussd: amalloy order? I actually swapped their location in the source file, no effect.

17:44 amalloy: the whole idea of compojure routes is that the first one that returns a non-nil response is the correct handler, and they're consulted in order

17:44 i guess i don't know how noir orders things for you

17:44 aaelony: me too, thanks to template-cljs

17:44 mefesto: not sure if im reading out-dated docs but is it true that google closure doesn't want you to use a document ready event?

17:45 amalloy: but if you were using compojure this would be a simple ordering problem

17:45 mefesto: they really don't

17:47 mefesto: i guess i'll have to change my ways

17:52 i'm used to jquery and how a lot of the event handling is wired together in the document ready event. is this an "acceptable" way using clojurescript? https://refheap.com/paste/2360

17:52 i'd like to avoid sprinkling script tags all throughout the html

17:53 arohner: amalloy: re: your turkey question. My sister-in-law lived in turkey, and she found the language mixup plausible

17:54 dnolen: mefesto: GClosure actually considers it an anti-pattern as it affects page load time. but really you can put your script tag wherever you want as long as you're outputting a single source file.

17:55 mefesto: that does make it somewhat harder to debug. Hopefully this will be moot point soon - source mapping.

17:57 mefesto: yeah i was reading their reasoning which makes perfect sense but it just goes against what i've become so accustomed to doing.

17:57 dnolen: mefesto: nothing prevents you from continuing to do it the jQuery way - jayq makes it even easier

17:58 mefesto: well if im going to go this route i'd like to follow it's idioms ... its. just. hard. :)

17:59 amalloy: arohner: thanks!

18:01 dnolen: mefesto: fwiw - I don't think it's important to fret over page load times the way that Google does - unless your Google size.

18:01 mefesto: best to just do whatever feels most comfortable.

18:02 mefesto: dnolen: true. i tend to get caught up in "the way" too much when switching to new tools :-\

18:02 i.e. the right way (for this tool)

18:02 to which most reply, there is no "one, right" way :)

18:05 redwire: Does someone know for a good guide for setting up clojure on OS X 10.7? I've been having a hard time setting up 1.4.0 to work, clojure-contrib included (I'm new at clojure, too). clj works after a macports install, but using it to try to build clojure-contrib fails.

18:06 technomancy: clojurebot: macports?

18:06 clojurebot: Excuse me?

18:06 technomancy: =(

18:06 dnolen: redwire: don't use macports - don't use brew. Just install leiningen.

18:06 technomancy: clojurebot: installing clojure?

18:06 clojurebot: Clojure isn't like most languages in that it doesn't need to be installed; it's just a library. Once you have a JVM, you can set up a project with something like Leiningen (http://j.mp/leiningen), which will pull Clojure in for you.

18:06 technomancy: aha; that's the one

18:06 dnolen: redwire: and don't bother with clojure-contrib it's deprecated.

18:08 redwire: I thought all sorts of things used clojure contrib? I see it all the time when I'm looking for particular function, it always seems to pop up.

18:08 amalloy: the web is a medium with a high rate of decay. two years ago, using all of contrib was very common

18:08 hiredman: :(

18:09 amalloy: and you're finding blog posts that are from that era

18:09 redwire: This is true.

18:09 I want technomancy's leiningen?

18:09 amalloy: yeah, accept no substitutes

18:10 redwire: Aye

18:10 mdeboard: redwire: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

18:10 * technomancy sends a DMCA takedown notice to knockoff Vietnamese Leiningen peddlers

18:10 solussd: I <3 leiningen- makes clojure the most convenient language to build in (out of what I use anyway)

18:11 redwire: Wow that's saying a lot.

18:17 I like this leiningen so far. Thank you, everyone.

18:18 technomancy: yay =)

18:18 redwire: Oh hi technomancy. o.O

18:22 gfredericks: technomancy: :D

18:22 ibdknox: technomancy: I'm happy to serve as a henchman and wait outside their apartments/scaring the neighbors as appropriate

18:23 * emezeske hides his bootleg Leiningen CD.

18:23 gfredericks: Vietnamese Leiningen Peddlers would be a good name for a group of some kind

18:23 ibdknox: especially if Nerf guns might be involved.

18:24 * ibdknox thinks the whole nerf thing has been one of the most ridiculous things he's heard lately

18:24 technomancy: http://fuckyeahfingerguns.tumblr.com/

18:24 Wild_Cat: sounds like a good name for a punk band

18:24 ibdknox: technomancy: hahah well done :p

18:26 zakwilson: There was something I used in one project from contrib that still doesn't appear to have been replaced.

18:26 Though I can't remember what it is now.

18:26 gfredericks: under "archive" it shows technomancy riding atop the dalai lama

18:27 I think that is window-size-sensitive though

18:29 * gfredericks makes another tally next to "number of times I have used 'technomancy' and 'the dalai lama' in the same sentence"

18:39 ipostelnik: what's a good way to debug why "lein deps" is slow

18:40 technomancy: ipostelnik: two things: 0) are you on 1.7.1, and 1) do you actually need to run lein deps? (probably not)

18:40 ipostelnik: technomancy, I'm on 1.7.0

18:40 I'll upgrade

18:41 technomancy: step 2: stop running lein deps =)

18:41 ipostelnik: even when I don't run it, lein uberjar does

18:41 what's the alternative to lein deps?

18:41 fmancinelli: Hi everybody... Just to announce that I've written a little plugin for Leiningen for compiling Less CSS files. You can find it here: https://github.com/fmancinelli/lein-lesscss - Comments are welcome. (FYI it's my first Clojure project)

18:41 technomancy: ipostelnik: just let lein fetch the deps when it decides it needs to

18:41 but 1.7.1 will fix the uberjar issue

18:41 ipostelnik: I have a "main" project and a "library" project that I'm working on

18:42 often I need to fix or extend the "library" project, then build "main" project

18:43 technomancy: have you tried using the checkouts/ directory?

18:43 ipostelnik: noidi, I'm not familiar with this feature

18:44 uberjar is definitely the bigger issue though, I'm glag simple upgrade to 1.7.1 helps

18:52 checkouts directory is awesome!

19:41 nDuff: Hmm.

19:42 I get a very different context classloader attached to my thread when using swank-clojure as opposed to nrepl

19:54 Roxxi: Is there a clojure idiom for zip? (e.g. (zip '(a b c) '(1 2 3)) => '((a 1) (b 2) (c 3)))

19:54 brehaut: roxxi: map

19:54 Roxxi: ehst

19:54 technomancy: clojurebot: zip?

19:54 clojurebot: zip is not necessary in clojure, because map can walk over multiple sequences, acting as a zipWith. For example, (map list '(1 2 3) '(a b c)) yields ((1 a) (2 b) (3 c))

19:55 Roxxi: err

19:55 ah

19:55 awesome

19:59 meiji11: is there a way to use recur in a function that takes a variable number of arguments?

20:00 writing (apply fn-name arg-list) works, of course, but I'd prefer not to consume the stack.

20:03 metellus: have it take a list or vector instead, maybe

20:05 meiji11: yeah, I could just introduce a small wrapper function.. that will work. thanks.

20:06 technomancy: meiji11: recur interacts in very surprising ways with destructuring and rest args

20:06 the details of which escape me at the moment

20:08 meiji11: it seems that way. shouldn't that be documented somewhere?

20:09 technomancy: =(

20:11 zanes: meiji11: s/documented somewhere/fixed/

20:13 hiredman: given the implementation of recur and the implementation of varargs fixing it would be very tricky

20:13 technomancy: also re-applying destructuring might slow things down

20:13 considering most loop/recur usage is in tight loops

20:14 hiredman: technomancy: I don't think there is an issue with destructuring, just rest args

20:15 if you recur, you jump to the top of the function, and the destructuring has a change to be applied

20:15 but for rest args the top of the function is already too late

20:16 technomancy: ah, sure. been a while since I ran into this.

20:17 hiredman: yeah, me too

20:17 not something I deal with on a regular basis

20:17 technomancy: thankfully

20:17 hiredman: Yes

20:28 * nDuff blinks

20:28 nDuff: ipostelnik: howdy!

21:09 aniero: hmm, when will clojuredocs.org be updated?

21:13 bhenry: aniero: when you update it.

21:13 aniero: for 1.4.0?

21:14 i'm ok with a "PDI" response, i just don't know how the site is operated/managed

21:14 bhenry: i'm just giving you a hard time. i don't think community has the capabilities to change the layout of a version, just the docs themselves for what's there.

21:16 aniero: hmm, looks like the docs analyzer requires a manual update in order to handle the next version

22:22 devn: ,((every-pred odd? number?) (range 0 10))

22:22 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Argument must be an integer: clojure.lang.LazySeq@9ebadac6>

22:22 devn: ,((every-pred odd? number?) 1 3 5 7 9)

22:22 clojurebot: true

22:22 devn: ^-cool. never knew about that fn.

22:23 ibdknox: dnolen: Got off the phone with the MITx guys - very neat experience :)

22:25 kovasb: ibdknox: cool. did the daring fireball post explode your inbox again?

22:25 ibdknox: not really

22:25 interestingly enough

22:26 I wonder if most of those folks had already seen it through HN or Reddit

22:26 kovasb: yeah thats funny. likely true

22:26 devn: lol. found this in the #clojure archives...

22:26 ,(letfn[(!-?>[&$ &!](if(>,&!,1)(!-?>@(->>,&$,(*,&!)ref)(->,&!,dec))&$))](!-?>,1,5))

22:26 kovasb: still, the audience is so huge

22:26 clojurebot: 120

22:26 kovasb: did see the kickstarter got a a kick tho :)

22:27 ibdknox: absolutely, UncleBobMartin and him helped a lot there

22:27 Raynes: ibdknox: Why were you talking to MITx?

22:27 ibdknox: Raynes: they wanted to talk to me

22:27 Raynes: About?

22:27 ibdknox: Light Table has a lot of potential as a teaching tool and they're building a teaching platform :)

22:28 Raynes: Tell them GIVE ME YOUR MONIES

22:28 kovasb: call it "consulting"

22:28 ibdknox: haha :)

22:28 muhoo: mitch resnick and those guys have been going towards something like this for a long time, but haven't quite got there yet

22:29 ibdknox: muhoo: I'm surprised I didn't hear from one of them to be honest

22:29 devn: Raynes: no one wants dirty grant money

22:29 kovasb: yeah, you don't know what they had to do to get it

22:30 devn: yeah...like...write grants

22:30 ewwww

22:30 ;)

22:30 kovasb: deal with committees

22:31 getting money out of academia has to be worse than enterprise sales

22:31 but i digress

22:31 ibdknox: I dunno about that.. enterprise sales is soul sucking

22:31 muhoo: sussman, wow

22:32 ibdknox: Yeah, it was cool

22:32 very down to earth and a lot of fun to talk to

22:44 devn: 115k and counting

22:44 shouldn't be long now...

22:44 muhoo: i'm so ready to take my chances on cljs now, after having to write stuff like this: https://refheap.com/paste/2363

22:45 devn: heh

22:45 ibdknox: muhoo: what's wrong with that? ;)

22:45 aniero: muhoo: i'd love to see the cljs version of that

22:45 ibdknox: it's probably not that much better

22:45 function will be fn though

22:45 devn: ^-i was thinking that but didnt want to say it

22:45 ibdknox: which is nice :)

22:46 muhoo: or #(

22:46 ibdknox: you can't nest those

22:46 muhoo: reader macro, ah

22:46 devn: (map #(... #(...)) ...) => kaboom

22:46 ibdknox: really though the difference comes from the way CLJS suggests you should code

22:46 it will cause you to write that differently

22:47 and *that* will be better

22:47 devn: yeah, it's all about strongly suggesting idioms where none exist

22:47 muhoo: the thing that annoys me is this crap: }); }});});

22:47 devn: err convention is i think what i meant

22:48 muhoo: like a winking bearded dude

22:48 yoklov: muhoo: i mean, versus )))))))?

22:48 devn: muhoo: http://www.afterhysteria.com/wp-content/uploads/2011/12/zoidberg.png

22:48 like that?

22:48 :)

22:49 muhoo: yeah, at least they're consistent and easier to match up. krusty the parens.

22:49 yoklov: haha

22:49 i like the parens better too

22:49 more comfortable

22:49 muhoo: and there's comp and (-> and such too. anyway, my complaint quota is up for today :-)

22:50 devn: muhoo: it's not complaint. it's a style thing

22:50 ibdknox: I was writing some python today

22:50 devn: that can be wildly superficial, but it can also be legitimate

22:50 muhoo: i am having so much fun with clojure/noir now, i'm not going to let js harsh my buzz

22:50 devn: there's room for style in any language

22:50 aniero: muhoo: use coffeescript ;)

22:50 ibdknox: and I realized exactly how much clojure has ruined all other languages for me

22:50 mbriggs: anyone have any resources on how to structure larger sized functional apps? (books/papers/blog posts/whatever)

22:50 muhoo: heheee

22:51 devn: mbriggs: like...code organization?

22:51 mbriggs: i can think of a half dozen books on how to do it with oo, but there is a serious lack of talking about it in fp

22:51 devn: yeah

22:51 devn: mbriggs: be careful with code organization. it can be a trap.

22:51 aniero: mbriggs: the oreilly clojure book has some info

22:51 devn: in the sense that it is largely not as necessary as you think it probably is

22:52 aniero: but i'm still on "hello world" so i'm not going to worry about it yet

22:52 devn: i came from ruby where i needed to look at 10 files to figure out the call chain

22:52 clojure doesnt have that problem

22:52 mbriggs: yeah

22:52 but like

22:52 devn: id rather have a few big files honestly

22:52 aniero: i'm getting the impression that a lot of things can end up as very compact bits of code

22:53 mbriggs: when you hit 3-400k loc, things usually need to look dramatically different then a few thousand

22:53 aniero: mbriggs: but take a look at the basic leiningen project skeleton

22:53 mbriggs: i was wondering what that would look like in clojure

22:53 aniero: when you've written 300kloc of clojure, you'll have already figured out how to organize it!

22:53 mbriggs: haha

22:53 devn: mbriggs: that's seriously true

22:54 ibdknox: 300kloc is an OS

22:54 devn: here's what i see happening:

22:54 you write 3k lines of code in one file.

22:54 since clojure depends on the order of declaration and definition

22:54 you end up with logical chunks of functions which could be their own files

22:54 so you do that when you need to

22:54 mbriggs: right

22:54 devn: doing it prematurely gives you problems

22:55 brehaut: ibdknox: or hello world in java

22:55 ibdknox: ~rimshot

22:55 clojurebot: Badum, *tish*

22:55 devn: he'll be here all week, ladies and gentlemen!

22:55 mbriggs: haha

22:55 brehaut: try the veal

22:55 muhoo: HelloHelperFactory

22:56 devn: StaticIntMainVoidFactory

22:56 tmciver: How do I kill a running jetty (ring) that I started from the repl?

22:56 muhoo: that's FInalStaticIntMainVoidFactory to you, buddy

22:57 devn: tmciver: with fire

22:57 muhoo: PublicStaticIntMainVoidFactory

22:57 tmciver: devn: how do I get fire?

22:57 ;)

22:57 muhoo: haha

22:57 brehaut: tmciver: you hold on to the server that is returned and the call .stop or something

22:57 muhoo: tmciver: keep a reference to it laying around after you start it

22:57 devn: tmciver: two sticks. rub them together vigorously.

22:57 muhoo: (def srv (server/start...))

22:57 then (.stop srv)

22:58 * tmciver wishes he had kept a reference . . .

22:58 devn: tmciver: what muhoo said. i keep a (comment "start and stop server" ...) block to do that

22:58 LuminousMonkey: I have a namespace of utility functions that I found somewhere and shamelessly copied.

22:58 tmciver: muhoo: so if I didn't grab a ref, I'm screwed?

22:58 muhoo: tmciver: afaict, yes

22:59 there may be a way to fish it out of something you do have a handle on, though

22:59 * tmciver goes and gets two sticks

22:59 devn: tmciver: is this in production or?

22:59 tmciver: nah

22:59 muhoo: (-> something .parent .otherthing .server .stop) , etc

22:59 tmciver: a toy

22:59 devn: okay...so sticks...

22:59 ;)

23:00 brehaut: tmciver: http://brehaut.net/blog/2011/ring_introduction > Servers and Adapters

23:00 muhoo: killall -9 java

23:00 brehaut: but yeah, you are probably hosed

23:00 LuminousMonkey: https://gist.github.com/2495345

23:00 tmciver: muhoo: that will kill my swank too

23:00 devn: is anyone else bothered by people doing this in their clojure code: [ 1 2 3 ]

23:01 or \n})))

23:01 it's driving me slightly crazy

23:01 muhoo: LuminousMonkey: an atom, good call

23:01 devn: it looks ugly as sin

23:01 LuminousMonkey: yeah, that's cool. i like that.

23:01 * muhoo clones

23:02 devn: i just "liked this" on github

23:02 LuminousMonkey: Wish I could claim credit, but I just found it somewhere.

23:02 muhoo: seriously, github is facebook? aieee.

23:02 devn: LuminousMonkey: that's how good code moves about

23:02 brehaut: LuminousMonkey: why not just varquote and not worry about restarting?

23:02 lancepantz: devn: that's old school perl style

23:03 never did it with lisp

23:03 devn: lancepantz: the newline stuff and the spaces around it?

23:03 lancepantz: the spaces

23:03 devn: it's ruby parlance in some cases as well

23:03 lancepantz: i used to do it with ruby until ninjudd kept yelling at me

23:03 devn: but...well, perl

23:04 lol. i feel like a nazi, but i think a lot of my pull requests have been really nice versions of: "this is what people expect in your library"

23:04 camelCase => camel-case, no more \n})))), and no more [ [1 2] [3 4] ]

23:04 LuminousMonkey: brehaut: I'll have to just profess ignorance. Still new to Clojure, et al.

23:04 devn: also, this craziness with lining up things so they're readable. i think it makes more trouble than it's worth

23:04 you find these definitions that are like:

23:05 brehaut: LuminousMonkey: right. thats an entirely valid reason :)

23:05 devn: {:foo [bar]

23:05 LuminousMonkey: That's horrible.

23:05 muhoo: i saw that, and thought it was someone's editor trying to be cute

23:05 devn: GOTTA LINE EM UP! GOTTA CATCH EM ALL!

23:05 mefesto: lol

23:05 muhoo: OCD is a terrible disease

23:06 lancepantz: oh dude, the arguments we have in the office about that

23:06 devn: i go to edit it and i rename something. the name is longer than the longest name in their map

23:06 so i spend 10 minutes realigning their code

23:06 its like wtf

23:06 lancepantz: that's something ninjudd is religous about doing

23:06 but it annoys the shit out of me and amalloy

23:06 devn: i cant stand it

23:06 i want to program, not align code

23:06 lancepantz: what's bad about it is that you end up editing lines you didn't really touch on commits

23:06 devn: lancepantz: exactly

23:07 mbriggs: m-x align-regexp :)

23:07 lancepantz: mbriggs: doesn't work in lisp

23:07 devn: mbriggs: i use that if i know the author is hardcore about alignment

23:07 lancepantz: you don't have an '=' to align on

23:07 mbriggs: true

23:07 devn: but in general i just make it messy by refusing to align

23:07 emezeske: More to the point, you end up un-aligning code without realizing it when you do a regex search+replace

23:08 devn: lancepantz: you can dedent the whole thing and then align on \s* or something

23:08 brehaut: LuminousMonkey: replace (wrap-stacktrace routes/app-routes) with (wrap-stacktrace #'routes/app-routes) and i think it should be good

23:08 devn: lancepantz: but either way, yes, it's ridiculous in my opinion

23:08 mbriggs: imo you should align things together that are the same things. all the values of your bindings aren't really related

23:08 devn: it's just crazy OCD

23:09 lancepantz: right

23:09 devn: if you need to align things to make it clear, i think you are probably failing to extract some stuff

23:09 muhoo: my vote for best homepage layout has to go to: http://flatland.org/ though

23:09 devn: i see this in case and cond statements

23:09 people align these (fn [])s

23:09 and it's like: dude, just make a new fn, name it

23:09 lancepantz: muhoo: what?

23:10 muhoo: thanks, but it's specifically an example of what we're bitching about!

23:10 LuminousMonkey: brehaut: What's the difference?

23:10 devn: lol lancepantz

23:10 * devn does a robot voice

23:10 brehaut: LuminousMonkey: that #' is a varquote; its equivalent to going (var routes/app-routes)

23:10 devn: "must...make all...strings..align"

23:10 * mefesto is guilty of manual alignment in case and cond

23:11 devn: mefesto: i usually do it, and then i undo it

23:11 because it's a pain in the ass

23:11 brehaut: LuminousMonkey: instead of indirecting though the var immediately, it holds that var and later indirects through it each time the handler is called

23:11 devn: mefesto: i add something and it's like "great, now time to realign the entire cond"

23:11 mefesto: devn: i tend to put the expr under the test

23:11 LuminousMonkey: Oh?! Hey, thanks!

23:11 brehaut: LuminousMonkey: it results in your jetty picking up the redef'd handler automatically, rather than you needing to manually restart the jetty

23:11 muhoo: what do you put in the commit comment for that change though?

23:11 LuminousMonkey: That is useful.

23:11 devn: muhoo: me?

23:12 LuminousMonkey: brehaut: I was too lazy to figure out how to avoid doing that.

23:12 brehaut: LuminousMonkey: yes :) it makes a world of difference for quickly developping a site with ring

23:12 devn: muhoo: i put "*grumble grumble*"

23:12 brehaut: LuminousMonkey: i didnt figure it out either; someone showed me

23:13 devn: lancepantz: so you mean to tell me ninjudd is all hardcore about [ 1 2 3 ], but aligns all of his code?

23:14 lancepantz: that's OCD^2 ;)

23:14 mefesto: devn: this is what my ocd makes me do https://gist.github.com/2495393

23:14 brehaut: no problem

23:14 devn: mefesto: why not inline it?

23:15 brehaut: whoops. wrong window

23:15 mefesto: devn: i wish i could rationally explain it :)

23:15 wkmanire: Howdy folks.

23:15 muhoo: i have to admit i wrote this and jackhammer that key combination obsessively: https://refheap.com/paste/2365

23:15 mefesto: devn: it much of a problem with that example but when the tests are more staggard it triggers my ocd

23:15 devn: mefesto: that's how i feel about that: https://gist.github.com/2495395

23:16 mefesto: or if you're committed to newlines... https://gist.github.com/2495395

23:17 err mefesto: https://gist.github.com/2495395/1bcb45004dc0f48748c91d227cd4091c3c61db9f

23:17 now im revealing my OCD

23:17 mefesto: devn: by staggard i mean something like this https://gist.github.com/2495393

23:17 devn: "you have OCD! you don't do it my way!"

23:17 mefesto: lmao

23:18 devn: mefesto: i think a 1 space or two space indent is appropriate there, and personally i really dislike the comments.

23:18 mefesto: again, i think that's OCD, but i just find it to be noisy as hell. we have docstrings and indentation before we require comments

23:19 mefesto: devn: my ocd could handle a 2 space indent

23:19 devn: mefesto: err s/that's/im/

23:19 i meant to say i think "that's my OCD"

23:19 i really rely on indentation to aid in readability

23:20 mefesto: i think the 2 space indent keeps the beast happy enough that i can lose the comments too. thanks :)

23:20 devn: mefesto: one thing i am always struggling with aesthetically in cond is inlining :else (do-other)

23:20 or :else\n(do-other_

23:21 mefesto: devn: i know the feeling!

23:21 devn: (do-other)*

23:21 wkmanire: I'm having a newb moment.

23:21 devn: wkmanire: im always having one of those ;)

23:22 wkmanire: Unable to resolve symbol doc in this context...

23:22 :/ Isn't it in clojure.core?

23:22 mefesto: wkmanire: (use 'clojure.repl) ?

23:22 devn: wkmanire: mefesto has it

23:23 wkmanire: Oh.

23:23 devn: wkmanire: i don't know exactly what prompted this and i personally disagree with it

23:23 wkmanire: Thanks.

23:23 Well, to put it very ignorantly, it seems to me that by starting my REPL I've done everything I need to do for doc to be available.

23:23 devn: wkmanire: but as of 1.3 or thereabouts doc was no longer there

23:24 mefesto: wkmanire: i agree ... if im in a repl i want clojure.repl :)

23:24 devn: wkmanire: i think rich's keynote at the last conj was fitting: we need different types of builds

23:24 id like to see a developer build/env, and a production build/env

23:24 wkmanire: That seems appropriate to me.

23:24 mefesto: im probably overreaching but i'd like clojure.pprint as well

23:25 devn: mefesto: i dont think i disagree with that

23:25 it doesnt WARN in core, so please gimme it

23:26 another thing i think about is: I want to search for functions that might be in clojure.walk, but that i can find via other avenues

23:27 mefesto: which reminds me. lately in my projects i've been using lein's :repl-init myapp.repl which has all those goodies plus helper functions all loaded in it. then when i connect to the repl i switch to that ns.

23:27 devn: I want to: (apropos "macroexpand" :std-lib) and see #'clojure.walk/macroexpand-all

23:27 mefesto: is that the wrong way to use :repl-init ?

23:28 muhoo: one of these days, i'm going to write my own ns macro that automatically pulls in clojure.repl, clojure.pprint, and my own library of trying-to-make-lein-into-ipython utils, whenever i change ns's in the repl

23:28 devn: mefesto: im not a user of it, so i cant speak to that.

23:28 muhoo: are you familiar with "pry"

23:28 muhoo: no, what's that?

23:28 devn: http://pry.github.com/

23:29 this is a ruby thing, but the idea of it is something ive wanted to build in clojure for awhile now

23:29 I want to (cd String)

23:29 (ls)

23:29 * felideon gives up setting up slime-ritz

23:29 muhoo: neat

23:30 i really should just try slime. probably everything i want is in there already

23:30 devn: muhoo: meh. it's a PITA to configure if you want bells and whitles

23:30 whistles*

23:30 hugod: felideon: what is proving difficult?

23:30 felideon: ipython sucks?

23:30 not that i've used it often

23:30 wkmanire: Would someone be able to recommend an in-depth article on namespaces.

23:31 devn: wkmanire: i have the perfect article

23:31 wkmanire: I am absolutely confused by them.

23:31 devn: wkmanire: http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html

23:31 muhoo: devn: well of course, it's emacs. it's taken me 8 years to set up emacs, and i'm about halfway done

23:31 wkmanire: devn: Thank you!

23:31 * wkmanire begins to read immediately.

23:31 felideon: hugod: getting a repl running

23:31 mbriggs: devn: what kind of bells and whistles are there? other then sending stuff to it and whatnot, the only whistle I have is ac-slime :)

23:32 hugod: felideon: you trying with jack-in, or a manually installed slime?

23:32 devn: mbriggs: i have syntax highlighting, paredit, and fuzzy completion in the slime repl

23:32 mbriggs: ooo

23:32 devn: i do full editing in the slime repl quite a bit

23:33 mbriggs: i remember reading somewhere syntax highlighting in the repl made stuff run real slow

23:33 felideon: hugod: i installed slime through marmalade

23:33 and tried jacking in

23:33 mbriggs: muhoo: i just did a du -h on my .emacs.d and got 121M .emacs.d

23:34 felideon: install clojure-mode

23:34 devn: mbriggs: here's the config: it's heavy and may not work for you... https://gist.github.com/2495437

23:34 mbriggs: it can make thing super slow

23:34 muhoo: heh. i just looked at the git history on my .emacs first commit: Mon Feb 9 22:08:51 2004 +0000

23:34 hugod: felideon: for jack-in, you shouldn't have slime installed

23:34 devn: mbriggs: so i (set! *print-length*)

23:35 felideon: hugod: the readme page is pretty hard to follow then

23:35 devn: err (set! *print-length* 10) and (set! *print-level* 3)

23:35 felideon: hugod: under the Install headline, those are all OR options?

23:36 mefesto: from reading the mailing list i think there is a different between property access and function access in clojurescript. is there a doc on this plus other things like js/* somewhere?

23:36 mbriggs: devn: you don't use rainbow parens?

23:36 muhoo: is there a way to jack-in to an already running lein repl, without starting a new one?

23:36 devn: muhoo: nah

23:36 that looks like clown puke

23:36 mbriggs: devn: and thanks, i love finding new emacs stuff :)

23:36 hugod: felideon: I see how it could be confusing

23:37 felideon: hugod: ok so i have lein ritz running

23:37 do i need to slime-connect to that?

23:37 devn: muhoo: i meant yes

23:37 mbriggs: that "nah" was directed at you

23:37 muhoo: slime-connect is what you want

23:37 hugod: felideon: yes

23:38 muhoo: lol, clown puke

23:38 devn: muhoo: "lein swank" assuming you have the lein-swank lein plugin installed

23:38 muhoo: devn: thanks

23:38 mbriggs: devn: haha

23:38 devn: then M-x slime-connect, and accept the defaults

23:39 mbriggs: devn: i use it, but all the faces are customized to stuff that is a bit less intense

23:39 emezeske: Anyone have a recommendation for a clojure time library for a webapp? I'm looking at clj-time right now, it looks good.

23:39 devn: emezeske: is that a joda-time thingamajig?

23:39 i think it is right?

23:39 emezeske: devn: Yeah

23:39 brehaut: technomancy: relevant to your interests http://vimeo.com/40980282

23:40 devn: emezeske: yeah ive used that in the past. it was good.

23:40 amalloy: mbriggs: i don't like rainbow-parens, mild colors or no, because it encourages manual matching up of parens

23:40 emezeske: devn: Thanks!

23:40 mbriggs: amalloy: you mean as opposed to just relying on paredit?

23:40 amalloy: yes

23:40 devn: mbriggs: just paren matching is good enough

23:41 paredit is icing

23:41 it's nice, but it doesn't exactly make you turn into a turnip or anything -- just need to find the rhythm of it and you're fine

23:42 * devn says something else vague and then leaves

23:42 felideon: devn: well, I didnt really appreciate paredit until i did manual paren matching for a while and tried it again

23:43 mbriggs: i use something called mic-paren as well, it matches the parens right before the point as well in a different colour

23:43 actually way more helpful then it sounds

23:44 devn: felideon: it's nice, but until it's second nature it's a weird, weird world

23:44 felideon: devn: paredit?

23:44 devn: felideon: so when im showing someone clojure for the first time i dont install emacs and paredit and all manner of craziness

23:44 because 90% of them dont use emacs by default

23:44 felideon: right

23:44 devn: i use that stuff personally and i agree with you

23:44 but it's a lot to take in

23:45 felideon: i know well seasoned lispers who use IDEs rather than emacs

23:46 and there is no paredit there, and are mad confused when one uses paredit

23:46 LuminousMonkey: I switched to Emacs purely because of Clojure.

23:46 Paredit took some getting used to.

23:47 mbriggs: i was using vim and i switched because of lisp in a general way

23:47 but i use evil mode

23:47 felideon: require: Symbol's value as variable is void: slime-ritz

23:47 * felideon sighs

23:47 felideon: now slime-connect doesnt work

23:48 you would think setting up a clojure environment in emacs is much more straightforward than Common Lisp

23:49 devn: honestly i have to say that the amount of discussion ive seen in this channel at editors is like...whoa

23:49 just write the damn code in notepad

23:49 hugod: felideon: you could try a M-: (require 'slime-ritz)

23:49 devn: s/at/about

23:50 felideon: devn: hell no.

23:50 muhoo: iirc, rhickey was married to lispworks IDE for a long while, before switching to emacs after clojure was released

23:50 mbriggs: devn: i love obsessing about editors :) its like, the one type of code i write that is useful to ME as opposed to other people

23:50 devn: lol. i just think it's so superficial'

23:50 LuminousMonkey: I don't think it is.

23:50 felideon: and copy&paste into terminal repl? nothx

23:51 devn: felideon: the code is more important than its indentation

23:51 felideon: I disagree.

23:51 LuminousMonkey: It's pretty much your interface into programming, you need it to be as comfortable as possible.

23:51 felideon: and it's more than indentation.

23:51 hugod: felideon: the latest slime-ritz is available in the melpa package repo at http://melpa.milkbox.net/packages/

23:51 devn: i tickled a nerve!

23:51 im playing devil's advocate on this for a reason

23:51 felideon: well I'm a real lisper, what can I say.

23:51 bahaha

23:51 LuminousMonkey: That's why Light Table stirred up all that interest. :)

23:52 devn: ive seen people who are way more efficient programmers than me

23:52 and they use crude environments with no safety nets

23:52 felideon: hugod: i think my inexperience with melpa and package.el is adding to the confusion

23:52 devn: and they make me look like a 10 year old

23:52 felideon: ah yes, the masochists.

23:52 i am not so smart, i need my safety nets. :P

23:52 devn: felideon: that cuts both ways

23:53 do you know how long i spent setting up my fucking editor?

23:53 LuminousMonkey: Yeah, I'm nowhere near that good.

23:53 devn: let's not get into masochism

23:53 mbriggs: haha

23:53 devn: there is a *balance*

23:53 LuminousMonkey: Hey, at least you're not putting a window into the side of your computer with neons.

23:53 devn: being OCD about your editor is not balanced

23:53 LuminousMonkey: You're not doing that right?? :)

23:53 devn: nor is not caring about any niceties

23:53 felideon: devn: true. i spent 2 hours figuing out why my emacs background was off than the screenshot of the theme i'm using

23:53 (damn you sRGB bug! *shakes fist*)

23:54 devn: felideon: i wish i knew how much time ive spent in emacs and how much time ive lost as a result of: "OMG GOTTA GET MY TERMINAL TO WORK WITH ESHELL BETTER"

23:54 it's just a distraction most of the time for me personally

23:54 LuminousMonkey: I'm sure there was a Steve Yegge rant about something similar to this...

23:54 devn: im glad i spent the time, because im done messing with it now

23:55 mbriggs: devn: I screw around with that stuff either when i'm fried from work and don't feel like hacking on real code, or sitting next to my wife, "watching" so you think you can dance

23:55 devn: but i think it truly was a waste

23:55 mbriggs: lol

23:55 the "so you think you can dance" reference just sealed this conversation

23:55 mbriggs: haha

23:55 felideon: lol

23:55 mefesto: lol

23:55 devn: you need a signet ring or something

23:55 that's how epic that is

23:56 felideon: hugod: thanks for helping.

23:56 devn: "So You Think You Can Dance" stamped in wax

23:56 felideon: are you supposed to add elpa directories to load-path?

23:57 devn: felideon: stop it!

23:57 ;)

23:57 felideon: devn: :(

23:57 devn: felideon: im kidding, i just need to look at my config and ill tell you what i do

23:57 hugod: felideon: (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/&quot;) t)

23:57 devn: felideon: i dont add them to the load path

23:58 felideon: if you're on emacs 24 i think they're already added to the load-path

23:58 felideon: oh ok.

23:58 hugod: ok so i have the marmalade-repo.org/packages

23:58 devn: felideon: yeah, thats all ive added as well

23:59 felideon: hugod: adding melpa.milkbox.net gives me bleeding?

23:59 hugod: felideon: yes

23:59 devn: milkbox.net

23:59 that's a great domain

23:59 felideon: now requiring clojure-mode fails, if i don't add the elpa sub-dir to load path

Logging service provided by n01se.net