#clojure logs

2009-08-20

00:00lowlycoderprocrastinate by helping me get work done
00:00lowlycoderand the cosmic balance is maintained
00:00hiredmanlowlycoder: http://clojure.org/data_structures
00:01lowlycodersounds like I want refs :-)
00:01r2q2IRC is for idleing I thought everyone knew that.
00:01derridar2q2: +1
00:05lowlycoderare the items in a let expression guaranteed to be bound sequentially?
00:05lowlycoder(they must be, in order to allow a latter one to refer to a former one, right?]
00:07rlblowlycoder: (doc let), follow link, second sentence (and yes).
00:08rlb,(doc let)
00:08clojurebot"([bindings & body]); Evaluates the exprs in a lexical context in which the symbols in the binding-forms are bound to their respective init-exprs or parts therein."
00:08rlbHmm, mine says: Please see http://clojure.org/special_forms#let
00:09lowlycoderis it just me, or is clojure code much much more dense than lisp code?
00:13hiredmanlet isn't really a special form, let is a macro that emits a call to let*, and let* is a special form
00:13hiredmanone of the utility functions doc uses is hardwired to treat let as a special form
00:14hiredmanbut clojurebot's doc is not, so it can actually return the docstring from the let macro
00:14lowlycoderyou are very knowledgable
00:14lowlycoderif I had a startup, could I hire you?
00:15lowlycoderthe thing that surpises me with let and destructuring binding
00:15lowlycoderis that I can often times write entire functions in a let declaration body
00:21hiredmanlowlycoder: well, maybe you should destructure in the function args and leave out the let
00:21lowlycodernah; i need the sequential binding o th elet
00:29lowlycoderargh , -> ~ is so stupid, ',' is so easy to type, just using middle finger; ~ is so awkwaaard to type, using pinky on shirt + ring finger for ` ... wtf
00:32lowlycoderuser=> (.printStackTrace *e)
00:32lowlycoderjava.lang.NullPointerException (NO_SOURCE_FILE:0)
00:32lowlycoderhow can I get more info thatn that?
00:32lowlycoderthe line above it is a bunch of *.java files and a ... oh wait, I see a model.clj file
00:32lowlycoderthat looks like my fault
00:40lowlycoderhow do I read the value out of a ref?
00:40lowlycodernot the @ notation
00:40lowlycoderthe actual function
00:41lowlycoderderef
00:41lowlycoderthanks
00:45hiredman,(macroexpand '@foo)
00:45clojurebot(clojure.core/deref foo)
00:45lowlycoderthat is smart
01:14lowlycoderis \ used much in clojure?
01:14lowlycoderi want to remap it to ~
01:14lowlycodersince I use that alot
01:16lowlycodercan anyone hear me?
01:16hiredman\ is used for characters
01:16hiredman,\a
01:16clojurebot\a
01:17lowlycoderhow about one of !@#$%^&* ?
01:17lowlycoder@ is for deref, ! used for anything?
01:17lowlycoder* is probaly used for multiply
01:20hiredmanyou cannot chaning the meaning of \ without cracking open the reader
01:21hiredmanwhich will make your code incompatible with everyone elses
01:21lowlycoderoh, i was going to remap it in vim/xmodmap
01:21lowlycoderso it'll still look like ~
01:44Fossiwhat's ^ used for? or $?
01:45hiredman,(macroexpand '^foo)
01:45clojurebot(clojure.core/meta foo)
01:45hiredman,(macroexpand '$foo)
01:45clojurebot$foo
01:45hiredmannothing
01:46Fossiah, right meta
02:51demasHi, all. I'm read 'Programming Clojure' on page 174 and I'm trying the example 'male_female.clj'
02:51demasBut I get error message: => (m 10) -
02:51demas• Игра с нулевой суммой - если один игрок выигрывает то, что проигрывает другой.
02:51demas• Ход - выбор одного из предусмотренных правилами игры вариантов.
02:51demas• Личный ход - сознательный выбор (в отличии от случайного хода)
02:52demas• Игра с полной информацией - игрок при каждом личном ходе знает результаты всех предыдущих ходов, как личных, так и случайных.
02:52demas• Конечной называется игра, если у игрока есть конечное число стратегий.
02:52demassorry
02:52demasjava.lang.IllegalArgumentException: Wrong number of args passed to: user$m (NO_SOURCE_FILE:0)
02:52demasHere is source code:
02:52dulanov@demas жги чувак )
02:52demas(declare m f)
02:52hiredmandemas: use a pastbin
02:53demas(defn m [n]
02:53demas (if (zero? n)
02:53demas 0
02:53demas (- n (f (m dec n)))))
02:53demas(defn f [n]
02:53demas (if (zero? n)
02:53demas 1
02:53demas (- n (m (f (dec n))))))
02:53hiredman*sigh*
02:53hiredmanlisppaste8: url
02:53lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
02:54demasok
02:54demashttp://pastebin.com/m5cde0ed6
02:55hiredmanyou are missing some parens
02:57demasyes, i see
02:57demasthank you
03:13LauJensenTop of the morning gents
03:13LauJensen~clojurebot where are you ?
03:13clojurebothttp://github.com/hiredman/clojurebot/tree/master
03:43AWizzArdhiredman: still awake?
03:43hiredmanyessir
03:44RaynesAWizzArd: A real hacker never sleeps. Especially a Lisp hacker. And especially ones named hiredman.
03:44AWizzArddid you try out fnparse?
03:44AWizzArdRaynes: true, hired is the most awakest guy in here *g*
03:44hiredman*snort*
03:45hiredmanyou mean update clojurebot to work with the latest fnparse?
03:45hiredman(I haven't)
03:46AWizzArdyou could teach the clojurebot to count parens for everything that gets posted here, and if it detects missing parens it could tell the user.
03:46hiredman:(
03:47AWizzArdwith the exception of smilies
03:47hiredmanAWizzArd: I'd rather code was pasted to a pastebin then to the channel
03:48AWizzArdalso an option
03:50hiredmanhttp://delicious.com/clojurebot/pastbin
03:57Fossisure it's not *t*iredman?
03:59hiredman:/
06:54hamzahey guys, how can i remove an element from a vector at a certain
06:54hamza index?
07:22mtdclojurebot: ,(assoc [0 1 2 3 4] 2 :two)
07:22clojurebotGabh mo leithscéal?
07:22mtd,(assoc [0 1 2 3 4] 2 :two)
07:22clojurebot[0 1 :two 3 4]
07:23mtdhamza: ^^
07:26ole3,subvec
07:26clojurebot#<core$subvec__4942 clojure.core$subvec__4942@fb53f6>
07:27Chousukehamza: you can overwrite it but actually removing it requires rebuilding most of the vector.
07:27Chousukehamza: though if it's near the end it'll be reasonably cheap :)
07:28rottcodd,(let [v [0 1 2] i 1] (reduce conj (subvec v 0 i) (subvec v (inc i) (count v))))
07:28clojurebot[0 2]
07:29ole3,(let [v [0 1 2 3] i 2] (vec (concat (subvec v 0 i) (subvec v (+ i 1)))))
07:29ole3+
07:29clojurebot[0 1 3]
07:31Chousukethat's O(n) though, and creates an entirely new vector.
07:32Chousukethough I guess the first one is O(n) too, technically :P
07:36ole3yes
08:36Fossii'm looking for a contrib function that groups maps according to a function. can't find it. somebody know where it's at?
08:37Fossiok, was in seq-utils
09:06LauJensen~paste
09:06clojurebotlisppaste8, url
09:06lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
09:08lisppaste8Lau pasted "Character cast? http-client" at http://paste.lisp.org/display/85731
09:08LauJensenDoes anyone know whats going on here?
09:09Chouserperhaps you want into-array ?
09:10LauJensen"Dont know how to create iseq from FilePart"
09:10Chouser(into-array [(FilePart. ...)])
09:10samlman i thought i modified JLine so that tab completion works on windows.. but that only worked at the beginning of a line
09:11LauJensenChouser, certainly you mean (defmacro >array [arg] `(into-array [~arg])) ?
09:11LauJensenAnyway, it did the trick, thanks alot :)
09:14LauJensenWow - I just did a POST upload of a picture. Impressive :)
09:15Chousernice.
09:18LauJensenYea, thats really the goodness of running my website via compojure. Just added a POST /backdoor/ route handler, and there was no need to installed an ftp server or any such thing, which would have weakened the overall security of the server..
09:20ChousukeI suppose you have some access checks in place for that backdoor? :P
09:21LauJensenNo, people can upload whatever they want. Nothing will be executable or exceed a certain size
09:23LauJensenChousuke: When I want to msg either you or Chouser, I have to write 5 letters before I can tab-complete. This is not satisfactory so I'll have to ask you do change your nick to Sukechou instead.
09:23ChousukeNot going to happen :)
09:24LauJensenWith all diligence, search my last statement for a "?" - It was not a question boy
09:24LauJensen(I'm kidding dont kill me)
09:24ChousukeI tabcomplete most people's names with a single character anyway
09:25ChousukeIrssi's tabcompletion is context aware so most of the time it gets the right name.
09:25LauJensenCool
09:25LauJensenI'm on Pidgin though
09:25FossiChousuke: so it knows that i want to talk to you?
09:26ChousukeFossi: It prefers people who were last active.
09:26ChouserI've considered using a nick that's visually distinct to reduce confusion (even though I've had my name longe ;-)
09:26Fossiwell, that would surely help me in this case ;)
09:26Fossii meant the completion
09:26Chousersomething like Ch_ouser. Or cccchouser. TheChouser
09:27lrennLauJensen: Does that mean you solved your URLDecode problem?
09:27LauJensenlrenn: It means I've found one way of getting around it. Not optimal, since I dug into org.apache.commons, forsaking stuarts http-client
09:28ChousukeChouser: You could always flip it around and make it ChrisH
09:31LauJensenChouser: Then you wouldn't be mistaken for being Chinese
09:31ChouserDoes chouser sound chinese?
09:32LauJensenYes sir
09:38ChouserChousuke: Or you could use Jarkko :-)
09:39Chouserno other ja* in here
09:41LauJensenAlso a good point Mr. Chen
09:45ChousukeChouser: Yeah, I could, but I doubt I will. :P
09:45Fossi,(str (/ 100 3))
09:45clojurebot"100/3"
09:46Fossii'd really start thinking if my name was chous' uke
09:46Chousuke:P
09:46Fossiexcept of course if you like a little homoerotic touch :D
09:47Chousukethat's just forcing it.
09:47Fossii hope not :D
09:48Fossi(it won't get any better from here ;)
09:48Chousukebesides, you're not allowed to break the name between s and u. that's impossible in Japanese orthography :P
10:40stuartsierraTried to improve performance on base64 in Clojure. http://bit.ly/3ZArh7
10:40stuartsierraStill 10-20 times slower than Commons Codec, I think limited by boxed bit-ops.
10:42cemerickunless one is targeting Android, etc., why not just use the com.sun stuff?
10:42clojurebothttp://clojure.org/rationale
10:42cemerickclojurebot: don't talk to me about full-stack impls, dammit! :-P
10:42clojurebotHuh?
10:44stuartsierraNo reason. I'll probably continue using Commons. I just wanted to see if I could do it.
10:44Chousukestuartsierra: hmm, did you try if escape analysis has any effect on it?
10:44stuartsierranno
10:45cemerickDon't mind me, I get twitchy when I see pure-clojure reimpls of existing java libs.
10:45stuartsierraBut I offer the code up as an optimization challenge.
10:45carkstuart : the line variable could be forced to an int and you could use unchecked functions for it
10:45Chousukehmm
10:45stuartsierracark: tried it, difference was neglible
10:45ChousukeI wonder if make-array returns a type-hinted array.
10:46carki guess you checked everything with *warn-on-reflection* true ?
10:46stuartsierraI don't think so. But I already checked that there are no reflective calls.
10:46carkok
10:46Chousuke*warn-on-reflection* doesn't warn about array reflection
10:46stuartsierrapre-boxing the bytes as Integers yielded about 10% improvement.
10:47Chousuke~def bit-and
10:47Chousukehmm. looks like it does inlining at least.
10:48carkah these re inlined
10:48ChousukeIs there really no primitive implementation for them? :/
10:49stuartsierraApparently not. Look at the BitOps classes in clojure/lang/Numbers.java
10:49carkwell this goes to prove that it's good we have java to fall back to for low level stuff
10:50carkbut it worries me for clojure-in-clojure ...
10:51carkwill we loose lot of performances on data structures ?
10:51Chousukecark: there's new-new now. you can actually implement interfaces with methods that take and return primitives now.
10:52carkwhat version is it scheduled for
10:52cark?
10:52Chousuke1.1 most likely :P
10:52carkcool =)
10:53Chousukehttp://clj-me.blogspot.com/2009/08/clojure-as-fast-as-java.html
10:54cemerickugh, that title makes me cringe now
10:55stuartsierraI can imagine a really clever compiler that provides a dynamically-typed implementation of bit-ops as a default, but generates primitive methods as needed based on type tags.
10:56carki don't expect the clojure compiler to ever become very smart... it's ok as long as we have the java alternative
10:58ChousukeI think we have all the tools now to start rewriting a compiler in Clojure but no-one has started anything yet :/
10:58carkmaybe with compiler macros we could already do los of optimizations
10:58stuartsierraPerhaps the good is the enemy of the perfect.
10:59ChousukeI unfortunately know nothing about designing compilers so I wouldn't know where to start ;/
11:00ChousukeLooking at the java compiler for inspiration is probably not a good idea.
11:01cemerickit seems like stuff like this definitely belongs in the host platform. Even if the clojure compiler were to get super-smart about these sorts of things, it seems like such an impl would depend on Java at the moment, making those optimizations pointless when js or objc or llvm, et al. is the host platform.
11:02ChousukeWhen I first started writing my clojure-reader I started with a PushbackReader and looked at the java implementation to see how it did things; I didn't get very far.
11:03ChousukeThen I restarted and ignored the java reader and started writing one that just takes a seq of strings as its input. Now it's progressing rather well
11:04cemerickalmost certainly not as fast, but I'll bet it'll be a dream to maintain (by comparison)
11:04ChousukeThough I'll probably have to change how the input is fed to it. Because it requires a line-seq, you can't just read "(foo)" from a "(foo)(bar)\n" stream without reading the (bar) from the stream as well
11:05Chousukebut it works character-by-character so that shouldn't be impossible.
11:05Chousukeand yeah, performance is also a secondary concern
11:06danlarkinChousuke: feature request: """triple quoted strings""" :)
11:06cemerickthat's part of why I'm definitely going to produce a binary, serialization-based print-dup alternative -- reading will only get slower over time
11:06stuartsierraI used a PushbackReader in my JSON lib, worked fine, but the result was still imperative-looking.
11:06Chousukedanlarkin: I'll implement feature parity first.
11:06Neronusre smart compiler: The clojure compiler doesn't need to be that smart. javac isn't really smart either
11:06Chousukeand even if the reader turns out not quite good enough, I hope my helper functions will be useful at least :P
11:07cemerickdanlarkin: to handle the 80% userland reader macro use case?
11:07ChousukeI already have a syntax-quote macro
11:07danlarkincemerick: hm?
11:07Chousukewhich I haven't tested thoroughly, but it appears to work :P
11:08cemerickdanlarkin: I thought that's why you were suggesting triple-quoted strings
11:08danlarkincemerick: oh, I want them so one doesn't have to escape inside docstrings
11:08cemerickah
11:09cemerickheh, that'd make things easier for tools to reformat code + docs
11:10ChousukeIf I could use something like fnparse I bet writing the reader would be ridiculously easy.
11:10cemerickthere was a discussion on the group about using triple-quoted strings as a way to cover some large chunk of the use-cases for reader macros
11:10danlarkinand writing docstrings a lot more sane...
11:11danlarkinI must've missed that discussion
11:11danlarkinsounds interesting
11:12cemerickit was earlier this week, I think
11:20LauJensen~paste
11:20clojurebotlisppaste8, url
11:20lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
11:20lisppaste8Lau pasted "POSTing a file" at http://paste.lisp.org/display/85738
12:34Chousukehm.
12:35ChousukeI'm again getting the eldoc lag with clojure-mode :(
12:35Chousukeearlier, it did seem like it honoured the setting
12:35Chousukebut now it doesn't, again.
13:32LauJensenSukechou: Sounds awful
13:32LauJensenWhats eldoc doing for you ?
13:52ChousukeLauJensen: :P
13:52ChousukeLauJensen: I don't know what's causing it.
13:52LauJensenSukechou: What it meant was: What do you gain from eldoc, I never used it?
13:53Chousukeit shows the arglists in the minibuffer.
13:53ChousukeLauJensen: but for some reason, clojure-mode ignores the eldoc delay altogether and that causes lag in display rendering.
13:53Chousukemaybe I need to git bisect my config...
13:54Chousukethough it might just be some incompatibility with clojure-mode and the version of clojure I'm using.
13:54Chousukeand/or swank
13:55ChousukeI'm somewhat behind master in my clojure-reader branch. I haven't done a merge since I started coding it.
13:56Chousukeand I won't, until I'm mostly done with it. :P
13:56tomojare we supposed to have tab-completion in source buffers, or just in the slime repl?
13:56LauJensenHow close are you to completeting it ?
13:56LauJensentomoj: In source buffers you can also have it by binding tab to dabbrev-expand as I recall
13:57tomojLauJensen: nice, thanks
13:57ChousukeLauJensen: Well, it's almost at feature-parity I think.
13:57Chousukemissing unicode escapes, #! and #_ ... and maybe some other stuff I've forgotten.
13:58LauJensenfeature-parity = feature-complete?
13:58ChousukeI guess.
13:59ChousukeBut after I'm done with the basic functionality there's still a fair amount of work before it can replace the java reader.
14:00Chousukeif you want to play with it, you can find it on my github, entirely undocumented!
14:00LauJensenI cant help wonder why its such a big challenge to write a reader where you already have the java code ?
14:00ChousukeWell, I'm not looking at the java code at all :P
14:00ChousukeBut it hasn't been much of a challenge so far, really. :)
14:01ChousukeI've just been slow with it.
14:01Chousukeimplementing a feature or two at a time whenever I feel like it. :P
14:01LauJensenAh ok
14:01LauJensenSpoken like a true freetard :)
14:01ChousukeWell, I'm in no hurry.
14:02ChousukeI suppose I should add my rh-from-string function to the source file :P
14:04wtetznerhey guys, i wrote an ant build script for one of my projects, and when compiling i get this error: [java] Exception in thread "main" java.io.FileNotFoundException: Could not locate clojure/test__init.class or clojure/test.clj on classpath: (read.clj:33)
14:04wtetznerdoes anyone know what i'm missing from the classpath?
14:04Chousukethe consume function takes a "reader-handle" which is a fancy way of saying "a pair containing lines a seq of strings and an offset to the current line"
14:04wtetzneri included clojure.jar and clojure-contrib.jar
14:04Chousukeas*
14:05Chousukewtetzner: which version of clojure?
14:05wtetzner1.0
14:05Chousuke1.0 doesn't have clojure.test
14:05wtetznerhmm
14:05Chousukeyou need a recent version from from git
14:05wtetznerok
14:06LauJensenIts also worth noting that tests are primarily for noobs
14:07wtetznerChousuke: so if 1.0 doesn't have clojure.test, why would it be looking for it when compiling a class?
14:09hiredmanwtetzner: are you using the 1.0 compat branch of contrib?
14:10wtetznerhiredman: i don't know
14:10wtetznerthat might be the problem
14:10wtetznerhow do i know if it's compatible?
14:12wtetznerhiredman: that was the problem
14:13wtetznerhiredman: i used the wrong version of clojure-contirb
14:13wtetznerthanks
14:16LauJensenGents - I'm trying to file an image to disk via a bufferedimage. There's a static function called ImageIO/write which should handle this and it works when I output my image as png, but b0rks when I choose jpg. Any idea why ?
14:17ChouserI have a vague recollection of needing some kind of external plugin to write certain kinds of image file formats. I may be pretty off base though.
14:18LauJensenThey docs say the same thing, but for everything but gif, jpg and png, which should be available on all platforms
14:18LauJensen"Their"
14:20LauJensenAlso - When I call ImageIO/getSupportedFormats it says jpg, JPG and jpeg are supported
14:21LauJensen,(doseq [r (ImageIO/getWriterFormatNames)] (print r))
14:21clojurebotjava.lang.Exception: No such namespace: ImageIO
14:22LauJensen,(doseq [r (javax.imageio.ImageIO/getWriterFormatNames)] (print r))
14:22clojurebotBMPbmpjpgJPGwbmpjpegpngPNGJPEGWBMPGIFgif
14:24Chouserwhat kind of b0rks do you get?
14:24LauJensenAh, "JPG" works...
14:24LauJensenException in thread "AWT-EventQueue-0" javax.imageio.IIOException: Invalid argument to native writeImage
14:24LauJensen at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeImage(Native Method)
14:24LauJensen at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeOnThread(JPEGImageWriter.java:1055)
14:24LauJensen at com.sun.imageio.plugins.jpeg.JPEGImageWriter.write(JPEGImageWriter.java:357)
14:24LauJensen(oops, sorry, I know that was 4 lines)
14:26LauJensenJPEG didnt work either
14:26LauJensenjpg in its entirety is b0rked
14:28tomojLauJensen: which java?
14:28l0st3d1Hi - newbie question - If I have a list like '(1 2 3 4 5) how do I turn that into a list of lists with every combination missing, i.e. '(1 2 3 4 5), '(nil 2 3 4 5), '(1 nil 3 4 5). '(nil nil 3 4 5), etc ?
14:28LauJensenGif and Png works, Bmp outputs faulty file, jpg doesnt output anything
14:28LauJensentomoj: 1.6
14:28tomojsun?
14:29LauJensenSi
14:29tomojdunno then
14:29cemerickLauJensen: you're doing something wrong :-)
14:29LauJensencemerick: thanks for chiming in, we'll talk tomorrow right? :)
14:29cemerick?
14:29Chouserl0st3d1: how long do you expect that list to get?
14:30LauJensenHmm, whats openjdk doing on this system ?
14:30l0st3d110 - 15 items
14:30tomojLauJensen: that could be the problem
14:30LauJensentomoj: Of course its the problem. its developed by freetards and lusers (quote linuxhater)... :)
14:35LauJensenapt-get purge openjdk* , and tada!! :)
14:35LauJensenThanks for staying sharp tomoj
14:36l0st3d1chouser: 10 - 15 items, so not too long. I started with (let [l '(1 2 3 4 5)] (for [i l] (map #(if (not (= % i)) % nil) l))), but I'm not sure how to proceed
14:36Chouserl0st3d1: a tidy recursive solution seems likely.
14:37tomojlooks like 32 items to me
14:38LauJensenOk, interesting. The image is now outputted without errors, the resolution is correct, but its entirely black, all details are lost. And only when output in jpg
14:40Chouser(defn nils [c] (let [[c1 & cs] c] (if cs (concat (map #(cons c1 %) (nils cs)) (map #(cons nil %) (nils cs))) [[c1] [nil]])))
14:41Chouser,(letfn [(nils [c] (let [[c1 & cs] c] (if cs (concat (map #(cons c1 %) (nils cs)) (map #(cons nil %) (nils cs))) [[c1] [nil]])))] (nils '(1 2 3)))
14:41clojurebot((1 2 3) (1 2 nil) (1 nil 3) (1 nil nil) (nil 2 3) (nil 2 nil) (nil nil 3) (nil nil nil))
14:42tomoj I guess before you blow the stack you'll have far too many possibilities anyway?
14:42Chouserthat'll blow the stack for longer input lists
14:42LauJensenChouser, isnt this where you trampoline it instead?
14:43Chouserthat'd be one solution for longer lists. I'm sure there are others.
14:43l0st3d1Chouser: excellent ... thanks ... I was messing with embedded fors ... longer lists and performance aren't a problem for me right now ... many thanks
14:44ChouserI think using 'for' instead of recursion would only work if you new the length of the list at compile time.
14:44Chouseryou'd need one 'for' clause per list item
14:45Chouseryou could use 'for' instead of the 'map' in my solution of course, and still recurse.
14:45l0st3d1I'm slowly reading your solution and trying to inderstand ;)
14:46l0st3d1I was trying to build a partial list in an outer for and mapping all the things in the outer list to nil in an inner list ...
14:46l0st3d1I'm sure it wouldn't have worked ;)
14:58LauJensenOk - The situation is this. Using Sun-java6 I can save an imageicon=>bufferedimage=>file. Perfect. Except to save it correctly you need to know the type of the image, for instance TYPE_INT_RGB. This differes from image to image. Anybody know an easy way to determine which type is correct?
15:00wtetznerhey guys, another question: i'm signing some jar files to be run as an applet, and i'm getting the error: Exception in thread "main" java.lang.SecurityException: class "clojure.proxy.java.lang.Object$ActionListener"'s signer information does not match signer information of other classes in the same package
15:00wtetzneri think it's because the actionlistener class ends up in the same jar file as the applet jar
15:00wtetznerbut clojure is in its own jar file
15:01wtetzneris there a solution to this?
15:01ChouserI've always put all classes into a single .jar file for applets
15:02wtetznerso you unzip clojure.jar etc. and put the contents into the applet jar?
15:02Chouseryeah
15:02wtetznerok
15:02Chouserdunno if that's right or recommended or anything, but I never figured out how to specify more than one .jar for an applet, so this is what I've been doing.
15:04wtetznerin the applet tag, you can use the archive attribute: archive="applet.jar,clojure.jar,clojure-contrib.jar"
15:05wtetznerbut if you sign each one separately, even using the same certificate, it doesn't like it
15:05wtetznerif two things from the same package are in different jars
15:06wtetznerare there any licensing issues of me moving the ActionListener stuff to the clojure.jar file?
15:08ChouserI think you can combine the .class files in whatever jars you want. Distributing modified class files is where you start running into restrictions. I think.
15:08wtetznerok
15:08wtetznerthanks
15:11LauJensenOk - The situation is this. Using Sun-java6 I can save an imageicon=>bufferedimage=>file. Perfect. Except to save it correctly you need to know the type of the image, for instance TYPE_INT_RGB. This differes from image to image. Anybody know an easy way to determine which type is correct?
15:11LauJensenFollowup: I've now tried forcing all image types indivually and none of them emits a correct image - whats up !?
15:12ChouserLauJensen: maybe #java can help you?
15:12LauJensenLast resort
15:13hiredmanare you sure imageicon is what you want?
15:14LauJensenOk, update: passing the getScaledInstance image through ImageIcon through .getImage did the trick
15:14LauJensenAll is well in la la land
15:15hiredmanImageIO can give you a buffered image from a url
15:16LauJensenTrouble is I wont always have an Url, sometimes I'll just have some scaling factors and an image
15:16LauJensenBut its working now
15:17LauJensenTrue to Clojure's slogan "I get by with a little from my friends"
15:33ChouserI guess it hinges on the phrase "derivitive work". I would assume changing Clojure's sourse results in a derivitive work, but I would think combining it in a jar with other stuff does not?
15:35tomoj"contributions do not include additions to the program which... are seperate modules of software distributed in conjuction with thi program under their own license agreement"
15:35Chouserah, nice.
15:35rsynnottthat's a nice clarification
15:35rsynnottfar too many people either don't clarify or clarify the other way ;)
15:36rsynnott(the authors of clisp, for instance, claim that any piece of software written in clisp and accessing the foreign function interface _falls under GPL for redistribution purposes_)
15:36Chouserthat then shifts to what makes up a "module". I suppose, one might try to claim that's what a .jar is.
15:41wtetznerwhy are classes created by proxy in the clojure namespace vs the namespace proxy was called in?
15:45tomojsecond clause in that list was that contributions do not include additions which are not derivative works :)
15:45Chouserthis has come up before. As it is, multiple namespaces can share the same proxy class if it would be identidal
15:45Chouseralso they're put in a package that's not used for anything else, which reduces the changes of collision.
15:46Chouserwtetzner: all that said, it might be better to put them elsewhere for easier packaging.
15:54weissjI'd like to make a function that if I pass it '("user" "passwd") it will return a lazy seq of ("user1" "pass1"), ("user2" "pass2") ...
15:55weissji can't quite figure out where to put the call to inc :)
15:55weissjsorry s/passwd/pass
15:56wtetznerChouser: yeah, for now i'm just putting everything in one jar
15:56wtetznerChouser: but it would be nice to not have to upload all of the clojure stuff every time i re-upload the applet
15:56Chouseryeah
15:57Chouserwtetzner: do you really have to sign the applet?
15:59wtetznerChouser: i got security exceptions from dynamic class loading when the applet wasn't signed
15:59Chouserif you're careful to remove all reflection and AOT compile it, those go away.
16:00Chouser,(letfn [(crack [c] (cons c (map (fn [n] (map #(str % n) c)) (iterate inc 1))))] (take 3 (crack '("user" "pass"))))
16:00clojurebot(("user" "pass") ("user1" "pass1") ("user2" "pass2"))
16:00wtetznerChouser: how can i tell if i've removed all reflection?
16:00weissjChouser: thanks
16:00Chouser(set *warn-on-reflection* true) before you even do (ns ...) at the top of your file.
16:00wtetznerChouser: oh, ok
16:01Chouserthen you'll get warnings at compile time for code that would cause security exceptions at runtime
16:01wtetznerChouser: so to remove reflection, what do i need to do? just add in type hints?
16:03Chouserwtetzner: generally, yeah.
16:03Chouserhm, last I checked 'ns' itself generated some reflection. I have a patch for that, but haven't mentioned to anyone yet.
16:04Chouserhttp://tinyurl.com/nqqubv -- clojure-type-hints.diff
16:05Chouserdunno if that's still needed or not
16:08Chouserah, it is. Or use the patch here: http://www.assembla.com/spaces/clojure/tickets/171
16:09wtetznerChouser: also, i wanted to be able to use the java web start, and i think that requires that the files are signed
16:09wtetznerChouser: i want the ability to drag the applet from the browser, and create a link on the desktop
16:09Chouserah, that's why I asked in the first place.
16:10ChouserIf you have some other reason to sign it, it's probably not worth chasing down all the runtime reflection (except possibly for performance).
16:10wtetznerChouser: yeah, it seems like a lot of work to add all those type hints
16:10Chouseryep.
16:10wtetznerand then the code doesn't look as pretty
16:21LauJensenAnybody here know how to integrate a .clj script into nautilus' right-click menu ?
16:24angermanhow would I translate something like Foo.class (java) to clojure?
16:24hiredmanFoo
16:27Chouserno official way to get to a map's .keySet() method?
16:28wtetznerwhat does .keySet() do?
16:28Chouserit seems sad to do an O(n) (set (keys my-map)) when (.keySet my-map) is there already.
16:29kotarakChouser: well keys could return the keySet, no? (Dunno whether it does...)
16:29wtetznerkeys returns a sequence of keys
16:30kotarakThen it could be modified to return the keySet...
16:30wtetzneror just add a key-set function to clojure.core
16:30kotarak(which might not help much, if the set has to be constructed internally also....)
16:31kotarakI think (.keySet some-clojure-map) already works.
16:31wtetzneryeah
16:31wtetznerbut it's not as pretty as (key-set some-clojure-map)
16:31Chousernot as pretty and more likely to change out from under me.
16:31wtetzneroh yeah, that too
16:32kotarakChouser: then work on rhickey to get keys returns the set. :) Turning it back into a seq is possible anyway...
16:33Chouserwell, that's why I'm asking.
16:36rhickeyas long as a map is a Map then keySet will work
16:36rhickeye.g. low risk
16:36Chouserok
16:37Chouserif 'keys' only promised a collection instead of a seq, it could call .keySet itself.
16:52wtetzneri don't know if you guys have seen this already, but this is a set of "look and feel"'s for swing
16:52wtetznerhttps://substance.dev.java.net/see.html
16:52wtetznerit makes swing look really good
16:53gkohello.
16:55cemerickwtetzner: yeah, substance is awesome. I'm hoping NetBeans becomes compatible with it in v7.
16:56wtetzneri think one of the reasons people don't like java applications is that the default gui is so ugly
16:57gkoI have code like this: ... (let [x (produce-a-list) b (map #(use-list %) x)]) ...
16:57gkoafter (produce-a-list), x has for example 10 elements, but when using map, the use-list function is called only twice...
16:58Chousergko: map is lazy
16:58Chousergko: it will call use-list only as many times as needed, based on whatever is using b
16:59gkoChouser: so doall ?
16:59Chouserif use-list has side-effects, and you want those to happen for every item in x, I'd recommend doseq
16:59gkoChouser: but in the let, the list is used...
16:59Chouserbut doall and/or runall might do as well.
17:00Chousergko: oh, it has side effects and the return values are used?
17:00gkoyes
17:01Chouserit might be worth trying to split that up a bit -- keep your side-effect stuff as separate as possible from the seq/computational stuff.
17:01Chouserbut failing that, doall or vec wrapped around map will force it and let you get at the values.
17:03gkonot working with doall...
17:03gkoI have code like this: ... (let [x (produce-a-list) b (map #(use-list %) (doall x))]) ...
17:03Chouser(doall (map use-list x))
17:03kotarak(doall (map ...))
17:03wtetznergko: call doall over the map
17:04gkoOh... It works now... Thanks!
17:05gkoHave seriously to read that chapter 5 ..
17:57sh10151I really dislike Groovy. :(
17:57Chouserhm, what's groovy's weak spot? macroless? How's its performance?
17:58Chousermutable
17:58sh10151They have a way to get at the abstract syntax tree
17:58sh10151not sure if anyone would care either way, though
17:59sh10151Unfortunately I think the main reason it's gotten traction is it is designed to look enough like Java to fool the unwary.
17:59Chouseryeah
17:59sh10151never mind that declaring a variable a certain type and then assign to it does an autocast, even when an autocast is nonsensical
18:00sh10151I mean, honestly if it were familiarity they were after, JavaScript Rhino should have been top choice -- but no one hypes it.
18:00hiredmanyeggie did
18:00sh10151Groovy seems to have a big hype machine on the enterprisey blogroll
18:00sh10151yeah and look what happened to him!
18:00sh10151like that! *poof* he's gone!
18:00Chouserwhat did happen to him?
18:00sh10151;)
18:00hiredmangood point
18:01sh10151probably got pulled into Google's V8 and now can't talk about it any more...
18:01sh10151just my theory
18:01hiredmanooo
18:01sh10151You like JavaScript eh, well *JavaScript This!*
18:03sh10151anyway, not sure what to do about it. I'm giving a presentation on Clojure at work next week but who knows how it will be received. :)
18:03hiredmanhard to say, I have difficulty imagining anyone not jumping on clojure, but I guess I am brainwashed
18:04Chouser.keySet returns a set that is not a IFn
18:05hiredmanhow unfortunate
18:05hiredman~ticket #69
18:05clojurebot{:url http://tinyurl.com/ntknnt, :summary "GC Issue 66: Add \"keyset\" to Clojure; make .keySet for APersistentMap return IPersistentSet", :status :test, :priority :low, :created-on "2009-06-17T19:55:38+00:00"}
18:06Chouserhuh!
18:07sh10151well
18:07sh10151early feedback is people are prejudiced against Lisp ;)
18:08ChouserI'm shocked. shocked.
18:08hiredmansh10151: shows what they know
18:10sh10151well, again if they were like "JavaScript works fine for us" that'd be one thing
18:10sh10151but clojure is sensitive to where you stick newlines, and in a semantic way not a syntactic way
18:11sh10151i.e. if you put a newline in one place, it behaves one way, and if you put a newline in another, it behaves differently
18:11Chouserthat's groovy?
18:11sh10151sorry
18:11sh10151s/clojure/groovy/ of course :)
18:11Chouserjavascript can occasionally have issues with that too
18:11hiredmansh10151: do you have anything on groovy clojure integration?
18:12sh10151http://groovy.codehaus.org/Things+you+can+do+but+better+leave+undone
18:12sh10151hehe no :)
18:12sh10151Chouser: yes but not as frequently because JavaScript doesn't use a bare {} as its anonymous function syntax
18:12hiredmanif you can get them to use clojure datastructures in groovy you are most of the way there
18:12Chousersh10151: ah.
18:13syamajalai need a crash course in java
18:13syamajalais there a good book?
18:13sh10151hiredman: hey, that's a good point
18:13sh10151hiredman: I might give that a shot
18:13hiredmanhttp://groovy.codehaus.org/JSR-223+access+to+other+JVM+languages
18:14syamajalai have experience with lisp/clos, ruby, and c, as well as a tiny bit of objc, but have never used java
18:14syamajalai've also read a bunch programming clojure
18:15hiredmanthere are video lectures on java from a few schools out there
18:15sh10151syamajala: Maybe the Core Java book?
18:15sh10151syamajala: Whatever you do, make sure it's recent
18:15sh10151syamajala: covering Java 5 at least
18:16sh10151I thought "The Java Programming Language" to be reasonable.
18:16sh10151not quite as nice as "The C Programming Language" but that's down to all the libraries they cover.
18:17syamajalaok, i'm really just looking for something lite that can quickly get me up to speed on java's version of oop
18:17hiredmanhttp://webcast.berkeley.edu/course_details_new.php?seriesid=2008-D-26332&amp;semesterid=2008-D is java
18:19sh10151"Effective Java" is light
18:19sh10151but you'd have to pick up a lot by reading between the lines as far as basic syntax goes
18:20sh10151I just have two Java books on my bookshelf: "The Java Programming Language" and "Effective Java."
18:20sh10151the rest is pretty much in the javadocs online
18:21hiredmanbeing able to read javadocs is best
18:21hiredmanactually knowing java is kind of secondary
18:22syamajalash10151: i don't think syntax will matter much because of clojure
18:23syamajalait would just better if i actually knew what things like a proxy are
18:23sh10151in clojure or in java?
18:23syamajalajava
18:23hiredman,(class (proxy [Object] []))
18:23clojurebotjava.lang.IllegalStateException: Var null/null is unbound.
18:23hiredmanouch
18:23sh10151in clojure it's just a short way to write new Interface() { public method1() {}} etc
18:23sh10151at least afaict
18:24hiredman,(class (proxy [clojure.lang.IDeref] [] (deref [] 1)))
18:24clojurebotjava.lang.IllegalStateException: Var null/null is unbound.
18:24hiredmanodd
18:24Chousukehmm.
18:24Chousuke:p
18:24syamajalash10151: see, i have no idea what an interface is though
18:24Chousukesyamajala: just a bunch of methods :)
18:24syamajalakinda like generic functions?
18:24hiredmanno
18:24sh10151syamajala: In Java an interface is a data type
18:24Chousukean interface is a bunch of methods for a class to implement.
18:24hiredmanan interface is a collection of method signatures
18:25syamajalaok
18:25syamajalayeah this is the type of stuff i need to learn...
18:25hiredmana class implements an interface by provoding bodies
18:25sh10151maybe you should go l33t and read "A Little Java, A Few Patterns"
18:25sh10151it's very light
18:26sh10151not exactly high on the "best practices for enterpisey java" chart though
18:26hiredmanhttp://math.hws.edu/javanotes/
18:26syamajala;-D it looks like the little schemer!
18:28sh10151syamajala: exactly so
18:28sh10151syamajala: actually it's pretty good
18:28sh10151syamajala: It might have been the first Java book I read
18:28syamajalais it the same question answer type thing?
18:28sh10151syamajala: yes
18:28sh10151syamajala: and don't read it on an empty stomach
18:28sh10151syamajala: it's all about pizza
18:28syamajalaheh
18:29sh10151definitely covers interfaces though
18:29sh10151and how they work in patterns
18:30syamajalamy neighbor let me borrow the little schemer when i was in high school, it helped with understanding recursion
18:31sh10151i will bbl
18:31sh10151toddler on rampage
18:32syamajalamaybe i should get a few other books while i'm at it
18:32hiredmanthere is a clojure bookshelf
18:32hiredman~books
18:32clojurebotTitim gan éirí ort.
18:32hiredman~bookshelf
18:32clojurebotIt's greek to me.
18:32hiredmanbah
18:32syamajalai mean other books
18:33syamajalai've always wanted to learn haskell and erlang
18:33hiredmansyamajala: books on those languages are on the list
18:33hiredman~bookshelf is http://www.amazon.com/Clojure-Bookshelf/lm/R3LG3ZBZS4GCTH
18:33clojurebotYou don't have to tell me twice.
18:34syamajalaprolog!
18:37hiredmantotal for the list is only $1,670
18:38syamajalai have some very big lists
18:38syamajala47 cs books and 46 math books
19:06lowlycoderdoes clojure have any good constructs for persistence/hibernation?
19:06cemerickfor those who frequent databases: are there any good clojure-y strategies for coordinating database operations and in-memory state?
19:12cemerickhrm, I wonder if I'm overusing (-> foo .bar .baz (.blah arg))
19:15Chousercemerick: is that even possible?
19:15cemerickwell, my code is becoming littered with them :-P
19:16cemerickthere's borderline case of (.method (SomeClass/staticMethod) arg) vs. (-> (SomeClass/staticMethod) (.method arg))
19:16cemerickI suppose the latter is clearly preferable, but I start worrying when I use something too much :-)
19:18lowlycoderhow can i, on exception, get a repl in the stack frame, rather than ust
19:18lowlycoderjust a printout of the stack frame?
19:22cemericklowlycoder: get a repl in the stack frame?
19:22lowlycoderyes
19:22lowlycoderand to be able to move up & down frames
19:22cemerickah
19:22cemerickcan't with the current impl
19:22lowlycoderso when it gives me an error of saying "x" is nil, and I see what I have let [{x :x} p] ... i can see what p is
19:23lowlycoderwtf? isn't "exception triggers recursive repl" standard to lisps?
19:23cemerickdefinitely possible in the JVM, but not in place
19:23cemericklowlycoder: common lisps, yes
19:23lowlycoderscheme as well
19:23lowlycoderi'm disappointed, ... it's a common way I debug code :-(
19:23cemerickwell, scheme is a broad world :-)
19:23lowlycoderhow do you debug clojure code without recursive repl, println's all over the place?
19:24Carkhcemerick : really , possible in the jvm ?
19:24Carkhthat would be so cool =)
19:24cemericklowlycoder: no, current practice is to use a debugger. Enclojure is good in this respect.
19:24Carkhlowlycoder : i do print all over the place =)
19:25cemerickCarkh: yeah. Many Java IDE's are capable of "break on error" -- it's baked in to the JVM.
19:25Carkhdebuggers are evil
19:25cemerickclojure doesn't hook into it, though.
19:25cemerickCarkh: it's all the same machinery, at least in the jvm / clr
19:25Carkhcemerick : i would love to break and add/modify definitions, common lisp style
19:26cemerickwell, we're < 2 years in, CL's had ~25. Let's give it another year, and I'll bet you'll be able to do that. :-)
19:27Carkhhehe ok =-
19:27rsynnottcommon lisp's break isn't all that great in most implementations
19:27clojurebotLisp isn't a language, it's a building material.
19:28rsynnott(and slime's support for it is generally very poor; it's one of the bits that isn't maintained well)
19:29cemerickagreed. I've seen some pretty hot stuff in lispworks, tho.
19:29rsynnottyep, lispworks has good debug facilities
19:29rsynnottthe whole lispworks ide is terribly impressive
19:30cemerickI wonder if they could make a run at a clojure environment.
19:30rsynnottit's interesting that break-style debug facilities don't even seem to see much use, though
19:30rsynnotteven where they work well
19:30rsynnottthe slime one is basically undocumented
19:31rsynnottcemerick: I doubt you'd get a lispworks class slime dev environment without a major funded/commercial project
19:31rsynnott*clojure dev that is
19:31cemerickyeah, that's what I was saying.
19:31rsynnottMCL's was also quite nice
19:31cemericke.g. a for-pay NetBeans plugin or whatever.
19:32rsynnottin my experience, even the best netbeans/eclipse plugins just aren't that food
19:32rsynnott*good
19:33cemerickno, mostly because they're unambitious junk with no market
19:33cemerickthere's no market for dev tools in general
19:33rsynnotthasn't been for a while
19:33cemerickbut depending on how the community goes, they could have a *growing* market of clojure devs willing to drop some real money on a top-notch environment
19:33rsynnottthe good ones are mostly built t a loss to push other products
19:34rsynnottx-code, visual studio etc
19:34cemerickI can't imagine there's much upside in the CL tooling space.
19:34rsynnotthasn't really happened elsewhere
19:34rsynnottruby doesn't even have a slime-class dev environment, for instance
20:14cemerickmaybe rather than eliminating use, (use foo.bar.baz) should expand to (require [foo.bar.baz :as baz])
20:14cemerickI do the latter constantly
20:44JAS415is it wrong to want java to be much less verbose?
20:44JAS415i can touch type pretty well and i'm getting tired
20:56tomojuse is going away?
20:58cemerickthere's been a lot of talk about unifying require and use
20:58cemerickand require's usage is definitely more idiomatic
21:06tomojwhat's a good way to represent a DAG?
21:06tomojI'm thinking a vertex can be a map with an :edges key pointing to a vector of other vertices, as long as I never try to print that out
21:07lowlycoderwhy does immutabilty allow correct implementations of hashCode() and equals() autoamtically?
21:08Chousertomoj: why could a vertex not just be a vector of other vertices?
21:09tomojChouser: need other info on each vertex
21:09tomojhmm.. actually I need other info on each edge too :(
21:10tomojlowlycoder: not sure what you mean by "allow"
21:10tomojyou could easily make an incorrect hashCode on an immutable data structure
21:11Chouserif you have a hash map keyed on mutable objects, and one of those object mutates, you have a real problem.
21:12tomojhashCode is always an int, though, no?
21:13lowlycodertomoj: 'allow' = autoamtically generate
21:13lowlycoderalso, why does clojure lack continuations
21:13tomojthen it certainly doesn't
21:14tomojI could hashCode my immutable data structure by returning the current time in seconds
21:14Chouserlowlycoder: clojure uses Java calling conventions for performance, and since Java doesn't have continuations, neither does Clojure.
21:15cemerickfew programming environments outside of compliant schemes and smalltalk have "real" continuations
21:15lowlycoderso each clojure call is a java stack frame?
21:15cemerickyup
21:22lowlycoderare java exceptions are resumable? if so, how do I resume clojure code taht's shown an exception at the repl?
21:22cemerickunless you're running with a debugger that's stopping on exceptions, no.
21:23lowlycoderdo these things not bother any of you?
21:23cemerickmy code doesn't produce exceptions :-D
21:23tomojif clojure weren't java, no one would know about it
21:23tomojI'm ok with these things in return for java
21:24cemerickI took a round trip from Java -> python -> CL -> scala -> clojure. The tradeoffs with the last hit my sweet spot.
21:25cemerickwell, actually, it was assembly -> RB -> CL -> scheme -> Java -> python -> CL -> scala -> clojure, but whatever :-)
21:25lowlycoderwell, i started by pushing electrons around
21:26tomojwhat's RB?
21:26AshRoot Beer
21:26cemericklowlycoder: man, how do you get by with programming languages then? ;-)
21:27cemericktomoj: RealBasic. It's actually a pretty pleasant environment. I picked it up in high school, used it for screwing around and started doing contract work.
21:27cemerickThen college hit, and someone threw MCL at me.
21:27cemerickif they had given me scheme at that point, I probably would have been a lot happier, a lot sooner
21:40ChouserEverytime I think I'm starting to understand git, I don't.
21:42RaynesI don't understand Git. I just use it.
21:43Chouserthe latest commit is "Merge branch 'lazychain'", 'git show' shows me nothing, 'git diff HEAD^' show the preceding commit's diff
21:43ChouserI can't find any branch called 'lazychain'.
21:43Chouserwhat the heck was checked in?
21:44rhickeyChouser: lazychain was the name of my local branch, I guess that's an automatic message on merge
21:44rhickeyI do all of my changes on local branches, then merge into master and push
21:44Chouserthe interleave commit was in there?
21:45rhickeyright
21:45Chouserah, ok.
21:45rhickeyonly that
21:45rhickeyI didn't know when I started the branch what the problem was exactly
21:45Chousersure
21:46ChousukeChouser: you might want to use some graphical tool for looking at git history. plain git log can be really confusing.
21:47Chousukeyou can do a merge and then all the new commits introduced to the branch are somewhere down the log.
21:47Chousukebecause they could be somewhat older than the other commits.
21:50cemerickChouser: gitx is fan-freaking-tastic
21:51lowlycoderwhy is meta data useful? why do I want to use it?
21:52lowlycoderclearly, its important since it's got it's own macro reader symbol, but why?
21:53Chousercemerick: wrong platform, but thanks anyway. :-)
21:54cemerickChouser: no kidding, I pegged you as a mac user
21:54cemerickI mean, isn't everyone? :-P
21:55cemericklowlycoder: lots of data is orthogonal to your domain data model
21:55rhickeygitx ... shiny
21:55Chousukeheh.
21:55Chousukeyeah, it's definitely shinier than gitk
21:56cemerickrhickey: whoa, yeah, you should've had that from the start :-)
21:56tomojlowlycoder: used (doc ...) yet?
21:56rhickeycemerick: doing ok with IntelliJ's git support
21:56cemerickyeah. Honestly, I'm so pro-gitx because NetBeans sucks pretty hard on the git front.
21:57cemerick(not that it's not a nice tool all on its own)
21:57rhickeyIntelliJ rules for Java
21:57rhickeyIMO
21:57Chousukeon a semi-related note, I wonder what happened to egg
21:57lowlycodertomoj: that's meta data ?
21:57Chousukeit's no longer showing me branch names in history view.
21:57cemerickrhickey: are you using the intellij clojure plugin as well, or still emacs?
21:58lowlycodertomoj: whoa, the doc-string in defn is meta data?
21:58Chouserwell maybe gitx would help. gitk's view of the log is hardly less confusing
21:58Chousuke,^#'+
21:58clojurebot{:ns #<Namespace clojure.core>, :name +, :file "clojure/core.clj", :line 629, :arglists ([] [x] [x y] [x y & more]), :inline-arities #{2}, :inline #<core$fn__4091 clojure.core$fn__4091@1bc6ed3>, :doc "Returns the sum of nums. (+) returns 0."}
21:58rhickeycemerick: I do look at and debug Clojure code in IntelliJ, but edit in emacs still until I'm 100% confident in the indentation, right now it is not as sophisticated as emacs for Lisp indentation
21:59Chousukelowlycoder: all that is standard metadata found on most functions.
21:59cemericklowlycoder just got bitten by the clojure bug :-P
21:59cemerickI wouldn't be able to cope with using multiple development environments
21:59rhickeydoes gitx do side-by-side?
21:59lowlycoderrhickey: hey, when are we going to get repls on exceptions? :-)
21:59cemerickhrm, I don't think so
22:00rhickeylowlycoder: not soon
22:00lowlycoderrhickey: why? what can I do to change that?
22:01rhickeycemerick: I'm used to this: http://cloud.github.com/downloads/richhickey/sdb/Picture_1.png
22:03rhickeylowlycoder: If you know about the Java debug API you might have a chance, but Clojure doesn't have the same kind of runtime infrastructure as say a typical CL
22:04cemerickrhickey: Both eclipse and netbeans have break-on-exception capability -- seems like there's a library that could be leveraged somewhere...
22:04rhickeycemerick: I'm happy for any contributions in that area, no doubt there are some facilities, just saying it's not going to fall out of the existing Clojure runtime
22:05rhickeyalso there's a debugger/debuggee dichotomy
22:05cemerickthat's true
22:05lowlycoderhow do you do exploratory programming without recursive repls / ability to resume on exceptions?
22:06lowlycoderabove dichotomy = in existing libraries, i.e. if we use it', it's not clojure repl debugging a clojure program?
22:06cemerickbut for the simple case, getting a repl and restart options should be doable, unless the IDEs are going some serious black magic
22:08cemerickrhickey: opendiff is pretty good if you like the side-by-side
22:08cemerickit's a darn good merge tool, actually
22:08rhickeycemerick: as I said, IntelliJ is working for me
22:09tomojanybody use magit?
22:09cemericksorry, I get chatty late at night
22:11rhickey:)
22:14rhickeylowlycoder: I'm open to contributions, myself, I don't like debugging
22:15rhickeymore flightcaster: http://www.infoq.com/articles/flightcaster-clojure-rails
22:17cemerickhrm, ::foo is :myns/foo in a dosync, but *ns* is always clojure.core in a dosync
22:17rhickeyI wonder how InfoQ does its schedule? I did a talk on state and identity at QCon I wish would come out soon
22:18rhickeycemerick: you are reading ::foo in a dosync?
22:18tomoj,(dosync *ns*)
22:18clojurebot#<Namespace sandbox>
22:19cemerickrhickey: I was actually filtering some keywords based on their namespace, and none of them were matching the name of *ns*. Somehow *ns* is always clojure.core in this particular snippet.
22:19cemerick^ but yes, the above in a dosync
22:20cemerick...not that I can replicate this problem in a smaller example.
22:22rhickeywow, Andy Fingerhut's transcription of the Boston Lisp talk is an act of heroism - 3800 lines!
22:25lowlycodermaps/sets having stable orders -- does that mean garbage collection does not change their order?
22:32rhickeylowlycoder: they are immutable
22:33lowlycodergood point
22:33lowlycoderrhickey: how did you support yourself while developing clojure?
22:34rhickeylowlycoder: used up my savings
22:35lowlycoderhow does this play with parts of life like ... family & friends?
22:53lowlycoderwhy is there lef and letfn ?
23:00tomojletfn is a handy shortcut for letting fns
23:01Chousermore than that. letfn allows local mutually-referential fns
23:02tomojooh
23:02tomojI read "all the names" but that didn't click
23:02tomojpretty cool
23:04Chouserbut it only does fn. 'let' is for other locals.
23:04clojurebotfor is not used enough
23:07lowlycoderwhat'sthe cost of using a trampolie?
23:08ChouserI think the biggest drawback is you have to write the caller and each callee with the knowledge that trampoline is being used.
23:10lowlycoderchapter 6, concurrency; this is a great day
23:13cemericklowlycoder: and to think I had pegged you as a skeptic ;-)
23:21lowlycodercan refs be built out of atoms?
23:23Raynes(atom x @y)?
23:23RaynesEr, vice versa.
23:23Chouserrefs and atoms are two kinds of reference types -- each are used to point to a value
23:23Chouseryou wouldn't generally store one in the other, if that's what you're asking.
23:24Raynes(def x (atom @(ref 10))), is what I was trying to say. :< I should sleep more.
23:25Chouserbut that's just copying a value out of one and storing it in the other.
23:25Chouseron another level, mixing refs and atoms seems a bit risky, since to the ref/transaction world, changes to atoms would be a kind of side-effect.
23:26RaynesChouser: You could interpret what he said that way. He needs to clarify.
23:26lowlycoderi will clarify
23:26lowlycoderif I gave you clojure without refs & stms; and only atoms
23:27lowlycodercan you build stms & refs on top of that single primitive?
23:27lowlycoderlike how locks can be built on top of only "compare & swap"
23:32lowlycoderif a dosync transaction block fails, do the java calls inside of it get rolled back too? (i'm guessing not, since I can do stuff like send packets over the network / delete files) ... if not, how do i know which pieces of java code got executed?
23:36cemericklowlycoder: nothing gets rolled back except for the state of whatever refs have been touched by the transaction
23:37lowlycodercemerick: ahh, nice; thanks, this is _really_ clear :-)
23:37lowlycoderso basically, clojure stms only act in clojure land, and doesn't care at all about the rest of the world
23:37cemerickso, if you've got anything side-effecting in your transaction, you're going to get burned eventually
23:37lowlycoderso even if I called a clojure wrapper for file i/o or network, i lose
23:37cemerickyes
23:38cemerickthat is, unless you're very clear about what the semantics of the call are.
23:38cemericke.g. file reads will generally be OK
23:38lowlycoderbank transactions may be bad ideas though?
23:39cemerickbank transactions are a great thing to do, as long as you're not writing out the result within the transaction
23:40cemericke.g. if you had the bank transaction history in a persistent data structure, in a ref, applying changes to it in a concurrent environment would always give you a consistent picture before and after each clojure transaction
23:40drewrChouser: destructuring isn't working with the new doseq
23:41drewre.g., (doseq [[k v] {:foo 1 :bar 2}] (prn [k v]))
23:42lowlycodercemerick: got it; thanks
23:47drewrChouser: I take that back
23:48drewrI was having classpath issues while updating
23:52Chouserdrewr: whew. thanks.
23:55drewrsorry to scare you
23:55drewrthe exception I was getting was strange though; not sure why it would have happened with either version of the code