#clojure log - Jun 17 2010

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

0:06 danlarkin: don't think that's possible?

0:06 technomancy: danlarkin: someone was talking about adding a way to do that, but I guess that'll be a future version.

0:07 danlarkin: IIRC steve's import rewrite was able to get a DAG of namespace deps and do appropriate things

0:07 or maybe that was for requiring, not compiling

0:07 maybe it applied to both

0:08 technomancy: it was just for requiring, but it would probably make the compiling change easier.

0:27 behold--the new Leiningen tutorial: http://github.com/technomancy/leiningen/blob/master/TUTORIAL.md

0:27 feedback welcomed

0:29 ohpauleez: technomancy: I'll check it out in a little bit and shoot you a message for sure

0:30 technomancy: thanks!

0:30 dnolen: techomancy: you should say something about install no? Easiest way hack on other people's libs.

0:31 technomancy: oh I see it. you do mention it.

0:36 ohpauleez: technomancy: looks awesome.

0:36 Is there a difference between :namespaces and :aot

0:37 remleduff: technomancy: If you've got a SNAPSHOT version, does it actually go out and check every time you run lein deps, or just once per day?

0:43 technomancy: ohpauleez: no, no difference

0:43 ohpauleez: cool

0:44 technomancy: remleduff: oh, it's once a day. I will mention that.

0:55 * dnolen when he thinks Clojure build/dep tools are wanting, he tries to install git from source to get a reality check

2:06 vIkSiT: hmm, whats the best way to read a file till its EOF with this approach : http://paste.lisp.org/display/111521 ?

2:06 this only ends up reading each line..

2:10 tomoj: that looks strange

2:10 the prn will return nil, so you're calling nil as a function?

3:10 LauJensen: Morning team

3:22 simloovoo: good morning

4:17 LauJensen: lpetit: !!

4:18 lpetit: LauJensen: hello Lau. Why '!!' ?

4:19 LauJensen: Because I just installed a fresh Eclipse and CCW on my Arch box, and there's no auto indent! You promised Laurent, you promised me I wouldnt have to indent all my code manually anymore!

4:22 lpetit: there is auto indent, I didn't lie.

4:22 auto indent is automatically triggered when you hit Enter. And you can also trigger it "manually" by hitting the Tab key from anywhere in the current line

4:22 But

4:23 (there's a but)

4:23 the feature (as well as other features in the editor) works only if you have a well structured text in the editor (basically : correctly closed literal strings, correctly balanced parens / square brackets / ... )

4:24 Which version of CCW are you using ?

4:24 eevar2: eclipse is evil

4:24 lpetit: BTW: I made no promise, I informed you, that is :-p

4:24 eevar2: really, go with any other ide

4:24 LauJensen: lpetit: Im just joking, Im not upset, I just wanted to get your attention :)

4:24 (defn disappointment

4:24 []

4:24 (+ 2 2))])

4:24 clojurebot: 4

4:25 LauJensen: I didnt add that final square bracket

4:25 lpetit: sorry I don't understand

4:25 LauJensen: Oh wait, yes I did

4:25 When you write (defn x [. Do you guys then hit right-arrow to step past the closing ] in the argument list?

4:26 tomoj: just hit ]

4:27 Twey: Yeah, I was about to say…

4:27 LauJensen: Thats what I did, causing that extra ] at the last line

4:27 tomoj: not emacs?

4:27 wait, hmm

4:27 lpetit: Lau: if you're accustomed to paredit in emacs, you should switch from the "default" mode to the "advanced" mode (I myself always am using the advanced mode)

4:27 Twey: Are you using electric-parens or something?

4:27 LauJensen: lpetit: hot key for that?

4:28 tomoj: oh, eclipse, I see :P

4:28 Chousuke: lpetit: what's the difference? :/

4:28 lpetit: LauJensen: Yes. For switching the edition mode just for the current editor : Alt + D (D as "Default")

4:28 LauJensen: tomoj: Yea just checking out Laurents progress :)

4:28 ok, thanks lpetit

4:29 lpetit: LauJensen: if you want to have all your editors open in advanced mode in the future, go to the Window > Preferences page, then Clojure > then Editor smth, then see where in the conf page it's talking about structural edition mode, then change the default

4:30 LauJensen: k

4:30 lpetit: LauJensen: you can see the current mode of the editor in the status bar. Notice the tooltip explanation when the mouse hovers over the corresponding text. Notice you can also double click on this text to swith the mode for the editor which is currently selected

4:31 LauJensen: Strict mode is much better

4:31 lpetit: LauJensen: I agree, I'm now accustomed to it ! I introduced default mode with the intent to not break "newbies" habits.

4:32 LauJensen: lpetit: I am strongly pursuaded that newbie-habits should be broken at all costs :)

4:32 I've never understood this crazy desire to stoop to the lowest level possible in order to bring in the horde

4:32 But perhaps thats just me

4:32 lpetit: LauJensen: note that some keyword shortcuts are not the same as in emacs. I had to adapt to what Eclipse already offers, and had to not overlap with eclipse existing ones

4:33 LauJensen: activate the help when in the editor (F1 on Windows, Ctrl +F1 on Ubuntu, Help keyboard key on Mac). You'll have the whole story about provided keyboard shortcuts

4:34 LauJensen: Cool, that'll come in handy. I assume Arch is similar to Ubuntu in that regard

4:35 lpetit: LauJensen: my favorite ones : Alt + R for raising the selection (or the form just after the cursor) over its parent: it's then veeery easy to switch from (spy (my expr)) to (my expr). Place the cursor before the opening paren of (my expr), hit Alt + R, "et voilà" !

4:36 LauJensen: second favorite : structural selection. Shift+Alt+ ... RIGHT_ARROW: expand to right sibling, ... LEFT_ARROW: guess that one, ... UP_ARROW: expand to enclosing form, .... DOWN_ARROW: undo previous selection expansion

4:36 zmila: what is the difference between the modes, lpetit?

4:37 LauJensen: lpetit: Ah ok

4:38 lpetit: It seems like your paredit mode, doesnt recover if there has been a structural error, and that is then removed

4:38 lpetit: zmila: default tries to not introduce "editor behaviour" which may "force" user to have prior knowledge to be able to continue its work. e.g. "default mode" does not prevent the user from deleting a single paren in a pair. "default mode" does not jump after the closing paren/square bracket/... because people accustomed with other editors in Eclipse would be somewhat lost

4:38 LauJensen: disagree. Currently the editor's content is always reparsed after each keystroke, so there's no state accumulation.

4:38 LauJensen: lpetit: Then I think you have a bug

4:39 zmila: which mode to use, when i habit to type both parens: [], your editor always adds the second []]

4:39 lpetit: LauJensen: much more viable option. Corner case ? What exactly did you do ?

4:39 LauJensen: lemme see, sec

4:40 hoeck: lpetit: btw, good work, I just tried ccw out of curiosity this morning and, as a total eclipse noob, I was able to get ccw and a clojure repl running

4:40 lpetit: zmila: you're right, in default mode I should not add the closing one. Would you please file an issue for that ?

4:41 hoeck: and when you'll be (maybe) doing both java projects and clojure projects, you'll see that ccw respects the "projects semantics" of eclipse well.

4:42 LauJensen: lpetit: "(defn i-miss-emacs []" that will then produce "[]]", push that extra bracket ahead of the cursor as you move to the next line and write "(+ 2 2)", and will then not be indented. Remove the excess bracket, and ENTER down to the next like "(+ 2 2)" that will not be indented either, but now there are no errors. Only happens in default-mode.

4:42 lpetit: zmila: switch and try the advanced mode.

4:42 zmila: yea, i prefer the strict mode

4:42 hoeck: I'm shure that I won't leave emacs anytime soon, but how knows what will happen when I finish university

4:43 lpetit: zmila: yeah. What I also like about it is that when you hit the closing paren, it will also e.g. remove spaces between this paren and the previous closing one, somehow cleaning up the code at the same time

4:43 zmila: lpetit, how about code folding?

4:44 lpetit: zmila: currently not identified as a top priority

4:45 zmila: and refactoring? select sexpr - press C-A-m - extract function, or extract binding - if inside (let [] ...)

4:45 lpetit: I'm considering that currently ccw has "the minimal survival stuff" I wanted to provide as quickly as possible (though there is a missing part: history in the REPL). And I'm currently refactoring the "structural edition" code so that it will accept to work with an incremental parser. Hopefully this incremental parser will lay out the foundations for having real static code analysis in ccw.

4:47 zmila: ^^^ will be the building block required for being able to go fast concerning all static analysis features: refactoring,

4:47 etc.

4:47 zmila: ok

4:49 lpetit: LauJensen: oh sorry, I almost missed your last entry ^^

4:49 LauJensen: but you don't have the closing paren ?

4:51 LauJensen: lpetit: well, it compiled

4:51 So I think I did

4:51 lpetit: LauJensen: ah. Was just reacting to the example you posted.

4:52 LauJensen: still have the bad code around in the editor ?

4:52 LauJensen: yea

4:52 query

4:52 lpetit: LauJensen: go to the offending line, and hit Tab to see what happens

4:53 LauJensen: Nothing - I think its because when you hit enter on a line thats not indented correctly, then the indenting is not fixed, causing all lines below to have the same bad indentation

4:58 lpetit: LauJensen: yes the indentation is automatically "fixed" for the new line, not for the existing line

4:59 must leave the area, thanks for the chat, and don't go back to emacs ;-)

4:59 LauJensen: lpetit: I never left :)

4:59 lpetit: :)

4:59 LauJensen: lpetit: one last thing

4:59 How do you tab between the windows, ie move focus to the repl ?

5:07 zmila: Ctrl+F7

5:07 LauJensen: thx

5:08 zmila: CF

5:08 C+F7 - between window and Console (REPL), C+F6 - between editing windows

5:23 Raynes: What is the separating of words by hyphens in Clojure called? Assuming it has a name, like camelcase.

5:24 ceptorial: would someone mind enlightening me on exactly what something like (defn foo [& args] ...) means, as far as the & args? i'm having trouble finding good documentation on that

5:25 does it mean that (foo 1 2 3) will put '(1 2 3) in args or something like that?

5:25 or does it mean optional?

5:25 Raynes: & args means "put the rest of the args in args". If you do (foo 1 2 3), in foo, args will be a sequence containing those args.

5:25 ceptorial: or that there can be multiple values? or what, exactly...

5:26 Raynes: $(letfn [(foo [a b & rest] (apply + a b rest))] (foo 1 2 3 4 5 6))

5:26 sexpbot: => 21

5:27 Raynes: It's just a way of letting a function take an arbitrary number of arguments. It can be even more useful with destructuring, especially the new optional keyword argument destructuring in 1.2 that allows for you to do default argument-like stuff.

5:29 $(letfn [(foo [a b & [x y & rest]] (+ a b (apply * x y rest)))] (foo 1 2 3 4 5 6))

5:29 sexpbot: => 363

5:29 ceptorial: woah

5:30 is :as for function arguments only 1.2?

5:30 LauJensen: ,(clojure-version)

5:30 clojurebot: "1.2.0-master-SNAPSHOT"

5:30 LauJensen: $(clojure-version)

5:30 sexpbot: => "1.2.0-master-SNAPSHOT"

5:30 LauJensen: hmm, dunno

5:30 Dont think so

5:30 ceptorial: right i didnt think so

5:31 Raynes that was very helpful, thx

5:31 Raynes: :as works in 1.1, I believe.

5:35 LauJensen: Clojure> (let [{:ke­ys [a b :as c]} {:a 5 :b 10}] c)

5:35 java.lang.Exception: Unsupported binding form: :as

5:35 Clojure> (clojure-v­ersion)

5:35 "1.1.0"

5:35 from: http://tryclj.licenser.net/

5:36 ceptorial: interesting -- same thing for functions?

5:36 LauJensen: its the same code being run, so yes

5:36 ceptorial: cool

5:40 Raynes: LauJensen: The try-clojure.org domain isn't down, is it? :o

5:40 LauJensen: Nope

5:40 Raynes: They both point to the same thing.

5:41 LauJensen: Didnt know

5:41 Raynes: <3

5:46 Licenser: what where ?

5:46 LauJensen: http://try-clojure.org/ is the official domain now :P

5:46 LauJensen: ok - you guys going to wrap up that tutorial and throw it on HN ?

5:47 Raynes: LauJensen: It was on HN ages ago.

5:47 LauJensen: Would be great if you made the REPL graphical, do stuff like (slurp* "http://bestinclass.dk/logo.png") :)

5:47 Licenser: watis hn?

5:47 LauJensen: http://news.ycombinator.com

5:47 Licenser: ah

5:47 Raynes: As for the tutorial, it's stagnated right this second. I'm going to talk to defn about maybe doing some sort of learnyouaclojure with embedded tryclojure.

5:47 LauJensen: Raynes: Im not saying that it wasnt on HN, Im just saying improve it a little and do it all over again

5:48 Licenser: I like the syntax highlighting :P

5:48 LauJensen: Also would be great if you could tap into html5's audio, and have Raynes do his thing with the Banjo in the background

5:48 Raynes: If that doesn't work out, the tutorial will be revamped, wrapped up, and other stuff will be done.

5:48 LauJensen: (set! raynes :playing)

5:48 Raynes: That was a clever one.

5:49 Licenser: and then we use html5 video and have defn dance in the background to it?

5:49 LauJensen: Licenser: Thats the stuff that sells tickets

5:49 Raynes: Absolutely.

5:50 Licenser: hmm but we don't sell stuff on try-clojure, it is totally a bad deal there :P

5:50 Raynes: But yeah, I'll know where to go with the tutorial in a couple of days. defn was interested a while back in being a part of a artsy Clojure tutorial (with dolphins nonetheless), so if he's interested in something like that now, we may go in an entirely different direction.

5:51 Licenser: and you didn't liked me texts *cries*

5:51 Raynes: Sure I did. I just haven't touched that thing in ages.

5:51 Procrastination is a disease with no cure. ;)

5:52 Licenser: yea sure I'll fly to the us just to put a fart pillow under your chair!

5:52 LauJensen: Raynes: I think the trick is, to unleash enough power that new-comers will really see how hard of a punch a few lines of Clojure packs. Like parsing the logs for the try-clojure.org site in a couple of lines would be cool.

5:52 Licenser: LauJensen: we have logs? :P

5:52 LauJensen: Licenser: eh?

5:52 Raynes: No logs, but that would be impressive.

5:53 * Licenser has set apache up to log to /dev/null

5:53 * Licenser is also just kidding

5:53 LauJensen: Apache? :±

5:53 Licenser: LauJensen: yes of cause, apache 2

5:54 LauJensen: Anyway, you can loot from bestinclass.dk if you want, I have a few lines that do some cool stats on an access.log - of course thats a log from a proper webserver

5:54 not a slow outdated outperformed ancient and antique beast such as apache

5:54 * Licenser has a very elaborate network struckture backing try-clojure.org

5:54 LauJensen: Licenser: You meant a Virtual Host XML entry?

5:55 Licenser: well not exactly they are on different hosts, the host try-clojure runs on isn't connected via anything but ssh to the interwebs

5:55 tecnically apache2 is running as a proxy

5:57 LauJensen: btw http://bestinclass.dk/logo.png is a 404

5:57 LauJensen: Licenser: ok :)

5:57 Licenser: it does not do squat itself

5:57 and to be frank I know how apache works better then I know how any other webservery thing works :P

5:57 and the comparable high memory footprint isn't an issue at the moment

5:58 LauJensen: Its been about a year since I last had my hands in the engine room of an Apache - My life got easier after I switched to ngin

5:58 x

5:58 nginx

5:58 :)

6:00 Licenser: in what respects is nginx better? I'm not at all opposed to switch

6:00 apache is like the H-Bomb amongst the webservers o.O

6:01 actually I'm always for trying out new nifty crazy stuff :P

6:01 * jwr7 seconds — I use lighttpd or nginx, Apache drives me crazy with its configuration.

6:02 LauJensen: Licenser: Its very simple to set up, has a simple yet powerful and extendable config language. The server itself is slim and high performant and incredibly reliable - I've never had it slowdown or crash on any installation.

6:02 And you'll find that red thread in almost all tools I use: Simplicity, simplicity, simplicity

6:02 Licenser: heh

6:03 hmm I'll look into that

6:03 LauJensen: trust me I am all for simpleicity :P

6:03 LauJensen: http://www.joeandmotorboat.com/2008/02/28/apache-vs-nginx-web-server-performance-deathmatch/

6:03 just some perf benchmarks

6:04 Licenser: I have a pretty complex rewrite which allows my old wordpress links to still work on the clojure driven bestinclass.dk, took a very short amount of time to make the rewrite in nginx

6:05 Licenser: neat

6:06 LauJensen: rewrite ^(.+)(\.php)(.+)$ http://www.bestinclass.dk$1.clj$3.html last;

6:07 Raynes: LauJensen: Impressive work on bestinclass, by the way.

6:08 LauJensen: Raynes: Thanks a lot :)

6:10 unfo-: hoom! you opensourced the blog-stuff. Interesting *strokes beard*

6:11 ooooh and you do euler too!

6:15 LauJensen, never-ever did I think of using matrices for fibonacci (re: ruby euler 25) thanks for this :)

7:59 LauJensen: unfo-: np :)

8:28 jartur: Good night everyone.

8:28 LauJensen: Night :)

8:29 jartur: Does anybody participate in ICFP PC?

8:29 I mean going to =)

8:45 LauJensen: naah, too easy with Clojure

8:46 bobo_: icfp?

8:46 ah

8:50 jartur: LauJensen: you don't know the problem yet =) It may be something difficult independent of the language

8:51 LauJensen: jartur: Naah, Im sure there's a function for it

8:51 jartur: LauJensen: Heh, some functions are damn hard to come up with.

8:51 LauJensen: (jarthur Im just kidding, I hope you know)

8:52 lpetit: hi, anybody has more info on GWT-clojure than what can be found on the blog entry ?

8:52 jartur: I think I'll spend two days solo on the problem if I like it. But I don't think I'll be able to solve it anyway. Just have a mental exersise.

8:52 clojurebot: People have a problem and think "Hey! I'll use a regular expression!". Now they have two problems....

8:52 LauJensen: Exactly clojurebot

8:53 lpetit: Last I heard it wasnt usable

8:54 jartur: Are there any GUI frameworks for Clojure in the works? Just curious.

8:54 bobo_: GWT-clojure? that sounds interesting?

8:55 _fogus_: jartur: I've been mulling over a Shoes-like GUI framework, but like many things it's just a seed at this point

8:55 jartur: Maybe something like XAML without XML. Though it's not a small task probably.

8:56 LauJensen: jartur: Swing, AWT work well. Qt works OK, Web is my preferred UI

8:56 jartur: _fogus_: Shoes-like is good. Especially when you need a relatively simple GUI.

8:57 LauJensen: I mean some abstractions over Swing. Like they build interesting stuff in Haskell world.

8:57 LauJensen: hehe

8:57 jartur: Something declarative would be nice.

8:57 _fogus_: jartur: I had the start of it in the book, but I would love to explore it further.

8:58 jartur: _fogus_: What book?

8:58 cemerick: GWT seems magical, but isn't it sorta bad just on spec?

9:00 eevar2: hmm... the icfp scoreboard for 2009 doesn't list languages?

9:00 and 2008 was won by a Java team :p

9:01 jartur: eevar2: icfp pc 2009 was kinda badly organised. I hope this year would be better.

9:01 And icfp is usually won by c/c++ teams.

9:01 It's "oh teh irony".

9:01 _fogus_: jartur: http://joyofclojure.com

9:01 eevar2: for some reason i thought ocaml always took the first X spots

9:01 LauJensen: jartur: Its not ironic. Only employed developers have time for ICFP :)

9:02 s/employed/unemployed/

9:02 sexpbot: jartur: Its not ironic. Only unemployed developers have time for ICFP :)

9:02 jartur: LauJensen: Also C++ hardcore programmers are usually VERYhardcore

9:02 LauJensen: Yea, harcore++

9:02 sigh

9:02 s/harcore++/hardcore++/

9:02 sexpbot: sigh

9:02 jartur: LauJensen: And most of 'sport' coders are on C++. With strong bg in algorithms and so on

9:03 _fogus_: Ah, didn't read it yet. Does it worth buying in your honest and not opitionated opinion? =)

9:04 LauJensen: jartur: I would say its definitely worth buying

9:04 rys: it's not just unemployed devs. me and my friends take the Friday and Monday off over the ICFP weekend to do it

9:04 rhickey: so, I've got a build of Clojure and contrib here with .equals based equality

9:05 the biggest problem I see is not with the collection equality, no one seems to care if (= [1 2 3] [1.0 2.0 3.0])

9:06 people frequently seem to expect (= 2 2.0)

9:06 LauJensen: So whats the biggest problem ?

9:06 jartur: rhickey: that's bad for them

9:07 rhickey: because you can't test floats for equality at all

9:07 rhickey: all such code would have to become (== 2 2.0)

9:07 LauJensen: ah, so you're introducing a new operator

9:07 cemerick: no, == has been around almost forever

9:07 rhickey: so = would literally just be an .equals call?

9:08 rhickey: cemerick: with a nil branch

9:08 cemerick: right

9:08 rhickey: that's how it used to be

9:08 cemerick: before equiv and such, you mean?

9:08 rhickey: right

9:08 cemerick: was that in 1.0?

9:09 rhickey: no, way back

9:09 cemerick: the memory fades :-)

9:09 rhickey: could be before your time

9:10 cemerick: Probably not :-)

9:10 well, maybe, depending on whether you added equiv before clojure was made public

9:10 anyway -- backing off to hosty = is a big deal

9:11 LauJensen: rhickey: Whats the motivation for this change?

9:11 jartur: Hmm, what is the semantics of (= 2 2.0) or (== 2 2.0) in code?

9:11 rhickey: cemerick: how is that hosty? equiv is .equals for the vast majority of cases

9:12 http://github.com/richhickey/clojure/blob/master/src/jvm/clojure/lang/Util.java

9:12 it really is strictly about numbers

9:13 jartur: Why would people want to test floating point numbers for equality?

9:13 cemerick: right -- the improved sanity of numerics is a big deal

9:13 rhickey: now, with uniform boxing, you rarely see 2 different boxed representations of 42

9:13 cemerick: which is more sane?

9:14 and all different representations look different: 42 42N 42M 42.0

9:14 cemerick: rhickey: well, the jury's out, I suspect. (= 3 <any float>) is just a little crazy if you know what floats are built with.

9:15 Anyone who isn't versed in that stuff at all will think (= 3 3.0) should work (despite the host's semantics)

9:15 (just look at all the people using floats for financial calculations)

9:16 rhickey: well, the big problem is that this is a significantly breaking change, given that usage

9:16 cemerick: right

9:17 LauJensen: In a dynamic language, I'd say (= 2 2.0) is true, makes the most sense

9:17 cemerick: If == retains equiv semantics, then it's reasonable to argue that people should have been using that all along.

9:17 jartur: LauJensen: how so?

9:17 cemerick: LauJensen: floats are floats, dynamic language or not.

9:17 LauJensen: jartur: I dont care if they are ints or float, just of they equal "two"

9:17 rhickey: cemerick: that's how I feel when looking at the breaking code

9:18 jartur: LauJensen: (= 2 1.9999999999998) is also true?

9:18 LauJensen: When you write 2.0 it's not what you will end up in memory

9:18 cemerick: rhickey, dragging people into CS by the collar, one by one ;-)

9:18 jartur: LauJensen: If it's not BigDecimal of course

9:19 rhickey: cemerick: the thing is, up to this point, everything in prim/num is highly backward-compatible

9:19 cemerick: rhickey: this is to aid prim/num and such, or are you just trying to simplify stuff

9:20 rhickey: cemerick: simplify

9:21 not just implementation or call-path complexity, but subtlety of equiv/equals pokes its head out often

9:21 cemerick: right

9:21 jartur: I hope we will not end up with = eq equal eqv ==

9:21 rhickey: jartur: we won't

9:21 eevar2: meh. force people to round their floats before comparing

9:22 cemerick: rhickey: so, my point about calling it hosty was that another host that has different numeric semantics than the jvm, or perhaps already provides some variant of equiv in its .equals will get messy.

9:22 jartur: or use Decimal types

9:22 dsop: hmm clojure dies if I try to get the 100th element of lazy seq that is recursive defined using a simple function

9:23 Chousuke: dsop: show the code if you want help :)

9:24 dsop: Chousuke: http://gist.github.com/442107

9:24 rhickey: cemerick: I can always add the type distinction on that host. Now we're paying to remove it all the time

9:26 Chousuke: dsop: looks fine to me. it runs out of memory or what?

9:26 cemerick: rhickey: Not sure I follow. If = -> .equals, and Host X's .equals performs some equivalency tests on numerics, are you then saying that the clojure impl for that host would catch those numeric types in the impl for =, handle them differently to match jvm semantics, and then pass on to the host's .equals?

9:26 dsop: Chousuke: it takes forever to calculate

9:27 rhickey: the big risk of moving equiv to == is that there may be pressure to introduce the 'test' for functions that do = internally

9:27 dsop: Chousuke: and i wonder why http://gist.github.com/442107 doesn't work

9:27 Chousuke: dsop: partial returns a function

9:28 rhickey: cemerick: yes. I am not saying that = *is* host .equals, just that numeric = will include type. That happens to match Java

9:28 Chousuke: dsop: maybe the ratios are slowing you down

9:28 dsop: try using doubles

9:29 jartur: dsop: Chousuke may be right. You will have enormous numbers on 30th iteration.

9:30 Chousuke: ratios get really slow when they grow big. or small

9:34 cemerick: rhickey: And CLR, and "native" hosts will likely follow the jvm's semantics, or be made to fairly trivially. Seems good to me.

9:35 jartur: Before clojure I would never use emacs. Today I'm in IRC with ERC... Though I still think that emacs is full of legacy.

9:35 rhickey: meh, several Incanter tests fail due to (= 2 2.0) => false

9:35 cemerick: rhickey: that's not a regression, they're bad tests ;-)

9:36 rhickey: but the rest of argos passes just fine

9:36 cemerick: The only issue might be opaque equality checks, where you really don't know what types you might be working with.

9:36 rhickey: cemerick: that's what == will cover

9:37 cemerick: rhickey: I mean where you might have non-numerics flowing through too.

9:37 LauJensen: If people generally have used = where they (we) should have used ==, isnt this a sed// fix ?

9:37 rhickey: cemerick: right, that's where the whole 'pass the test fn' problem seeps in

9:37 _fogus_: rhickey: So only an Incanter test fails? I wonder if that represents actual expectation

9:37 jartur: Btw, does anybody work on CLR support? Just sayin'

9:37 cemerick: (= a b) => (or (= a b) (and (number? a) (number? b) (== a b)))

9:38 rhickey: _fogus_: I looked now, now of the fail comparisons are in Incanter lib code, only in the test code itself, so, yes, could just be weak tests

9:38 cemerick: jartur: David Miller is the point man for that. I don't think he's in the channel much.

9:38 rhickey: none of

9:39 cemerick: the order is swapped, plus collections of same

9:42 whatever the correctness of this new semantic, it remains a difficult change due to the undetectable breakage. People shouldn't in fact be switching to == everywhere, but become more cognizant of the numeric types in play

9:43 I really like the current world where you just use = everywhere

9:44 LauJensen: Yea that makes two of us

9:45 rhickey: but code that does (= 42 (some-fn-that-returns-a-float)) is just lazy and wrong, but currently works

9:47 cemerick: rhickey: I think a strong case could me made that current = behaviour is a huge help for most programmers.

9:47 rhickey: 20080213 Release 'made = use equiv for Numbers' http://groups.google.com/group/clojure/browse_thread/thread/3e4fb7cfc458b31e/d1e3e02d5b677ef2?q=equiv+group:clojure

9:47 jartur: As I thought with CLR working with generics is a problem. And I suppose a huge one.

9:48 dsop: Chousuke: any way to avoid them? i probably should use doubles instead? thanks for the hint ill try it!

9:48 cemerick: rhickey: OK, ever so slightly before my time :-)

9:51 rhickey: cemerick: yes, currently they only trip up when using numbers as keys, and most of those will be fixed due to consistent boxing. Few people complain about =

9:52 but = is used often and the current logic is pretty heavy for such an important thing

9:52 even dropping the collection special handling would help things, but muddy the semantics

9:55 LauJensen: rhickey: are you considering making the change, or looking for way to make an easier transition ?

9:56 Raynes: _fogus_: Interesting interview questions. The zombie vs vampire one was *tough*. ;)

9:56 rhickey: LauJensen: I'll probably push to yet another branch, so people can evaluate that change separately from the work in num, but it's all done

9:57 LauJensen: Ok great

9:57 rhickey: Have you decided on what constitutes 1.2 yet ?

9:57 s/constitutes/goes into/

9:57 sexpbot: rhickey: Have you decided on what goes into 1.2 yet ?

9:57 rhickey: LauJensen: I'm going to write up all this work and solicit feedback

9:57 LauJensen: k

9:57 _fogus_: Raynes: ;-)

9:57 rhickey: I gave a talk last night on prim/num, was well received

9:58 LauJensen: rhickey: video/mp3 up somewhere?

9:58 rhickey: no

10:03 pjstadig: rhickey: when will you learn? you must video every talk you give :)

10:03 you're a rock star now

10:04 rhickey: pjstadig: since I wrote the talk on the car ride on the way to the city, would have been a bit plucky to record it :)

10:05 anars: you aware if anyone else recorded it?

10:05 rhickey: anars: no

10:07 so, no one has complained about the loss of auto-promotion

10:08 cemerick: N and M syntax along with autopromotion helps

10:11 raek: how will I know when to use 1 and 1N in my functions?

10:11 doesn't that depend on how large numbers the caller needs?

10:41 jwr7: rhickey: just wanted to say that the num branch is a Big Deal for some of us (like myself), even though we stay quiet most of the time. Now, if only somebody implemented efficient sparse vectors and sparse matrices...

10:52 rhickey: jwr7: great!

10:53 raek: if the caller has passed you a bigint, doing arithmetic with it and 1 will yield a bigint

10:54 raek: polymorphic math is still there

11:13 raek: rhickey: ah, I see... then I have no problem with the loss of auto-promotion

11:21 * raek git checkout -b num origin/num

11:33 raek: rhickey: my factorial function yields a negative value when I give it 26N or greater: http://gist.github.com/442269

11:33 rhickey: is this a bug?

11:35 rhickey: raek: yes

11:36 bagucode: What is a good way to get the class that a symbol represents if you have the symbol? eg. getting java.lang.String from the symbol String. (eval 'String) works but seems a litte yucky

11:41 raek: clojure.lang.RT/classForName is used in clojure.contrib.core/new-by-name

11:41 http://github.com/richhickey/clojure-contrib/blob/9f448420b082ce8a6e577696df5203a405f4e8d4/src/main/clojure/clojure/contrib/core.clj#L71

11:42 yacin: how big of a file would you need to see a performance benefit from using mmap/slurp over clojure.core/slurp?

11:51 bagucode: raek: Was that classForName tip for me? It doesn't work :( It works the same as regular java Class/forName. What I want is a way to get the class from a single symbol. I already figured out that eval works so I was curious if there is a better way.

11:52 hoeck: yacin: "For most operating systems, mapping a file into memory is more expensive than reading or writing a few tens of kilobytes of data via the usual read and write methods. From the standpoint of performance it is generally only worth mapping relatively large files into memory."

11:53 yacin: from http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.html

11:54 raek: bagucode: have you tried passing the symbol through (name)?

11:54 (Class/forName (name 'java.lang.String)) <-- this works for me

11:55 yacin: hoeck: thanks

11:57 bagucode: raek: Yes that works, but that's not what I want. I have a symbol that is a single word which corresponds to an imported class so I don't have the whole class name available. Otherwise (name ) or (str ) would work

11:57 raek: (Class/forName (str 'String)) will not work

12:01 When I think about it maybe I don't really mind using eval in this situation. I want the symbol evaluated after all.

12:07 raek: bagucode: ah, ok. now I see what you mean

12:08 candera: bagucode: does ns-map help?

12:09 ,((ns-map *ns*) 'Thread)

12:09 clojurebot: java.lang.Thread

12:10 candera: ,(type ((ns-map *ns*) 'Thread))

12:10 clojurebot: java.lang.Class

12:10 bagucode: candera: Yeah, that's what I was looking for. (eval 'String) is shorter though ;) but there is that eval smell coming from it

12:11 candera: s/eval/evil/

12:11 sexpbot: ,(type ((ns-map *ns*) 'Thread))

12:11 clojurebot: java.lang.Class

12:11 candera: :)

12:12 Hoornet: hello!

12:12 I am new here (and new in Clojure)

12:12 candera: Hoornet: Welcome!

12:12 Hoornet: Is clojurebot returning libraries?

12:13 Thank you

12:13 candera: Hoornet: if you're asking what clojurebot does, one of the things it does is to evaluate expressions that are prefixed by a comma:

12:13 ,(str "example")

12:13 clojurebot: "example"

12:13 Hoornet: aha!

12:13 tnx

12:13 candera: NP

12:14 bagucode: candera: Switched to the ns-map solution. Can't stand eval in the code :)

12:14 Hoornet: so it's like a one line only REPL

12:14 ?

12:14 candera: bagucode: Yeah, I would feel dirty, too. :)

12:15 raek: btw, is the #=(...code...) reader macro deprecated?

12:15 I don't see it on the clojure.org/reader page any more

12:15 candera: Hoornet: Well, since Clojure doesn't use newlines as delimiters, I'm not sure the "one line only" distinction matters. But it reads, evaluates, and prints an expression, yes.

12:15 cemerick: Hoornet: yeah, good to show examples to people, etc. without opening a gist

12:16 Hoornet: a very nice touch :)

12:16 alpheus: ,(str

12:16 clojurebot: EOF while reading

12:16 alpheus: "example")

12:17 heh

12:17 Hoornet: that's what I meant with one-liner

12:17 :)

12:17 candera: Hoornet: yeah, I understood eventually. I'm a little slow.

12:17 :)

12:19 Hoornet: Hmm. I'm traing to get into functional programming but really just can't decide how to start. There is soo much really good stuff here I didn't even know existed!

12:19 Clojure, Scheme, Haskell

12:19 hamza: guys, I am having some problems with multimethods they don't work across namespaces, http://bit.ly/alLhvA

12:20 anyone have any ideas?

12:20 Hoornet: So like a madman I'm sqwitching among all of them tryind to decide which one to really lern first :)

12:21 dnolen: Hoornet: you've got your homework cut out for you :) Clojure, Scheme, and Haskell are all pretty different

12:21 cemerick: ouch. That doesn't sound fun. :-)

12:22 Scheme and clojure at the same time is particularly difficult. I did that for a few weeks once.

12:22 raek: hamza: double-colon keywords get the namespace of the current namespace

12:22 ,::foo

12:22 clojurebot: :sandbox/foo

12:22 Hoornet: yes! That's why I can't decide. They are all very interesting though.

12:22 raek: in another namespace, you would need to type :sandbox/foo in this case

12:24 if you have an alias to the other namespace, say (ns ... (:require [sandbox :as s])), you can also write ::s/fo

12:24 * ::s/foo

12:24 ,(alias 'core 'clojure.core)

12:24 clojurebot: nil

12:24 cemerick: Hoornet: They're all useful paths to take.

12:24 I'll hazard to say that Clojure is the most "practical" of them, insofar as its at home anywhere a JVM is.

12:24 raek: ,::core/foo

12:24 clojurebot: :clojure.core/foo

12:25 hamza: raek: damm thanks since namespaces names begin with same prefix I missed that now it words. I need to get some sleep.

12:25 *works

12:25 Hoornet: yes, but that is also a little repulsive (java theater, i mean).

12:26 cemerick: Right, it depends on what your tastes are and context is.

12:26 Hoornet: There is no context (yet), except I wanna learn the damn thing :)

12:26 rhickey: so, another decision point. Currently, recur to prim with object throws, this to highlight the fac tthat you lost 'primitiveness' in intervening ops. In num branch, that will be less likely, and prim locals are automatic, i.e. (let [x 1] ...) makes x a long. In order to facilitate (loop [x 1] ... (recur (:foo bar)) I currently do silent safe convert to prim, with warning when *warn-on-reflection*. Would people prefer the error? It would re

12:26 (loop [x (num1)] ...) if you are going to possibly recur with a boxed number.

12:27 Hoornet: Clojure really does look very nice. But so does Haskell. But I believ C,lojure has a more practicle chances

12:28 AWizzArd: rhickey: Hi! Yesterday your internet conn was not so stable, so I don't know if you got this message:

12:28 ,[(= 0.5M 0.5 1/2) (= 0.5 1/2 0.5M)]

12:28 clojurebot: [true false]

12:28 Hoornet: to use work with as a programmer

12:28 AWizzArd: because of:

12:28 rhickey: AWizzArd: fixed already, thanks

12:28 AWizzArd: ah ok

12:28 dnolen: Hoornet: comparing Haskell and Clojure and their comparative usefulness seems like an exercise in futility.

12:28 cemerick: Hoornet: I learned haskell for three weeks or so. It was pretty painful, but good to get a sight of that side of FP.

12:28 AWizzArd: good

12:29 dnolen: Hoornet: I think at the end of the day it boils down to 1) taste 2) project requirements

12:29 AWizzArd: And another thing which might be or not be fixed:

12:29 ,(binding [*print-dup* true] (println (first {1 2})))

12:29 clojurebot: #=(clojure.lang.MapEntry/create [1 2])

12:29 AWizzArd: but

12:29 ,(clojure.lang.MapEntry/create [1 2])

12:29 clojurebot: java.lang.IllegalArgumentException: No matching method: create

12:30 raek: rhickey: you first line ended with "(...) error? It would re" . I think the IRC server trunkated it.

12:31 rhickey: . Would people prefer the error? It would require (loop [x (num1)] ...) if you are going to possibly recur with a boxed number.

12:31 cemerick: dnolen: I think community is a big factor, perhaps bigger than taste. *shrug*

12:31 bigwavejake: i'm new to clojure. i've got lein installed, but when i run lein deps on a new lein project, i get an error about "Unable to resolve artifact...". I thought lein deps would download and install clojure. Am I wrong?

12:32 dnolen: rhickey: so if if we go with error do we need explicit cast?

12:32 cemerick: rhickey: as long as the conversion is safe, then that seems like a no-brainer compared to an error.

12:33 dnolen: bigwavejake: 90% probably a typo in your project.clj

12:33 raek: bigwavejake: which dependency?

12:33 bigwavejake: :dependencies [[org.clojure/clojure "1.1.0"]

12:34 rhickey: dnolen: well, you have to fix it somehow, either make the local non-primitive or cast yourself on recur

12:35 dnolen: with the warning option (to check yourself), I think the conversion is better

12:35 bigwavejake: all i've done was "lein new myapp" and then "cd myapp; lein deps"

12:35 cemerick: rhickey: what is the warning for? A boxed number doesn't do anyone any good anyways....

12:36 rhickey: cemerick: you have a primitive loop local, you are recurring with a non-primitive, it could be what you intended or represent an un-noticed inefficiency, masked by the auto-conversion

12:37 raek: bigwavejake: can you post the complete error message somewhere?

12:37 rhickey: cemerick: boxed numbers frequently already exist and unboxing them is perfectly efficient

12:37 cemerick: rhickey: right, but if you're silently converting them, and there's no loss of info, then why a warning at all?

12:38 rhickey: cemerick: if you've created one accidentally in your local calculation, that might be a mistake you care about fixing

12:39 bigwavejake: raek, http://pastebin.com/cuYqJwHZ

12:39 rhickey: currently, the error on recur catches a lot of optimization mistakes

12:40 bagucode: I would certainly care about a performance issue due to a mistake I made. But I don't know if I have a preference for warning or error. What I know is I do want one of them.

12:41 raek: strange... you can download the jars files from http://build.clojure.org/releases/org/clojure/ and put them in the lib/ directory

12:41 but you should not have to do this

12:41 rhickey: raek: fixed, thanks. Note that if you want an accumulator that can accommodate bigints you need a boxed ini like this: http://gist.github.com/442269#comments

12:41 boxed init

12:42 raek: because 1 is a long

12:51 bigwavejake: raek, how should i proceed?

12:51 raek: I'm afraid that I don't know

12:52 maybe you could try to clear your ~/.m2 directory

12:52 and reinstall leiningen

12:53 bigwavejake: ok

12:53 raek: there is a #leiningen channel, maybe they can help you

12:54 bigwavejake: that fixed it!

12:54 weird

12:54 raek, thanks for your help!

12:54 raek: clearing ~/.m2 ?

12:54 bigwavejake: clearing ~/.m2 and lein self-install

13:16 rhickey: equal branch available for the intrepid: http://github.com/richhickey/clojure/tree/equal, includes all of prim and num

13:30 raek: what is the rationale of boxed numbers to be non-= ?

13:41 technomancy: bigwavejake: I suspect it was a network hiccup.

14:09 rhickey: raek: they have different semantics when used, at least between fixed integers, arbitrary-precision integers, floating point and bigdecimal

14:10 within fixed precision integers, different boxed types is an artifact of the host, and uniform boxing should hide that

14:12 sclv: quick question -- does anybody have any sample code illustrating using clojure with Thrift

14:29 technomancy: what ever happened to that =? equality predicate-maker function that was proposed?

14:30 rhickey: technomancy: which was that?

14:31 technomancy: ISTR talk of (=? :foo) returning a predicate for equality to :foo

14:31 maybe that was just idle brainstorming though?

14:31 rhickey: ah that, didn't go anywhere

14:32 technomancy: because #(= :foo %) is short enough?

14:32 rsh: I have a hashmap with a nested hashmap for some key. I want to assoc something to the inner map and return the outer+inner map with the change made...is there a way to do this?

14:32 an idiomatic way that is

14:32 rhickey: technomancy: no, just not urgent, no consensus as to utility

14:33 technomancy: rhickey: right, probably better to focus on 1.2 right now. =)

14:33 rhickey: ,(doc update-in)

14:33 clojurebot: "([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created."

14:33 rhickey: technomancy: yeah

14:33 rsh: thanks

14:44 cemerick: wow, for is gnarly

14:44 does it hold onto head?

14:44 rhickey: cemerick: shouldn't

14:48 cemerick: mmm, nope, it doesn't.

14:56 dnolen: cemerick: gnarly? I would describe it as pretty cool :)

14:57 cemerick: dnolen: Indeed it is....but still gnarly enough that it's faster for me to ask about it holding head here rather than just reading the code. :-)

15:07 danlarkin: I just think of for as doseq, but keeping a list of results

15:08 cemerick: right...there was a time when for (and others, I think) held onto the head of the sequence being acted upon.

15:08 rhickey: cemerick: no

15:09 for being lazy was always a feature

15:09 cemerick: no? I seem to distinctly remember that being the case at some point.

15:10 lazy, yes -- but none of them should hold onto elements for which a result has already been produced (or reacted to, in doseq's case)

15:10 rhickey: doseq and for are completely different

15:11 for produced a lazy sequence, and like all lazy seq fns, didn't hold onto the head unless the user did

15:19 dnolen: so does future always create new thread?

15:21 danlarkin: it uses the clojure.lang.Agent threadpool iirc

15:22 ugh, but I seem to always be wrong about these things, sooooo maybe it's the complete opposite of what I just said

15:26 dnolen: danlarking: mostly curious if is at all possible to achieve something like coroutines with future?

15:26 danlarkin: ^

15:28 danlarkin: maybe with promise/deliver? Not sure

15:43 LauJensen: It was mentioned that the * prefix for a function, was not idiomatic for denoting that the function was the driver of a macro or something similar, but did people ever agree on another standard?

15:49 yacin: can you do :pre and :post with functions defined like clojure.core/+?

15:49 ([arg1]) ([arg1 arg2]) ([arg1 arg2 & more])

15:52 sclv: total beginner clojure question here -- if I have java object and want to introspect it to see its methods, etc from the repl, what's the easiest way to do so?

15:53 I assume there's something nicer than the standard java intospection api

15:57 yacin: sclv: not sure if it's built-in (probably is) but check this out: http://travis-whitton.blogspot.com/2009/06/method-introspection.html

15:58 sclv: yacin: thanks. that looks about right.

15:59 tomoj: clojure.contrib.repl-utils has show

15:59 (require '[clojure.contrib.repl-utils :as repl]) (repl/show 3)

16:00 islon: how do I set a static java field?

16:00 "Config.LoggerProvider = LoggerProvider.DISABLED;"

16:01 LauJensen: sclv: C-c I, from the SLIME/REPL

16:01 Gives you a great introspection tool for both Java and Clojure objects and classes

16:01 sclv: even better :-)

16:02 yacin: C-c I is niiiiiiice

16:03 LauJensen: Waaay nice :)

16:03 tomoj: have to inspect the class to see instance methods, I guess?

16:03 LauJensen: Yea

16:03 raek: islon: you can use the set! special form

16:03 LauJensen: Or an instantiation

16:04 islon: raek: thanks!

16:04 raek: http://clojure.org/java_interop#Java%20Interop-The%20Dot%20special%20form-%28set!%20%28.%20instance-expr%20instanceFieldName-symbol%29%20expr%29

16:09 serp_: how do I use write-json with an OutputStream?

16:09 wrapping it in a (reader) doesn't work

16:10 rhickey: Some docs for prim/num/equal branches: https://www.assembla.com/wiki/show/clojure/Enhanced_Primitive_Support

16:10 feedback welcome

16:19 dnolen: rhickey: well I saw those notes in person yesterday, great stuff! better to get it in sooner then latter :D especially since Clojure community keeps growing, the later changes like that get in the more painful.

16:20 raek: serp_: wrap it in a (writer)

16:20 dnolen: I feel jealous for the newbies if this gets in 1.2, way more sane.

16:20 they'll never know how we much we roughed it.

16:21 hiredman: rhickey: I vaguely recall some traffic about using weakrefs for keywords instead of the current concurrenthashmap, and was wondering if you would be interested in a patch to switch to a weakhashmap of symbols to weakrefs

16:21 serp_: raek: I meant that I wrapped it in (writer), of course :)

16:21 sclv: Ok I'm confused. I'm trying to create a new instance of a static inner class and failing terribly. Anything to watch out for?

16:21 serp_: but it doesn't work: java.lang.RuntimeException: java.lang.ClassCastException: java.io.BufferedWriter cannot be cast to java.io.PrintWriter

16:21 hiredman: or maybe just rehashing why it wasn't a good idea

16:21 sclv: oh wait -- I think I have a lead

16:22 It needed to be declared fully qualified.

16:22 which is mildly irritating.

16:23 raek: ah, then you could use (java.io.PrintWriter. (writer out-stream))

16:25 tomoj: sclv: you have to import the inner class too

16:25 if you don't want to fully qualify

16:25 serp_: hrm!

16:26 sclv: tomoj -- gotcha. I was expecting if I had OuterClass then I would get OuterClass$InnerClass automatically

16:26 tomoj: yeah, I ran into that too

16:30 rhickey: hiredman: maybe, I'm always cautious about weakrefs

16:43 yacin: wonder why clojure.contrib.math doesn't have log/ln/lg

16:48 hiredman: rhickey: so just send the patch to -dev and rfc?

16:59 rhickey: hiredman: sure

16:59 thanks

17:17 raek: which thread pool are futures executed in?

17:21 the "send" or "send-off" pool?

17:21 rhickey: raek: send-off

17:25 raek: ok, thanks!

17:36 TakeV: So, :gen-class and proxie are both out of date? What do I use instead of them?

17:41 raek: you might be thinking of reify

17:42 http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/reify

17:42 tomoj: gen-class and proxy aren't out of date.. are they?

17:43 kotarak: no

17:43 TakeV: tomoj: I was told so last time I asked about them in here. :\

17:43 kotarak: they are not.

17:43 raek: but their usage overlap somewhat

17:44 kotarak: with reify you can't have superclasses, you can only implement interfaces.

17:44 with proxy you can have superclass.

17:44 raek: reify has support for closures, which proxy lack, right?

17:46 kotarak: no, proxy methods are plain function, ie. closures

17:46 raek: ah, yes

17:46 proxy is implemented with a map of functions, IIRC

17:52 some background: http://www.assembla.com/wiki/show/clojure/Datatypes http://www.assembla.com/wiki/show/clojure/New_new

18:58 dnolen: hmm

18:58 anyone tried to compile Clojure on an OS X box over ssh?

19:00 tomoj: why should it matter whether it's over ssh?

19:01 dnolen: tomoj: I'm getting a could not connect to winder server.

19:01 I always wondered by ant on OS X need to launch a GUI

19:01 now I'm getting bitten by it over ssh.

19:01 tomoj: oh, I see

19:01 wwmorgan: dnolen: try enabling X forwarding (-X or -Y on your ssh)

19:02 tomoj: the little java icon that shows up in the dock, I guess?

19:03 dnolen: tomoj: in the app switcher

19:05 wwmorgan: thx for that tip, but it looks like I need to setup X11 forwarding perms first

19:07 wwmorgan: dnolen: if you enable X forwarding, do you still get a "cannot connect to window server" error message?

19:08 dnolen: wwmorgan: yeah

19:08 wwmorgan: hm. Try setting your DISPLAY environment variable to ":0.0" before you invoke ant, if it isn't set already

19:20 cemerick: rhickey: prim is *nice* :-)

19:24 dnolen: try setting -Djava.awt.headless=true in your ANT_OPTS (or in the build.xml) -- that should avoid any X requirements (and should probably be there by default anyway)

19:24 wwmorgan: howdy :-)

19:25 wwmorgan: hi cemerick, getting up to speed with clojure since about 1.0

19:25 cemerick: yeah, there's been a lot going on

19:25 All good, of course.

19:28 dnolen: cemerick: hmm, still no go, I've set that in my .profile

19:30 cemerick: dnolen: you might have to just add the system property to each <java> invocation in the build.xml depending on whether they're forking or not

19:31 dnolen: cemerick: <sysproperty key="-Djava.awt.headless" value="true" /> ?

19:31 cemerick: dnolen: FWIW, java.awt.headless isn't an env variable, it's a java system property

19:31 dnolen: sound right :-)

19:31 sounds*

19:32 dnolen: and just for kicks, add a fork="true" to the <java> element too, to make sure it's free from whatever ant is actually running with.

19:33 dnolen: i see what the problem is

19:33 it's all the ui stuff

19:33 that should be configurable

19:33 ant no-ui

19:33 cemerick: right, the inspector and such

19:33 well, that's what the headless system property controls

19:34 dnolen: but that should just be a build option, right? that stuff is less useful on the server anyway.

19:35 cemerick: you mean whether to include it? I wouldn't think so.

19:35 Just about any server-side apps should be run with headless=true for just this sort of thing.

19:36 dnolen: cemerick: yeah but you need to compile clojure first right? why shouldn't there be knobs for that?

19:37 again clearly not an issue if running on unbuntu in my experience, but I'm setting up a colocated mac mini

19:37 cemerick: dnolen: building clojure's just another (set of) java invocation, so the headless property should have the intended effect.

19:37 I'll give it a shot on a server, and see what happens

19:37 dnolen: cemerick: but I need to edit build.xml by hand, lame

19:38 cemerick: heh

19:38 well, OK, but I suspect this isn't a frequent requirement -- building in a headless environment

19:40 hiredman: build.clojure.org runs X now?

19:40 dnolen: cemerick: hmm, I guess clojure-contrib needs some fixing in this regard as well.

19:41 cemerick: hiredman: stuff like the inspector loads swing and such, so that's an AWT thread

19:41 dnolen: cemerick: test_miglayout.clj also givin me trouble in contrib

19:42 cemerick: dnolen: OK, nevermind, just built clojure HEAD on a headless ubuntu server

19:42 no errors, no build.xml modifications needed

19:42 (which I'm a little confused by, but there it is)

19:43 dnolen: cemerick: it's known OS X issue

19:43 cemerick: ah, OS X only; I didn't catch that.

19:43 dnolen: you can't call into AWT classes without triggering a permissions problem

19:43 some of them anyways

19:43 cemerick: dnolen: link?

19:44 dnolen: cemerick: http://lists.apple.com/archives/webobjects-dev//2005/Jul/msg00582.html

19:44 cemerick: yeesh, 2005

19:45 okay, that's totally outside of what the headless mode will fix

19:46 dnolen: or, so I thought: http://lists.apple.com/archives/webobjects-dev//2005/Jul/msg00596.html

19:46 headless fixed it for the next fellow down

19:46 dnolen: cemerick: "plus changes in the code"

19:46 cemerick: *shrug*

19:47 can you paste your modified build.xml?

19:48 dnolen: cemerick I just commented out clojure.inspector and clojure.java.browse-ui from compile-clojure target

19:48 everything works then

19:49 cemerick: well, yes, though that's obviously not a fix :-)

19:49 dnolen: cemerick: setting headless didn't work

20:06 rustemsuniev: is there any better way to filter a map? (filter #(and (= (get % :x) 1) (= (get % :y) 3) ) [{:x 1 :y 1} {:x 1 :y 2} {:x 1 :y 3}])

20:26 rhickey: cemerick: are you trying them in order? prim/num/equal

20:29 TakeV: How do I actually use clojure-contrib? :use clojure-contrib?

20:31 hamza: guys, how can I add some text to the main index.html created from autodoc? been searching through the docs but no mention yet clojures api docs does it..

20:43 nDuff: TakeV, do you want something to put in your ns declaration, or to use standalone? For an example of the latter -- some of my code calls (require '(clojure.contrib [mmap :as mmap])), and later uses (mmap/mmap file)

20:43 TakeV: nDuff: I'm not sure what the distinction is.

20:44 nDuff: TakeV, ...functionally, there isn't necessarily one. AFAIK it's an aesthetics choice.

20:44 (but AFAIK isn't very far)

20:45 TakeV: nDuff: Well, then which is easier to manage/use? :P

20:45 nDuff: I do my requires standalone for easier cut-and-pasting into interactive interpreters.

20:46 * TakeV nods

20:49 TeXnomancy: TakeV: you use clojure-contrib one namespace at a time. See the ns form at the top of this file where it uses clojure.contrib.io: http://github.com/richhickey/clojure-contrib/blob/master/src/test/clojure/clojure/contrib/test_io.clj

21:21 redalastor: If I want the latest clojure, which of the git branches should I be following?

21:24 lancepantz: master

21:24 the others are experiments

21:25 redalastor: It seems there are lots of experiments lately.

21:26 Are we getting close to 1.2?

21:27 rhickey: redalastor: there is a direct line - master->prim->num->equal, not a bunch of true divergent branches

21:28 just a question now if people are interested enough in the num stuff to want it in 1.2

21:28 redalastor: Is there somewhere I can read about the num stuff?

21:28 rhickey: https://www.assembla.com/wiki/show/clojure/Enhanced_Primitive_Support

21:31 redalastor: It sounds very good.

21:39 cemerick: rhickey: no, I jumped straight to num

21:39 rhickey: cemerick: ah, you said prim

21:40 TakeV: So I'm looking for a good graphics library for Clojure. Does one exist?

21:40 cemerick: rhickey: I just (sloppily) think of the whole batch of changes as primitive-related

21:40 rhickey: cemerick: but you didn't go all the way to equal?

22:04 bortreb: Hi, does anyone know what happens when you future-cancel a future? specifically, I'm wondering why (let [fut (future (do (Thread/sleep 5000) (println "Got to here.")))] (future-cancel fut) ) returns true immediately and doesn't print anything, but (let [fut (vector (future (do (Thread/sleep 5000) (println "Got to here."))))] (map future-cancel fut) ) returns (true) immediately but then...

22:04 ...STILL prints 5 seconds later?

22:05 nDuff: doesn't map return a lazy sequence?

22:05 bortreb: yes but even putting a doall or dorun causes the same bahaviour; also the REPL should realize the sequence anyway to print it

22:08 nDuff: ...actually, I can't reproduce that behavior.

22:08 wwmorgan: I can't reproduce it either

22:08 nDuff: on clojure 1.1.0, behavior is what you (bortreb) expect.

22:08 bortreb: with or without the dorun?

22:09 nDuff: cut+pasted exactly as you provide

22:11 bortreb: that's weird as I have 1.1.0 as well...

22:14 ceptorial: hi all.. does clojure.contrib.sql have a way to grab last autoincrement id from the most recent insert?

22:16 bortreb: I'm sure everyone knows this, but the international functional programming contest starts tomorrow (http://icfpcontest.org/).

22:16 anyone looking to start a team?

22:17 lancepantz: ceptorial: you have to use with-query-results with a sql statement with a RETURNING clause

22:17 ceptorial: RETURNING?

22:18 lancepantz: insert into x ... values ... returning id;

22:20 ceptorial: http://gist.github.com/443115

22:20 ceptorial: that's a function i have that uses the pattern

22:21 ceptorial: got it.. but is that supported by mysql? i guess i could just do a separate select last_insert_id();

22:22 lancepantz: ah, i'm not 100% there, we use postgresql

22:24 ceptorial: got it.. ok cool, thx

22:24 lancepantz: did you find a mysql equivalent?

22:25 ceptorial: no i think you have to do a separate select last_insert_id();

22:25 lancepantz: lame

22:26 ceptorial: i wonder what contrib.sql does if i do with-query-results "insert ... ; select last_insert_id();"

22:26 although maybe it's jdbc that determines that

22:27 lancepantz: dunno

23:12 cemerick: bizarre -- I've got a try/finally (with a recur in the try body), where the finally is not being run

23:13 pulling the recur out allows the finally to run :-/

23:15 rhickey: If you have opinions on the enhanced primitive support, please chime in on: http://groups.google.com/group/clojure/browse_thread/thread/c8c850595c91cc11

23:34 hiredman: cemerick: well, recur is a goto

23:36 cemerick: hiredman: essentially yeah, but finally is supposed to be run, no matter what happens in the try

23:36 e.g. https://gist.github.com/80c5c990b66bf8f04147

23:49 hiredman: cemerick: but I don't believe finally really exists

23:49 cemerick: heh

23:49 existentially?

23:50 hiredman: I mean it doesn't exist in bytecode, it's simulated

23:50 cemerick: right

23:50 hiredman: either way, it's a bug

23:50 cemerick: yeah, I'm trying to narrow things down

23:55 redalastor: After reading about the num branch, I now want a Haskell target for clojure-in-clojure to get decent types :)

23:57 hiredman: http://gist.github.com/443208

Logging service provided by n01se.net