2009-08-14
| 00:18 | eyeris | I just installed vimclojure from bitbucket |
| 00:18 | eyeris | :scriptnames shows it loaded the scripts |
| 00:18 | eyeris | However the mappings, such as \ef, do not work. |
| 00:19 | eyeris | They are not displayed by :map <LocalLeader> |
| 00:20 | mikem`_ | eyeris: i think those are only mapped when the nailgun server is running |
| 00:21 | eyeris | It is running |
| 00:21 | eyeris | NGServer started on 127.0.0.1, port 2113. |
| 00:25 | mikem`_ | eyeris: ah yes, you also need to open a .clj file |
| 00:25 | mikem`_ | s/file/buffer/ |
| 00:25 | eyeris | I did. |
| 00:26 | mikem`_ | and your ~/.vimrc has the relevant entries? clj_want_gorilla et al? |
| 00:27 | eyeris | I have the clj_want_gorilla set |
| 00:27 | mikem`_ | ok, at this point I'm not sure. sorry |
| 00:28 | eyeris | np |
| 00:46 | eyeris | When I try to use the ng client from the cmd line I get |
| 00:46 | eyeris | clojure.contrib.pprint.PrettyWriter |
| 00:46 | eyeris | That exception is right on the vimclojure page. |
| 00:47 | eyeris | The explanation is that I didn't AOT compile clojure-contrib, but I did and the .jar is in my CP |
| 00:51 | eyeris | Fixed that. |
| 00:52 | durka42 | what was it? |
| 00:53 | eyeris | clojure-contrib wasn't actually AOT compiling. It was just silently failing |
| 00:53 | eyeris | Though now I am CP hell... |
| 00:55 | eyeris | Yay! it works now! |
| 01:24 | clojure | i really like vimclojure, since it saves me from using emacs/slime |
| 01:46 | lrenn | i was just thinking how emacs + slime + paredit + clojure is the most fun I've ever had coding in my entire life. |
| 01:51 | albino | pretty bold statement there |
| 03:25 | lowlycoder | after typing in 'ant' in the clojure dir; it builds clojure for me ... however, how do I install clojure? |
| 03:25 | lowlycoder | I want it in /usr/local/whatever |
| 03:30 | arbscht | lowlycoder: I don't believe there is a standard way to do that. I set mine up roughly according to the debian java package conventions, and with a custom clj launcher |
| 03:37 | eevar2 | lowlycoder: here's my install, stuffing all jars of interest in /opt/clojure-libs: http://pastebin.org/8749 |
| 03:38 | eevar2 | (except the compojure deps) |
| 03:40 | tomoj | so far I've just been unzipping clojure, clojure-contrib, and any jars a project depends on into project/target/dependency for clojure-project |
| 03:40 | tomoj | getting pretty annoying |
| 03:41 | mikem`_ | eevar2: what do you put in your CLASSPATH variable then? how do you start the clojure REPL or clojure apps? |
| 03:43 | cschreiner | wish there was a one-click-installer for clojure |
| 03:43 | eevar2 | mike: java -cp "/opt/clojure-libs/*" clojure.lang.Repl # should work, assuming you have java1.6+ |
| 03:44 | eevar2 | iirc 1.5 doesn't like * in the class path |
| 03:46 | mikem`_ | eevar2: |
| 03:46 | mikem`_ | eevar2: ok, cool, thanks for sharing :) |
| 03:46 | eevar2 | http://pastebin.org/8946 # my real/current/working .emacs config. the one i pasted earlier might have been bogus |
| 03:47 | eevar2 | i.e. not setting the class path correctly |
| 03:48 | tomoj | eevar2: if you have project-specific dependencies, do you add to swank-clojure-extra-classpaths for that project? |
| 03:49 | eevar2 | neh, i just stuf the jars into my global library |
| 03:49 | tomoj | ah |
| 03:49 | eevar2 | if for whatever reason you need to work with different versions of the same library, that might be an issue |
| 03:49 | tomoj | that would mean you never have to create special slime repls for different projects with different classpaths like clojure-project does... sounds like a good idea |
| 04:00 | JesterMonkey | Hello ? |
| 04:02 | tomoj | hello |
| 04:14 | eevar2 | tomoj: working with multiple files gets a bit hairy if you dont make sure you're in the correct dir. and you'll want '.' in your classpath as well, which the crap i posted earlier doesn't include ;) |
| 04:19 | tomoj | hmm |
| 04:19 | tomoj | maybe I'll stick with clojure-project for now |
| 05:04 | DrJoke | (life restart) |
| 05:11 | seths | is there a historical reason why (inc Integer/MAX_VALUE) overflows? |
| 05:11 | seths | (+ 1 Integer/MAX_VALUE) just automatically promotes to Long |
| 05:11 | seths | and Long/MAX_VALUE to BigInteger |
| 05:13 | cark | might be worth making a post about it on the mailing list |
| 05:19 | febeling | how often are the irc logs posted? I can only see the ones from a couple of days ago |
| 05:27 | tomoj | it seems like the intention is for (inc Integer/MAX_VALUE) to not overflow |
| 05:28 | tomoj | the inc method in IntegerOps checks whether the first operand is less than Integer.MAX_VALUE |
| 05:30 | seths | I am putting together a quick post to the mailing list |
| 05:31 | seths | (dec Integer/MIN_VALUE) also over (under?) flows |
| 05:32 | tomoj | weird, because the dec method in IntegerOps does a similar check there |
| 05:32 | tomoj | s/first operand/argument/ |
| 05:33 | seths | I haven't checked in the source, but I just updated from Github |
| 05:34 | seths | "checked in" the source = read it :-) |
| 05:35 | tomoj | maybe it's something to do with inlining? |
| 05:35 | tomoj | I dunno |
| 05:42 | Fossi | i guess if it's intended behaviour, it should be documented |
| 05:42 | Fossi | but i doubt it |
| 05:42 | Fossi | at least it's not what i would expect |
| 05:43 | tomoj | from the source code it looks to me like it's not intended |
| 05:44 | tomoj | but that was my first dip into the java source |
| 05:45 | seths | I was sort of expecting (inc) and (dec) to be macros |
| 05:45 | seths | expanding to (+) and (-) |
| 05:46 | tomoj | then (iterate inc 1) wouldn't work, would it? |
| 05:47 | seths | haven't used iterate yet :-) |
| 05:50 | seths | neat |
| 05:52 | tomoj | also stuff like |
| 05:52 | tomoj | ,(map inc [3 4 5]) |
| 05:52 | clojurebot | (4 5 6) |
| 05:53 | seths | I am seeing the limits of my clojure-fu :-) |
| 05:54 | seths | I don't understand why this hangs: (take 10 (iterate (fn [val] (+ 1 val)) 1) |
| 05:55 | seths | but this works: (defn bad-inc [val] (+ 1 val)) (take 10 (iterate bad-inc 1)) |
| 05:55 | tomoj | the first doesn't hang for me |
| 05:55 | tomoj | did you really forget the extra ) at the end? |
| 05:55 | _mst | am I going mad or are you missing a right paren on both of those? |
| 05:56 | _mst | yeah :) |
| 05:56 | seths | GAAAAAHHHHHH |
| 05:56 | seths | sorry |
| 05:56 | tomoj | slime tells you "[input not complete]" in the minibuffer |
| 05:57 | tomoj | and the auto-indentation gives a hint too |
| 05:57 | Fossi | highlight-parentheses-mode ftw |
| 05:58 | seths | I'm ashamed to say the repl is not running in Emacs |
| 05:58 | seths | unlike IRC |
| 05:58 | Fossi | eh, for me it's the other way round ;) |
| 05:58 | seths | I really need to stop being lazy about slime |
| 05:59 | tomoj | it's very much worth it imo |
| 05:59 | tomoj | once you have slime installed you can just use the clojure-install function from clojure-mode to set most everything up |
| 06:00 | Fossi | tomoj: i should've known that |
| 06:00 | seths | cool, thanks |
| 06:01 | seths | ah, good post on the overflow on the newsgroup |
| 06:01 | seths | Integer.MAX_VALUE is an int, not an Integer |
| 06:02 | tomoj | ah, that explains why the checks in java didn't work |
| 06:03 | seths | ,(inc (+ 1 Integer/MAX_VALUE)) |
| 06:03 | clojurebot | 2147483649 |
| 06:03 | seths | ,(.getClass Integer/MAX_VALUE) |
| 06:03 | clojurebot | java.lang.Integer |
| 06:03 | seths | hmm |
| 06:04 | tomoj | the distinction between int and Integer is somewhat hidden |
| 06:04 | tomoj | I don't understand it myself yet |
| 06:05 | tomoj | ah, I think I may see the problem |
| 06:05 | tomoj | integers are boxed on function calls |
| 06:05 | tomoj | but inc is inlined |
| 06:06 | tomoj | so the inc(int x) in clojure.lang.Numbers is called |
| 06:06 | tomoj | which does throwIntOverflow if x is Integer.MAX_VALUE |
| 06:12 | seths | tomoj: that would be a great addition to the posting on the newsgroup |
| 06:13 | tomoj | ,(inc (identity Integer/MAX_VALUE)) |
| 06:13 | clojurebot | 2147483648 |
| 06:13 | mikehinchey | that's what should promote instead of throw |
| 06:13 | tomoj | is there a clearer way to box besides identity? |
| 06:14 | mikehinchey | unchecked_inc should be used if you want the exception |
| 06:15 | tomoj | also, is there a way to check whether a certain value is boxed or not? |
| 06:15 | tomoj | (class foo) won't work because foo gets boxed |
| 06:16 | mikehinchey | I think it's assumed you know what you're doing when you use java interop |
| 06:16 | tomoj | unfortunately I don't :( |
| 06:17 | tomoj | ie. I don't understand how to use unboxed ints for performance |
| 06:17 | tomoj | and I can't really investigate it because (class <int>) is still Integer |
| 06:18 | mikehinchey | like I said, I think the inc behavior is wrong, so you wouldn't have to know for this case |
| 06:19 | tomoj | right, but for performance optimization, I'd like to know |
| 06:19 | mikehinchey | I suppose that would require a new special form, since a fn or macro can't know if something is primitive or not |
| 06:20 | Chousuke | the compiler does know though. |
| 06:20 | mikehinchey | right |
| 06:20 | Chousuke | but arguments to function calls are always boxed. |
| 06:20 | tomoj | well |
| 06:20 | Chousuke | if you want primitive math, you need a (loop ...) |
| 06:21 | tomoj | I saw something in here the other day about using (int ..) in binding forms |
| 06:21 | tomoj | I don't see that explained anywhere on clojure.org |
| 06:21 | mikehinchey | inlined fns can avoid boxing |
| 06:21 | Chousuke | well, yeah, but that's because the function is never really called :/ |
| 06:22 | Chousuke | tomoj: should be in the java interop section |
| 06:22 | tomoj | Chousuke: ah, hadn't looked there. thanks |
| 06:23 | tomoj | yup, I see it now. cool |
| 06:29 | tomoj | ,(+ 1 Integer/MAX_VALUE) |
| 06:29 | clojurebot | 2147483648 |
| 06:29 | tomoj | ,(+ (int 1) Integer/MAX_VALUE) |
| 06:29 | clojurebot | java.lang.ArithmeticException: integer overflow |
| 06:33 | rsynnott | aren't Java integers 64bit these days? |
| 06:33 | rsynnott | or is that just Long? |
| 06:34 | tomoj | apparently they are 32bit |
| 06:35 | tomoj | otherwise there would be no overflow there |
| 06:35 | tomoj | right? |
| 06:35 | rsynnott | yep, they seem to be :) |
| 06:35 | rsynnott | I must have imagined the 64bit thing |
| 06:35 | rsynnott | ,(+1 Long/MAX_VALUE) |
| 06:35 | clojurebot | java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn |
| 06:35 | rsynnott | ,Long/MAX_VALUE |
| 06:35 | clojurebot | 9223372036854775807 |
| 06:35 | rsynnott | ah |
| 06:35 | tomoj | we don't have a +1 |
| 06:36 | rsynnott | yep, that's 64bit :) |
| 06:36 | rsynnott | ooh, missed a space, yes |
| 06:59 | seths | 06:58 *** banisterfiend JOIN |
| 07:33 | Fossi | what's the keybinding for getting the repl again? |
| 07:33 | Fossi | in emacs that is |
| 07:34 | Chousuke | M-x slime? :/ |
| 07:35 | Chousuke | I don't quite understand the question :P |
| 07:35 | Fossi | there is a keybinding to get the buffer with the open repl somehow |
| 07:35 | Chousuke | hmmh |
| 07:35 | Fossi | instead of having to go through M-x b *sl TAB r TAB |
| 07:36 | Chousuke | heh. |
| 07:37 | arbscht | C-c C-z does slime-switch-to-output-buffer |
| 07:38 | Chousuke | I have fuzzy completion in the minibuffer from some addon. I'm not sure which, I cloned some set of emacs customisations from github and just tweaked them. :P |
| 07:38 | rsynnott | doesn't slime have fuzzy completion anyway? |
| 07:39 | rsynnott | oh, fuzzy completion in emacs itself? |
| 07:39 | Chousuke | I can just got C-x b slre<tab> and it switches |
| 07:39 | arbscht | emacs yeah - I use icicle |
| 07:39 | Chousuke | I think it might be that. or just ido.el? :/ |
| 07:39 | clojurebot | that is not what I wanted |
| 07:39 | Chousuke | I'm not sure what, but it's nice :D |
| 07:39 | Fossi | yeah, i need to get that as well |
| 07:40 | Fossi | C-c C-z almost does what i want, only that it opens the buffer in another window |
| 07:40 | Chousuke | I also have rather nice tabcompletion in clojure-mode buffers. |
| 07:41 | Chousuke | again, not sure which part of my .emacs.d does it but it's also nice :P |
| 07:42 | Fossi | damn ctrl-w |
| 07:42 | Fossi | i need to disable that for pidgin :( |
| 07:43 | Chousuke | heh |
| 07:43 | Chousuke | I would hate that. I'm pretty used to deleting words with ctrl-w |
| 07:44 | Chousuke | the one nice thing about the mac command key is that it doesn't interfere with application shortcuts using control |
| 07:45 | Chousuke | the downside is the lack of an alt gr, making emacs somewhat less pleasant :P |
| 07:45 | Fossi | well, remapping should be trivial |
| 07:45 | Fossi | i think i might switch ctrl and alt/meta when i go back to dvorak |
| 07:45 | Chousuke | well, yeah, but using cmd as meta then makes emacs unable to utilise the commmon mac shortcuts. |
| 07:46 | Fossi | ah, ok |
| 07:46 | Chousuke | -m |
| 07:46 | Chousuke | :P |
| 07:46 | Chousuke | though for now, that doesn't matter much. |
| 07:47 | Chousuke | it's a bit annoying sometimes though, because Cocoa emacs has some cmd-shortcuts in its menus and I'm not sure what the traditional emacs equivalents are. |
| 07:48 | andyfingerhut | Out of curiosity, does anyone happen to know what is stored in the 8 bytes (32-bit system) or 16 bytes (64-bit system) of every java.lang.Object? Reflection on fields doesn't seem to give me the answer for that class like it does for others. |
| 07:48 | Chousuke | hm, though, problems like that are easily solved with f1 k :P |
| 08:01 | Neronus | andyfingerhut: I know at least that its default constructor does nothing (not setting any fields, no nothing) |
| 08:04 | Fossi | hmm. doesn't work |
| 08:07 | tomoj | hmm.. I get tab-completion in the repl but not in my source buffers |
| 08:12 | Fossi | "gtk-key-theme-name = "Emacs" " hmmmm |
| 08:13 | Fossi | in source buffers i have dabbrev-expand on M-/ |
| 08:13 | Fossi | kinda sufficient |
| 08:13 | fsm | Hello everyone. My raytracer is improving: http://tu.be/graphics/teapot2.png |
| 08:15 | Neronus | andyfingerhut: I suggest: One pointer to the super object (which is null for object, or the object itself, I don't know what the jvm does) and one pointer pointing somewhere denoting the type of the instance |
| 08:16 | andyfingerhut | Neronus: thanks. sounds plausible. I'll keep Google searching. Trying to figure out where all those 48 bytes go on my 64-bit machine for each clojure.lang.Cons and clojure.lang.LazySeq. |
| 08:16 | Chousuke | keybindings with / in them always cause problems to me |
| 08:16 | Fossi | fsm: nice |
| 08:17 | Chousuke | I use a Finnish layout so there's no single key that gives me / |
| 08:17 | fsm | thanks |
| 08:17 | Fossi | Chousuke: that's why i use an us-altgrintl layout (typematrix 2030) |
| 08:18 | Fossi | worst is comment-region on a german keyboard |
| 08:18 | Fossi | meta alt-gr ctrl - |
| 08:18 | Chousuke | :P |
| 08:19 | Fossi | although there's still a possibility for shift in there ;) |
| 08:19 | Fossi | apart from (), the layout is pretty nice |
| 08:19 | Fossi | but those suck on most layouts |
| 08:20 | Chousuke | maybe I should tell emacs to output parentheses from å instead of the useless letter |
| 08:20 | Fossi | with paredit you rarely need ) anyway |
| 08:20 | Chousuke | paredit doesn't work with viper too well though :/ |
| 08:20 | Fossi | so one letter or å Å would be sufficient |
| 08:21 | Chousuke | viper overrides paredit's parentheses deletion protection and then completely confuses paredit |
| 08:21 | Fossi | but i also like the intl layout for letting me type all those characters easily :D |
| 08:21 | Chousuke | to the point that with paredit mode enable, I can't even re-balance the s-exprs because paredit thinks things are unbalanced. |
| 08:22 | Chousuke | enabled* |
| 08:22 | Chousuke | I suppose I could just tell emacs to use a US layout. |
| 08:23 | Fossi | well, that's kinda a mood point about paredit |
| 08:23 | Fossi | never c&p |
| 08:23 | Fossi | or you will have to go through hell to fix it |
| 08:23 | Chousuke | it's not about cut'n'paste though. |
| 08:24 | Chousuke | if I just delete a line with viper, it will confuse paredit if it happens to cause the parens to become unbalanced. |
| 08:24 | Fossi | you can always rebalance them by pasting a ")" |
| 08:24 | Fossi | well, that's more or less cutting |
| 08:25 | AWizzArd | http://www.csd.uwo.ca/staff/magi/personal/humour/Computer_Audience/Boot%20It.html |
| 08:25 | Fossi | you should use paredit-kill for deleting anyway |
| 08:27 | Chousuke | I need a better keyboard anyway :/ |
| 08:27 | Fossi | typematrix rocks |
| 08:27 | Chousuke | the macbook keyboard is very much not emacs-friendly |
| 08:27 | Fossi | haven't found a better one and i searched quite some |
| 08:28 | Fossi | it's a little strange at first, but it pays |
| 08:29 | Chousuke | mmh |
| 08:29 | Chousuke | control key seems to be in a bad position :/ |
| 08:29 | Fossi | a real small downside is that the backspace is so close to the enter key |
| 08:30 | Fossi | so sometimes i send messages in irc/im that i wanted to correct, but that's prolly because i don't touch type correctly |
| 08:30 | Fossi | that's why i thing i'll switch alt and ctrl when i go dvorak again |
| 08:30 | Chousuke | I read some advice for buying a keyboard for emacs use, and it said that the control key should be pressable with the palm |
| 08:30 | Fossi | *think |
| 08:31 | Chousuke | which makes a lot of sense. |
| 08:31 | Fossi | the right control key is kinda nice thoughand the inline cursor keys |
| 08:31 | Chousuke | I don't use enter that much actually |
| 08:31 | Chousuke | just ctrl-m |
| 08:32 | Chousuke | often it doesn't work though :( |
| 08:32 | Fossi | ah, didn't know that one yet |
| 08:33 | Chousuke | in irssi it seems ctrl-j works too |
| 08:33 | Fossi | well, th etypematrix is not really emacs centric |
| 08:33 | Chousuke | hmm, and in a regular shell |
| 08:33 | Chousuke | two different linechars I guess |
| 08:34 | Fossi | prolly cr lf |
| 08:34 | Chousuke | in slime ctrl-j seems to just add a line, and ctrl-m actually sends input |
| 08:35 | Fossi | newline-and-indent is great |
| 08:35 | Fossi | i guess i should bind that to RET in clojure-mode |
| 08:36 | Chousuke | I need to get over my current tiredness |
| 08:36 | Chousuke | then I might write regexp pattern support for my reader! |
| 08:37 | Chousuke | It's really fun to write. |
| 08:38 | Chousuke | I think of the simplest method to accomplish something, write it out, and then test it, and most of the time it just works :P |
| 08:39 | Chousuke | I guess it helps a lot that I'm not working with a stateful stream. writing a small function to add a bit of functionality and then testing it is really easy. no need to reset the stream or anything :) |
| 08:40 | Chousuke | though I thing that might turn out to be a problem later on :/ |
| 08:41 | Chousuke | But I think I'll worry about it after I have a working reader for non-stateful input. |
| 09:08 | cemerick | wow, clojure is the 21st most popular language on github. That's sort of amazing, IMO. |
| 09:08 | AWizzArd | cemerick: and the number of chatters here in the channel is increasing again |
| 09:09 | AWizzArd | next January we will have a new peak |
| 09:09 | cemerick | heh, maybe |
| 09:09 | cemerick | #clojure is a far less important indication, I think |
| 09:09 | LauJensen | cemerick: Whats #1 and #2 ? |
| 09:09 | cemerick | ruby and javascript |
| 09:09 | cemerick | http://github.com/languages |
| 09:10 | cemerick | definitely the web-2.0 crowd |
| 09:11 | cemerick | clojurebot: popularity-on-github is <reply>Clojure ranked #21 on 8/14/2009 |
| 09:11 | clojurebot | Alles klar |
| 09:11 | LauJensen | Ok - Am I evil for hoping Clojure will never get above #15? :) |
| 09:11 | andyfingerhut | Anybody here use github commercially? I only have a free account. It is darned convenient. |
| 09:11 | cemerick | andyfingerhut: we looked at it very briefly, but it's *incredibly* expensive |
| 09:11 | LauJensen | andyfingerhut: None that Ive heard of, Im even migrating my freebies off Github to Gitorious |
| 09:12 | Chouser | "I'm very envious of the attention [arc] gets" --rhickey http://clojure-log.n01se.net/date/2008-02-12.html#12:08a |
| 09:12 | Chouser | has anyone heard arc mentioned anywhere recently? I haven't. |
| 09:13 | Chouser | what a difference 18 months can make |
| 09:13 | LauJensen | Arc compiles to native though? *jealous* |
| 09:14 | cemerick | LauJensen: can gitorious be set up on a server by a mere mortal now? It was simply impossible IMO when I tried it some months back. |
| 09:14 | LauJensen | cemerick: Dunno, I just use their webservice, havent set anything up myself |
| 09:14 | cemerick | Chouser: I talked with a couple of MIT folks a few weeks ago that are using it actively. The Graham connection explains that, I think. |
| 09:14 | LauJensen | And that only took < 2 minutes |
| 09:15 | Chouser | cemerick: huh. ok. |
| 09:15 | cemerick | I wouldn't look to random researchers at MIT for trend datapoints ,tho :-) |
| 09:20 | rsynnott | wow, people are using arc? Amazing |
| 09:20 | rsynnott | I thought it just died |
| 09:21 | cemerick | I'm starting a new project, probably going to push it to github. Do folks prefer clj-dbm or cljdbm? I was trying to get a sense of whether there's a naming convention to these things at the moment, but it seems not. |
| 09:22 | Fossi | didn't even know it was released |
| 09:24 | arbscht | clj-dbm. to me, cljdbm risks implying cl-jdbm |
| 09:26 | arbscht | there's precedent in clj-html, clj-android etc. from clojure.org/libraries |
| 09:26 | Fossi | i also like clojure- or clj- better |
| 09:33 | LauJensen | cemerick: Whats the full name of the project? |
| 09:34 | cemerick | LauJensen: clj-dbm, or some variant |
| 09:34 | cemerick | it's a wrapper for the jdbm library |
| 09:34 | LauJensen | Does dbm not stand for something? |
| 09:34 | cemerick | (with lucene integration) |
| 09:35 | cemerick | database manager |
| 09:35 | LauJensen | I'd probably go with clojure-dbm, but it would be nice to get consensus on a convention |
| 09:35 | cemerick | the DBM model has been around for a long, long time http://en.wikipedia.org/wiki/Dbm |
| 09:35 | LauJensen | We've been happy with ClojureQL |
| 09:35 | cemerick | jdbm happens to be a java impl |
| 09:44 | tomoj | I was thinking about doing something with agent watchers and automatic json conversion with couchdb |
| 09:53 | LauJensen | I recently implemented an ajax chat using compojure/json/clojureql. Quite nice way to develop |
| 10:10 | andyfingerhut | anyone have some quick hints for a Java newbie on how to run a Clojure program with the right options so that a Java debugger can get all the info it needs to be useful? I'm trying out a free eval of jDebugTool. Not sure if that tool is any good or not. Recommendations for something free or with a trail eval period are welcome. |
| 10:14 | andyfingerhut | I'm currently starting the java process with these debug-enabling options: -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n |
| 10:14 | clojurebot | ☕ |
| 10:15 | andyfingerhut | And then I run jDebugTool separately and attach to that process. |
| 10:31 | Fossi | somebody *really* needs to write an elisp script to clean up imports ;D |
| 10:41 | mblinn | sonofcim michael vick |
| 10:41 | mblinn | oops |
| 10:41 | mblinn | sorry, carryon |
| 10:58 | Anniepoo | clojurebot: paste |
| 10:58 | clojurebot | lisppaste8, url |
| 10:58 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 11:00 | lisppaste8 | Anniepoo pasted "RT/ROOT_CLASSLOADER" at http://paste.lisp.org/display/85380 |
| 11:01 | Chouser | heh |
| 11:02 | Chouser | I guess that's what I get for recommending you look at my own code... |
| 11:02 | LauJensen | Anniepoo: Sweet with the title :) |
| 11:02 | Anniepoo | it's urping at this location. I take it you're doing some deep magic getting the class loader |
| 11:02 | Chouser | the interface has changed |
| 11:02 | Anniepoo | LJ, yah, thanks for the tip, and I quit marking them one hour too |
| 11:04 | Anniepoo | yah, it's private now |
| 11:04 | Chouser | Try this instead: (RT/baseLoader) |
| 11:04 | Chouser | or wait for me to commit an update |
| 11:04 | Anniepoo | lol |
| 11:05 | Anniepoo | that didn't work |
| 11:05 | Anniepoo | Unable to find static field: baseLoader in class clojure.lang.RT (textjure.clj:323) |
| 11:05 | Chouser | you need the parens |
| 11:06 | Anniepoo | ah |
| 11:07 | Chouser | tested and pushed. |
| 11:10 | Anniepoo | pasting throws exception |
| 11:10 | lisppaste8 | Anniepoo annotated #85380 "pasting throws exception in textjure" at http://paste.lisp.org/display/85380#1 |
| 11:12 | Anniepoo | this is better than being rubbed with a brick, that's for sure! |
| 11:13 | Anniepoo | what's the upper and middle panels for? |
| 11:13 | Anniepoo | (sorry, the upper - you've set a max size) |
| 11:22 | Chouser | the upper panel is meant to be a text editor |
| 11:22 | Chouser | nothing useful there yet though. |
| 11:23 | Anniepoo | ah, ok |
| 11:23 | Chouser | huh, I don't know anything about that paste error. |
| 11:23 | Anniepoo | dunno, could be related to me running in IntelliJ |
| 11:24 | Anniepoo | I'm insanely tempted to ignore everything I have to do for the next week and build my own tiny IDE in Clojure |
| 11:29 | Chouser | Anniepoo: I understand the temptation. textjure demostrates how for I got before returning to my senses. |
| 11:29 | Anniepoo | LOL |
| 11:30 | Anniepoo | well, I should know the language better before doing it |
| 11:30 | Fossi | i guess a native editor would be nice |
| 11:30 | Fossi | then again, emacs is just so damn effective |
| 11:31 | Chouser | I got bogged down trying to write a general "parser" for multi-keystroke vi-like command sequences. |
| 11:31 | Anniepoo | ah, Cl port of YACC? |
| 11:31 | cemerick | Fossi: ...at causing madness and general mayhem? ;-) |
| 11:32 | Neronus | At being a mail client |
| 11:32 | Fossi | cemerick: apparently, that lasts only a few years ;) |
| 11:32 | Anniepoo | I could write something saner in the time it'd take me to memorize the emacs commands for the third time in my life |
| 11:33 | Fossi | i thought so too |
| 11:34 | Fossi | now i miss things like forward-delete-word in other programs |
| 11:34 | Chouser | Fossi: dW |
| 11:34 | Chouser | sorry |
| 11:34 | Chouser | I should restrain myself. But that's an example of what I wanted to be able to parse. |
| 11:35 | Anniepoo | sure - and I've got them memorized for IntelliJ - it's ctrl shift right arrow del |
| 11:36 | Fossi | Anniepoo: exactly my point. |
| 11:36 | cemerick | I've never understood the attraction of arcane stuff like dW and all the emacs-isms. Visual feedback is always good, incantations are always bad. |
| 11:36 | Chouser | vim apparently has a giant C switch statement that munges global variables as you type. bleh |
| 11:36 | Anniepoo | I'm with cemerick |
| 11:36 | cemerick | Programmers are more like civilians than we generally like to think. |
| 11:36 | Anniepoo | I've been programming since Unix was an interesting new OS |
| 11:37 | Fossi | well, just from my experience from the last two month of clojure with emacs compared to eclipse and java, the editing feels much faster |
| 11:37 | Knekk | Incantations are merely useful shortcuts |
| 11:37 | LauJensen | cemerick: Emacs is very transparent, speedy and flexible. I'd get annoyed just from the 5 second start up time of Eclipse |
| 11:38 | Anniepoo | and fail to understand the fascination in some quarters for stuff that went out with pin matrix printers |
| 11:38 | Fossi | then again, you prolly can't do things like paredit does them with more syntax |
| 11:38 | cemerick | LauJensen: speedy and flexible, but only for a particular definition of those terms. The notion of transparency is laughable though (IMO, of course) |
| 11:38 | Anniepoo | I'd agree with Fossi, most ANY decent editor that you have memorized the keys for is better than |
| 11:39 | Anniepoo | any other editor you haven't |
| 11:39 | LauJensen | cemerick: Laughable? |
| 11:39 | Fossi | Anniepoo: well, i have them down for eclipse i think |
| 11:39 | Fossi | it's just that it's not or only barely possible to kill things in the current scope for example |
| 11:39 | Anniepoo | ah, that's interesting |
| 11:40 | Fossi | and ctrl-shift-right del is rediculous from the amount of finger movement compared to meta-d |
| 11:40 | Anniepoo | well, yes, and I'm on IntelliJ, which knows about and is wonderful for Java, but won't, for example, double click highlight str-utils as one identifier |
| 11:40 | cemerick | LauJensen: emacs does lots of the same kind of stuff that vim does, except it's user-extensible, so bindings can be changed by things other than user action. |
| 11:41 | LauJensen | So how is that laughable ? |
| 11:41 | cemerick | chorded keybindings, basic lack of visual feedback, etc etc etc. |
| 11:41 | Knekk | elisp is way easier to use than vim macros |
| 11:41 | Fossi | Anniepoo: i wouldn't even think of using emacs for java |
| 11:41 | cemerick | LauJensen: it's not what I would consider "transparent" |
| 11:42 | Anniepoo | OK, Fossi, you're making a more convincing argument |
| 11:42 | LauJensen | By transparent I meant - I dont have to worry about 6 different windows I rarely use and an abundance of tools that are unnecessary for editing .clj files. Perhaps I used the wrong word |
| 11:42 | Fossi | i guess it would be really cool to have a seperate editor for clojure, it's just going to be hard to be as effective as emacs is for lisps |
| 11:43 | Fossi | that was my whole point :) |
| 11:43 | tomoj | +1 for slime/paredit |
| 11:43 | Knekk | how many times do you reach for the mouse when you are using your IDE? Learn to love keyboard shortcuts, a.k.a. incantations |
| 11:43 | cemerick | yeah, it's totally a personal preference, likely not with much of a defensible basis. |
| 11:44 | Anniepoo | Fossi, I suspect the solution is to effectively wrap emacs in something |
| 11:45 | Fossi | dunno |
| 11:45 | Anniepoo | but you've convinced me to try it, I'll get set up to do emacs and I'll make myself a set of flashcards and spend a few hours memorizing keystrokes |
| 11:46 | cemerick | Knekk: IRC'ing from the train? |
| 11:46 | Fossi | i just edited away and took a look at a new keystroke every few days |
| 11:46 | Knekk | cemerick: aint' technology grand? brb |
| 11:46 | Anniepoo | yes, but I've found when I change editors it's well worth it to make a stack of index card flashcards |
| 11:46 | Anniepoo | find a coffee house somewhere |
| 11:47 | Anniepoo | a couple mocha's later I'm a lot more productive |
| 11:47 | LauJensen | Whats the attraction of this IntelliJ people are talking about? |
| 11:47 | Anniepoo | Lau, for Java it's wonderful |
| 11:48 | Anniepoo | it has incredibly intelligent refactoring |
| 11:48 | Anniepoo | it's in many ways another approach to dealing with the ceremony of Java |
| 11:48 | LauJensen | Looking at the site now. Cemerick whats your editor of choice? |
| 11:48 | LauJensen | Anniepoo: Anything Clojure-specific for it? |
| 11:49 | Anniepoo | you can do most refactorings as single keystrokes |
| 11:49 | cemerick | NetBeans. IntelliJ is very, very nice for Java, but NB has a much richer plugin ecosystem (for what I care about, I suppose), and a very good clojure environment. |
| 11:49 | rsynnott | 'ceremony of Java' - I am imagining people sacrificing explicit casts to the gods, here |
| 11:50 | Anniepoo | yes, there's a (not all that hot, but OK) La Clojure plugin |
| 11:50 | LauJensen | Anniepoo: Refactoring - I've never tried it - Is that where you editor is smarter than you in dividing your code into logical factions ? |
| 11:50 | cemerick | It's Java capabilities are good, but not close to IntelliJ. If I were dedicated to programming in Java for many years to come, I'd probably buy it. |
| 11:50 | cemerick | bah, its* |
| 11:51 | Anniepoo | Lau, it's where my editor is a darn sight faster than me in doing something like |
| 11:52 | Chouser | If I couldn't use vim, I'd definitely use emacs. I've never tried an IDE that didn't end up annoying me, while I got quite far with emacs once. |
| 11:52 | Anniepoo | adding a parameter to a method call and propagating it everywhere |
| 11:52 | tomoj | unfortunately I think clojure will never have that kind of thing |
| 11:52 | LauJensen | k |
| 11:53 | Anniepoo | tomoj, why not? it's be a lot easier to write for Clojure, and with it's Lisp heritage, there's lots of AI/NLP oriented programmers around to do that sort of thing |
| 11:53 | Anniepoo | brb |
| 11:53 | tomoj | hmm |
| 11:53 | tomoj | but clojure is dynamic |
| 11:54 | tomoj | there are no good refactoring editors for ruby because it's dynamic |
| 11:54 | cemerick | tomoj: I've heard very good things about the NB ruby environment and its refactoring |
| 11:54 | cemerick | (never used it myself, tho) |
| 11:54 | tomoj | it's nothing compared to intellij, from what I've heard |
| 11:55 | Chouser | I think if you accept that even in Java refactoring is perfect 100% of the time, then you can make progress on a dynamic language like Clojure. |
| 11:55 | tomoj | e.g. in ruby if you see foo.some_method, there's no way to know what foo is, so you can't rename or add parameters to some-method |
| 11:56 | Anniepoo | IntelliJ has it's weaknesses - the module/project system is obscure, and the GUI builder is weak |
| 11:56 | cemerick | has anyone heard of plans to add contrib.def to clojure itself (core, or some other ns)? |
| 11:57 | cemerick | Anniepoo: oh, yeah, the GUI builder. That thing is *horrible*. |
| 11:57 | cemerick | directly generates classfiles, last time I tried it *ugh* |
| 11:57 | andyfingerhut | any jswat users here? |
| 11:57 | Anniepoo | cemerick, you can set that |
| 11:57 | Anniepoo | it's in project settings |
| 11:57 | cemerick | ahha |
| 11:58 | cemerick | the fact that it's an option at all makes me question the entire product top-to-bottom |
| 11:58 | Anniepoo | JBuilder from Borland has a lovely, lovely GUI builder |
| 11:58 | cemerick | generating classfiles that are *intended* to be added to source control is insanity |
| 11:58 | rsynnott | Borland always was good at GUI builders |
| 11:58 | Knekk | what did I miss? |
| 11:58 | Anniepoo | cemerick, forcing users to do what you think is good for them is probably more insane |
| 12:00 | cemerick | Anniepoo: is there any use case for versioning the artifacts of code generation? In this neck of the woods, that's what build processes are for. |
| 12:01 | Chousuke | cemerick: maybe you should prompt it on the group. core could use a def- and defmacro- at least, if not defvar and defvar- |
| 12:01 | Anniepoo | actually, I can indeed think of a few. I mostly do graphics related stuff, and often work with asset pipelines |
| 12:01 | Chousuke | cemerick: I think it's somewhat counterintuitive to have defn- but no def- :/ |
| 12:02 | cemerick | Chousuke: OK, I will. Any idea why it's defvar- and not def-? |
| 12:02 | Anniepoo | it's not uncommon to have odd semi-automated processes |
| 12:02 | Chousuke | cemerick: it supports a docstring |
| 12:03 | cemerick | Anniepoo: yeah, I'll definitely grant you the asset case. But UI layouts aren't graphical assets. |
| 12:03 | Anniepoo | hmm.... |
| 12:03 | Anniepoo | I currently have a project that has a bunch of wood workshop files |
| 12:03 | Anniepoo | I assume if I pass you my project you have wood workshop installed and configured correctly? |
| 12:04 | Anniepoo | ;c) |
| 12:04 | cemerick | Chousuke: Oh, I see. Yeah, a regular def- would be good |
| 12:04 | Chousuke | I'd like the defvar macros too though. |
| 12:05 | Chousuke | actually, having them but not def- would be enough I guess. |
| 12:05 | Chousuke | def could remain the low-level special form it is :) |
| 12:13 | Fossi | +1 for def- and defmacro- |
| 12:14 | cark | i use defonce quite a bit too |
| 12:14 | cark | in clojure.contrib.def |
| 12:14 | cark | and its variant defonce- |
| 12:14 | Fossi | i rarely use any of them because i can't be bothered to import them |
| 12:15 | Fossi | which is a shame |
| 12:15 | Fossi | especially generating docs without the private things would be pretty useful |
| 12:30 | drewr | I hate spending 3 hours debugging a fn with lazy-seq only to discover I wasn't recurring correctly |
| 13:01 | drewr | is there a lazy flatten somewhere? |
| 13:01 | drewr | I thought the one in seq-utils would be |
| 13:01 | Chousuke | ~def flatten |
| 13:02 | Chousuke | seems lazy to me. |
| 13:02 | drewr | ,(flatten [[1 2 3] [4 5 6] [7 8 (iterate inc 0)]]) |
| 13:03 | clojurebot | Execution Timed Out |
| 13:03 | drewr | ,(flatten [[1 2 3] [4 5 6] [7 8 9]]) |
| 13:03 | clojurebot | (1 2 3 4 5 6 7 8 9) |
| 13:03 | drewr | whoops |
| 13:03 | cark | but clojurebot tries to print it |
| 13:03 | drewr | ,(take 4 (flatten [[1 2 3] [4 5 6] [7 8 (iterate inc 0)]])) |
| 13:03 | clojurebot | (1 2 3 4) |
| 13:03 | drewr | hm |
| 13:03 | drewr | ,(firt (flatten [[1 2 3] [4 5 6] [7 8 (iterate inc 0)]])) |
| 13:03 | clojurebot | java.lang.Exception: Unable to resolve symbol: firt in this context |
| 13:03 | drewr | ,(first (flatten [[1 2 3] [4 5 6] [7 8 (iterate inc 0)]])) |
| 13:03 | clojurebot | 1 |
| 13:04 | drewr | I guess it is. Interesting. |
| 13:08 | cemerick | it's too bad that one cannot import an inner class; e.g. (import 'org.apache.lucene.document.Field$Store), then use Store/YES |
| 13:09 | drewr | ~import-static |
| 13:09 | clojurebot | Excuse me? |
| 13:09 | drewr | ~def import-static |
| 13:10 | drewr | maybe not |
| 13:10 | cemerick | yeah, that won't help |
| 13:10 | cemerick | totally not a big deal |
| 13:14 | drewr | flatten doesn't act lazily with side effects perhaps |
| 13:14 | drewr | I'm returning batches of data from a database with lazy-seq |
| 13:15 | drewr | if I do (take 1 (flatten (get-batches ...))) it hits the database for all matching batches |
| 13:15 | drewr | but if I do (take 1 (get-batches ...)), it only hits the db to get the first batch |
| 13:16 | cemerick | whoa, doseq supports the same filtering as for! |
| 13:18 | abedra | got a strange question if anyone is around to help |
| 13:19 | abedra | I have some code http://gist.github.com/167970 |
| 13:19 | abedra | that produces an error |
| 13:19 | abedra | but if I copy the top function into the repl and just paste the innards of the second funtion to the repl it works |
| 13:19 | Chousuke | defn is missing the parameter list |
| 13:19 | abedra | oh good lord |
| 13:20 | mudphone | it happens to everyone |
| 13:20 | abedra | wow |
| 13:20 | abedra | time for sleep |
| 13:20 | abedra | thanks |
| 13:20 | mudphone | (or maybe just me) |
| 13:20 | Raynes | Never happened to me. >_> |
| 13:20 | abedra | lol |
| 13:20 | mudphone | just me then :) |
| 13:21 | Raynes | Of course, I had several embarrassing mistakes that seemed equally stupid. Just not this particular one. |
| 13:21 | Raynes | :) |
| 13:21 | mudphone | last night I tried to use defn, without calling it... |
| 13:21 | mudphone | defn... instead of (defn |
| 13:21 | mudphone | oh boy |
| 13:21 | lrenn | happened to me last night. writing lots of deftests can do that. |
| 13:22 | mudphone | the interesting thing is the error |
| 13:22 | mudphone | java.lang.Exception: Can't take value of a macro: |
| 13:23 | mudphone | ... anyway... |
| 13:24 | Chousuke | ,def |
| 13:24 | clojurebot | java.lang.Exception: Unable to resolve symbol: def in this context |
| 13:24 | mudphone | in my case it was |
| 13:24 | mudphone | ,defn |
| 13:24 | Chousuke | that's rather interesting |
| 13:24 | clojurebot | java.lang.Exception: Can't take value of a macro: #'clojure.core/defn |
| 13:24 | Chousuke | ,(def def 0) |
| 13:24 | clojurebot | DENIED |
| 13:24 | Chousuke | damn. |
| 13:24 | cemerick | better than when I first started learning clojure, and was doing (filter #(nil? %) ...), etc. |
| 13:24 | cemerick | :-( |
| 13:25 | Chousuke | well, that's quite normal :P |
| 13:25 | abedra | :) |
| 13:25 | Chousuke | eventually you grow to notice such redundancy and eliminate it. |
| 13:25 | cemerick | that's what I get for being away from scheme for so long |
| 13:26 | Chousuke | and filtering nils is interesting too. :) |
| 13:27 | mudphone | some people like their nils |
| 13:27 | Chousuke | heh. |
| 13:31 | cemerick | Chousuke: yeah, I was just tossing out an example, and nil? came to mind first |
| 13:33 | Chousuke | heh. |
| 13:46 | jwhitlark | Does anyone know if "The Little Schemer" has anything to offer for working in clojure? Is it lisp focused or scheme focused? |
| 13:46 | osaunders | I don't understand. There's not-any? but no any? Is that right? |
| 13:47 | mblinn | scheme |
| 13:47 | mblinn | but it's very enjoyable |
| 13:47 | stuartsierra | osaunders: "any?" is effectively "some" |
| 13:48 | cemerick | not-any? probably should have been none? |
| 13:48 | osaunders | stuartsierra: Thanks. Can't help being annoyed by that naming inconsistency though. |
| 13:48 | technomancy | is "some" a CL-ism? |
| 13:48 | mudphone | jwhitlark: I'm currently reading "The LIttle Schemer" |
| 13:48 | technomancy | that would certainly explain the annoying inconsistency |
| 13:48 | mudphone | jwhitlark: I think it's worth checking out, if you're new to lisp |
| 13:48 | stuartsierra | "some" is slightly different, it returns the thing found, instead of true/false |
| 13:48 | jwhitlark | I'm just trying to figure out if has a wider applicability to lisp. |
| 13:48 | technomancy | jwhitlark: definitely worth a read. |
| 13:48 | stuartsierra | The predicates ending in "?" usually return a boolean. |
| 13:49 | osaunders | Ah. |
| 13:49 | stuartsierra | I believe it's also a CL function. |
| 13:49 | jwhitlark | mudphone: I've been using lisp off and on for a while, but I'm really aiming for a deeper understanding now that I'm trying to do production work in clojure. |
| 13:50 | stuartsierra | You could (defn any? [pred coll] (if (some pred coll) true false)) |
| 13:51 | stuartsierra | correction: "some" returns the first logical true value returned by the predicate. |
| 13:51 | mudphone | jwhitlark: rich hickey has a clojure bookshelf on Amazon |
| 13:52 | mudphone | jwhitlark: clojure bookshelf: http://www.amazon.com/Clojure-Bookshelf/lm/R3LG3ZBZS4GCTH |
| 13:53 | stuartsierra | that's one comprehensive list! |
| 13:53 | jwhitlark | ohhh. Christmas time! |
| 13:53 | stuartsierra | If you can plow through every one of those books, you'll be a rockstar programmer for sure. |
| 13:55 | jwhitlark | I'm working through On Lisp at the moment. I've got a month's vacation to get caught up on the things I've been missing. |
| 13:55 | gko | Is there already a FTP clojure library ? |
| 13:56 | mudphone | jwhitlark: there are three books in "The Little Schemer" series... in case the first one is too basic for you |
| 13:57 | mudphone | stuartsierra: let's see if I can plow through AND understand them :) |
| 13:57 | osaunders | stuartsierra: Thanks for the any? def but I think some will do fine. Probably why any? isn't defined. |
| 13:58 | stuartsierra | exactly |
| 13:58 | osaunders | Is a bookshelf the books his owns? |
| 13:58 | osaunders | *he owns |
| 13:58 | osaunders | The list author says: "Books that influenced Clojure, in no particular order |
| 13:59 | osaunders | ^ answered my own q. |
| 13:59 | mudphone | actually, first heard of the list from technomancy's blog |
| 14:00 | osaunders | 36 programming books is a lot of work. |
| 14:00 | osaunders | I get through probably little over 6 programming books a year. |
| 14:01 | osaunders | I read something once that suggested the best ratio for programming awesomeness was 70% programming 30% reading. |
| 14:01 | osaunders | Of course the time you spend programming should be on stuff that challenges you, |
| 14:01 | clojurebot | that is not what I wanted |
| 14:03 | osaunders | (print pie), |
| 14:03 | mudphone | ravi_n = ravi_nemani ??? |
| 14:22 | drewr | stuartsierra: do you want patches for c.c.http.agent, or is it still a work in progress? |
| 14:23 | drewr | actually, c.c.http.connection |
| 14:23 | stuartsierra | drewr: happy to have corrections/bugfixes |
| 14:24 | stuartsierra | but I wouldn't bother with assembla patches, it's still a work in progress |
| 14:24 | stuartsierra | I've actually been wondering if I should remove it from contrib altogether until I'm satisfied it's finished. |
| 14:24 | drewr | works well for me with a couple of bugfixes |
| 14:25 | stuartsierra | hit me, then |
| 14:25 | technomancy | stuartsierra: I'm of that opinion. it's not difficult to create new repositories for experimental or in-progress code. |
| 14:25 | technomancy | as long as you've got mechanisms for dependency resolution, of course. |
| 14:25 | stuartsierra | It doesn't depend on much, just duck-streams. |
| 14:26 | technomancy | stuartsierra: right, I mean for code depending on http.agent |
| 14:26 | stuartsierra | oh, right |
| 14:26 | lisppaste8 | drewr pasted "c.c.http.connection fixes" at http://paste.lisp.org/display/85390 |
| 14:26 | technomancy | good thing corkscrew is around! </self-promotion> |
| 14:26 | stuartsierra | how's that coming, by the way? |
| 14:27 | drewr | I'm using jdk6; not sure if that makes a difference with regard to setting streaming mode before connecting |
| 14:27 | technomancy | stuartsierra: it's done. as much as I need is done anyway. |
| 14:27 | drewr | but that's why I had to move .connect around |
| 14:27 | stuartsierra | cool |
| 14:27 | technomancy | just waiting for the vast throngs of users to tell me how they like it. =) |
| 14:27 | drewr | s/move/copy/ |
| 14:28 | stuartsierra | drewr: I think you're right. |
| 14:28 | stuartsierra | the streaming mode should be set before .connect, always |
| 14:34 | cemerick | a generalized dependency resolution utility and linker would be great |
| 14:34 | technomancy | cemerick: what's a linker? |
| 14:36 | cemerick | technomancy: broadly, given a program, it determines all transitive dependencies, and produces "object code" (in our case, just a merged jar, etc) that contains only what you need to run the given program |
| 14:37 | technomancy | cemerick: gotcha. yeah, if you've got dependency resolution down, then that's pretty trivial. |
| 14:37 | cemerick | which we don't, yet (AFAIK) |
| 14:37 | technomancy | cemerick: take a look at corkscrew. =) |
| 14:37 | cemerick | technomancy: I saw maven and ran away. Sorry. :-( |
| 14:38 | drewr | stuartsierra: thanks |
| 14:38 | technomancy | cemerick: heh; the whole point of corkscrew is that you don't have to use maven. |
| 14:38 | drewr | ah, you broke the typo out into a separate commit, good |
| 14:38 | stuartsierra | yeah, someone posted that on the list |
| 14:38 | cemerick | technomancy: "It currently requires that Maven be installed to work. This requirement should be removed in future versions."? |
| 14:39 | technomancy | you don't have to interact with it is what I mean. |
| 14:39 | cemerick | ah |
| 14:40 | technomancy | once I get it so you don't need maven installed I will be sure to hide any references to that word deep away in the code so it doesn't frighten people away. |
| 14:40 | cemerick | right now we're using git submodules for dependencies. I'm hoping subtree merging gets into the git mainline eventually, as that would be a nearly-ideal scenario. |
| 14:41 | cemerick | technomancy: I'm highly allergic to maven. It's one of those tools that demands that it own your entire world. |
| 14:42 | technomancy | cemerick: maybe in Java that's true |
| 14:42 | technomancy | in Clojure you can use it only for dependency resolution and it's very simple |
| 14:42 | lrenn | technomancy: did you consider ivy since you're only using the dependency resolution? |
| 14:43 | technomancy | lrenn: I considered it. they both support maven's repository format... when in doubt, choose the tool that doesn't consider XML to be a programming language. |
| 14:43 | technomancy | greenspun's tenth and all |
| 14:44 | cemerick | technomancy: that's interesting. I may take another look if git subtrees don't materialize. |
| 14:44 | technomancy | I mean, when you consider the fact that the creator of ant has publicly apologized for it and decided to give up his career in programming... that says a lot. |
| 14:44 | Chousuke | subtree merging? |
| 14:45 | technomancy | and it's a good thing too; he's much better at photography. |
| 14:45 | lrenn | technomancy: agreed re: xml and ant, but you could have used ivy just to fetch the deps, no xml required (i think anyway). |
| 14:46 | technomancy | lrenn: corkscrew is 200 lines of code. if someone wants to rewrite it to use ivy I would be fine with that. |
| 14:46 | cemerick | Chousuke: http://navarra.ca/?p=520 and http://github.com/apenwarr/git-subtree/tree/master |
| 14:49 | Chousuke | hmm |
| 14:49 | Chousuke | git submodules aren't that bad once you get used to them, but they're not very flexible. |
| 14:49 | Chousuke | you can't follow a "moving target" |
| 14:50 | cemerick | That's not my real gripe with them. The real issue IMO is that the submodule dir (that contains the hash to be checked out) is a constant source of merge conflict. |
| 14:54 | Chousuke | cemerick: interesting |
| 14:54 | Chousuke | I hope it gets merged. |
| 14:54 | cemerick | one step closer to svn:externals, which is the only thing I miss from svn |
| 14:55 | weissj | anybody know how to use jline? how do you go back to history? |
| 15:13 | cemerick | does proxy not support implementing overloads with different arities? |
| 15:14 | Chouser | it does |
| 15:14 | cemerick | (e.g. even with -byte<>-int-int-style names?) |
| 15:14 | cemerick | hrm |
| 15:14 | Chouser | I can never remember how, though. you might have to overload all the arities and handle them inside the one fn |
| 15:14 | cemerick | Oh, right. I remember now. :-P |
| 15:19 | cemerick | Chouser: yup, thanks for the reminder :-) |
| 15:21 | Chouser | I'm not sure I've ever had to do it myself, or at least so rarely I always forget. |
| 15:23 | cemerick | this was precipitated by proxying an abstract class that had a writeBytes(byte[], int, int) method, but provided a (byte[], int) default impl -- and I figured I could leave the latter to do its thing |
| 15:24 | Anniepoo | I can't believe it, I was loving this language before, and having to go through a compile cycle. Now I'm altering the code as it runs! A-freeeking mazing!!!! |
| 15:26 | Anniepoo | Whooo HOOOO!!!!! |
| 15:26 | Chousuke | :D |
| 15:33 | weissj | i was using clojure-dev in eclipse but the repl sucks so bad there bc jline doesn't work in eclipse. so now i'm using a plain repl in linux console. what do i call to load a file and run it? that's what the eclipse env does behind the scenes. load-file just loads it |
| 15:35 | weissj | er, maybe my previous environment would switch ns, this one doesn't |
| 15:36 | weissj | what's that |
| 15:37 | Chouser | http://github.com/mmcgrana/ring |
| 15:37 | Chouser | (defmulti app :uri) (ring.jetty/run {:port 8080} app) ; whee! |
| 15:38 | Chousuke | heh |
| 15:39 | Chousuke | github is slow :( |
| 15:39 | Chousuke | I hear they're working on it though. I wish them success :) |
| 15:40 | hiredman | indeed |
| 15:49 | lrenn | technomancy: after looking at corkscrew, ivy is of no use to you since you use it to build. |
| 15:49 | lrenn | technomancy: i think you might have some issues with a few of you shell scripts as well. |
| 15:49 | lrenn | technomancy: other than that, pretty neat. |
| 15:50 | technomancy | lrenn: well that's basically my first non-joke shell script, so no surprises there. |
| 15:50 | lrenn | technomancy: yeah, while trying to debug it I saw the comment :) |
| 15:50 | technomancy | using corkscrew to build is just bonus though; it'd be pretty easy to move that out of maven. |
| 15:50 | stuartsierra | Are agent actions dispatched with "send-off" queued in the order they are sent? |
| 15:50 | technomancy | well, so says me anyway since I have yet to encounter a non-trivial build process modulo dependency resolution. |
| 15:50 | weissj | what's wrong with (-> @testscript getClass getDeclaredMethods) ? -> doesn't work like ..? |
| 15:51 | Chousuke | weissj: you need .getClass and .getDeclaredMethods |
| 15:51 | weissj | oh right |
| 15:51 | stuartsierra | i.e. if I write (do (send-off a one) (send-off a two) (send-off a three)) do I know that the actions will execute in the order one,two,three? |
| 15:52 | technomancy | stuartsierra: pretty sure it will; you can double check what class is used for queueing in Agent.java if you want to be sure. |
| 15:52 | stuartsierra | ok |
| 15:53 | stuartsierra | It appears to work. |
| 15:58 | stuartsierra | ,(let [a (agent [])] (dotimes [i 1000] (send a conj i)) (await a) (apply < @a)) |
| 15:58 | clojurebot | true |
| 16:09 | weissj | is there a compliment to nil? |
| 16:09 | weissj | i mean a compliment to (nil?) ? |
| 16:09 | Chouser | (complement nil?) |
| 16:09 | Chouser | :-) |
| 16:10 | weissj | i know there's (not nil?) |
| 16:10 | weissj | but i mean one fn |
| 16:10 | Chouser | Yeah, I understand. I don't think so. |
| 16:10 | weissj | k |
| 16:11 | Chouser | #(not (nil? %)) or (complement nil?) |
| 16:11 | cemerick | there's always if-not and when-not, too |
| 16:11 | Chouser | many higher level things have their own complementes |
| 16:11 | Chouser | right, if-not, when-not, remove instead of filter |
| 16:17 | drewr | I have a doseq that is traversing a lazy-seq of stuff from a db that's somehow running out of heap |
| 16:17 | drewr | if I babysit it and run System/gc periodically, it frees memory up |
| 16:18 | drewr | but I shouldn't have to do that |
| 16:19 | drewr | I can count the whole stream and it doesn't run out of memory |
| 16:19 | Chouser | ew |
| 16:19 | Chouser | sorry |
| 16:19 | drewr | I guess I'm doing something in the doseq that's holding onto the head |
| 16:20 | Chouser | if you're actually holding the head, I don't thing a System/gc would help. |
| 16:20 | drewr | right, that's what I thought |
| 16:20 | drewr | of course me calls to .freeMemory are completely unscientific |
| 16:20 | drewr | it may just be illusory |
| 16:21 | tomoj | why is it unscientific? |
| 16:21 | tomoj | too many other variables? |
| 16:21 | drewr | just randomly hitting it from the repl |
| 16:21 | drewr | to see if it's rising or falling |
| 16:37 | Chousuke | Chouser: heh, I should've used #() in my golfing attempt :( |
| 16:47 | hiredman | :D |
| 16:48 | hiredman | clojurebot responded to ~def + in a xmpp muc |
| 16:49 | hiredman | ~ping still gets me a NPE |
| 16:50 | technomancy | hiredman: you got clojurebot on xmpp? |
| 17:03 | osaunders | java.lang.RuntimeException: java.lang.ClassCastException: java.lang.Integer |
| 17:03 | osaunders | That means I'm trying to execute a number right? |
| 17:03 | osaunders | ,(1) |
| 17:03 | clojurebot | java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn |
| 17:04 | osaunders | Can that exception occur for any other reason? |
| 17:05 | hiredman | those are the same exception but for different reasons |
| 17:05 | hiredman | java.lang.ClassCastException means something is trying to cast something to something it isn't |
| 17:05 | osaunders | Oh wait, I worked it out. |
| 17:06 | osaunders | ,(conj 1 []) |
| 17:06 | clojurebot | java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IPersistentCollection |
| 17:06 | osaunders | ,(conj [] 1) |
| 17:06 | clojurebot | [1] |
| 17:06 | osaunders | :-) |
| 17:19 | osaunders | When do you use let? I haven't yet needed it. |
| 17:20 | tomoj | all the time? :) |
| 17:21 | osaunders | Why? |
| 17:22 | hiredman | for local names |
| 17:22 | osaunders | You don't need that though. |
| 17:22 | osaunders | Right? |
| 17:23 | tomoj | I assume clojure is still turing complete without it |
| 17:23 | Chousuke | you do, unless you want to do a lot of unnecessary typing/computation |
| 17:23 | technomancy | osaunders: you never _need_ it. you use it sometimes to cache values in order to avoid calculating them twice, and sometimes just to give a value a more readable name. |
| 17:23 | tomoj | but it can be useful |
| 17:23 | tomoj | here's a simple example: I'm matching a string against a regex with re-matches |
| 17:23 | tomoj | well.. guess that's not a really good example |
| 17:24 | Chousuke | I mean, which is better: (let [x (first s)] (+ x x x)) or (+ (first s) (first s) (first s))? |
| 17:24 | tomoj | that's a good example :) |
| 17:24 | osaunders | (apply + (repeat (first s))) |
| 17:24 | osaunders | 3 in there |
| 17:24 | Chousuke | you forgot take 3 |
| 17:24 | Chousuke | but that's contrived |
| 17:25 | Chousuke | never mind that (* 3 (first s)) is even better :P |
| 17:25 | tomoj | I have some code here where I have to do some conditionals based on a string, but it needs to be parsed to an int before I can check it |
| 17:25 | Chousuke | but still, let is not something you'd want to do without. |
| 17:25 | tomoj | rather than reparse it in every single conditional, I use let to bind it to a local name |
| 17:25 | Chousuke | especially because it has destructuring |
| 17:25 | osaunders | Hm. |
| 17:25 | osaunders | I don't think I get this language at all sometimes. |
| 17:26 | Chousuke | what, specifically? |
| 17:26 | technomancy | is it a common pattern to have properties that need to get set before a given class loads? |
| 17:27 | technomancy | I was assuming they were getting checked at runtime, but that was not the case. |
| 17:27 | Chousuke | osaunders: let is like temporary variables in other languages. |
| 17:27 | weissj | if i'm calling a java method that has a vararg String... i can't pass it ["hi" "there"], how do i give it a type hint |
| 17:27 | osaunders | Chousuke: I'm not saying that just because of let. |
| 17:27 | hiredman | god |
| 17:27 | technomancy | ~doc into-array |
| 17:27 | clojurebot | I don't understand. |
| 17:27 | Chousuke | osaunders: though of course, let bindings are not variable at all :P |
| 17:27 | hiredman | osaunders: your code isn't full of calls to defs is it? |
| 17:28 | hiredman | def |
| 17:28 | tomoj | ,(let [[match? month day year] (re-matches #"(\d+)-(\d+)-(\d+)" "08-14-2009")] [match? month day year]) |
| 17:28 | clojurebot | ["08-14-2009" "08" "14" "2009"] |
| 17:28 | Chousuke | tomoj: durr. |
| 17:29 | Chousuke | I forgot the existence of re-matches completely. |
| 17:29 | tomoj | is there something better? |
| 17:29 | osaunders | hiredman: Hm, yeah I guess it is. |
| 17:29 | Chousuke | pat* |
| 17:30 | hiredman | osaunders: :( |
| 17:30 | Chousuke | osaunders: then you're most likely doing it wrong :/ |
| 17:30 | hiredman | very very wrong |
| 17:30 | Chousuke | though hopefully not. |
| 17:30 | tomoj | the fact that clojure can be used that way is somewhat scary |
| 17:30 | Chousuke | osaunders: are those defs inside functions? |
| 17:30 | osaunders | Actually no, in this case I don't think I am. |
| 17:30 | hiredman | def is only ever for global names, and you should never be re-defing stuff |
| 17:30 | technomancy | tomoj: it's a side-effect of allowing interactive development |
| 17:30 | osaunders | But I can see that it will be unsustainable. |
| 17:31 | tomoj | technomancy: I guess it's not really all that scary. I've just been reading "Out of the Tar Pit" today |
| 17:31 | technomancy | hehe |
| 17:31 | technomancy | tomoj: I wouldn't be averse to a warning when using def in a non-toplevel context |
| 17:32 | hiredman | so clojurebot is also in clojure@conference.thelastcitadel.com if anyone wants to play with him via xmpp |
| 17:33 | tomoj | so does that mean I can evaluate clojure in gmail now? |
| 17:33 | tomoj | :) |
| 17:33 | hiredman | sure |
| 17:34 | tomoj | not sure when I would want to do that really, but cool |
| 17:34 | clojurebot | that is not what I wanted |
| 17:34 | hiredman | I think getting into a mutiluser chat with gmail is weird |
| 17:34 | tomoj | oh, I see |
| 17:35 | osaunders | What did clojurebot just say that? |
| 17:35 | osaunders | *Why did |
| 17:35 | Chousuke | it does that sometimes. |
| 17:36 | osaunders | lol |
| 17:37 | osaunders | Like a swearing uncle... "Oh he does that sometimes." |
| 17:37 | Chousuke | ~want |
| 17:37 | clojurebot | It's greek to me. |
| 17:37 | Chousuke | hmm |
| 17:37 | osaunders | ~uncle |
| 17:37 | clojurebot | Gabh mo leithscéal? |
| 17:37 | Chousuke | I wonder which word he reacted to |
| 17:38 | Chousuke | ~that |
| 17:38 | clojurebot | that is not what I wanted |
| 17:38 | osaunders | want something |
| 17:38 | osaunders | that |
| 17:38 | Chousuke | clojurebot: forget that |
| 17:38 | clojurebot | I forgot that |
| 17:38 | osaunders | want that |
| 17:39 | osaunders | clojurebot: forget want |
| 17:39 | clojurebot | I forgot want |
| 17:39 | Chousuke | hm |
| 17:39 | osaunders | clojurebot: your own head |
| 17:39 | clojurebot | Gabh mo leithscéal? |
| 17:39 | osaunders | clojurebot: forget your own head |
| 17:39 | clojurebot | I forgot your own head |
| 17:39 | Chousuke | how did he forget want when he had no definition for it? :P |
| 17:39 | Chousuke | osaunders: don't abuse the bot please. |
| 17:39 | osaunders | Aww :( |
| 17:39 | Chousuke | it'll really forget some useful factoid if you keep that up :P |
| 17:40 | osaunders | lol OK |
| 17:40 | lrenn | I don't suppose there is a way to add a jar to the classpath at runtime eh? I just wrote some wrappers around ivy and it'd be supper nifty to not only download the files, but add them to the classpath as well. |
| 17:41 | Chousuke | anyway, clojurebot is programmed to randomly respond to some statements with a factoid, using a fuzzy matching algorithm :P |
| 17:41 | Chousuke | lrenn: add-classpath |
| 17:41 | Chousuke | lrenn: but that's supposed to be repl-only :P |
| 17:42 | Chousuke | lrenn: you should instead make it print out the proper classpath invocation so it can be configured at startup. |
| 17:42 | technomancy | lrenn: the only way to do that is to unpack the jars into a directory and have that directory on the classpath at JVM boot. |
| 17:42 | technomancy | managing a dynamic classpath is just asking for trouble |
| 17:43 | lrenn | Chousuke: I'm fine with it being repl only. Now I can do (rezolve "org" "name" "version") and have it available at the repl. |
| 17:43 | Chousuke | you should rename that function :P |
| 17:43 | lrenn | technomancy: agreed, but using it with emacs/slime wouldn't be too much trouble. if it blows up i'll just restart slime :) |
| 17:43 | lrenn | Chousuke: I should, but clojure already has a resolve :) |
| 17:43 | Chousuke | lrenn: ivy-find? :P |
| 17:44 | Chousuke | lrenn: "gimme"? :D |
| 17:44 | lrenn | Chousuke: was thinking of prefixing it all. I'm just screwing around right now. I'll probably got that route. Find will be reserved for searching (which is in ivy as well). |
| 17:52 | lowlycoder | how do I actually install clojure into /usr/local; rahter than something like java -cp ~/build/clojure/clojure.jar clojure.main |
| 17:52 | Chousuke | short answer: you don't. but you can put a launcher script in some bin directory. |
| 17:53 | lowlycoder | got it; question 2: how do I get openGL in clojure? perferably with access to opengl 3.0 functions |
| 17:53 | Chousuke | hmmh |
| 17:53 | Chousuke | there are java opengl libraries. through them I suppose. |
| 17:53 | Chousuke | then there was that clojure opengl library, ... |
| 17:53 | Chousuke | but I forgot what it's called. |
| 17:54 | Chousuke | ah, http://github.com/ztellman/penumbra/tree/master |
| 17:54 | lowlycoder | cloggle? |
| 17:54 | Chousuke | cloggle was the other one. but penumbra looks neater :) |
| 17:55 | Chousuke | I've never done anything with opengl so I'm not fit to judge :P |
| 17:58 | lowlycoder | it appears penumbra has GLSL support |
| 17:58 | lowlycoder | nice :-) |
| 18:02 | lowlycoder | okay, it looks very very strongly like glsl support is in there |
| 18:02 | lowlycoder | i'm convincd this is the right library |
| 18:02 | lowlycoder | thanks :-) |
| 18:35 | andyfingerhut | If I've got a possible performance bug to tell Clojure developers about, is it best to send it to the Clojure Dev group, or is there some other preferred method? |
| 18:36 | andyfingerhut | Hmm, maybe not, since the info for that Google group says only members can post. |
| 18:36 | hiredman | the google group is moderated |
| 18:36 | hiredman | or at least it was |
| 18:36 | hiredman | your first post had to be ok'ed by rich |
| 18:36 | andyfingerhut | So the regular Clojure group, then? |
| 18:37 | hiredman | I think that may be best |
| 18:37 | hiredman | I am kind of curious to hear about this performance bug |
| 18:38 | andyfingerhut | I had a little test program for allocating different kinds of data structures, and one created 500K PersistentVectors. |
| 18:39 | andyfingerhut | I used jmap -histo:live to see what objects were live at the end of that, and there were 500K instances of java.util.concurrent.atomic.AtomicReference still around, live. |
| 18:39 | andyfingerhut | This was purely sequential code. |
| 18:39 | Chousuke | you can also use the support system on assembla I guess. |
| 18:40 | andyfingerhut | My guess is that those should be temporarily allocated while creating a vec, but the references to them should perhaps be set to null after the (vec ...) call is finished. |
| 18:40 | hiredman | well, gc doesn't happen in the blink of an eye |
| 18:40 | andyfingerhut | True. But is it true that "jmap -histo:live" actually searches out and only reports live objects, as the documentation implies? |
| 18:40 | hiredman | no idea |
| 18:41 | hiredman | yeah take it to the group |
| 18:41 | Chousuke | no-one will fault you even if it happens to be a false alarm. :) |
| 18:41 | Chousuke | at least, I hope no-one will |
| 18:41 | andyfingerhut | If they do, I can live with it :) |
| 18:42 | Chousuke | The group behaves quite well usually. :P |
| 18:42 | andyfingerhut | Yeah, I hope I haven't stirred up trouble by starting these benchmarks. Certainly wasn't my intent to cause trouble. |
| 18:44 | jnudie | andyfingerhut: trouble maker... |
| 18:45 | Chousuke | I think benchmarks are fine as long as they are done to accomplish some objective. |
| 18:46 | andyfingerhut | Well, I've given my objective -- figure out what styles of Clojure code give what kind of performance. I certainly don't deal with large data sets all the time, but when I do, I don't want to give up a big constant factor in time or space. |
| 18:47 | Chousuke | but you really may have found a memory leak here, so it's worth discussing on the group. |
| 18:47 | andyfingerhut | I will send it soon. |
| 18:48 | Chousuke | and most times it *is* rather difficult to squeeze the best performance out of Clojure. |
| 18:48 | andyfingerhut | I may even end up with a few additional tips to add to Rich's list of how to improve Clojure performance in inner loops. |
| 18:48 | Chousuke | using arrays is no pleasant. |
| 18:48 | Chousuke | not* |
| 18:48 | andyfingerhut | but his current list is pretty darn good. |
| 18:51 | Chousuke | Rich once said that he'd rather work on "fundamental" performance than micro-optimisations. I should find the quote from the logs I guess :/ |
| 18:51 | hiredman | Chousuke: architectual |
| 18:52 | Chousuke | right. |
| 18:52 | Chousuke | we have transients, chunked seqs and new new already coming up in the next version. And I guess primitive vectors and non-boxing functions are possible too. |
| 18:53 | hiredman | :2009:May:25:17:45:54 rhickey : other than that, things are so simple, architectural things (like the chunked seqs we are discussing) yield much more bang for the buck than micro-optimization |
| 18:54 | dnolen | Chousuke: non-boxing functions? has much been said about that? |
| 18:54 | Chousuke | dnolen: more than about primitive vectors :P |
| 18:54 | hiredman | just rhickey dropping hints I think |
| 18:54 | hiredman | "I think I have way to do this" |
| 18:54 | hiredman | or something like |
| 18:55 | dnolen | which probably means it will happen :) |
| 18:55 | Chousuke | dnolen: I think he plans on adding overloads to IFn for a certain number of long and double arguments |
| 18:55 | dnolen | wow that's cool. |
| 18:55 | andyfingerhut | So my examining the memory utilization was initiated by the "Uncle Bob looking for Clojure help" message a couple days ago. |
| 18:56 | dnolen | andyfingerhut: I have a version of his code now that runs in 500ms instead of +25000ms. |
| 18:56 | Chousuke | I think one of the primary difficulties in making clojure code performant is telling when boxing and unboxing happens. |
| 18:56 | andyfingerhut | (def r (java.util.Random.)) |
| 18:56 | andyfingerhut | (defn rands [] (repeatedly #(.nextGaussian r))) |
| 18:56 | andyfingerhut | (defn points [] (take 400000 (partition 2 (rands)))) |
| 18:56 | andyfingerhut | (let [hull-points (time (hull (points)))] |
| 18:56 | hiredman | :( |
| 18:56 | andyfingerhut | Woops. Didn't mean to do all those lines like that. |
| 18:56 | andyfingerhut | But it is fairly short. |
| 18:56 | hiredman | lisppaste8: url? |
| 18:56 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 18:57 | Chousuke | that, and I suppose using arrays can lead to reflection that *warn-on-reflection* doesn't report :/ |
| 18:57 | andyfingerhut | If you realize the list returned by defn points, guess how much memory is used per 2d coordinate (all 400K of them) on a 64-bit JVM |
| 18:57 | Chousuke | which of course kills performane. |
| 18:57 | Chousuke | +c |
| 18:57 | dnolen | andyfingerhut: for that example using vectors is pointless |
| 18:57 | dnolen | vectors are wrong for that kind of iteration heavy code over primitives |
| 18:58 | dnolen | even creating an empty vector in a loop that tight is expensive |
| 18:58 | dnolen | even creating an object is expensive |
| 18:58 | dnolen | http://github.com/swannodette/convex-hull/tree/master |
| 18:58 | andyfingerhut | Every one of the 400K points, in a fully realized list, allocates 2 Doubles (expected), 3 Cons's (expected), and *4* LazySeq's (surprised me at first. I know why 3 of them, but the 4th is still a mystery) |
| 18:59 | Chousuke | dnolen: that's very ugly though :/ |
| 18:59 | andyfingerhut | And on a 64-bit machine, each Cons and each LazySeq is 48 bytes of mem |
| 18:59 | andyfingerhut | So for 2 8-byte doubles, on a 64-bit machine we are spending 384 bytes of mem. |
| 19:00 | dnolen | Chousuke: exactly. optimization is not pretty. |
| 19:00 | andyfingerhut | I'm not saying that this program ought to be coded this way, but when you look at his code, it looks fairy reasonable and natural. |
| 19:00 | andyfingerhut | s/fairy/fairly/ |
| 19:00 | dnolen | also I have a sneaking suspicion now that javac does certain high level byte code optimizations for the JVM that the Clojure compiler currently does not do. |
| 19:01 | dnolen | everything in my version is inlined and optimized, and the Java version is still about 6 times faster. |
| 19:01 | andyfingerhut | On a 32-bit JVM, it's better, but still 200 bytes per 2d point. |
| 19:02 | Chousuke | dnolen: maybe because not everything in the java version is inlined? |
| 19:02 | Chousuke | or is it? |
| 19:02 | Chousuke | remember, too much inlining can hurt performance too |
| 19:03 | dnolen | Chousuke, javac doesn't crazy kinds of analysis. if you have a for loop with no operation, that code actually gets removed! |
| 19:03 | dnolen | basically, it'll be some time before you can compete with javac. |
| 19:03 | hiredman | dnolen: I'm pretty sure the jit does that |
| 19:03 | Chousuke | Clojure pretty much depends entirely on hotspot for optimisation |
| 19:03 | JAS415 | when is there gonna be a GCC frontend for clojure :-p |
| 19:03 | dnolen | hiredman: not as far as I could tell, this doesn't happen in clojure for example. empty loop/recur with no ops takes up time. |
| 19:04 | Chousuke | if hotspot fails to optimise, you just get unoptimised gode :P |
| 19:04 | Chousuke | ... code. |
| 19:04 | JAS415 | hotspot is really good |
| 19:04 | JAS415 | especially if you run a function more than once |
| 19:04 | Chousuke | JAS415: yeah, it is. but probably optimised for java... |
| 19:04 | JAS415 | it'll get faster and faster |
| 19:04 | JAS415 | code is code :-P |
| 19:05 | Chousuke | but code patterns are not identical between languages. |
| 19:06 | konr | what clojure tutorial do you guys recommend me reading? |
| 19:07 | andyfingerhut | what's your background in other prog languages? |
| 19:07 | Chousuke | konr: here is some good stuff http://java.ociweb.com/mark/clojure/ |
| 19:07 | konr | I did some cool things with lisp, know a bit about python and c and web things, but nothing about java |
| 19:08 | tomoj | uhh |
| 19:08 | tomoj | that page plays a soundclip, lol? |
| 19:08 | Chousuke | it does? |
| 19:08 | tomoj | I thought we stopped doing that several years ago |
| 19:09 | Chousuke | oh it does. |
| 19:09 | andyfingerhut | I've got some Lisp/Scheme background before coming to Clojure, too, and I wouldn't call it a tutorial, but I really enjoyed the "Clojure for Lispers" on clojure.blip.tv. About 3 hours long between 2 videos. |
| 19:09 | tomoj | <embed> with autostart |
| 19:09 | hiredman | haha |
| 19:09 | hiredman | is that friends? |
| 19:09 | tomoj | isn't that like 10 years ago stuff |
| 19:10 | Chousuke | oh, yeah. |
| 19:10 | Chousuke | Watch all of Rich's talks. |
| 19:10 | Chousuke | if that doesn't sell you clojure, nothing will. |
| 19:10 | tomoj | where are they? youtube? |
| 19:10 | hiredman | ~blip.tv |
| 19:10 | clojurebot | blip.tv is http://clojure.blip.tv/ |
| 19:10 | tomoj | nice |
| 19:10 | tomoj | does he defend against no tests in one of those? |
| 19:11 | hiredman | http://www.artima.com/designtechniques/hotspot2.html some of these tips seem to be at odds with clojure |
| 19:11 | hiredman | no' |
| 19:11 | andyfingerhut | Not in the Clojure for Lispers one, at least. I haven't watched them all. He does definitely mention functional code being easier to test. |
| 19:11 | hiredman | there is another video somewhere of the talk where I think someone asked about that |
| 19:12 | hiredman | but I forget where that video is |
| 19:12 | tomoj | I read technomancy say that he mentioned the paper Out of the Tar Pit while defending |
| 19:12 | tomoj | I'd be interested to hear what else he said about it |
| 19:12 | hiredman | I imagine he just said "there is a great paper about that: Out of the Tar Pit" |
| 19:13 | Chousuke | hiredman: yeah, and it does say on the page that this "lore" is outdated by hotspot :) |
| 19:13 | Chousuke | or supposed to be, anyway |
| 19:13 | technomancy | tomoj: that was the bay area clojure meeting. |
| 19:14 | technomancy | and he didn't defend against "no tests" he defended against "you should be the one writing the tests" |
| 19:14 | technomancy | big difference |
| 19:14 | andyfingerhut | Chousuke: "lore" about "JVM is slow", or lore about testing? |
| 19:14 | Chousuke | andyfingerhut: lore about how to make java programs fast. |
| 19:14 | tomoj | technomancy: I see |
| 19:15 | tomoj | test-first vs test-later ? |
| 19:15 | hiredman | http://kotka.blip.tv/file/2286313/ is the bay area clojure meetup |
| 19:15 | technomancy | test-first vs regression tests, yeah. |
| 19:16 | tomoj | I'm glad the question wasn't "no tests?" |
| 19:16 | tomoj | that scared me |
| 19:16 | tomoj | hiredman: thanks |
| 19:19 | JAS415 | testing? |
| 19:23 | tomoj | wow, I never realized this |
| 19:23 | tomoj | multimethods are like a duckier version of duck-typing |
| 19:24 | tomoj | instead of "does it quack like a duck?" you get to pick whatever question you want.. cool :) |
| 19:25 | andyfingerhut | Reminds me of a line from a weird Monty Python sketch: "Maurice, you haven't got something a little less _ducky_, have you?" |
| 19:25 | hiredman | it's dispatch as it's own thing without being part of a type system |
| 19:25 | tomoj | wonder if someone has thought of a cute name for it |
| 19:43 | lowlycoder | if comma is white space, what's unquote? |
| 19:44 | lowlycoder | the cond change seems really stupid |
| 19:48 | tomoj | unquote is ~ |
| 19:49 | Carkh | what cond change ? |
| 19:49 | tomoj | ,`(foo ~(inc 3)) |
| 19:49 | clojurebot | (sandbox/foo 4) |
| 19:49 | tomoj | cond is different from CL |
| 19:49 | tomoj | I think arc made the change too |
| 19:49 | Carkh | oh i was worried for a second =P |
| 19:50 | Carkh | it doesn't make a whole lot of a difference from cl |
| 19:50 | tomoj | seems sensible to me |
| 19:50 | tomoj | why do you need those extra parens? |
| 19:51 | Carkh | so you can have pultiple statements |
| 19:51 | Carkh | multiple |
| 19:51 | Carkh | but cl is not as functional as clojure so that make sense for cl |
| 19:51 | tomoj | ah, implicit progn |
| 19:51 | tomoj | yeah |
| 19:52 | Carkh | so i would disagree that the change is stupid |
| 19:52 | tomoj | I think do is meant to me very explicit in clojure |
| 19:52 | tomoj | you want to be easily able to see anytime something is nonfunctional |
| 19:52 | Carkh | it is not mere syntactic easing, it conveys a meaning |
| 19:54 | tomoj | wow, arc's `if` is anaphoric |
| 19:55 | tomoj | according to graham, mccarthy said he got cond wrong and it had too many parens :) |
| 19:55 | Carkh | well i still beleive it makes perfect sense to have those extra parens for CL |
| 19:56 | Carkh | whatver mccarthy might think about it =) |
| 20:09 | lowlycoder | at the clojure repl, C-C and C-D both terminate, the repl, but C-h gives me ^H rather than deleting the previous char; how do I fix this (C-h works fine at the zsh shell, so I think it's java/clojure specific) |
| 20:10 | technomancy | lowlycoder: you'll want to run your repl inside the rlwrap tool |
| 20:10 | technomancy | java's console IO is crapforbrains |
| 20:11 | lowlycoder | nice; thanks! |
| 20:33 | lowlycoder | user=> (require 'quoted-namespace-symbol) |
| 20:33 | lowlycoder | java.io.FileNotFoundException: Could not locate quoted_namespace_symbol__init.class or quoted_namespace_symbol.clj on classpath: (NO_SOURCE_FILE:0) |
| 20:33 | lowlycoder | user=> |
| 20:33 | lowlycoder | clojure was started with: "rlwrap java -cp clojure.jar clojure.main" |
| 20:34 | lowlycoder | user=> (require quoted-namespace-symbol) |
| 20:34 | lowlycoder | java.lang.Exception: Unable to resolve symbol: quoted-namespace-symbol in this context (NO_SOURCE_FILE:8) |
| 20:36 | technomancy | lowlycoder: most likely "quoted-namespace-symbol" was intended as a placeholder for the name of a real namespace. |
| 20:36 | technomancy | what are you trying to do |
| 20:36 | technomancy | ? |
| 20:36 | lowlycoder | page 37 of the clojure book |
| 20:36 | technomancy | right. |
| 20:37 | technomancy | you want to replace that with the name of the library you want to require. |
| 20:42 | mebaran151 | that could really screw somebody up, if somebody actually named a library that |
| 20:43 | tomoj | if it's a grey block with blue text, you're not supposed to type it |
| 20:43 | tomoj | you're supposed to type the reddish text that looks like it's at a repl |
| 20:48 | lowlycoder | to use clojure.contrib ... do I use clojure-1.0.0 or clojure from git? |
| 20:49 | hiredman | clojure contrib is a seperate package |
| 20:49 | lowlycoder | right, but it depends on a version of clojure |
| 20:49 | hiredman | sort of |
| 20:49 | hiredman | there is a branch of contrib to maintain 1.0 compat |
| 20:50 | lowlycoder | hmm, i just built clojure-contrib.jar |
| 20:50 | lowlycoder | how do I get (require 'clojure.contrib.str-utils) to work? |
| 20:50 | hiredman | then you should be fine |
| 20:50 | hiredman | the jar needs to be in your classpath |
| 20:52 | lowlycoder | rlwrap java -cp ~/clojure/clojure/clojure.jar:~/clojure/clojure-contrib/clojure-contrib.jar clojure.main |
| 20:52 | lowlycoder | Clojure 1.0.0- |
| 20:52 | lowlycoder | user=> (require 'clojure.contrib.str-utils) |
| 20:52 | lowlycoder | java.io.FileNotFoundException: Could not locate clojure/contrib/str_utils__init.class or clojure/contrib/str_utils.clj on classpath: (NO_SOURCE_FILE:0) |
| 20:54 | hiredman | ,(require 'clojure.contrib.str-utils) |
| 20:54 | clojurebot | nil |
| 20:54 | hiredman | works here |
| 20:54 | hiredman | *shrug* |
| 20:54 | lowlycoder | how do you start clojure? |
| 20:55 | _mst | lowlycoder: your second ~/ in the above command line might not be expanding |
| 20:55 | hiredman | java -cp etc:etc clojure.main |
| 20:58 | lowlycoder | hmm, it appears that i'm not building clojure-contrib properly |
| 20:58 | lowlycoder | ls -l ~/clojure/clojure/clojure.jar |
| 20:58 | lowlycoder | -rw-r--r-- 1 x x 1502501 2009-08-14 17:41 /home/x/clojure/clojure/clojure.jar |
| 20:58 | lowlycoder | ant -Dclojure.jar=~/clojure/clojure/clojure.jar |
| 20:58 | lowlycoder | still gives me: |
| 20:58 | lowlycoder | [echo] WARNING: You have not defined a path to clojure.jar so I can't compile files. |
| 20:58 | lowlycoder | [echo] This will cause some parts of clojure.contrib not to work (e.g., pretty print). |
| 20:58 | lowlycoder | [echo] To enable compiling, run "ant -Dclojure.jar=<...path to clojure.jar..>" |
| 20:58 | _mst | yeah, it's your ~'s |
| 20:59 | _mst | start using $HOME instead of ~ and it should be alright |
| 20:59 | lowlycoder | yeah, it is apparently |
| 20:59 | Carkh | the contrib warning is only for c.c.pprint |
| 21:00 | lowlycoder | is there some var I can export in my ~/.zshrc to make my life easier? |
| 21:00 | lowlycoder | woot, rinally got: (require 'clojure.contrib-str-utils) to work |
| 21:03 | hiredman | lowlycoder: you running jdk1.6? |
| 21:03 | hiredman | 1.6 can have * in the classpath |
| 21:03 | lowlycoder | yes |
| 21:03 | lowlycoder | i'm running 1.6 |
| 21:03 | hiredman | so you puts all your jars in ~/.jars/ |
| 21:04 | hiredman | and CLASSPATH="$HOME/.jars/*" in your .zshrc |
| 21:04 | lowlycoder | symlinks okay? |
| 21:04 | hiredman | sure |
| 21:04 | hiredman | .jars or where ever |
| 21:05 | lowlycoder | export CLASSPATH="$HOME/*.jars/*" |
| 21:05 | lowlycoder | do i need something else? |
| 21:05 | hiredman | setopt allexport |
| 21:06 | hiredman | woa |
| 21:06 | hiredman | that won't work |
| 21:06 | hiredman | * in the classpath is not the samething as the shell glob |
| 21:07 | konr | these clojure videos are so cool <3 |
| 21:08 | konr | the video is not synchronized, though. Is there a way to download them? |
| 21:09 | hiredman | on blip.tv? |
| 21:09 | konr | yes |
| 21:09 | hiredman | yeah you go down on the right side |
| 21:09 | hiredman | there should be a "files" menu or something |
| 21:09 | lowlycoder | how do I take a clj file and turn it into a *.jar ? |
| 21:09 | hiredman | I forget exactly |
| 21:09 | hiredman | lowlycoder: a jar is just a zip file |
| 21:10 | hiredman | so it kind of depends |
| 21:10 | hiredman | if you just want to bundle clojure files up, you can just jar them up and put the jar on the classpath |
| 21:10 | hiredman | if you actually want to AOT compile the clojure files to class files the process is slightly more involved |
| 21:11 | lowlycoder | i can just jar up a bunch of *.clj files? |
| 21:11 | hiredman | sure |
| 21:11 | hiredman | as long as they have the correct namespace stuff |
| 21:11 | durka42 | that will not do what you expect though, doesn't a jar have a bunch of hidden files |
| 21:11 | durka42 | i mean a jar that can be run with java -jar |
| 21:11 | hiredman | depends |
| 21:12 | hiredman | durka42: you don't know what he expects |
| 21:13 | durka42 | this is true |
| 21:13 | durka42 | i made a baseless assumption |
| 21:14 | lowlycoder | i want to build jar files that operate kinda like *.so files |
| 21:15 | lowlycoder | i.e. things other clojure apps can load up and use functions from |
| 21:15 | hiredman | clojurebot: the point of moby dick is "be yourself" |
| 21:15 | clojurebot | Alles klar |
| 21:15 | hiredman | lowlycoder: yeah, you can just jar up the files and directory structure |
| 21:15 | lowlycoder | just jar up the *.clj files? |
| 21:15 | lowlycoder | they aren't even compiled .... |
| 21:15 | hiredman | yep |
| 21:15 | hiredman | no problem |
| 21:15 | lowlycoder | so what, java automatically loads up teh source, runs clojure, then converts them to jvm byte code? |
| 21:16 | lowlycoder | how does java even know how to handle clojure files? |
| 21:16 | hiredman | nope |
| 21:16 | hiredman | you need the clojure.jar |
| 21:17 | hiredman | lowlycoder: when you require namespaces the clojure runtime searchs the classpath for the implementation of the namespace |
| 21:17 | hiredman | ~classpath |
| 21:18 | hiredman | clojurebot: hello? |
| 21:18 | hiredman | crap, I left a debugging println in somewhere |
| 21:18 | clojurebot | classpath is (System/getProperty "java.class.path") |
| 21:19 | clojurebot | BUENOS DING DONG DIDDLY DIOS, fRaUline hiredman |
| 21:20 | hiredman | ~namespaces |
| 21:20 | clojurebot | namespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it |
| 21:20 | hiredman | ~compile |
| 21:20 | clojurebot | the unit of compilation in clojure is the namespace. namespaces are compiled (not files). to compile a namspace the namespace needs to be on the classpath and so does ./classes/ (and the directory needs to exist) because clojure writes the class files to that directory. http://clojure.org/compilation |
| 21:21 | hiredman | share and enjoy |
| 21:59 | _hrrld | Does anyone know where I can find an example of using clojure.contrib.logging successfully? I'm calling trace, but it's not clear where the log output is going. |