#clojure log - Aug 04 2011

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

0:00 st3fan: interesting

0:00 amalloy: *boggle* what is this (:use [clojure.contrib]) thing? i don't think clojure.contrib exists as a namespace, does it?

0:00 fmw: I'm having trouble importing a module from Google Closure (goog.history.Html5History). For some reason it says goog.history is undefined when my script loads, but later it does exist: http://paste.pocoo.org/show/452339/

0:01 amalloy: oh, you have [except] in there

0:01 fmw: any idea how to fix this?

0:01 amalloy: clojurebot: thunk?

0:01 clojurebot: Gabh mo leithscéal?

0:01 amalloy: dang. anyone got something pithy and useful to teach clojurebot about thunks?

0:02 st3fan: amalloy: i took the sql code as an example .. do you know why they do code like with-client and with-client* ?

0:02 i assume i can merge the two pretty easily

0:03 amalloy: st3fan: i don't know about sql in particular

0:03 st3fan: maybe it is to do as less possible in the macro

0:03 amalloy: but in your code one is a macro and one isn't. the macro is easier to write in simple cases, and the function is easier to combine with other code

0:04 st3fan: yeah the sql code is all like that .. one line macros that call a function

0:04 amalloy: that's one common use of the foo/foo* distinction. see, for example, in clojure.core: binding, with-bindings, and with-bindings*

0:05 fmw: hmm, if I change the order of my imports with (:require [...]) it says some other module is undefined

0:05 st3fan: i see

0:09 ok time to sleep

0:09 thanks for all the help and hints :)

1:02 Pupeno: Any clojars people in here away? technomancy?

1:02 technomancy: Pupeno: not for much longer, but go ahead

1:03 Pupeno: technomancy: did you mention wanting to switch databases for something java based, not sqltie? or did someone did it already?

1:03 technomancy: Pupeno: I think hiredman was talking about derby.

1:03 I don't know what _ato thinks.

1:04 I think derby makes more sense than sqlite, but I don't know if it's worth messing with something that works.

1:04 Pupeno: I was recently recommended H2 on Stack Overflow.

1:04 Ok then.

1:04 technomancy: one thing that's a definite win would be moving the search functionality off sqlite to lucene

1:05 apparently we already have indices being generated

1:05 then again, the indices might not include description, I'm not clear on that

1:06 _ato: what would be the benefit of derby over sqlite? to me it just seems to make things harder. sqlite has a very nice command-line tool

1:06 Pupeno: _ato: the advantage would be no extra non-java dependency to install… not a huge advantage for clojars.

1:07 technomancy: I think with the repl the CLI tool isn't a big deal, but I don't feel strongly either way.

1:07 Pupeno: technomancy: is vagrant supposed to set up some kind of port forwarding or something so I can access clojars with a browser from my real machine.

1:08 technomancy: Pupeno: yes, see the Vagrantfile; localhost:8088 should work

1:08 _ato: sqlite doesn't need to be installed (except if you want the command-line tool). The sqlite jar file is fully self-contained and runs everywhere

1:08 technomancy: _ato: oh, I didn't realize that. in that case they're really functionally identical.

1:08 Pupeno: _ato: it is? I didn't know that… cool!

1:09 technomancy: yay! it's working! :)

1:09 technomancy: I also thought that we would need to run mirrors by now, so what do I know about databases. =)

1:09 Pupeno: nice!

1:09 Pupeno: Ok… I'll try to upload a jar and see how it goes… should I try switching to the packaged nailgun?

1:10 _ato: yeah, the jar includes native code for most common platforms and some kind of magical "convert a mips binary to JVM bytecode" so even if there isn't a native version for that platform it can still run (but with some performance overhead)

1:10 technomancy: Pupeno: I'd hold off on that since it may become irrelevant with the mina sshd branch

1:10 _ato: aha; nestedvm. I'd heard about that but it sounded crazy =)

1:11 _ato: yeah, I think it is crazy. It's crazy that works though. :-)

1:12 Pupeno: technomancy: is there another port for ssh/scp?

1:12 technomancy: should be 2222

1:12 that's vagrant's default

1:13 Pupeno: I'll add this to the docs.

1:13 technomancy: Pupeno: the #1 feature I would like to see added is having it not require the pom file to be scp'd along with the jar if the jar contains the pom

1:13 that would be very convenient

1:14 Pupeno: technomancy: if I can get the uploading a jar part working, I'll try to look into that.

1:14 technomancy: showing more metadata on the jar pages is probably second on my list

1:15 Pupeno: Where's the password for the vagrant user?

1:15 technomancy: it's just "vagrant"

1:16 Pupeno: ok.

1:16 technomancy: would be good to have that documented too

1:16 Pupeno: man, you are like the fifth person I've tried to rope into helping out, but the first who's actually done anything. this is great. =)

1:17 Pupeno: I wrote the info in the README.md… I'll turn it into sentences later.

1:17 I do want something in return… I'm very new to Clojure, so any feedback on what I'm doing wrong and how to improve my code is very appreciated.

1:19 The Joy of Clojure should arrive today :)

1:20 I used to do some scheme and cl a few years ago but I'm really writing Java with Clojure syntax and not Clojure (well, Java, Ruby, whatever)

1:20 ruby-1.8.7-p334 pupeno@picard:~/Temporary/foobar$ scp -P 2222 foobar-1.0.0-SNAPSHOT.jar pom.xml clojars@localhost:

1:20 Welcome to Clojars, pupeno!

1:20 It's taking a long time.

1:21 The vm seems to be iddle.

1:22 technomancy: you can check the log in /var/log/clojars/

1:22 I'm heading off though; sorry

1:22 * technomancy &

1:22 lazybot: java.lang.Exception: EOF while reading

1:23 Pupeno: It seems not to be doing anything.

1:25 Ok… nailgun exception: https://gist.github.com/1124552

2:11 _ato: Pupeno: http://groups.google.com/group/clojars-maintainers/browse_thread/thread/fbc233186c497751

2:56 Cozey: :-)

4:01 Pupeno: _ato: how do you deploy clojars?

4:04 _ato: uberjar it, stick an upstart job in that runs two instances of it with java -jar. Put nginx in front to deliver the static files (like the jars themselves). Use balance for failover of the ssh port

4:04 Pupeno: I meant… do you copy the jars manually?

4:05 _ato: there's a git checkout in /home/clojars/prod. I have a shell script that does a git pull && lein uberjar && restart clojars

4:05 Pupeno: ok.

4:06 _ato: some more details here (you've probably seen this therad): https://groups.google.com/group/clojars-maintainers/browse_thread/thread/d4149ec96316d5b1

4:11 Pupeno: _ato: the proper way to get nailgun would be to download 0.7.1, apply that patch and compile, right?

4:12 This patch: http://mail.martiansoftware.com/pipermail/nailgun-users_martiansoftware.com/2009-November/000009.html

4:12 _ato: right. just for development testing vanilla 0.7.1 is fine. But I wouldn't want to run in production without that

4:13 Pupeno: Ah, ok… then just the package then.

4:19 Generic_Dumbass: I'm a noob, forgive a dumb question: how complete is the conversion of SICP to Clojure?

4:23 wunki: Generic_Dumbass: http://sicpinclojure.com/content/current-status

4:24 Generic_Dumbass: Right, I was hoping someone had something a bit clearer.

4:24 kumarshantanu: There are few SICP solutions on GitHub too

4:24 Generic_Dumbass: Thanks though.

4:24 Ok, I'll check that as well

4:24 I saw Github converted Practical Common Lisp too, so yeah

4:24 kumarshantanu: I guess it should be a bit collaborative to get it complete faster

4:25 wunki: I just ordered SICP today, is it doable to convert to Clojure yourself while reading? Without the page above.

5:18 Pupeno_: As far as I know SICP require very little language features, so it shouldn't be that hard to do it in another language.

5:20 opqdonut: I guess the biggest difference between scheme and clojure is tail recursion

5:20 and maybe some macro stuff

5:20 Pupeno_: opqdonut: yes... tail recursion... that's an important one.

5:20 opqdonut: I don't remember any macros from SICP. I haven't read it all though.

5:21 opqdonut: I'm not sure either whether it had any

5:31 raek: ...and the different approach to mutability

5:39 opqdonut: oh yeah

5:41 Pupeno_: I would go through SICP with Scheme or a language I know already.

6:39 jsoftw: Whats a good gui library which has windows looking like the normal windows from the guest os?

7:10 thorwil: is it possible to construct a function call using a construct like (symbol (str 'f "-bar)) within a function?

7:12 _ato: thorwil: http://clojuredocs.org/clojure_core/clojure.core/resolve

7:12 Bronsa: [B[B[B[B[B[B[B[B[B[B[B[B[B[B[Bbailey ] [ SecretAgent ] [ xiaolongxia ]

7:12 ops

7:12 sorry, mouse broken

7:13 thorwil: _ato: ah, thanks!

7:21 jsoftw: :

7:21 :(

7:22 Chousuke: thorwil: are you sure you want to do that though. sounds super hacky :P

7:22 jsoftw: lein repl / test gives a bunch of bollocks exception trace, with the most meaningfull error being 'incompatable type on stack'. Any ideas?

7:23 Pupeno_: jsoftw: paste the whole thing? (gist.githum.cob.

7:23 com).

7:24 jsoftw: git://gist.github.com/1124991.git

7:24 thorwil: Chousuke: actually not 100% sure. it's nice to get rid of repetition easily, but not being bale to search for all symbols in use is bad

7:24 able, even

7:24 jsoftw: https://gist.github.com/1124991 <--

7:25 This is the stuff I fear :(

7:25 Java coming back to haunt me

7:27 manutter: jsoftw: that looks like either a corrupted jar file or (perhaps more likely) conflicting jar files in the same classpath

7:28 jsoftw: riight.

7:28 :(

7:28 manutter: Does it do that for all "lein new" projects, or is there perhaps something magical about lein new TEST"?

7:28 jsoftw: all new projects.

7:29 manutter: The first thing I'd try would be "lein upgrade" to see if that cleans up anything

7:30 jsoftw: I might just get the proper java.

7:30 _ato: what java are you running? gcj or something?

7:31 jsoftw: I did not realize debian installed some bodgy 'GNU' java.

7:31 Yeah gcj.

7:31 Which I shall remove promptly.

7:32 jcromartie: In Compojure, should I explicitly pass things like the current user to my views?

7:32 or would that be better for earmuffs

7:32 _ato: ah yep, that's likely the problem. one of the first things I do on a debian box is install the openjdk-6-jdk package

7:32 jcromartie: since the currently logged-in user is a lot like *in* or *out* frankly

7:35 raek: "lein new test" is known to be "magical"

7:35 thorwil: jcromartie: you could have different views depending on role

7:35 jcromartie: hm

7:35 raek: thorwil: to get rid of repetition of names, macros can be used

7:36 thorwil: jcromartie: and those could actually be specializations of more generic views

7:36 jsoftw: Ahh there we go.

7:37 Good riddance

7:37 thorwil: raek: as i do in several cases. but it doesn't matter whether i assemble symbols in macros or functions, the effect is in both cases to have no direct reference in the source

7:37 jcromartie: thorwil: the problem I have is that I am pulling the user out with every request

7:37 I mean I could assoc it with the request, too

7:38 and that would make destructuring simple

7:38 but if I am pulling out the user and passing it to the view with every single request (and I am, because some parts of the page which are always rendered depend on the user)

7:39 I dunno this is my first full-blown compojure app

7:39 thorwil: jcromartie: i think passing the user along with the request is sensible, too. only using globals seems unnecessary

7:39 jcromartie: yeah

7:39 although it does kind of make sense for things that are basically bound to the life of the request

7:39 like, I have *session* and *flash*

7:40 _ato: A middleware thing that enhances the request map with the user data sounds good to me too. Generally I find dynamic vars always come back at bite me eventually (eg threads)

7:40 thorwil: jcromartie: i currently switch views based on user, as that makes it relatively easily to have a single conditional in the controler and none in the views

7:41 jcromartie: hm... so how about rendering things like the currently-logged-in user name? or other bits like that?

7:41 jsoftw: Problem fixed :) once proper java was in there, its all go.

7:41 jcromartie: do you just always pass the values needed for the view?

7:41 not that I'm really opposed to that... it just seems more convenient to use bindings

7:42 thorwil: jcromartie: i would add things like user name into the request map (currently it's just admin or not admin, here)

7:43 jcromartie: and you pass the whole request map to the view?

7:44 I could see the view arglists getting quite large

7:44 thorwil: i think it's worthwhile to strive for having the controller pass all required info to the view, and each view thus having a single "point of entry"

7:49 jcromartie: yeah

7:50 what about having a "main" view

7:50 like, I have one called "layout"

7:50 which renders common stuff, and then the content view

7:50 right now most view functions call layout themselves

7:51 but if the controller used it like (view/layout user (view/specific-page stuff))

7:52 that requires the controller to be a little more involved, but makes the view pretty simple, I guess

7:53 thorwil: i prefer to assemble things within views, so controllers only call a single "interface" function from views. seems easier to read

7:57 jcromartie: hm

7:58 so how does that actually look?

8:01 thorwil: you just define a view functions in views.clj that only take arguments as provided by the controlers and whose job is to pass those args to a series of functions and to assemble the result

8:03 after ending up with a bit of a mess doing that ad-hoc, i switched to an approach where each view comps a number of functions, passing a map through all of them

8:03 Chousuke: thorwil: usually macros are used to get rid of repetition

8:03 jcromartie: thorwil: ah, so a map of the info you need

8:03 instead of individual args

8:03 ?

8:04 makes sense

8:04 thorwil: yes

8:04 jsoftw: Hoooray, slime repl to clojure working! :)

8:05 thorwil: Chousuke: this just looked like a case where a fn might have been sufficient. i try to use macros only where i have to. but i actually can't get the resolve and symbol combo to work, outside of a simpliefied example on the repl

8:05 Chousuke: thorwil: if you end up using resolve or eval chances are you are better off using a macro or even rethinking your approach completely

8:05 thorwil: yeah, seems so

8:05 Chousuke: what exactly are you trying to do? why do you need to construct a function name at runtime?

8:05 jcromartie: thorwil: that makes sense. so the controller basically turns the request into a map of useful model data

8:08 thorwil: Chousuke: i have pairs of views like "foo" and "foo-for-admin", so i want to use "foo" as sole arg and generate the "-for-admin". i do know how to do it with a macro

8:09 i'd switch to using an optional argument instead, but the way i currently build the views doesn't make that trivial

8:18 jcromartie: hmm

8:19 I am of the opinion that it's bad form for a macro to silently define vars with anything other than supplied names

8:19 aka "secret defs"

8:19 raek: thorwil: if you need to choose something from some set of alternatives, why not put the alternatives in a data structure? (e.g. a map)

8:19 jcromartie: or, actually

8:19 "surprise defs"

8:20 raek: you can make a macro later do make the code look prettier

8:21 I feel reluctant to the idea of using a namespace and naming conventions to "magically" choose the right var

8:24 you could perhaps use multimethods to define views for different combinations of page + role, like (defmethod render ["foo" :admin] ...) (defmethod render ["foo" :user] ...)

8:25 thorwil: i have my problems coming up with a way to handle this that will not require additional conditionals

8:25 raek: if you put the view functions as values in a map, you could use ["foo" :admin] as the key

8:26 thorwil: but of course ... i have to try that later on

8:27 ty. apparently it's still hard for me to see some of the possibilities even in the basics :)

8:30 malkomalko: what's the easiest way to add the values of two maps together? { "a" { "foo" 1 } }, { "a" { "foo" 2 } "b" { "bar" 3 } } => { "a" { "foo" 3 } "b" { "bar" 3 } }

8:31 Chousuke: malkomalko: merge

8:31 or merge-with in this case I guess

8:35 malkomalko: doesn't seem to work with nested maps

8:37 lobotomy: ,(merge-with (partial merge-with +) {:a {:foo 1}} {:a {:foo 2} :b {:bar 4}})

8:37 clojurebot: {:b {:bar 4}, :a {:foo 3}}

8:38 malkomalko: ahh I see why

8:39 that'll do it

8:40 looking at the docs lobotomy, I don't understand how that partial is working

8:40 jsoftw: How common is it for people (ie, normal, non geeks) to have the jvm on their computers?

8:41 manutter: I think the jvm is pretty standard on Mac and Windows

8:41 MasseR: jsoftw: I'd say that it's common enough to be counted as a pro argument

8:42 jsoftw: hmmm

8:43 So is it fairly straight forward to learn how to use the java libraries? Ive never coded java before

8:44 lobotomy: malkomalko, ##((partial merge-with +) {:foo 1} {:foo 2})

8:44 lazybot: ⇒ {:foo 3}

8:44 malkomalko: reading this now: http://christophermaier.name/2011/07/07/writing-elegant-clojure-code-using-higher-order-functions.html

8:44 pretty nice blog post going over partial

8:45 MasseR: lobotomy: What does the ## do? Signal the bot to run?

8:45 *eval

8:45 lobotomy: apparently yeah :]

8:47 raek: jsoftw: if you have some experience with object oriented programming languages in generelar it shouldn't be

8:48 mdrogalis: ,(partition 2 1 [1 2 3 4 5 6])

8:48 clojurebot: ((1 2) (2 3) (3 4) (4 5) (5 6))

8:48 raek: *in general, it shouldn't be too hard

8:49 mdrogalis: ,(partition 3 2 [1 2 3 4 5 6])

8:49 clojurebot: ((1 2 3) (3 4 5))

8:50 lobotomy: hahah, (partition 2 -1 [1 2 3 4 5 6]) produced a funny result

8:50 jsoftw: Excellent.

8:50 lobotomy: (not giving that to the bots)

8:50 raek: jsoftw: what you do need to learn is how the java interop looks like for the different cases. (e.g. class methods vs instance methods, nested classes, etc)

8:50 lobotomy: (partition 2 0 [1 2 3 4 5 6]) seems to do likewise

8:51 jsoftw: raek: I see

8:51 raek: and how to go from something you find in the javadoc of the lib to clojure interop code

8:51 once you learn those rules, it's pretty simple

8:52 jsoftw: Good

8:52 I think this is the business

8:52 A lisp with a bazillion libraries, good threading/etc, and nicely portable!

8:52 wi.

8:52 win.

8:53 Look forward to playing over the next month or two

8:54 raek: the libs that are harder to use from clojure are those that require you to define a class with special naming, annotations, etc

8:55 mattmitchell: anyone know if it's possible to connect a new repl to an existing swank server?

8:55 raek: basically those where the library uses reflection on your class, instead of just accepting an object that implements an interface (which is much more simple for clojure)

8:59 malkomalko: thanks for the help lobotomy, I understand now

9:00 raek: mattmitchell: if you have two separate instances of emacs, you can slime-connect to the same swank server with both

9:01 but i don't know if the one emacs - two repl buffers case is possible

9:02 mattmitchell: raek: ok that's good to know. what about using "lein repl" to connect to one?

9:02 that probably doesn't make sense, hmm.

9:03 raek: mattmitchell: lein repl actually starts a repl socket server (it prints the port number when you start the command)

9:04 mattmitchell: you can use the telnet command to connect to it: telnet localhost <port>

9:04 mattmitchell: raek: ahh telnet, let me try that

9:04 raek: but then you don't get emacs integration etc

9:04 mattmitchell: true yes

9:04 raek: just a plain terminal repl

9:10 MasseR: Oh yeah. Is a better repl in the comings?

10:08 flazz: anyone know if the free ebook included with the print copy of "joy of clojure" can be in formats other than pdf?

10:22 lobotomy: flazz, they sent me a link to versions in pdf, epub and mobi

10:22 not sure if that's a permanent thing though or some kind of limited offer

10:23 flazz: lobotomy: that sounds perfect, i'd love to read it on my kindle. have you tried it on a kindle?

10:29 lobotomy: nope, don't have a kindle

10:50 jcromartie: so here's how I'm thinking about MVC in Compojure now:

10:51 Routes live at the controller level, and the controller's job is to turn HTTP input into "view model" objects, to pass to the actual view rendering layer.

10:51 take HTTP input, reach into the model layer, and use raw model data to produce view-model data

10:51 how about that

10:53 MVVM

10:53 mefesto: I'm not familiar with compojure but that sounds like the same approach that java's spring web mvc takes

10:54 jcromartie: the traditional MVC puts a lot of stuff in the views... MVVM seems more in line with FP

10:54 gtrak: classic MVC is controller changes the model and view observes the model

10:55 jcromartie: I guess web MVC is not really classic MVC

10:55 seems like you can only really get MVC in a web app with client-side UI

10:55 which is where I'd like to be headed, actually

10:55 mefesto: most web mvc frameworks frown on logic in the views

10:56 jcromartie: Backbone.js

10:56 gtrak: martin fowler has good articles on that stuff: http://martinfowler.com/eaaDev/uiArchs.html

10:56 * chouser whispers ClojureScript

10:56 jcromartie: mefesto: how do you handle things like: (if logged-in logout-link login-link)

10:57 mefesto: ClojureScript is on my list. Just got the G Closure the definitive guide book earlier this week

10:57 gtrak: jcromartie, make a session map that you pass around

10:57 mefesto: the jdoc type hint chapter is one boring read :-\

10:58 jcromartie: thanks gtrak

10:58 gtrak: you mean like, pass a map to the view layer

10:58 mefesto: jcromartie: a conditional in the view

10:59 jcromartie: perhaps with some sort of helper to keep it as clean and reusable as possible but still boils down to a conditional

11:00 jcromartie: gtrak: and do you really mean the session map, or just a map of data that the view needs?

11:01 I'm all sold on the view only relying on data passed to it

11:01 because my session is pretty light-weight right now (just the user ID and locale)

11:01 gtrak: jcromartie, it's probably simpler to segregate session-data, you can either use two maps or a single map with a :session key, I don't know if compojure has something built in for that

11:02 jcromartie: gtrak: I have a stateful session middleware for getting/associng things in the session itself

11:02 but so far the view doesn't actually use the session

11:02 only the controller

11:03 gtrak: it should be easy to add stuff to the session and use it from the view

11:14 Cozey: i'm trying to run swank-cdt, but it can't find tools.jar - i have this file in javas home directory- how can i add this path to lein?

11:16 malkomalko: when running a reduce function, is it possible to get the current index?

11:17 chouser: malkomalko: if the current index is included in the input sequence, then sure!

11:18 malkomalko: aight, that's what I figured

11:20 hugod: Cozey: there are some suggestions for how to do that under "Sun/Oracle JDK and OpenJDK" here https://github.com/pallet/ritz

11:20 flazz: does anyone have a working link for the vimclojure nailgun jar?

11:23 mefesto: is ring-jetty-adapter suitable for a production app or is it meant only for development?

11:23 running a few ab tests against it and it seems pretty capable

11:26 Cozey: hugod: thanks! I knew i'll get this kind of arcane knowledge here :-)

11:27 gtrak: is there a way to keep multiple repl buffers in emacs?

11:29 ah, I see slime has this functionality

11:31 dnolen: chouser: why couldn't you web app routing with regular pattern matching? (just thinking out loud here)

11:31 "you do" I mean

11:32 chouser: dnolen: people do it all the time, I suspect. But wouldn't open be better. automatically "pluggable" web apps

11:35 dnolen: chouser: yeah that would be doable once we upgrade pattern matching to predicate dispatch. sadly core.logic wouldn't support in its current form, its pattern matching logic is very simple (no optimized decision tree) and closed.

11:36 chouser: you've done some work on open optimized decision tree, haven't you?

11:36 dnolen: chouser: yes, it's coming along nicely. I dare say ... it is awesome.

11:36 kumarshantanu: Is any forthcoming book going to cover core.logic (and core.unify)?

11:36 chouser: I believe it. :-)

11:37 dnolen: kumarshantanu: not from me :)

11:38 chouser: hm, though I think Rails routing provides a way to generate a path string that will take you to a given branch (ie. the inverse of routing). Delivering that feature might be pretty tricky.

11:41 dnolen: chouser: The open bit is quite tricky. We could use eval initially, but I'd like to figure out a solution using a high perf DAG via Java arrays.

11:42 chouser: I assuming that reversing has realistic limitations, you have to give precise information

11:44 chouser: yes, in rails you give precise details for each "slot", and since the rules it allows are pretty simple it ends up working out (most of the time)

11:45 it may be that it's not actually appropriate to pack all that into the same mechanism

11:47 I think the goal (or at least the one I care about) would be to have a module that can generate HTML links and forms that then trigger its own handlers again, all without restricting the specific path or route that an application "installs" that module at.

11:48 so perhaps it would be better, when installing such a module, to provide a route to trigger it as well as a function to build such a route.

11:49 dnolen: chouser: yes that would be quite cool.

11:56 huh, in Scala/Haskell can you pattern hashmaps? If so anyone got a link?

11:56 s/pattern/patternmatch

11:56 lazybot: <dnolen> huh, in Scala/Haskell can you patternmatch hashmaps? If so anyone got a link?

12:47 gtrak: hmm, I've got a problem, clj-http is pulling in apache httpclient 4.0.3, is there a version of it that uses 4.1.1?

12:49 edw: gtrak's problem just reminded me: What happens when a module is built against 1.2.0 but one's project depends on 1.2.1? I try not to think about this too much.

12:50 chouser: you should be able to override the version demanded

12:51 as long as they're still compatible, you'll be okay.

12:51 gtrak: I'll try that

13:04 AWizzArd: gtrak: and of course it always depends on what you want to do. If you just want to do a basic request then you could also just use java.net.HttpURLConnection

13:04 That way your projct would not suddenly require 5 new dependencies.

13:06 gtrak: AWizzArd, our stuff is doing some complex hackery, trying to drop clj-http in favor of clj-apache-https for secure stuff

13:06 in particular PKI and client auth doesn't seem simple

13:07 AWizzArd: Yes oki. I just wanted to mention it, because several people download a complex http lib for just doing 2-3 posts. Not all know about j.n.HUC

13:07 gtrak: yes, I wish that was the problem :-)

13:09 AWizzArd: btw, Netty also comes with an http client, and Aleph makes it usable.

13:09 Also currently Aleph has an unnecessary dependency on clj-http, but I already informed Zach about it, and he will probably drop that in the next release.

13:10 dnolen: Racket peeps have pattern matching on hash-tables, neat

13:10 gtrak: AWizzArd, been looking at: https://github.com/diamondap/clj-apache-http

13:10 it's a special fork that adds security stuff

13:10 AWizzArd: k

13:14 dnolen: yummy, yummy, Pattern Matching For Object Oriented Languages - http://www.hpi.uni-potsdam.de/hirschfeld/publications/media/GellerHirschfeldBracha_2010_PatternMatchingForAnObjectOrientedAndDynamicallyTypedProgrammingLanguage_HPI36.pdf

13:20 hiredman: fancy

13:22 mattmitchell: ,(concat [1 2] 1)

13:22 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>

13:22 mattmitchell: ,(concat [1 2] [1])

13:22 clojurebot: (1 2 1)

13:22 mattmitchell: ,(conj [1 2] 3)

13:22 clojurebot: [1 2 3]

13:23 mattmitchell: ,(#{"US"} "US")

13:23 clojurebot: "US"

13:23 mattmitchell: ,(#{"US" "CA"} "US")

13:23 clojurebot: "US"

13:23 mattmitchell: ,(#{"US" "CA"} "CA")

13:23 clojurebot: "CA"

13:24 Scriptor: clojurebot also works in pm :)

13:25 cemerick: It looks like leiningen does not use repository credentials in settings.xml?

13:25 mattmitchell: Scriptor: hey now, what are you trying to say? :)

13:25 Scriptor: just pm myself?

13:26 oh duh, ok got it :)

13:27 very cool

13:27 who the hell wrote clojurebot? seriously, too clever.

13:28 cemerick: ugh, I guess not: http://groups.google.com/group/leiningen/browse_frm/thread/dbe8536846143947

13:33 dnolen: that pattern matching for Newspeak is pretty interesting tho of course their claim about the extensibility via dynamism fails to address the work in Racket, you don't need access to the compiler there. Macros FTW.

13:35 hugod: cemerick: I think that should be easier to support once lein moves to using aether

13:36 cemerick: hugod: Sure — I can imagine dealing with the master password and hooking things up just so is probably a PITA.

13:36 AWizzArd: hugod: aether link?

13:37 cemerick: My first real attempt at using lein in a serious project is a casualty, tho. That was quick :-P

13:37 hugod: AWizzArd: http://aether.sonatype.org/

13:37 cemerick: hugod: how's the zi experiment going?

13:38 hugod: cemerick: maturing - I'm using it for my clj-ssh rewrite that I'm doing

13:40 cemerick: I'm thinking of adding a feature to the ritz/swank goals to allow you to run on the parent project of a multi-module setup (and include the source paths and dependencies of all the modules)

13:42 cemerick: See, I've always considered that an editor/IDE feature; modules / checkout dependencies are evident given a "workspace" concept and dependency coordinates. Having that leak into the build tool chafes for me.

13:42 On a conceptual level, that is — of course, I don't need to use those features.

13:43 technomancy: cemerick: sounds like you're just asking all the editors and other tools to reimplement features rather than having a single canonical source for the classpath.

13:44 hugod: the swank goal is the link bettween the build tool and the ide

13:45 Scriptor: which file are all the cljs data structures source located in?

13:46 cemerick: technomancy: I'm not asking for anything from anybody. :-)

13:47 chouser: Scriptor: src/cljs/cljs/core.cljs

13:47 cemerick: I just don't think I should have to get project clones arranged in particular ways on disk in order to get my REPL's classpath to be "right".

13:47 Scriptor: chouser: thanks

13:48 cemerick: Or, said more precisely: the classpath is a very crude and narrow pipe to control what (IMO) is easier to manage at higher levels.

13:49 technomancy: there'd be more wiggle room if runtime classpath modification didn't have big red scary warning klaxxons

13:52 chouser: I wonder how long until someone writes a lein or coke competitor in ClojureScript.

13:53 hiredman: clojurebot: coke is a solid fuel made by heating coal in the absence of air so that the volatile components are driven off.

13:53 clojurebot: c'est bon!

13:53 cemerick: coke?

13:53 clojurebot: coke is a solid fuel made by heating coal in the absence of air so that the volatile components are driven off.

13:53 cemerick: oh, cake

13:57 chouser: oh, sorry. yes, cake.

14:00 technomancy: chouser: did you mean to say competitor or port?

14:01 edw: technomancy: Yeah, I was wondering what would preclude a port.

14:01 hiredman: why a port?

14:01 cljs requires the jvm to run anyway

14:02 might as well just have a plugin that builds cljs

14:02 edw: To compile, not run.

14:02 technomancy: to take advantage of the rich set of libraries available under the node package manager? =P

14:02 hiredman: edw: lein is a build tool, not a tool for running code

14:03 chouser: I meant competitor because I assumed anyone happy with lein would use it as is.

14:03 cemerick: technomancy: I assume that's heavy with sarcasm, but I've never even downloaded node.js so I can't tell.

14:03 edw: I was saying that cljs doesn't need to the jvm to run. I know that lein exits to build (and also run) code.

14:04 It just occured to me that you could write a cljvm compile in cljs...

14:04 s/compile/compiler/

14:04 lazybot: <edw> It just occured to me that you could write a cljvm compiler in cljs...

14:04 chouser: people were jsut talking about classpath management. It is exteremely common for Java apps to have non-JVM scripts to set up their classpath, env, cwd, etc. before starting the jvm.

14:04 cemerick: node is presumably a better quick launcher for a Clojure build tool than ruby — beyond that, you still need to have a JVM somewhere, both for dependency resolution and compmilation.

14:04 dnolen: so I guess you can't match maps in Erlang, Scala or Haskell...

14:05 s/match/pattern match

14:05 lazybot: <dnolen> so I guess you can't pattern match maps in Erlang, Scala or Haskell...

14:05 chouser: cake uses ruby for this, IIUC. Doesn't lein use bash?

14:05 anyway, a compiled cljs script could fulfill that role. And probably will for someone at a some point.

14:06 hiredman: so now you need nodejs installed to launch the javascript process which launches the jvm?

14:06 edw: cemerick: Don't worry, I'm not disputing that, though I wasn't thinking about the ramifications of that -- long build times are here to stay -- when I originally wrote.

14:06 hiredman: :|

14:06 technomancy: yeah, ruby is bad enough as a dependency; node would be a huge stretch.

14:06 chouser: hiredman: yep. Or you could launch a JVM to launch a JVM, paying its startup cost twice.

14:06 technomancy: "here, go compile this big pile of C, then you'll be ready to use clojure"

14:07 chouser: or you could use just one JVM and fiddle with the classpath at runtime, klaxons notwithstanding.

14:07 * cemerick still needs to try the o'caml jark launcher at some point

14:07 hiredman: o'caml?

14:08 technomancy: hiredman: the irish port of objective caml

14:08 hiredman: the famous ira sharpshooter?

14:08 kumarshantanu: Jark 0.4 client is coming in OCaml

14:09 dnolen: kumarshantanu: nice

14:09 Pupeno: Hello te.

14:09 Hello technomancy.

14:09 cemerick: link for those that want to peek: https://github.com/icylisper/jark-client

14:11 kumarshantanu: technomancy: Did anybody toy with the idea of having Lein split into a lein-server and lein-client (probably version independent)?

14:11 bulters: gday. anyone here was a pointer to an article describing how to set up emacs for clojure?

14:12 hiredman: ~swank

14:12 clojurebot: swank is try the readme. seriously.

14:12 technomancy: kumarshantanu: not yet; I think it could be built on jark.

14:13 hiredman: technomancy: you may want to add a link to clojure-mode from the swank-clojure readme

14:13 * cemerick watches his evil plan come together ;-)

14:13 kumarshantanu: bulters: want to try this? http://charsequence.blogspot.com/2010/07/setup-emacs-for-development-with.html

14:13 hiredman: no no

14:13 ~blog

14:13 clojurebot: make a note of http://scienceblogs.com/goodmath/2006/11/the_c_is_efficient_language_fa.php it is yet another article about picking c or c++ for performance being naive

14:13 hiredman: erh

14:13 never read blog posts

14:14 they are always outdated and the source of 60-70% of problems people have

14:14 edw: I gave up coffee and Hacker News on Sunday and I've been quite happy since.

14:16 bulters: kumarshantanu: one sec...; i've been looking for an up to date 'manual' for a few days now

14:18 kumarshantanu: bulters: I guess this is a better thing to red - https://github.com/technomancy/swank-clojure

14:20 bulters: kumarshantanu: I've been trying to stay away from 'the starter kit' up till now; but I'll give it a try

14:20 guess i can always 'roll my own' when i'm a grown up (emacs user)

14:21 kumarshantanu: bulters: starter-kit is a non-invasive way to ramp up on Emacs, in my experience

14:21 YMMV

14:22 bulters: kumarshantanu: cloning right now :P

14:23 Pupeno: technomancy: there seem to be some important patches in Alex's master branch; are you planning on merging or rebasing the vagrant branch?

14:33 bulters: kumarshantanu: at least it workds out of the box on my linux machine :P

14:36 Pupeno: technomancy: vagrant+ato's master: https://github.com/pupeno/clojars-web/tree/vagrant2

14:37 kumarshantanu: bulters: neat!

14:49 Pupeno: _ato: can you share your deploy script for clojars, or should I write my own?

14:59 chouser: I really hate that Google named their JS toolkit "Closure"

14:59 It makes me a little bit angry.

15:00 kumarshantanu: chouser: am sure many would second that

15:00 scgilardi: Edge.js :)

15:01 Pupeno: chouser: totally… and a language go… geez… these people seem not to know of google.

15:01 dnolen: implementing pattern matching on maps is gonna fun. might not be too much work to make the whole system user extensible...

15:01 chouser: both are lousy for googling. "closure" is horrible even for just talking or writing about.

15:01 ibdknox: chouser: their documentation is equally infuriating

15:02 chouser: yeah, it's particularly ironic that one of the least googlable API's I've ever worked with is one of google's own.

15:02 bulters: chouser: you have any seo experts in mind to suggest to google?

15:02 kumarshantanu: they only make sense when explicitly prefixed with "Google ", as in "Google Closure" and "Google Go"

15:02 bulters: maybe they can up their searchability a bit

15:07 Pupeno: Yay! Clojars working!

15:08 Is there anything like capistrano that you'd use in a Clojure project?

15:09 hiredman: pallet maybe?

15:10 hugod: I'ld be happy to help with a pallet configuration for clojars

15:11 Pupeno: hugod: well, I'm about to give it a try.

15:12 hugod: are you familiar with pallet?

15:12 hugod: Pupeno: more or less ;)

15:14 Pupeno: Are you familiar with Clojars?

15:15 hugod: Pupeno: as a user, yes - never looked at the code base

15:15 Pupeno: hugod: ok… if you want to give it a try, let me know and I can try to help you get setup with it… it took me a while.

15:15 thorwil: does Closure even have *anything* to do with closures?

15:16 ibdknox: thorwil: no more so than being on top of JS

15:16 hugod: Pupeno: are the (system level) dependencies documented?

15:17 Pupeno: hugod: there's a branch call vagrant that uses vagrant to set up a running VM with all dependencies and everything. It's pretty sweet, but the way it deploys Clojure is broken, so I want to fix it.

15:18 hugod: basically it checkouts technomancy's vagrant branch, which at the moment doesn't work. Checking out my vagrant2 branch works, but it should just deploy your local version, whatever it is.

15:18 bulters: shouldn't it be possible to set up a git after commit hook, which analyzes the commit for all changes; connects to a running process (via swank?) and updates all changes in the running process?

15:19 Pupeno: hugod: other than that you can checkout the project, run lein deps, lein ring server and you should have it running it on your machine.

15:19 hugod: but you won't be able to push jars to it.

15:19 * Pupeno watches the Pallet screencast.

15:22 hugod: Pupeno: I'm in #pallet if you have pallet specific questions

15:23 amalloy: bulters: certainly it's possible - you have any number of turing machines at your disposal. but it's probably not practical, and i'm not convinced it would be desirable

15:25 bulters: amalloy: just a dream about rolling deployments ;-)

15:27 jcromartie: sometimes you just gotta restart the app

15:27 but yeah

15:27 Pupeno: hugod: I'll have questions soon ;)

15:27 Erlang makes it possible and beautiful to do rolling deployments…. updating the code while the app is running, it's great.

15:27 bulters: jcromartie: it's the same as back in the winME days, sometimes you just have to restart your machine, or it stops working

15:28 jcromartie: Pupeno: I wonder if there's anything preventing Erlang-style deployment with Clojure, barring new jars of course

15:28 amalloy: i don't think that's it. but if you try to mechanically reload "whatever changed", you'll do things you didn't mean to. like, say someone changes the initial value for some mutable counter

15:28 jcromartie: but even with new jars, a dynamic classloader should be able to do it

15:29 amalloy: you don't want to re-def back to the initial value in the running app

15:29 jcromartie: amalloy: you have to design for it

15:29 defonce, etc.

15:29 Pupeno: jcromartie: I don't know… it's just that Erlang is prepared for that, you even have functions for switching the in-memory data structures from the old version to the new version. I suppose nothing prevents you from doing a similar thing in Clojure.

15:39 jcromartie: exactly, Pupeno

15:39 Cozey: Hello. If I have some lazy expression inside try catch block, and the lazy expression when evaluated, can produce an exception - then it is possible that the exception will escape the try catch block - am I thinking right?

15:39 hiredman: yes

15:40 Cozey: scary.

15:40 how can I secure myself from this kind of situation?

15:40 wrap everything in doall ?

15:40 (i'm not using exceptions in clojure myself - but interacting with java, which likes to use exceptions as part of an api for example)

15:42 dnolen: Cozey: doall will works as long as the lazy sequence doesn't have lazy sequences inside of it.

15:42 Cozey: i suppose

15:42 so nothing can be done here except being extremely careful?

15:42 it's a huge gotcha!

15:43 jcromartie: well

15:43 you can handle the exception in the code that generates the elements of the sequence

15:43 dnolen: Cozey: perhap catch the exception in the lazy sequence where it'll happen is another way.

15:43 jcromartie: for instance, if you're using map: (map #(try ...) coll)

15:43 Cozey: mhm

15:44 jcromartie: I know I've run into this before. Lazy seqs are a double-edged sword.

15:46 Cozey: yes lazies produce the strangest bugs

15:46 kumarshantanu: Can anybody pass on a tip - how to comment out a block of Clojure code in Emacs?

15:47 amalloy: kumarshantanu: just put #_ in front of it?

15:47 of if you want to do something super-fine-grained, mark it and use M-;

15:48 kumarshantanu: amalloy: how does #_ work? I tried and don't think it actually commented it out

15:48 amalloy: &(let [x #_(inc 1) (dec 1)] x)

15:48 lazybot: ⇒ 0

15:49 amalloy: so i think you are wrong :P

15:50 kumarshantanu: amalloy: oh it works! Emacs gave me no visual cue though

15:50 amalloy: well, emacs doesn't know that #_ is a comment indicator. i'm not sure how you would go about teaching it, as i'm not sure CL has a similar construct

15:51 kumarshantanu: this is a bug on clojure-mode then?

15:51 amalloy: uh

15:51 i would call it a "feature request"

15:53 emacs doesn't recognize (comment foo bar) as a comment either. neither of them are technically comments, so that's hardly a bug

15:55 morphling: amalloy: you'd use #+(or) or #-(and) in CL for what you do with #_ in clojure. but i don't think emacs recognises those either

15:55 jcromartie: I use (comment ...) for comments where I want full clojure-mode

15:56 amalloy: jcromartie: ##(let [x 1 (comment as per ticket 32432)] (inc x))

15:56 lazybot: java.lang.IllegalArgumentException: let requires an even number of forms in binding vector

15:56 amalloy: morphling: i only used CL for a month or so; what are those?

15:58 hah. the second result on google for "list of common lisp dispatch macros" is the clojure reader

15:59 morphling: amalloy: those reader macros conditionally include or ignore the next sexp. (or) and (and) are the conditions and evaluate to T and NIL respectively

16:00 thorwil: what can be better done instead of (into (into foo bar) baz)?

16:00 amalloy: ah

16:00 (reduce into foo [bar baz])?

16:01 jcromartie: (reduce into [foo bar baz])

16:01 ##(reduce into ["hi" "bye" "foo"])

16:01 lazybot: java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IPersistentCollection

16:01 amalloy: (into foo (concat bar baz))

16:01 jcromartie: herp

16:02 ##(reduce into (map seq ["hi" "bye" "foo"]))

16:02 lazybot: ⇒ (\o \o \f \e \y \b \h \i)

16:02 thorwil: ... ok :)

16:03 gtrak: anyway to get like a call/reference graph from slime/swank?

16:03 amalloy: you could use slime to write an email to the guy who wrote the code, and ask him for a graph

16:04 lobotomy: hey guys, i managed to code up this monstrosity: http://pastebin.com/zg3tH3T1

16:04 how to clean it up? :D

16:04 gtrak: amalloy, ha, I guess that means nope

16:04 lobotomy: what's a good way of formatting stuff into strings anyway? can do it no prob with my limited skills, but the resulting code isn't pretty, haha

16:05 amalloy: what...what are you even trying to do?

16:06 lobotomy: to print the field thing

16:06 prettily

16:06 amalloy: turn that matrix-y thing into "z|.|.\n.|b|c\nq|r|."?

16:06 lobotomy: yeap

16:06 chouser: for the sake of brevity in writing, I'm going to shorten Google Closure to gc

16:06 shoot, that looks like garbage collection.

16:06 oh, Google Closure Compiler -> gcc

16:06 amalloy: chouser: i like the implication

16:06 chouser: oh, dear

16:07 joly: no luck :P

16:07 dnolen: lobotomy: clojure.pprint has cl-format if you are not afraid.

16:07 amalloy: "gc throws away all the code you're not using, while the gc throws away the data you're not using"

16:08 joly: makes sense since code is data

16:10 lobotomy: ooh, pprint. just need to figure out how to install that...

16:10 hmm, can i just say "lein install pprint" or something?

16:11 gtrak: they should just change it to google bung

16:11 amalloy: ,(println (clojure.string/join "\n" (for [row '[[z nil nil] [nil b c] [q r nil]]] (clojure.string/join "|" (for [col row] (if (nil? col) "." (name col)))))))

16:11 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.string>

16:11 amalloy: ,(use 'clojure.string)

16:11 clojurebot: #<IllegalStateException java.lang.IllegalStateException: join already refers to: #'clojure.set/join in namespace: sandbox>

16:11 amalloy: wtf

16:11 ,(println (clojure.string/join "\n" (for [row '[[z nil nil] [nil b c] [q r nil]]] (clojure.string/join "|" (for [col row] (if (nil? col) "." (name col)))))))

16:11 clojurebot: z|.|.

16:11 .|b|c

16:11 q|r|.

16:12 arohner: cond really needs special indentation, especially when your clause is long enough for one line

16:12 amalloy: for/join is substantially clearer than that mess of nested maps with anonymous functions

16:13 arohner: i wrote a cond+ that lets you optionally wrap the test/expr clause in a vector

16:13 arohner: amalloy: link?

16:13 or is it not public?

16:13 amalloy: https://github.com/amalloy/amalloy-utils/blob/master/src/amalloy/utils/core.clj

16:16 fair warning, i never actually use it. tested that it works, but can't really excuse using something non-standard like that just for the sake of some minor readability

16:16 arohner: amalloy: yeah. I'd be happy with just consensus on identing the normal one properly

16:17 I like lazy-loop though

16:17 amalloy: arohner: yes, lazy-loop is much more handy

16:17 one of my favorites

16:17 arohner: I need to make my own utils lib.

16:17 amalloy: arohner: i encourage that! everyone should have their own

16:17 arohner: or, publish it. I keep copy-pasting between my projects

16:17 amalloy: heh. i wrote a blog post about the evils of doing that

16:18 lobotomy: arrgh, how do i reset my namespace in emacs

16:18 guess i better sleep since things are for some reason getting difficult :D

16:19 amalloy: arohner: the best parts of amalloy-utils have been ported to https://github.com/flatland/useful now, which is the repo seeing active maintenance/development - amalloy-utils is kinda old, and i only linked it because i didn't port cond+ to useful

16:19 dnolen: ,(require '[clojure.pprint :as pp])

16:19 clojurebot: nil

16:20 tomoj: amalloy: aww, I got excited when I saw "unrestful"

16:21 lobotomy: trying to evaluate (ns myns) and it throws that illegalstateexception, "replace already refers to: <thisandthat> in ns myns"

16:21 arohner: one util that really needs to take off is 'fold', map:for :: reduce:fold

16:21 amalloy: arohner: huh? fold *is* reduce

16:22 ,(doc remove-ns)

16:22 clojurebot: "([sym]); Removes the namespace named by the symbol. Use with caution. Cannot be used to remove the clojure namespace."

16:22 arohner: amalloy: how for is a 'nicer' version of map, there needs to be that, but for reduce

16:22 I call mine fold

16:22 amalloy: arohner: link? i'm curious what a nicer version would look like

16:22 and i've toyed with integrating a reduce functionality into for, but that seemed evil

16:22 lobotomy: is there a way to obliterate a namespace? i'm looking for something that could let me forget about the current state of the namespace and re-evaluate

16:22 without having to kill swank, restart it etc

16:22 amalloy: lobotomy: plz see above

16:23 arohner: amalloy: https://gist.github.com/1126155

16:23 lobotomy: ah right

16:23 vijaykiran: all -- I got a small compojure question - how can I add two routes with /abc and /abc/id and use the same method ?

16:24 lobotomy: (remove-ns 'myns) ;; yay

16:25 kjeldahl_: Here's a tip; don't make your own user.clj handling the user namespace. Leiningen doesn't like it very much...

16:25 vijaykiran: I'm using : https://gist.github.com/1126158 but both the URLs call the same method ..

16:26 amalloy: arohner: https://gist.github.com/1126157 is a little less repetitive, incidentally

16:26 arohner: amalloy: yeah, it still needs more polish, but that idea needs to go in core

16:26 I use it all the time

16:26 amalloy: also, it seems like a complete lie that binding can take any arguments supported by for? it can't take :let, :when, or :while

16:27 arohner: amalloy: right. that's the quick&dirty version

16:27 amalloy: you're planning to expand it?

16:27 arohner: not immediately

16:27 if you're interested, go for i

16:27 for it

16:28 I wrote it quick & dirty to see if it was worthwhile, it was, and then I didn't end up using the 'for 'features

16:30 amalloy: nah, i'm not really interested. it doesn't seem like a big win over reduce to me. i can see how it would be a little more clear sometimes, but like cond+ i don't think i'd actually use it

16:50 mefesto: anyone using c.j.jdbc with oracle?

16:54 seancorfield: having problems? i haven't had a chance to test c.j.j with oracle yet

16:55 it's been a while since i've had a local install of oracle... used to have it set up on my old mac desktop but haven't needed it since i got the new one two years ago

16:56 mefesto: seancorfield: ah the man himself :) yeah I'm getting the following when doing an insert-record: "SQLException: error occurred during batching: batch must be either executed or cleared"

16:56 lemme put together a small test to make sure it's not something else

17:05 seancorfield: https://gist.github.com/1126283

17:10 updated with backtrace

17:12 Cozey: what's this? https://gist.github.com/1126299 (exception in at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222))

17:12 it's related to derefing a future

17:15 hiredman: Cozey: http://download.oracle.com/javase/1,5.0/docs/api/java/util/concurrent/ExecutionException.html

17:17 Cozey: of course. i need sleep.

17:17 sorry for a dumb question

17:39 amalloy: is there something like swap!/alter that works on vars? i want something like (with-altered-binding [*myvar* vary-meta assoc :foo bar] (...use new var bindings...))

17:40 since it's not as readable to do like (binding [*myvar* (vary-meta *my-var* assoc :foo bar)] ...)

17:42 hiredman: uh

17:42 metadata on vars isn't threadlocal

17:51 arohner: sometimes at the repl, swank will give me an error that looks like "error in process filter: Wrong number of arguments: nil, 0"

17:51 what causes that, and how can I see the stacktrace?

17:52 hiredman: arohner: what emacs version?

17:52 arohner: hiredman:, OSX

17:52 hiredman: there was a bug in 24 a few weeks ago

17:52 ah, dunno

17:53 arohner: where was that bug? this seems like a swank-only issue

17:56 hiredman: it was in 24, with how hex numbers were formatted, and the slime protocol prefixes messages with the byte count as a hex number

17:56 but it should not be in 23

17:57 arohner: huh. This seems to be related to exceptions being thrown while evaluating lazy-seqs. Putting a try/catch in the general area is a workaround

17:57 mefesto: seancorfield: fyi, oracle insert-record issue resolved in [org.clojure/java.jdbc "0.0.6-SNAPSHOT"]

17:58 seancorfield: ah, cool

17:58 amalloy: hiredman: i don't want to set metadata on the var itself, but on the value the var references

17:58 seancorfield: yes, that was a problem with apache derby too

17:58 mefesto: had to do with internal/do-prepared-return-keys*

17:58 seancorfield: i rewrote the do-prepared... stuff in 0.0.6

17:59 Bronsa: e che cazzo

17:59 amalloy: perhaps vary-meta was a misleading example for that reason; instead imagine (with-altered-bindings [counter inc])

17:59 Bronsa: ops

17:59 wrong channel

17:59 mefesto: seancorfield: just curious but when do you think you'll push a 0.0.6 release?

18:00 seancorfield: i was just holding off until that snapshot had more testing on different DBs

18:00 sounds like it's ready :)

18:01 mefesto: heh well i'll put it through the paces here and let you know if anything comes up

18:01 that is... regarding oracle 11g support

18:03 seancorfield: thanx

18:04 given that the batch / update problem seems to affect several DBs and is fixed, i might as well cut 0.0.6 and if you hit other problems, open issues in JIRA and I'll see what i can do for 0.0.7

18:04 mefesto: sounds good

18:06 seancorfield: at least the build now has a fairly full set of tests for HSQLDB and Derby - and locally i also test against mysql

18:06 soon we'll have postgresql and mysql available to build.clojure.org so it should be easy to automate tests against those too

18:06 then i need to try sql server on a local VM and maybe oracle too

18:07 mefesto: wow that's some nice coverage :)

18:07 seancorfield: ok, 0.0.6 has been cut and should show up in maven central some when...

18:11 java interop question: if i have a method that takes List<Foo>, is it possible to type hint that in Clojure?

18:11 mefesto: i think ^java.util.List is good enough

18:11 brehaut: seancorfield: i think type erasure means that its just a List once the java computer is finished with it

18:11 hiredman: compiler

18:12 seancorfield: 'k i'll try that (i'm working on congomongo with multiple host connections right now)

18:13 brehaut: err yeah.

18:18 amalloy: arohner: just stumbled upon my blog post about publishing your own utils library, if you're interested: http://hubpages.com/hub/Build-your-own-Clojure-toolkit

18:24 arohner: amalloy: thanks

18:25 dnolen: sweet http://engineering.twitter.com/2011/08/storm-is-coming-more-details-and-plans.html

18:40 seancorfield: thank you brehaut hiredman - ^java.utill.List did what i needed!

18:47 brehaut: is backtype/twitter's storm a hadoop replacement?

18:48 chouser: no

18:48 amalloy: brehaut: my understanding is that they have cascalog, written on top of hadoop, and storm is a message queue

18:48 brehaut: chouser, amalloy thanks

18:56 _ato: Pupeno: my deploy script is in that email I linked you from the Clojars list

18:59 Pupeno: _ato: ah, ok… thanks.

19:00 _ato: Pupeno: http://groups.google.com/group/clojars-maintainers/browse_thread/thread/d4149ec96316d5b1

19:00 search for ato@clojars:~/bin$ cat deploy-clojars

19:00 Pupeno: I have it bookmarked.

19:00 :)

19:04 _ato: By the way, if you know of ways to make the deploy simpler/easier/more-reliable let me know. I won't promise to agree with all of them, but it's been a while since I've heavily worked on a Clojure webapp and there's a lot more tools these days. lein wasn't released when I started clojars, let alone nice plugins like lein-ring. ;-)

19:06 lpetit: Hello

19:06 is clojure 1.3 a minimum for running ClojureScript, or will it work with clojure 1.2 too ?

19:11 Scriptor: if you run the installer that comes with it, doesn't it get clojure for you?

19:12 ibdknox: lpetit: I'm fairly certain it requires 1.3

19:13 lpetit: I can't remember what part of 1.3 it depends on

19:13 lpetit: *shrug*

19:13 My bet on ^:keyword reader addition

19:22 ibdknox: alright guys, hope to see many of you at the Bay Area Clojure group tonight!

19:22 amalloy: sf, la, and seattle all have their meetups on the same day. seems a bit weird; what's so special about the first thursday of the month?

19:23 (and i'm sure someone from a city i've never been to will get upset that i didn't mention they have their clojure meetup today too)

19:23 technomancy: tuesday is ruby group; wednesday is beer&&code

19:24 amalloy: technomancy: but it could be like...third thursday, to split things up a bit

19:24 like, who wants to come to a clojure meetup with a head full of ruby and hangover?

19:24 technomancy: I guess it's just easier to remember

19:24 heh; actually those two are weekly

19:25 amalloy: ah

20:00 flazz: (class 4) => java.lang.Integer; Integer/SIZE => 32; (.SIZE (class 4)) => IllegalArgumentException, is there a way to get the .SIZE attribute of a non literal class?

20:00 amalloy: i think it needs reflection?

20:01 or if you actually do know the types at compile time, it's just not convenient to specify them as literals, you can macro your way around it

20:03 flazz: hmm, ultimately i'd like to convert primitives to byte vectors, do you know of a better way?

20:04 hiredman: flazz: http://download.oracle.com/javase/6/docs/api/java/io/ObjectOutputStream.html

20:06 byte vectors or byte arrays?

20:16 amalloy: flazz: use a DataOutputStream on a ByteArrayOutputStream?

20:16 flazz: hiredman: vectors of numbers lte 255

20:17 Raynes: What about a ByteArrayDataOutputStream? :D

20:17 amalloy: What is the longest Java classname in the official Java APIs?

20:17 flazz: Raynes: looking ...

20:19 Raynes: TransformerFactoryConfigurationError is a big one.

20:21 hiredman: flazz: like clojure vectors?

20:22 flazz: hiredman: yep, clojure vectors

20:22 i'm only doing it with longs and its pretty easy, i guess i'm trying to be too abstract

20:23 hiredman: you are aware that the max value of a byte is 127 on the jvm?

20:24 (the jvm has signed bytes for some reason)

20:24 amalloy: 128 values should be enough for anyone

20:30 Raynes: Container.AccessibleAWTContainer.AccessibleContainerHandler is a good contender

20:36 hypercube32: anyone here help me out trying to get maven working with clojure?

20:38 hiredman: is maven a requirement? have you checked out lein?

21:15 Generic_Dumbass: So, going through SICP like a noob:

21:15 (def (square x) (* x x)) doesn't work in Clojure. How should it be written?

21:15 amalloy: (defn square [x] (* x x))

21:15 and i think that doesn't work in scheme either? it uses define, not def

21:15 Scriptor: scheme is just a *leetle* different from clojure

21:16 Generic_Dumbass: right, i switched out define // def

21:16 thanks

21:16 amalloy: or (def square (comp (partial apply *) (juxt identity identity))))...

21:17 Raynes: amalloy: You'll scare him away!

21:17 Scriptor: looks legit

21:17 amalloy: Scriptor: it was a trap, though. i put in too many )s

21:18 * Scriptor hangs head in shame

21:18 amalloy: because as we all know, lisp is about counting parens

21:18 Generic_Dumbass: No scaring away. Thanks

21:19 I actually already went through Little Schemer a year or so ago, so, it's not foreign

21:19 lol on the trap

21:19 technomancy: amalloy: (add-hook 'erc-mode-hook (lambda () (paredit-mode t))) ; bro

21:20 amalloy: technomancy: one of these days you'll convince me to use erc. but that day is not today

21:20 technomancy: amalloy: avoid embarrassing paren mismatches! switch channels with ido! all your abbrevs available.

21:20 amalloy: or, for a more trolly response: i tried that but mirc gives a error code

21:21 technomancy: so I was told that rms's .emacs file is mostly a bunch of predefined abbrevs for stuff that he types all the time.

21:21 Scriptor: I love how I get paren matching in erc

21:21 amalloy: technomancy: i preferred to fix lazybot to guess what my maladjusted parens are supposed to be

21:21 technomancy: "Perhaps you mean GNU/Linux?" "Please don't use the term \"Intellectual Property\" as it is semantically meaningless and confusing." "Using vi is a penance, not a sin."

21:21 &c

21:21 lazybot: java.lang.Exception: Unable to resolve symbol: c in this context

21:21 technomancy: dang it

21:21 amalloy: hah

21:23 hiredman: clojurebot: & is <reply> fg #who

21:23 clojurebot: Alles klar

21:23 hiredman: ,&

21:23 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: & in this context, compiling:(NO_SOURCE_PATH:0)>

21:24 hiredman: ~&

21:24 clojurebot: fg hiredman

21:43 paul_: I have a method that takes a java.io.Reader and returns the first line. I was hoping to make a sequence of lines using (repeatedly (fn [] (read-line reader))), but that seems to return the first line each time

21:44 hiredman: ,(doc read-lines)

21:44 clojurebot: It's greek to me.

21:44 hiredman: ,(doc line-seq)

21:44 clojurebot: "([rdr]); Returns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader."

21:45 paul_: i have a non-buffered reader, and i was hoping not to wrap it

21:50 Generic_Dumbass: so what is the origin of juxt? new to Clojure or is there some origin from Scheme / CL?

21:52 danlarkin: juxt is hiredman's favorite function

21:53 hiredman: yes, and that is why I had rich add it

21:53 chouser: LOL

21:53 Generic_Dumbass: :)

21:54 hiredman: (it's funny, because everything I suggest on the mailing list gets shot down)

21:54 technomancy: it doesn't happen often, but when I find a justifiable use of juxt at work, I call it a good day

21:55 Scriptor: hiredman: for a moment I thought you were Ken

21:55 chouser: It's funny because nobody has Rich add anything. Ever.

21:55 hiredman: Scriptor: shot down and ignored are not the same thing

22:01 Generic_Dumbass: ok, so, no idea where juxt came from then? lol

22:04 Scriptor: heh, the docstring still says the name is subject to change

22:10 ataggart: is anyone using the lastest clojurescript? I'm getting lots of errors.

22:54 amalloy: my understanding is that haskell has something similar to juxt named (and i'm not making this up) ***

23:14 paul_: why would you "hope not to wrap it"? that's like...you have the strings "1" and "2", and you hope to add them together, but you hope not to use integers at any point. you can do it all with strings, but why would you go to that trouble?

23:40 scottj: clj-arrow has ***

23:50 flazz: how does one test equality for records? .equals seems to work where = and == do not

Logging service provided by n01se.net