#clojure logs

2010-06-07

00:00ravaty
00:01trptcolinsure
00:38_brian2_hi, is there a way to convert a string, say "{:foo "bar"}" to its clojure form?
00:39tomoj,(doc read-string)
00:39clojurebot"([s]); Reads one object from the string s"
00:39_brian2_ok, thnks!
01:39jarturHello, everyone. I have another thrilling question.
01:39jarturDoes anybody know of a way to connect REPL to the running app?
01:39jarturIs there a way at all?
01:49jarturLooks like No =)
01:51jarturOkay
01:51jarturclojure.contrib.server-socket should be it
02:00jarturIt's so easy, I feel embarrassed. But google didn't want to show me the way.
04:27LauJensenMorning all
04:39robinkLauJensen: Good morning.
04:43TheBusbymorning
04:46_extermmorning
05:03LauJensenThere's still a few seats left for the next Conj Labs (http://conj-labs.eu) so let me know if you're interested
05:23esjMorning Good People.
05:35LauJensenlypanov: Where there's a will there's a way
05:35LauJensen:)
05:36lpetitMorning all
05:36LauJensenMorning Mr. Petit
05:37esjwotcha.
05:37lpetitcounterclockwise users in the room ?
05:42lpetitapparently no ... :-(
05:45esjlpetit: I used it briefly but the lack of paredit drove me back to the dark god Emacs.
05:48zmilalpetit, me :) as usual
05:49lpetitesj: the force is with counterclockwise nowadays = 80% of paredit has been ported to it!
05:50lpetitesj: It's called "Structural Editing Mode" (because paredit means nothing to eclipse users), and comes in two flavors: "default" (does not get in your way, e.g. does not prevent you from deleting single open or close paren), and "advanced mode" (my preferred) which tries hard (as paredit does) to prevent you from breaking the structure of your code
05:50lpetitzmila: ! :)
05:50lpetitzmila: did you update to the last version ?
05:50esjlpetit: Great news! I'll give it a spin then :)
05:51zmilai have 57.stable
05:52lpetitzmila: if you're a windows user and are annoyed by the bug on windows concerning "cannot delete file" .., I encourage you to upgrade to 58.stable and give feedback !
05:54zmilalpetit, i did not see this bug
05:54zmilatill now I deleted no clj file :) only adding
05:55lpetitzmila: bug occured when you launch the REPL, and while the REPL is running, you edit and save clojure files
05:56LauJensenIm very fond of Emacs, especially with par-edit disabled
05:57lpetitLauJensen: ccw paredit tries to be more user friendly in the "default" mode
05:59LauJensenBut its like training wheels - Its a habit you need to grow out of
06:00LauJensenHow have you improved it lpetit ?
06:02lpetitLauJensen: separated the features which "surprise you". e.g. when you try to delete a paren, intentionally wanting to temporarily break the structure of your code, but paredit doesn't let you do so, "for your own good". In default mode, this command is not active.
06:03lpetitLauJensen: and there's a note in the status bar indicating if you're in the default mode or in the status mode. And jumping from one to the other can be made by keyboard shortcut, entry in the contextual menu of the editor, or by clicking on the message on the status bar.
06:04lpetitLauJensen: stopped working on porting paredit features yet. Working on improving the overall perf.
06:04LauJensenAh ok, especially the 'non babysitter feature' is nice
06:05lypanovLauJensen: if you have another session at a later date i'll have better luck :)
06:05esjLauJensen: i like my babysitter, she's cute
06:05esjvery curvy
06:07LauJensenlypanov: We are working on some, still Europe but perhaps a little different in scope :)
06:09lypanovhopefully our company will grow a bit and i'll be able to join. at this point i'm still 100% on forging ahead full speed. no time for clojure :(
06:09lypanovstuck in RoR land. (though its not that bad with v 3)
06:10LauJensenlypanov: I've never dug into RoR - Can you recommend any projects for scouting out the basics?
06:11lypanovLauJensen: ror 2 stinks frankly. but there are a few good presentations on 3 by the lead. not sure about canonical good projects alas.
06:12lypanovror 3 is still not out, so not much yet available on it alas. :(
06:12lypanovits the first version that doesn't make we want to weep though.
06:13lypanovLauJensen: if i spot a talk that doesn't assume existing ror 2 knowledge will pass it along. can't find anything with a very quick google.
06:14lypanovanyone know how clojure in clojure is coming along?
06:14LauJensenk
06:14LauJensenlypanov: no idea, cgrand might have a clue
06:14lypanovi'd still love to replace jquery + js with lots of clojure code.
06:15LauJensenlypanov: via scripjure, clojurescript, what?
06:17lypanovLauJensen: via clojure itself. currently doesn't exist.
06:18lypanovi like the gwt model of single language for server / client.
06:18lypanovhaving the same for clojure would make web app devel so much more fun.
06:19lypanovLauJensen: basically i'd want aot js compilation
06:20LauJensenk
06:33lypanovdoes anyone have any opinions / knowledge on good visually orientated code editors much like the self environment but a bit more modern?
06:34lypanovbeing the complete apple ho that i am, i'd just love to hack out clojure on an ipad.
06:34LauJensenhaha
06:34lypanov(html5, touch, no app store)
06:34LauJensenI would like to shake your hand sir, you're the first I've ever met who wants an Ipad
06:35LauJensen"Uuuh I wish my Iphone was too big for my pocket and that I was unable to make calls from it"
06:35LauJensenOr that my websites looked like this: http://bradcolbow.com/archive/view/the_brads_test_how_your_site_looks_on_the_ipad/
06:35lypanovLauJensen: i was in a room last week with 5 of them.. and this was in .nl. freaky.
06:36unfo-LauJensen, ahahahhaha :D
06:36lypanovLauJensen: it looks terrible at an angle, but straight on, i can't see the smudges.
06:36lypanov(nor the light, but i'm used to reflective screens now also)
06:37LauJensenseriously, Steve must be laughing his butt off that people are actually buying his products - I wish I could be paid to have so much fun
06:37lypanovyou have a mac right?
06:37LauJensenNo - I've gotten rid of all of my Mac gear
06:37lypanovah. ;)
06:38lypanovhonestly, i understand where you're coming from. i just wish that someone else would have products worth buying.
06:38lypanov(not talking about laptops here)
06:38LauJensenhmm, actually ipad did win one comparison, I wasnt aware before now
06:38LauJensenhttp://techcrunch.com/2010/01/30/ipad-v-a-rock/
06:38lypanov:P that ones great.
06:39lypanovah, saw a better one. this ones silly.
06:39lypanovthe other one said "battery: unlimited"
06:39eevar2apple's releasing new stuff today, no?
06:39lypanoveevar2: yeah but not h/w.
06:39lypanovwell, other than iphone.
06:39lypanovanyway. as i said, i'm an apple ho.
06:39lypanovi verily admit to insanity.
06:39LauJensenI wish I could get my hands on the prototype: http://img.hexus.net/v2/news/apple/ipad-joke-1.jpg
06:40lypanovLauJensen: have you used one?
06:40LauJensenNo of course not
06:40lypanovk.
06:40LauJensenDo I look like an iTard? :)
06:41lypanovyou used to be, did you grow a beard recently? :)
06:41LauJensenhehe
06:41lypanovanyway. i regret my mention of apple ho.
06:41LauJensenWhy, did I hurt your feelings?
06:42lypanovshould i say "OMG I WANT A CLOJURE APP ON MAH ANDROID PAD :("
06:42lypanovLauJensen: naah, just that it got off topic.
06:42LauJensenOk :)
06:42lypanovi was more interested in actual movement on touch interfaces for programming.
06:42lypanovi think they could really kick ass.
06:42lypanovsyntax free langs are the only ones that its possible with.
06:43LauJensenWell, in terms of development, anything from Apple is truely uninteresting
06:43lypanov*nod* but i'm talking about a website.
06:43lypanovand the ipad is the only readily available large multi touch device atm.
06:43lypanovbut lets say something else does come out, and i'm talking about that.
06:43lypanovlets call it the LauPad
06:44lypanovi still think that visual touch orientated development is a progression that would afford many things we currently can't do easily without a fair bit of interaction.
06:44eevar2the iphone store is supposedly a lot better than android et al. in terms of making actual sales
06:45lypanovyeah. but as i said, i want a clojure dev env.
06:45LauJenseneevar2: Due to the large user base no doubt
06:45lypanovi'm not interested in selling it. nor in native apps.
06:45lypanovapple would block any app i wrote anyway.
06:45eevar2LauJensen: and willingness to pay
06:46lypanovi won't touch a non open sourced editor again in a few life times, and wouldn't want to force it upon others either.
06:46lypanovimagine where textmate could have been by now if it was open.
06:47lypanovanyway. i'll go off and look for some papers. someone must have done something interesting in the area.
06:48eevar2LauJensen: then again, the people telling me android users won't buy stuff are into add based revenue ;)
06:48lypanovad based < closed source < open source
06:48lypanovnothing is worse.
06:48eevar2lypanov: and gpl < mit/bsd
06:49lypanovyup.
06:49lypanovwell, for applications sometimes i disagree.
06:49lypanovbut plugins must always be bsd/mit and libs also.
06:50lypanoveven agpl is nice. i just wouldn't ever want to be the consumer of it ;)
06:50lypanovi'm gonna disappear as #clojure hasn't been more offtopic in a while :P
07:41rhickeyanyone with examples of Java APIs that require your class have a particularly named static method?
07:43telmichhello
07:44LauJensenhi telmich
07:47karmazillarhickey: in spring, you can instantiate beans by specifying a static factory method
07:48rhickeykarmazilla: must it have a particular name?
07:48karmazillarhickey: no
07:49rhickeyI'm interested in the case where an API says, you must have a static method called "___"
07:51esjclojure.lang.IPersistentCollection calls for equiv. Any pointers on what this is and how it differs from Object.equals ?
07:54powr-tocI've just update slime to 20100404 (from elpa) and tab completion has stopped working in the REPL buffer... It just says "No dynamic expansion found for user> foo"
07:54powr-tocany idea how to fix it?
07:56telmichI'm wondering, how to get the zip-reader running
07:57telmichI'm trying to get this file running http://github.com/panter/edu/blob/master/clojure/imdb/src/imdb/movies_by_years.clj and installed clojure via lein
07:58telmichwhen removing the comment and having downloaded the required files before, I get the error "java.lang.Exception: Unable to resolve symbol: zip-reader in this context (NO_SOURCE_FILE:50)"
07:59telmichwhere lein is downloaded from http://github.com/technomancy/leiningen/raw/stable/bin/lein
08:44rhickeycemerick: got any examples of Java APIs that require your class have a particularly named static method?
08:46cemerickhrm
08:48rhickeycemerick: you were suggesting injecting a static method with a particular name might interfere with interop requirements
08:49cemerickoh, I was just saying that if you also want to allow the definition of static factory fns, then you'd want to push any automatically-generated statics into some "safe" mangled territory, e.g. Foo/_record, Foo/_ctor, etc.
08:50rhickeycemerick: so they have to be then wrapped in order to not be ugly?
08:51cemerickrhickey: we're still in the context of the map factory fn?
08:51rhickeyyes
08:53cemerickno, the "wrapping" would be there so as to present a consistent interface, and get out of the territory of Foo-from, etc.
08:54cemerickThe static factory fn that happens to be a static method is an impl detail.
08:56rhickeycemerick: unless you have a recipe for avoiding ongoing non-modular accumulation in (record ::Foo ...), it's definitely on the ropes
08:56rhickeyits not an implementation detail, it's an implementation impediment
08:57cemerickI missed what the modularity issue is. (record Foo ...) just becomes a macro to (Foo/_record ...), no?
08:58rhickeyif macro, can't be applied
08:58cemerickah, right
08:58rhickeycan't be used in data-driven manner
08:58cemerickwell, that's separate from this modularity issue
08:59rhickeynot really, if you didn't care about apply or data-driven use the macro wouldn't have modularity issues
09:01cemerickback in a sec
09:51cemerickrhickey: from left field: perhaps the most sensible thing would be to determine how factory fns should work in general, and then figure out how these various default/standard factory fns fit into that.
09:54rhickeycemerick: I have pages of notes around this already, just trying to shake out the (record Foo ...) option. If I thought it was the nicest thing ever but couldn't implement well, it won't go in
09:55rhickeyconceptually, they are very simple - they are functions that call the ctor, but take arguments that differ from the ctor's
09:56cemerickrhickey: I understand, but stepping back, those "userland" factory fns presumably wouldn't fit into the (record Foo ...) regime, and they wouldn't fit into a Foo-from option either. The key is not in the implementation, but in the UI, as it were.
09:57rhickeycemerick: what do you mean by userland?
09:57cemerickfactory fns for which the impl is user-defined, as opposed to canned / provided by default
09:58rhickeycemerick: having the generated either target or be replaced by user code is easy
09:58cemerickcouldn't parse that :-)
09:59rhickeyit is easy to make the canned/provided version either target or be replaced by the user-impl
09:59cemerickah
10:00cemericksure
10:00cemerickwhat I'm driving at is that these canned factory fns should probably be handled just like those userland factories -- in terms of where the vars live (if any) where the static methods are (if any), etc.
10:05hugodrhickey: could the data-driven use be covered by (record (some form) ...) expanding to (invoke-factory-using-reflection (some form) ...)? or am I misunderstanding "data-driven"?
10:05rhickeyhugod: there will be no reflection based things
10:06rhickeyso data driven implies some sort of self registration by the record into some sort of dispatcher
10:08chouserto be modular, that implies the registration is held at the classloader? which suggests a static method of the class itself?
10:08hugodto prevent modularity issues, each namespace could maintain some registration data for the dispatcher?
10:09rhickeychouser: I'm not sure modular and dispatcher are compatible at all
10:09a_strange_guyjust a stupid question: What was the original reason to switch from 'Foo as a fn living in a Var to 'Foo beeing a auto-imported java classname?
10:09cemericka_strange_guy: only java.lang.* stuff is auto-imported.
10:10rhickeycemerick: no, defrecord Foo imports Foo
10:10chouseris modularity a general problem for multimethods dispatching on type?
10:10cemerickoh, didn't think a_strange_guy's Q was related to records, my bad :-/
10:11rhickeya_strange_guy: because deftype started generating named classes, so too confusing to have user.Foo and user/Foo
10:11rhickeychouser: yes
10:12rhickeychouser: but not inherent, as with factories, who's fn itself refers to the type
10:13cemerickback to basics, perhaps. Strawman time: https://gist.github.com/a455d0afd7478092b141
10:13cemerickapply is nice, but direct usage is probably 90% of the game, and is needed for the interop story anyways.
10:14rhickeycemerick: ick
10:14a_strange_guybleh, dont like static factories
10:15cemerickrhickey: interesting, I thought that's what you were aiming for for user-defined factories anyway.
10:15rhickeya_strange_guy: vs what?
10:16a_strange_guystatic factories and constructors mean that I have to re-eval not only the defrcord form but all it's users
10:16a_strange_guyelse they keep producing the old version of the record
10:17cemerickwithout static factories *and* ctors, I think you're left with vanilla maps. :-)
10:17rhickeywell, the dynamism is an important point, and a difference between (record Foo ...) and (record ::Foo ...)
10:18rhickeyyou can always build dynamic things on static, but not vice-versa
10:18rhickeyso, I understand a_strange_guy's point
10:19a_strange_guywell i really don't think that static things are needed at all
10:19a_strange_guyexcept maybe for Interop
10:19rhickeya_strange_guy: what about performance?
10:20a_strange_guyis there one?
10:20rhickeya_strange_guy: one what?
10:20a_strange_guycalling a fn wrapping the ctor or calling the ctor directly?
10:21rhickeya_strange_guy: a perf difference? yes
10:22a_strange_guymeh, I put too much hope into the JIT ^^
10:23rhickeythe JIT is awesome, but saying something is dynamic makes it volatile, which inhibits inlining
10:27a_strange_guyand what about direct binding?
10:28rhickeya_strange_guy: avoids that by taking the value out of the var, remembering it, and thus making it non-dynamic
10:29a_strange_guythis would be IMHO preferrable
10:29a_strange_guymaking the default record construction dynamic
10:29rhickeya_strange_guy: same result, must re-eval
10:30a_strange_guysure, but only where we have perf bottlenecks
10:31a_strange_guymaking the default static seems like premature optimization
10:32rhickeya_strange_guy: I don't se what you mean by default. The dynamic must be built upon the static
10:32rhickeyif you don't want to call the ctor, don't
10:32rhickeyif it didn't exist, then what?
10:33a_strange_guythe way i understand the JIT is:
10:34a_strange_guystatic -> full inlining
10:34a_strange_guywrapper fn in a var -> no inlining
10:35a_strange_guywrapper fn in a var + directly bound at callsite -> full inlining?
10:35rhickeyonly if there is something static to inline to
10:36a_strange_guythe wrapper fn would call the native ctor
10:36rhickeydefrecord now provides an accessible named ctor. Don't use it if you want dynamism
10:36rhickeya_strange_guy: I understand all this, sheesh
10:37rhickeythe class exists, it has the name you gave it, the constructor has the same name. These are baseline facts. You want a function, you can write one that calls these things. You want one generated by defrecord, propose a name
10:39a_strange_guylooking at the IRC logs i don't think that i could provide a better name
10:40rhickeynot auto-importing the class and commandeering its name for the factory fn would preclude importing it
10:41a_strange_guyLISP-1: you only have one namespace, so use it wisely xD
10:42TweyHaha
10:43a_strange_guymy proposal would be to return to Foo beeing a fn in a var, but having metadata on the var to find the correct class
10:43a_strange_guyand some magic for extend and type-hints
10:44a_strange_guybut I don't think that this is thought throgh till the end
10:45a_strange_guymy english sucks :-)
10:49a_strange_guythat would mean that (Foo "some" "args") calls the fn dynamically,
10:49cemericka_strange_guy: we've been there already
10:50a_strange_guyhmm
10:50cemerickthat is, that's what records started with
10:50JorejiHey guys, I have a java app from which I start a new thread which itself loads a clojure class. Is there some way to set the COMPILE_PATH variable before the class is being loaded (i.e. from the java code with something like Var.pushThreadBindings)
10:51Joreji?
10:51cemerickJoreji: why do you care about *compile-path* if you've already got a classfile?
10:52a_strange_guyjeah, i just liked that simplicity
10:54cemerickThe current state is strictly simpler than if Foo were a fn. Now you have easy access to the generated class, and using it is just like using any other class.
10:55rhickeyadmittedly hosty and less dynamic
10:55cgrandon Foo/record and apply, what about not making Foo/record a static method but a static field pointing to a IFn? (this would require modifying the compiler to support calling a fn in a static field)
10:55Jorejicemerick: Well, I want other classes to be compiled before loading the class. Basically during start-up of clojure.
10:56a_strange_guycgrand: there ist still a problem with redefining the defrecord
10:56JorejiI've modified clojure to do that, however I need a way to set the COMPILE_PATH to something different before the clojure start-up.
10:56cemericka_strange_guy: the same "problem" exists with macros. *shrug*
10:56rhickeycgrand: it complicates the semantics of (Foo/bar ...) quite a bit
10:56cemerickJoreji: do you need to compile a class, or *load* a class?
10:57Jorejicemerick: compile.
10:57cemerickJoreji: this is in a deployment environment?
10:57Jorejicemerick: ... and then load, I guess.
10:57Jorejicemerick: It's on android.
10:58JorejiNot sure what you mean by deployment environment.
10:58cemerickJoreji: then I'm really confused -- don't you need to AOT-compile everything you want to get onto the device?
10:58a_strange_guyrhickey: is making Foo a fn in a var again completely out of question?
10:59rhickeycemerick: I've made that argument also (same re-eval as macros), but people expect otherwise. I feel we are approaching a real divide between people needing perf and those desiring dynamism at all times
10:59Jorejicemerick: No. Android has its own compiler for the dalvik vm which compiles java vm bytecode code to dalvik vm bytecode. I can thus do: .clj (clojure source) -> .class (compiled java) -> .dex (compiled dalvik)
10:59bartjreading russian data present in a mysql table and spewing it to the output, all I get is garbage
11:00cemerickJoreji: right, I understand that, but doesn't that workflow need to happen before the app is loaded onto the device?
11:00rhickeycemerick: putting a good knob/swithc on that is tricky
11:00bartjusing clojure.contribl.sql -> does that take an encoding parameter?
11:01Jorejicemerick: Not really. All required components are available on the device, so it is possible to do it there.
11:01cemerickrhickey: I'm not particularly sympathetic to those that push for hardcore dynamism. That makes a lot of stuff really hard across the board, it seems (and again, you're tied up with macros anyway).
11:01bartjnope, none of the clojure.contrib.sql takes any encoding parameters?
11:01a_strange_guyit's more a divide between "perf as default and dynamism when needed" and "dynamic as default and perf when needed"
11:02cemerickJoreji: Interesting. Well, anyway, yes, you can use pushThreadBindings from Java. Grep the clojure source for how to do that. :-)
11:02cemerick(not a very common requirement)
11:03rhickeyif people have to annotate every thing explicitly in order to be fast, then fast programs will be very ugly (see CL)
11:03Jorejicemerick: Hmm. I've already tried using: Var.pushThreadBindings(RT.map(Compiler.COMPILE_PATH, path));
11:03Jorejicemerick: Alas that didn't work, so I expected it to require clojure already being initialized.
11:04cemericka_strange_guy: perf must be the default. No one puts up with slow anything for very long.
11:04cemerickJoreji: well, yes, clojure must be fully initialized for that to work, I'd presume.
11:04cemerickAlthough just referencing RT should do that.
11:04canderacemerick: Rubyists might say otherwise
11:05cemerickcandera: exactly! :-P
11:05a_strange_guycemerick: The reverse argument is also true
11:05candera:)
11:05a_strange_guyThe python and ruby people rewrite stuff in C to make it fast
11:05Jorejicemerick: As in: import clojure.lang.RT ?
11:06cemericka_strange_guy: no, it's not. You can always layer on dynamism if you really need it, as rhickey has said. You can't make a heavily-dynamic system as fast it it would be if it were static, no matter how hard you try.
11:06candera"Make easy things easy and hard things possible"
11:06cemerickJoreji: Probably on first reference (i.e. RT.map will init the class, not the import)
11:07cemerickthough I suppose dalvik might be different in subtle ways
11:07TweyPython doesn't any more so much… you've got Cython and RPython and stuff instead
11:07Tweya_strange_guy: ^
11:09hugodJoreji: *compile-path* is initialised from the clojure.compile.path property - is that what you want?
11:10a_strange_guycemerick: sure you cant make a dynamic system as fast as a static one, but that is a straw man. The goal is to provide the knobs to make a dynamic system more static, so that it can become as fast as a static system
11:12a_strange_guyand adding dynamic layers on a static system isn't always a good idea
11:12cemericka_strange_guy: I'll refer to rhickey's comment about CL. Further, defaults matter a lot. You should not have to work harder to get a system that performs to its fullest. Advanced users that want über-dynamism can be expected to jump through a few hoops though.
11:13cemerickBesides, are you looking for macros to operate at runtime? If not, then referring to defrecord ctors aren't a problem either.
11:13foguscandera: I think that the Ruby guys have made a conscious decision to trade speed in execution for speed in development time.
11:14a_strange_guythere is a big difference between macros and static ctors
11:14a_strange_guymacros do stuff that can't be done at call time, only at compile time
11:14Jorejihugod: I'll try that out now, thanks for pointing it out!
11:15Tweyfogus: False dichtomy
11:15Tweyfogus: In doing so, they throw away the chance to do both
11:15canderafogus: Yep. My point was simply to counter cemerick's statement, as it's dependent on what you're doing. I'm actually happy to have a language that defaults more in the perf direction.
11:15cemericka_strange_guy: the point is that if the macro definition changes (or if a defrecord class changes) you need to reload all your usages in order to get the new behaviour/classes.
11:17fogusTwey: It's only a false dichotomy if you think Ruby can be fast. ;-)
11:17TweyHaha.
11:17TweyIt probably can, though. Haskell manages to be pretty fast, after all, and it's much higher-level than Ruby.
11:17canderaWasn't someone in here the other day claiming that JRuby was going to get faster than Clojure "pretty easily"?
11:17fogusTwey: But my point was not that severe. I think speed in development time is just as legitimate as speed of execution... thankfully Clojure allows both.
11:17TweyAye
11:17a_strange_guyI just don't accept the "macros and ctors are similar cases" argument
11:18a_strange_guynormally your code isn't littered with macros everywhere
11:18cemerickheh
11:18Chousukewell
11:18Chousukenot with macros that YOU wrote :P
11:18cemerickI was going to say. :-)
11:19a_strange_guyhaving many defrecords in a namespace is realistic
11:19cemerickThe whole point of them is that they *are* classes with fields, permitting host-esque performance. There's a tradeoff there compared to regular maps.
11:20a_strange_guyyeah
11:20a_strange_guybut you can't use regular maps instead
11:20a_strange_guybecause they don't allow protocols
11:20cemerickright, because regular maps can only be dispatched dynamically
11:20cemerickthat's what multimethods are for
11:21a_strange_guyProtocols are dispatched dynamically too...
11:21cemerickno, they're dispatched based on the static type of the first argument
11:22a_strange_guys/dynamic type/static type/
11:22sexpbotProtocols are dispatched dynamically too...
11:24lypanovfogus: heya. just wondering if manning has said anything about epub editions of the clojure book? i only read on my iphone and it hates pdf's :(
11:24foguslypanov: I think epub will be available when the book is finally published.
11:24a_strange_guyIMHO you shouldn't be punished to reloading your code if you wan't to do explorative programming with defrecords
11:24canderalypanov: I've been reading on iPod as well. It's not an awesome experience, no. But GoodReader's text mode does reasonably well with it.
11:25lypanovfogus: :( *nod* thought so.
11:25foguslypanov: Sorry.
11:25cemericka_strange_guy: punished?
11:25lypanovcandera: it seemed to really mess up the text i was reading. example code was seriously messed up for example.
11:25lypanovmaybe i should try latest stanza.
11:26canderalypanov: Yeah, I have to flip back over to the regular view for code.
11:26lypanovfogus: not your issue. just hope they change the way they publish meaps in the future.
11:26a_strange_guycemerick: I fix a typo in a defrecord form
11:26lypanovif the dang ipad was here already i'd be reading :)
11:26canderalypanov: +1 on both
11:27a_strange_guybut have to reeval every defn where the type gets created
11:27cemericka_strange_guy: again, same situation as with macros. Again, defrecord and its kin generate a class.
11:27lypanovcandera: i even wrote a new app to do it. but the width of the content is just slightly too high to fit in landscape even with pixel tweaking.
11:27lypanovcandera: (pdf reader with page turn via swipe)
11:28lypanovgreat for papers though. but i'd prefer an ipad or higher res iphone to most content on the iphone currently.
11:28canderalypanov: PDF on iPhone is definitely suboptimal. iPad would be perfect if a) I could fold it up to fit in my pocket, and b) someone other than Apple made it. :)
11:28a_strange_guycemerick: most macros just wrap some forms in a thunk, and expand to a call to a fn
11:29a_strange_guyso you can actually fix most macros by just fixing the underliing fn
11:29cemericksome are like that yes -- many, many others are now
11:29cemericknot*
11:30lypanovcandera: yeah... god the m$ thing looked beautiful.
11:30a_strange_guyI don't want to get in an argument here, but most people try to make macros fixable at runtime
11:30cemericka_strange_guy: FWIW, absolutely no one here is against dynamic development. I think the consensus is that we'll accept a dent in dynamism for maximal perf, though.
11:31cemerickThere's massive classes of macros that exist to do work at compile time rather than runtime. That's not a hit on them, that's their entire purpose.
11:33a_strange_guywhat I am trying to say is that static constructors are a big pain in the ass in Javaland
11:34cemerickheh, along with all manner of other things! :-D
11:34a_strange_guythey try to work around that stuff with all the DI bullshit
11:34cemerickindeed
11:34a_strange_guyso why import static constructors fom Java
11:34cemerickBecause we want to be fast.
11:35a_strange_guyxD
11:36cemerickThere's lots to hate in the JVM world. Lots more to love IMO. One of the biggest parts to love is that the JVM is smokin' fast. If you didn't want to take advantage of that, then there's far, far less of a reason to use the JVM.
11:36a_strange_guynobody stops you fom writing (new namespace.Foo <args>) if perf is needed
11:36cemerickSame with the CLR, BTW.
11:37cemerickSure, but defaults matter. You line everyone up, and they'll care about perf far, far, far more than development-time dynamism.
11:37a_strange_guyactually 'new could do some magic and allow (new Foo <args>)
11:37cemerickAgain, macros present the same issues.
11:37cemerickOy.
11:38cemerickmagic == indirection
11:38a_strange_guyindirection == bad?
11:39a_strange_guyactually this would seem logical
11:39cemerickI remember when I suggested (a long time ago) to rhickey that some conditional be added to new. I got taken to school. :-D
11:40cemerickindirection has a perf penalty
11:40Twey(= 'indirection 'abstraction)
11:40cemerickThe language should not get in people's way.
11:40a_strange_guy'new is a special form that allows fast and hosty object creation
11:40TweyAnd abstraction is good
11:40cemerickTwey: actually, that's not true. Macros are a good abstraction, but need not introduce any indirection.
11:41Tweycemerick: Macros are indirection by definition
11:41TweyThey introduce an extra layer between the code you write and what actually happens
11:41cemerickonly at compile time :-)
11:41candera"There is no problem in CS that cannot be solved by adding a layer of indirection. There is no problem in performance engineering that cannot be solved by removing one."
11:41a_strange_guynew could do this 'magic' at compiletime
11:41Tweycandera: Hehe
11:42a_strange_guyif the first form is not a class but a Var
11:42TweyIn some cases, abstraction can lead to better performance
11:42TweyGood abstractions add semantic information to operations, which allows the compiler to make optimisations based on it
11:42TweyAlso, see lazy evaluation
11:43a_strange_guyill sketch my idea up...
11:44cemericka_strange_guy: so you're going to propose radically changing one of the core host interop operators?
11:45a_strange_guythere is no change, 'new still performs fast, hosty and direct object creation
11:46cemericka_strange_guy: in any case, my hat's off to you. Good luck. :-)
11:50a_strange_guyno offence taken
11:54hugodcgrand: to run the enlive tests, I had to add clojure-contrib as a dev-dependency in project.clj
11:55cemerickcontrib isn't a direct dep anyway?
11:55cemerickhugod: feh, nm, I thought we were in #pallet :-P
11:56cgrandhugod: thanks, I should update the tests to use clojure.test too
11:58rhickeypoll: if you had to qualify a defn with some metadata tag in order for it to have these characteristics: direct-linked, could take/return primitives, non-closure, no self-reference as object/HOF (self-call ok), what tag would you use?
11:58rhickey:static?
11:58rhickey:fast?
11:59AWizzArd:static is okay, and it will remind people of static typing
11:59cgrand:static
12:00a_strange_guy:static
12:01rhickeynote that you could still use the resulting fn as a HOF/IFn
12:01a_strange_guyalthough i wouldn't use defn to define it
12:01AWizzArdI would be glad about any optional information that is known at compile time.
12:02canderaI've always thought static was a horrible keyword. The semantics for those of us who have been doing C-family programming for 20 years are right, but in and of itself I think there must be something better.
12:03cgrandrhickey: is that an asnwer to my kludgy defhintedfn?
12:03rhickeycgrand: perhaps, I'm measuring the difficulty now. But it covers a lot of things, including the 'knobs' for direct-linking, etc
12:03hiredman:metal
12:04hugod:native
12:04candera:bare?
12:05a_strange_guyI would like :native, but that would confuse Java-people
12:06a_strange_guyso :static or :statically-linked-and-really-fast-do-not-use-if-not-needed xD
12:06TweyHaha
12:06AWizzArdWell, I think this is all about static information, that won't change at runtime, and are known at compile time.
12:07rhickeyalso static as in the opposite of dynamic
12:07AWizzArdAs long this is optional it's great.
12:07rhickeyit would be an important difference in direct linking, moving the decision to the fn definition and away from the caller. Not that you have control over that right now, that's the current architecture
12:09a_strange_guymeh...
12:09rhickeycgrand: I've had statics and defstatic on the todo list for a while, this would unify several things and deliver in the context of fns.
12:09AWizzArdWhatever the key is, be it :static or whatever, what is the value? Just a true/false? Or a record of information?
12:09rhickeytrue
12:10AWizzArdah ok
12:10AWizzArdWell, in that case :fast is also fine.
12:11rhickey:fast was a joke
12:11cgrandI guess that most of core fns would be marked as :static then and the special-case for direct-binding removed
12:11rhickeycgrand: exactly
12:13rhickeysince primitive args/return would only be supported for :statics, using them without saying :static could either: A) be an error, B) be implicitly :static true
12:13lpetitrhickey: what would happen if someone tries to rebind such a var ?
12:14rhickeylpetit: nothing. you might do this as part of fixing code interactively, with the caveat that you must re-eval any consumer code to see the effect, just like with macros
12:14AWizzArdA) ==> the compiler should signal an error
12:16lpetitrhickey: new semantic (direct linking, non closure, no self reference apart from itself) => new "public API" keyword ? that is why not :static as the metadata , but the preferred usage be via e.g. defstatic / defnstatic ?
12:17lpetits/keyword/command/
12:17sexpbotrhickey: new semantic (direct linking, non closure, no self reference apart from itself) => new "public API" command ? that is why not :static as the metadata , but the preferred usage be via e.g. defstatic / defnstatic ?
12:17a_strange_guylpetit: agreed
12:17rhickeylpetit: I'm not quite sure I understand
12:18a_strange_guydefn shouldn't hve a semantic change
12:18a_strange_guyif you see that a corefn is defined with defstaticfn or similar
12:18rhickeyI'm sure people will get tired of (defn {:static true} foo ...) just like with :private
12:19lpetitrhickey: yes, defn having a semantic change seems odd to me. Maybe internally (or for power users), why not have the :static keyword metadata, but for "normal" users, having defstatic will *clearly* prompt in their mind that they are dealing with a new kind of definition
12:20lpetitrhickey: this looks more like a new kind of definition than a variant to me
12:20lpetitrhickey: :private was ok, a variant with a different scope. But once you have the var in your hands, everything happens like usual.
12:21a_strange_guyrhickey: do you plan to compile this down to static methods?
12:22rhickeylpetit: well, we're back to layering. It is a variant, and I'm not opposed to a defsomethingshort, but lots of things yield defns, and metadata flows...
12:22rhickeya_strange_guy: I'm not planning anything yet
12:24lpetitlpetit: just like defmacro is a defn with a :macro true metadata, but nobody in current code writes it with anyhting but defmacro, I would see defstatic, with still (as for defmacro) the :static metadata keyword. Oh this would be really consistent: defmacro / :macro , defstatic / :static
12:25rhickeylpetit: but defmacro could turn into something completely different tomorrow
12:25rhickeythe fact that a macro is a fn is an implementation detail
12:26lpetitrhickey: wouldn't it be the same for defstatic ?
12:26rhickeyNo, the things inside defstatic vars would be guaranteed to be IFns
12:26lpetitrhickey: with some constraints at definition time, but not visible to the caller
12:27lpetitrhickey: but the need to reeval user code if the definition changes ...
12:27rhickeyright, and some linkage directives
12:27rhickeyhigher-order usage would go through the var, as would (#'my-static-fn ...)
12:33lpetitrhickey: higher-order function via the var would then "loose" the "no boxing" property ?
12:33rhickeylpetit: right
12:38lpetitdoes somebody know if there is a version of try-clojure.org which works with 1.2.0 snapshot ?
13:14LauJensen(clojure-version)
13:14LauJensen,(clojure-version)
13:14clojurebot"1.2.0-master-SNAPSHOT"
13:24bartjreading this string - "Детские сады, детские центры, дошкольное образование, прогимназии, ясл" from a MySQl database prints jibberish in Java
13:24bartjI am using the clojure.contribl.sql library
13:25bartjdoes one have to decode UTF-8 strings while displaying on the console?
13:25bartjwhat I see is this - "Абразивные инструмент оптом
13:25bartj"
13:26mefesto_bartj: can you read the value in the database by some other means to make sure it was inserted w/out error?
13:26bartjmefesto: yes, I am able to do so in Perl
13:27bartjwith no charset supplied...
13:32mefesto_bartj: have you tried manually specifying the character encoding in the jdbc url connect string?
13:33bartjmefesto_: no, I will look in the documentation right now...
13:40bartjmefesto_: yes, retried specifying the encoding as follows - "useUnicode=true&characterEncoding=utf8"
13:40bartjmefesto_: does not work as expected...
13:40mefesto_bartj: and you are sure that the server itself is using utf8 too?
13:41bartjmefesto_: er, you mean the mysql server?
13:41mefesto_yeah
13:41bartjmefesto_: yes
13:42bartjbartj: "CHARSET=utf8" is specified while creating the mysql tables
13:43bartjmefesto_: I am able to read the db values from a Perl program....
13:44mefesto_bartj: yeah, i was just thinking that maybe for some reason connector/j wasn't able to auto detect the correct encoding but perl was...
13:45bartjmefesto_: which should not be the problem, since we have specified the encoding in the URL string?
13:45mefesto_bartj: yeah
13:53tcrayfordis printing it out the problem?
13:54tcrayfordiirc slime/swank might not work that well with utf8 (it works, but needs some configuration set up_
13:54bartjtcrayford: no, because, I am able to print it out in Perl?
13:54tcrayfordwhen you display the string in the repl I mean
13:54chousergood question. Since the String should be unicode-aware, it would be helpful to know if it made it correctly into the String or not.
13:54bartjThis URL quite nicely explains what the problem is - http://linux.kieser.net/java_pg_unicode.html
13:54bartjthough the problem and the solution both are for PostgreSQL
13:55tcrayfordthat's somewhat nasty :/
13:55chouserbartj: maybe check the length of the string to see if it is right or not?
13:56canderaYou should be able to write it to a file and view it, no? That will bypass display-related issues.
13:57chouserif the length is right, the problem is in printing the string. If the string is too large, the problem is getting it from the db into the string.
13:57bartjno, writing to a file doesn't help
13:58bartjtcrayford: you refer to the URL I pasted?
13:58canderaMeaning I'm wrong and that doesn't tell you anything, or you tried writing it to a file and it's still garbage in the file?
13:58tcrayfordbartj: yes
13:59bartjcandera: I tried writing to a file and it's still garbage
13:59canderaAre you sure the editor you used to view it knows what the encoding of the file is?
13:59canderae.g is there a BOM at the beginning
13:59chouserthat doesn't prove much, if the thing writing the file or the thing reading the file chooses the wrong encoding.
13:59bartjcandera: BOM?
14:00canderaByte Order Mark. Seen often when serializing XML. A couple of bytes that help readers of the file detect the encoding.
14:00chouserI'd check the length of the string while it's still in java, no IO having been done since reading from the db connection.
14:01canderabartj: are you on Windows?
14:02bartjcandera: No, Linux - Ubuntu
14:02bartjregarding the string length, doing a length(column) on mysql gives a value of 261
14:03canderaAh. I don't know the editor landscape there. On Windows at least, some editors fail to deal with encoding and some get it right.
14:03bartjand doing a .length() after reading it from the Db in Java gives a 42
14:03chouserwhoa
14:03bartjI mean 52
14:03chouserso there's definitely something broken there. too short? maybe it's tripping over a null or something.
14:03bartjcandera: It displays quite nicely when I output it on the bash command line using a Perl progam
14:03chousernot a display issue
14:04bartjcandera: so, I am pretty certain it is not a display issue
14:04canderaYeah, if the length is goofed up, that's not it.
14:04canderaSorry for the red herring.
14:05chouserbartj: you don't have a .getBytes() method you can try instead of .getString() or seomthing?
14:06chouserbartj: you've seen this page? http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-charsets.html
14:08bartjchouser: yes
14:08bartjI suspect the problem is that I am encoding characters twice!
14:09bartjbut decoding the db output (in Java) does not seem to solve it... :(
14:09chousernot if it's already too short
14:10bartjchouser: I am not sure if the comparision I did is apt?
14:11chouserthe column is a string in the db, not bytes or something else?
14:11chouserif so, then length(col) should be your gold standard.
14:12chouserJava strings can contain nulls and such without the .length() method failing, so whatever chars make it into the string will be counted.
14:13chouserthe question being then the format of the data sent by the server to the jdbc driver, and then how the driver interprets that to create the Java string. Surely those are the only two places left to mess it up.
14:15bartjthe string length of this is - "Детские сады, детские центры, дошкольное образование, прогимназии, ясли": 71
14:15chouserI see nothing but blanks and commas between those quotes. :-)
14:16bartjchouser: ha
14:16chouserbut we're not trying to solve my IRC client's unicode problems, so that's ok.
14:18neotyk,(count "сады")
14:18clojurebot4
14:20neotyk,(.length "сады")
14:20clojurebot4
14:20KirinDavewell played, java
14:20neotykbartj: what's the problem?
14:21neotykI had quite some problems with PL encoding while ago
14:22bartjneotyk: I am unable to display unicode strings (russian for now) from mysql database
14:22neotykwhat is your connection string? do you set client encoding (jdbc driver)?
14:24bartjjdbc:mysql://localhost/db?useUnicode=true&characterEncoding=UTF-8
14:24bartjneotyk: yes
14:25bartjthe string size is 71, but when I read it from the mysql database it shrinks
14:26neotykand you see those characters in mysql client
14:26bartj, (count "Детские сады, детские центры, дошкольное образование, прогимназии, ясли")
14:26clojurebot71
14:26bartjyes, absolutely
14:30mozinatorhi guys, fetching clojure from leiningen doesnt seem to work anymore for me, anyone else noticed this ? [WARNING] repository metadata for: 'snapshot org.clojure:clojure:1.2.0-master-SNAPSHOT' could not be retrieved from repository: clojure due to an error: Error transferring file
14:32lancepantz
14:32chousermozinator: Can you fetch it from build.clojure.org instead?
14:34mozinatorchouser, I can download it from here: http://build.clojure.org/snapshots/org/clojure/clojure/1.2.0-master-SNAPSHOT/
14:34mozinatorchouser, maybe its the same error I encountered in the past on debian linux, a missing java keystore
14:35ysphmozinator: i am able to fetch with [org.clojure/clojure "1.2.0-master-SNAPSHOT"]
14:36mozinatorstrange.... openjdk works, but sunjdk does not work on debian linux
14:36zakwilsonAhh... a channel that isn't full of Apple stuff.
14:36zakwilsonShould I be using 1.1 or 1.2 for my personal project?
14:36chouser1.2
14:36zakwilsonNo hesitation there. Alright, I'll switch over.
14:36ysphmozinator: what version of sunjdk?
14:37chouser:-)
14:37mozinatorsun-java6-jdk 6.20-dlj-1
14:37ysph1.6.0_12-b04 here
14:37ysphthe new oracle vms are known to reject previously valid signatures
14:37zakwilsonWhat's the appropriate contrib version to go with that?
14:37ysphmay or may not be a factor
14:38mozinatorysph, I am going to check if I can reproduce the problem with a manually downloaded jvm
14:38chouserzakwilson: latest snapshots of each should be ok
14:41mozinatorok, I can reproduce the problem with a manualy downloaded JVM from oracle
14:41mozinatorysph, I think your theory is right
14:45LauJensenIm wondering what happens under the hood when I do (drop 150000 (read-lines "log"))
14:46LauJensencontrib.io.read-lines
14:48ysphLauJensen: how far under the hood?
14:48ysphmozinator: it seems plausible, our Eclipse RCP build stopped working after a routine upgrade to 6.20 because of rejected certs
14:49LauJensenysph: Far enough to see how wasteful it is
14:49kotarakLauJensen: it opens a reader on log
14:50LauJensenkotarak: Sure, but what goes on with the 15000 lines?
14:50chousertechnomancy: ?
14:50kotarakLauJensen: they are obviously read when you call seq on it
14:50technomancychouser: we have a game at work where every time we run into issues with Oracle's JVM, I get a point, but whenever there's a problem with OpenJDK, they get a point.
14:50technomancychouser: so far we are tied.
14:50chouserheh
14:51ysphtechnomancy: this latest round might put you over the top
14:51technomancyysph: it does sound pretty wretched
14:51zakwilsonAfter upgrading to Clojure and contrib 1.2, I cannot connect to Swank on a remote machine. I don't think I changed anything else.
14:52LauJensenkotarak: So drop doesn't have any tricks for lazy-seqs where it moves the line-pointer instead of actually consuming each dropped line
14:52LauJensen?
14:52chouserzakwilson: oh, man, I'm sorry -- I should have qualified my recommendation. I don't use swank, and it often lags a bit. I dunno if 1.2 works properly there yet or not.
14:52kotarakLauJensen: how could it know how far to read into the file for line without knowing in advance where the linebreaks are?
14:53LauJensenGood point :)
14:53zakwilsonchouser: no problem. I'll poke at it a bit and if it doesn't start working, it won't be hard to downgrade.
14:54LauJensenkotarak: But I just dont get it, its currently getting to the last line of a 65MB file in 400ms
14:55ysphzakwilson: there is a swank-clojure 1.2.0 in the repos that works for me locally
14:56zakwilsonysph: I have 1.2.1. Starting it with lein swank works locally, but I can't connect to the remote.
14:56kotarakLauJensen: do you have it in cache? (read: memory)
14:56LauJensenno
14:56zakwilsonWait... maybe I did something stupid.
14:57zakwilsonNope. Connection refused
14:57LauJensen~source group-by
14:58zakwilsonnmap of local from remote shows port 4005 closed. nmap of remote from remote shows port 4005 open. I have not changed any firewall settings on remote.
14:59kotarakzakwilson: did you start with 127.0.0.1 to listen?
14:59a_strange_guyI think that #'ns-unmap -ing imported classes has some wierd consequences
14:59a_strange_guyhttp://gist.github.com/429027
15:00zakwilsonkotarak: I ran "lein swank". If it takes any options, I'm not aware of them.
15:01tomojzakwilson: don't you want to look at nmap of remote from local?
15:02zakwilsontomoj: Uhh... yes. I said it backwards, but did it forwards. nmap of remote from local shows port 4005 closed
15:02tomojdo you really want it to be open, anyway?
15:02ysphzakwilson: what does netstat -tln on remote say regarding 4005?
15:02zakwilsontomoj: both machines are on my LAN. I do want it open.
15:03tomojah
15:03zakwilsonysph: netstat -tln|grep 4005 comes up blank.
15:04zakwilsonysph: I should note that remote is running Mac OS and might have a slightly different netstat than you expect.
15:05ysphif you run it without grep is should say something like "Active Internet connections (only servers)"
15:06ysphzakwilson: how about netstat -l -p tcp
15:08zakwilsonysph: that doesn't show a line with 4005, but it does show the active ssh connections. netstat -an does show a line with 4005:
15:08zakwilsontcp4 0 0 127.0.0.1.4005 *.* LISTEN
15:11ysphzakwilson: this looks somewhat promising, http://github.com/hugoduncan/lein-remote-swank
15:13zakwilsonysph: I tried that when using Clojure 1.1 and it failed to start Swank on the remote machine.
15:14troutwineWould someone be so kind as to comment on this: http://groups.google.com/group/clojure/browse_thread/thread/6225680aad195dc0
15:14troutwineI swear that lein was working just fine not but a few days ago. :/
15:14cschreinersudo?
15:15mozinatortroutwine, I just had the same error
15:15mozinatortroutwine, its the new oracle jdk
15:15Tweytroutwine: Looks to me like it can't download swank-clojure-1.2.1.jar from anywhere
15:15jdmmmmmtroutwine: try this: :dev-dependencies [[swank-clojure "1.2.1"]]
15:15troutwineOh good, I've not gone mad.
15:16troutwinejdmmmmm: I'll give it a go.
15:16troutwinemozinator: How is the new Oracle JDK causing this?
15:16hugodzakwilson: I haven't tried the lein-remote-swank plugin in a while - I'll take a look to get it working with 1.2
15:17mozinatortroutwine, I am not really sure , but when I switch between openjdk and the new oracle jdk things go from working to not working
15:17TimMcLauJensen: I took a look at your website's code... I guess what I really need to look at is a dynamic site's code.
15:17zakwilsonhugod: cool. Currently, it's failing to rsync.
15:17troutwinejdmmmmm: That did it. I don't understand why, though. Can you explain the difference?
15:18mozinatortroutwine, ok, clearly you have another problem :)
15:18TimMcLauJensen: I'm interested in finding a site that uses data from the DB to generate HTML pages based on templates.
15:18hugodzakwilson: probably a host key checking problem, or maybe invalid rsync options for your os
15:19ysphapparently lien swank as of 1.2 takes args such as lein swank 4005 "localhost"
15:19LauJensenTimMc: check out templates.clj. All the templates take arguments, they can come from a DB if you prefer. There's really nothing more to it
15:19troutwinemozinator: Hanging out as I do on Debian Stable, I don't think I'm using Oracle's Java yet.
15:19LauJensenAnd the dynamic bit is in admin.clj/webview.clj where all the urls served are dynamic
15:19ysphref: http://stackoverflow.com/questions/2752720/how-to-reconnect-to-slime-swank-clojure-session
15:20zakwilsonhugod: It stopped working after I rewrote project.clj. I may have somehow broken something with remote-user and remote-path, but I'm not sure how I'd do that as they seem pretty simple.
15:21zakwilsonProblem solved, I think. Just before ysph posted that, I looked up the source for lein-swank and tried specifying a host. Evidently, it was using the loopback interface.
15:21jdmmmmmtroutwine: I have no idea. It could have been uploaded with a different groupId previously and then removed. I just go with what's in clojars.
15:24TimMcLauJensen: Oh, the admin stuff... I'll take a look as soon as my work machine stops crapping itself.
15:25troutwinejdmmmm: I believe I understand. I was instructing lein to request swank-clojure from clojure.org, rather than from where-ever availiable.
15:26zakwilsonMy problem had nothing to do with the Clojure version. I ran lein clean to get rid of the old Clojure version and also got rid of the old lein-swank version.
15:26jdmmmmmtroutwine: It's all based on how it's identified (groupId/artifactId in clojars or other public maven repos).
15:32zakwilsonNew problem: "lein swank" doesn't seem to be honoring jvm-opts
15:34korrezakwilson: what is jvm-opts?
15:35zakwilsonA project.clj key that supposedly passes arguments to the java command line
15:35korrea ok
15:36korrewhell so you can patch swank or use a shell script to start upp swank
15:37zakwilsonOr I can edit the leiningen shell script, which is what I've done in the past. Still, that option was created to avoid having to do so and I'd like to use it.
15:39korreso what are you using the comand line args for in swank mode?
15:40bartjto all the kind souls who helped with the encoding issue, thanks! - the problem is solved
15:41Licenserhello my lispy friends
15:41LauJensenHi Licenser
15:41Licensergreetings LauJensen
15:41korrewho told you i had a lisp?
15:41Rayneskorre: McCarthy.
15:41RaynesHe sensed it.
15:42a_strange_guycemerick: you remember us dicussing new+dynamic-fns-in-vars+defrecord?
15:42a_strange_guythis was my idea: http://gist.github.com/429080
15:42zakwilsonkorre: the one I need is -Xmx2048M, but I've been playing with other optimizations to see if I can get more speed.
15:42a_strange_guyhorray for metadata in clojure
15:44bartjchouser: The primary problem with the encoding issue was that the database and the 'server' were not utf8...
15:45bartjchouser: in mysql you could do - "show variables like '%char%';"
15:46korrezakwilson: i thought lien started up new process's... if that is the case then modifying the script shouldnt help
15:47chouserso it was stored right in the table, but the server was putting it on the wire wrong.
15:47zakwilsonkorre: I killed the old one first
15:49cemericka_strange_guy: I'm sunk in elsewhere, can't look at that too closely atm. If you throw in some comparative benchmarks, and they're comparable with the existing way, you might want to run it by rhickey. I doubt he'll want to change defrecord so significantly (again), but anything's possible if your idea is better.
15:50mmarczykgood morning (ugt)
15:51mmarczykLauJensen: hurray on your open-sourcing of your site-baking code :-)
15:51bartjchouser: yes!
15:56Licenserfear! I'm bac!
16:04LauJensenmmarczyk: hooray :)
16:06mmarczyklol, I misspelled hooray :-)
16:07kotarakwell, it was almost hurry
16:07kotarakhurra
16:07mmarczykyup
16:07mmarczykand apparently "hurrah" is a word in English too
16:08kotarakhurra is german :)
16:08mmarczykand also Polish :-)
16:09LauJensenand Danish
16:10mmarczykwell now, we've just found some linguistic common ground ;-)
16:11TweyAh, but do you have ‘huzzah’?
16:12mmarczykincidentally, how's ClojureQL coming along? I was thinking of providing a direct mapping from CQL query expressions to the internal structures I'm using in this project: https://www.assembla.com/wiki/show/adqc at some point
16:12LauJensenmmarczyk: Eventually 'hurra' will also be adopted into the Swedish language, but unfortunately they have been unsuccesful in teaching the population words with more than 4 letters. There's progress though.
16:12mmarczyk(that's Clojure in GSoC -- I'm going to post to the mailing list about this soonish, but probably after wrapping up the piece I'm working on right now)
16:13LauJensenmmarczyk: We're hit a small bump in the road, which Budu and I are trying to help kotarak resolve. Hard to give a deadline
16:13LauJensen(hard=impossible)
16:13mmarczykoh, not really asking for that, just pinging for progress
16:13LauJensenprogress is slow, but fortunately there's not many miles left
16:14mmarczyksounds optimistic enough
16:15LauJensenCynicism never had a chance :)
16:15mmarczykwell, s/slow/not happening/ would be worse :-)
16:27mjg123 Hi. If I have a list of numbers-as-strings, how to convert it to a list of numbers?
16:27mjg123something like: (map java.lang.Integer/parseInt ("1" "2" "3")) ?
16:27a_strange_guy,(map #(Integer/parseInt %) ("1" "2" "3"))
16:27clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn
16:27candera,(map #(java.lang.Integer/parseInt %) ["1" "2" "3"])
16:27clojurebot(1 2 3)
16:28mjg123oh, so the java call is not a function by itself?
16:28canderaCorrect.
16:29LauJensen(map read-string ["1" "2" "3"])
16:29LauJensen$(map read-string ["1" "2" "3"])
16:29sexpbot=> (1 2 3)
16:29mmarczykoh, welcome back, sexpbot
16:29a_strange_guyjava calls expand to either the 'new or the '. (dot) special form
16:29mmarczykand that's if the source the strings are coming from can be trusted
16:30mmarczyk$(map read-string "#=(println :foo)" "2" "3"])
16:30sexpbotjava.lang.Exception: Unmatched delimiter: ]
16:30mmarczyk$(map read-string ["#=(println :foo)" "2" "3"])
16:30sexpbot=> :foo (nil 2 3)
16:30mmarczykbut, um
16:30mmarczyk$(require '[clojure.contrib.java-utils :as ju])
16:30sexpbotjava.lang.SecurityException: Code did not pass sandbox guidelines: (#'clojure.core/require clojure.contrib.java-utils)
16:30mjg123in fact I have lists of Character, not String...
16:31mmarczykouch. never mind
16:31mmarczyk(that's was about the SecurityException)
16:32a_strange_guy$#=(String. "foo")
16:32sexpbotCommand not found. No entiendo lo que estás diciendo.
16:32a_strange_guy$[#=(String. "foo")]
16:32sexpbotCommand not found. No entiendo lo que estás diciendo.
16:32a_strange_guy$(vec #=(String. "foo"))
16:32sexpbotjava.lang.Exception: EvalReader not allowed when *read-eval* is false.
16:33LauJensen$(map #(-> % str read-string) [\1 \2 \3])
16:33sexpbot=> (1 2 3)
16:34mjg123annnd that's project euler #8 done, thanks :)
16:34LauJensenhttp://clojure-euler.wikispaces.com
16:35mjg123I thought you weren't supposed to do that!
16:35LauJensenWell...
16:35mjg123:)
16:35mjg123I won't look
16:35LauJensenGotta jet - Good night all
16:37mmarczykgood night!
16:40ska2342Reference types are supposed to hold one of Clojures datastructures. Has there been any discussion on holding e.g. POJOS, and what pitfalls await the programmer?
16:42mmarczykmjg123: as an alternative solution, (require 'clojure.contrib.java) (for Clojure 1.2; used to be java-utils), then (clojure.contrib.java/wall-hack-method clojure.lang.LispReader :matchNumber [String] nil "123") => 123
16:42mmarczykska2342: you're forgoing all the safety guarantees if you put something mutable behind a reference type
16:45ska2342mmarczyk: yes, thank you. Actually I am more interested in some readable material that sums the reasons for not doing so up. Ah, whatever, not so important, I gues..
16:50mmarczykhm, you could do some rummaging around the google group, this does come up occasionally (although I regret to say I have no links at hand)
16:50mmarczykbut basically, the whole idea behind the reference types is that they allow you to operate on snapshots of your data
16:51ska2342mmarczyk: it's OK, thank you. :-)
16:51mmarczykfor a Ref r, you can say, at any time, @r, and you're sure to get something consistent back; that's clearly no longer the case if that thing can change
17:27chouserit seems that dynamic typing allows me to solve problems that I don't undestand as fully as I would need to if I were to solve them with static typing
17:28chouserI suppose there might be differing opinions as to whether that's good or not.
17:28Bootvisthe question is: is that a good thing?
17:28chouser:-)
17:29TakeVIs there a tutorial for using interfaces? I've seen a demo, but I don't quite understand them.
17:33TakeVEr, *protocols
17:34chouserHalloway has a very good video on them.
17:34chouserTakeV: http://vimeo.com/11236603
17:35TakeVThank you.
17:35chouserTakeV: let me know if that's sufficient for them to make sense to you
17:35chouserI'm considering doing a talk on protocols, but if that video is sufficient, maybe I need to find another topic.
17:37ska2342chouser: it is, if you are familiar with the expression problem. I had to read some other sources to get that and then it made sense to me.
17:43zakwilsonI want to convert a number to its ascii equivalent. What's the Clojure version of CL's code-char?
17:46zakwilsonOh, it's simply char
18:07TakeVchouser: More information is always good.
18:37Licenser:)
19:22vIkSiTlo all. is there a way to pass "default" values to a fn definition?
19:25ysphvIkSiT: typically you provide multiple defs as in (defn foo ([x] (foo x 5)) ([x y] (* x y)))
19:29Raynesysph: He's gone.
19:29ysphsnap
19:29ysphrather impatient eh?
20:04kensanataI have a little swing app that lets me draw tiles. When the user presses a key, the app should switch to a different tile. Coming from Emacs Lisp, I want to do something like this: (def current-tile FLOOR_TILE) (defn get-tile [] current-tile) (defn set-tile [tile] (set! current-tile tile)) -- what's the Clojure way of doing this?
20:05kensanataI tried various variants resulting in IllegalStateException... :)
20:05technomancykensanata: probably an atom, unless you need to be able to coordinate changes across threads.
20:05technomancyatoms are the simplest of the reference types
20:06kensanataOk, will read up on atoms. Thanks. :)
20:33charliekilonoob compojure question: is it ok to use agents in Compojure? ... I remember that creating threads (which to my knowledge agents do), is not allowed in containers like Tomcat, Jetty.
20:35boredomistHow could I create an instance of a nested Java class? Say I want to use Y from some.package.X.Y where X is also a class, for example
20:39lancepantzyou (import '[some.package X]') then refer to it as X$Y
20:40lancepantzerr (import '[some.package x])
20:41boredomistGreat, thanks :)
20:41lancepantznp
20:49ataggartcharliekilo: so long as you do it properly, creating new threads from webapps running tomcat, etc. is fine.
21:23herdrickquestion: is there a way to make memoized functions ignore, for the purpose of memoization, some of it's arguments
21:23herdricki.e. have the cache be keyed only on certain args?
21:32ataggartnot with the default implementation, but I recall a good post that made memoize a bit more flexible. lemme see if I can pull it up
21:34ataggarthttp://kotka.de/blog/2010/03/The_Rule_of_Three.html
21:37defnWhere would (identity form) give you something you don't necessarily expect?
21:39tomojwhere you're expecting something strange?
21:39defnheh, cgrand had a little clojure riddle he posted on twitter
21:39tomojprimitives maybe?
21:39defnwhere is ((identity X) arg1 .. argN) equal to (X arg1..argN)
21:40tomojoh, I see it
21:40tomojinteresting
21:42vIkSiThi all
21:42tomojis his next tweet the answer?
21:42hugodzakwilson: I have brought lein-remote-swank up to date. Let me know if you have any issues.
21:42vIkSiTIf I've got a fn called myfn, invoked as (myfn a b) - whats the best method to run this function with values of in (range 0 10)?
21:43vIkSiTvalues of a*
21:43vIkSiT(like, repeatedly run this function, sort of a test harness)
21:43mmarczykwell
21:44mmarczyktaken literally, that's not a very difficult riddle :-)
21:44mmarczykno extra constraints?
21:44vIkSiTmmarczyk, none :) so, I can think of two ways of doing it..
21:44tomojpresumably only interesting answers will be accepted
21:45mmarczykvIkSiT: map, for, doseq... :-)
21:47mmarczykfor cgrand's riddle, there are two huge obvious classes of answers... it would be quite interesting to discover whether there are any possibilities outside those
21:47vIkSiTah, is there a way to do it using loop?
21:47tomojclojurebot: loop?
21:47mmarczykvIkSiT: well, sure, but why?
21:47vIkSiTmmarczyk, ah, thats the one I couldn't get to work..
21:48mmarczyk(loop [i (range 0 10)] (myfn i b)), with b to be supplied by the surrounding lexical context
21:48vIkSiT(btw, which riddle was just referenced here?)
21:48mmarczykouch, I mean
21:48tomojloop doesn't work that way
21:49vIkSiTmmarczyk, clojure.lang.LazySeq cannot be cast to java.lang.Number :) loop won't work that way..
21:49vIkSiTthats what I was assuming too..
21:49mmarczykyeah, typed a for form, then switched to "loop" by replacing the initial symbol :-P
21:49vIkSiThehe
21:49tomojvIkSiT: if you're throwing away the return values, use doseq
21:49mmarczyk(loop [i 0] (when-not (== i 10) (myfn i b) (recur (inc i))))
21:50KirinDaveSo we gotta write a clojure to objc combiler.
21:50KirinDaveErr, compiler
21:50mmarczykhere you go, but it's best accomplished in a different way
21:50KirinDaveSo that we can get something resembling clojure onto the iPhone. :\
21:50vIkSiTtomoj, mmarczyk - ah in either case, the return value won't be available..
21:51tomojif you want the return value, use for
21:51mmarczykalso, this is assuming you're throwing away the results; if you want, say, to build a vector of them, (loop [i 0 r []] (if-not (== i 10) (recur (inc i) (conj r (myfn i b))) r)) is one possibility, though for normally be better
21:52mmarczykvIkSiT: then doseq is indeed your best bet: (doseq [i (range 0 10)] (myfn i b))
21:52vIkSiTaaaah. that last loop is quite enlightening, thanks.. yes, the for and doseq are cool.
21:52tomoj,(= (range 10) (range 0 10))
21:52mmarczyktomoj: oh, right :-)
21:53mmarczykKirinDave: that's not really going to work with the current wording of the dev agreement
21:53KirinDavemmarczyk: Can they tell?
21:53KirinDaveProbably not.
21:53mmarczyksure, if they care to
21:54KirinDaveWell, I am not sure.
21:54KirinDaveI've written code generating compilers that people couldn't tell before
21:54KirinDaveFor C++ even
21:54Raynes$(= (range 10) (range 0 10))
21:54sexpbot=> true
21:54KirinDaveFairly complex.
21:54mmarczykwell, I'm wishing you luck, of course
21:54vIkSiThrm, clj to objc sounds like fun :)
21:54mmarczykI've seen some machine-generated code and it was always pretty obvious that no human's written it
21:54Raynestomoj: When at first, clojurebot doesn't succeed, try, try sexpbot. :p
21:55mmarczykbut I'm not saying that you can't do better
21:55mmarczykthe "common wisdom" seems to be that that's actually pretty hard
21:55tomojI would be incredibly surprised if objc compiled from clojure looked anything like human-written objc
21:56KirinDavetomoj: It might not be idiomatic.
21:56KirinDaveAnd it might require a very comprehensive library
21:56mmarczykplus all this is without bringing up the feeling of insecurity I'd have if I knew I was consciously doing things in a way incompatible with the dev agreement for the platform I was working on
21:56KirinDaveBut guys, I'm blue skying here. Come on.
21:56KirinDavemmarczyk: Actually it's really unclear what apple wants to do there.. I mean, are they really gonna kill games using Lua?
21:56KirinDaveThey haven't done that entirely yet.
21:57mmarczyknot to say I don't believe such legal shenanigans as Apple is performing right now should be banned due to the way in which they complicate (make impossible?) interoperability, because I do :-P
21:57Lajlammarczyk, how do you specy ranges in clojure.
21:58tomojbanned by whom?
21:58LajlaSomething I, as the greatest programmer except the MCSA should surely be told.
21:58LajlaLike, (range 0 10) does that work?
21:58mmarczyktomoj: I meant "made illegal"
21:58Lajla,(range 0 10)
21:58tomojcrazy
21:58mmarczykwhere it's not illegal already.
21:59LajlaOh, it's above there coindidentally.
21:59Lajla$(range 10)
21:59sexpbot=> (0 1 2 3 4 5 6 7 8 9)
21:59mmarczykwell, I don't care enough to really argue that particular point
21:59Lajla$(range 0 4 2)
21:59sexpbot=> (0 2)
21:59LajlaWhat's with the new bot?
22:00tomojif there's anyone I'd be more afraid of than apple/MS/google/whoever to have in control of such things, it's the government :)
22:00herdrickataggart: thanks
22:00mmarczyktomoj: not sure what you mean by this
22:00herdrickthat is interesting
22:00tomojLajla: "specy" ?
22:00Lajlatomoj, oui
22:01mmarczykthe government mandating which languages we can use -- I don't even want to think about that
22:01LajlaWe used to have a different one that worked by a comma
22:02mmarczykbut a law being passed to prevent companies from these kinds of outrageous interference with people targetting their platforms in languages they don't control seems rather different
22:02tomojheh i
22:02mmarczykto the point where I can't see that the two ideas are really related
22:02tomojI imagine a C++ country, a clojure country, a ruby country, etc, all going to war in cyberspace
22:03LajlaC++ would win, stupid people are surprisingly powerful in large groups.
22:03mmarczykin fact, isn't it already explicitly legal to reverse engineer where that is done for interoperability reasons, right? both in US and EU
22:05mmarczykof course the current trend is to prevent consumers from circumventing DRM even where this would be for purposes compatible with fair use... locking up content being sold to consumers in formats which might well become a problem in and of themselves (a server goes down and you can't play your track...) is apparently perfectly legal
22:05mmarczykI wonder if I should perhaps discontinue ranting at this point :-)
22:12zakwilsonhugod: I will give it a try tomorrow. I'm currently away from my LAN.
22:32vIkSiThmm. so I've got this tree traversal function here: http://paste.lisp.org/display/111243
22:32vIkSiTis there an idiomatic way to conver this to loop/recur, and somehow conj the results into a seq?
22:32vIkSiTconvert*
22:33mmarczykyou don't need the do around the or, for one thing
22:33mmarczykalso, how about in-order for a name :-)
22:34vIkSiThehe, yes, the name will change ;)
22:34vIkSiTah yes the do is gone now.
22:35mmarczykbut, um, this will just print the leaves left-to-right, right?
22:35vIkSiTyes?
22:36vIkSiTin-order should do left, root, right?
22:36mmarczykyup
22:37tomojwon't that always return false?
22:37mmarczykhow about (->> bt (clojure.walk/prewalk (fn [{:left left :right right}] [left right])) flatten (map #(partial println "Visited"))) or some such thing
22:38mmarczykoh, sorry, that's (fn [{left :left value :value right :right}] [left value right])
22:39Raynesclojure.walk?
22:39mmarczykfor loop/recur, you'd have to rewrite this in continuation-passing style
22:39Raynes:|
22:40mmarczykRaynes: hi! nice to see sexpbot again :-)
22:40vIkSiThmm clojure.walk. must look that up.
22:40mmarczykwhat's wrong with clojure.walk?
22:41Raynesmmarczyk: <3 sexpbot :D
22:41Raynesmmarczyk: Nothing wrong with it. I just have no clue what it is.
22:41mmarczykoh :-)
22:41vIkSiTmmarczyk, hmm yes, was wondering if thats the most efficient or not. also, I wanted to re-learn consing recur resulsts :)
22:42vIkSiT,(doc clojure.walk/prewalk)
22:42mmarczykI find it superbly useful in ast transformations where all disambiguation can be performed based on the looking down the tree :-)
22:42mmarczyk$(doc clojure.walk/prewalk)
22:42sexpbot=> ------------------------- clojure.walk/prewalk ([f form]) Like postwalk, but does pre-order traversal. nil
22:42Raynesmmarczyk: dysinger ran sexpbot out of #clojure for a while. sexpbot overcame and burned down his house. <3
22:42mmarczykclojurebot's gone for a walk apparently
22:42vIkSiTaah
22:42mmarczykRaynes: way to go! :-)
22:42dysingerare we still talking about this ?
22:42vIkSiTwell, I guess I should look at how prewalk is implemented then :) trying to do this from first principle
22:43Raynesdysinger: sexpbot and I still love you. <3
22:43mmarczykdysinger: no, by this point we're just sorry about your house ;-)
22:43mmarczykvIkSiT: oh I can tell you that -- it's implemented in a wicked cool way :-)
22:43dysingersorry guys I have real work to do
22:43dysingerthanks for calling my attention though
22:44RaynesYou're welcome.
22:44RaynesSourpuss. :(
22:45vIkSiToh that IS nice
22:45vIkSiTI like the inner outer implementation
22:45RaynesI should make sexpbot's doc special like clojurebot's. That line of -'s at the beginning is rather offputting, especially for long docstrings.
22:46vIkSiTRaynes, +1
22:46RaynesIt's better if the documentation is longer than 300 characters though, because sexpbot gist's evaluation results that are over 300 characters (or is it 200?).
22:46Raynes$(range 1 1000)
22:46sexpbot=> (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 ... http://gist.github.com/429531
22:46Raynesgists*
22:47vIkSiTthis is pretty cool too - http://rosettacode.org/wiki/Tree_traversal#Clojure
22:47vIkSiTis the "walk" idiom a functional thing? or is that more clojurian?
22:48tomojI wonder how deep your tree has to be to blow the stack
22:48vIkSiTtomoj, yes thats the reason I was trying to convert this into loop/recur
22:51tomojnot sure how that would be possible
22:52mmarczyk(loop [bt bt q (clojure.lang.PersistentQueue)] (let [{:keys [left right value]} bt items (drop-while nil? [left value right])] (condp == (count items) 1 (do (println "Visiting" (first items)) (if-not (empty? q) (recur (peek q) (pop q)))) 2 (recur (first items) (conj q (second items))) 3 (recur (first items) (into q (rest items))))))
22:52hiredman~scala {((x: Any, y: Any) => (f: Function2[Any, Any, Any]) => f(x, y))(1, 2)((x: Any, y: Any) => x)}
22:52mmarczykvIkSiT: I actually wrote this right here, no testing, but maybe you can give it a try ;-)
22:53mmarczykRaynes: cool idea with the gist, though I trust egregious misuse is being prevented somehowb :-)
22:54Raynesmmarczyk: How would someone misuse that?
22:54mmarczykum, (range) ...?
22:54Raynesmmarczyk: It would time out.
22:54hiredmanclojurebot: ping?
22:54clojurebotPONG!
22:54mmarczykhow large would it get though
22:55Raynesmmarczyk: If it times out, it doesn't give anything to gist.
22:55mmarczykthen you could use (range n) for just the right n
22:55RaynesAnd it still wouldn't be large enough to cause problems, I imagine.
22:55RaynesAnd I could lower the timeout if necessary.
22:56RaynesOh noes, clojurebot is back. sexpbot's claim to fame has been interrupted. :p
22:56mmarczykI wonder, ranges materialise pretty quickly
22:58Raynesmmarczyk: I could count the size of the output, if it was an actual problem, but that wouldn't be very efficient. Unless gist has a very low limit on what size a gist can be, it shouldn't ever pose a problem.
22:58riddochcMaybe if sexpbot choose a more risque name people would use it instead? ;)
22:59RaynesI was kidding. <3 clojurebot
22:59RaynesBut sexpbot does prove useful in situations like the one a moment ago where clojurebot disappeared briefly. :D
23:00mmarczykRaynes: if you feel this way... I promise not to try to break it :-)
23:00Raynesmmarczyk: If you can break it, by all means, go for it. :p
23:00clojurebotforget Clarity of mind means clarity of passion, too; this is why a great and clear mind loves ardently and sees distinctly what it loves. -- Pascal
23:01mmarczykRaynes: all of a sudden I feel evil :-)
23:02mmarczyk$(doall (map #(* 2 #^Integer %) (range 4000000)))
23:02sexpbotExecution Timed Out!
23:03mmarczykoh come on.
23:03mmarczyk$(doall (map #(* 2 #^Integer %) (range 2000000)))
23:03mmarczyk$(range 2500000)
23:03sexpbotExecution timed out.
23:03sexpbotjava.lang.Exception: Thread stopped!
23:03_brian2_noob question > from the tree exmple, I m just trying to understnd the first function , what is f in (defn walk [node f order] ...
23:03mmarczykThread stopped?
23:03mmarczyk$(range 2500000)
23:04sexpbotExecution timed out.
23:04sexpbotjava.lang.Exception: Thread stopped!
23:04mmarczyk$(range 1000000)
23:04sexpbotjava.io.IOException: Error writing to server
23:04mmarczykohhh, that's something new :-)
23:05mmarczykoh, alright... admittedly I should have queried the bot
23:06mmarczyk_brian2_: were are you getting that from?
23:07_brian2_somebody just cited http://rosettacode.org/wiki/Tree_traversal#Java
23:09Raynesmmarczyk: I suspect that java.io.IOException: Error writing to server is the breakage you were looking for.
23:09mmarczyk_brian2_: apparently the idea is that node is a binary tree with data on interior nodes
23:09mmarczyka node looks like {:left left-branch :val value-at-current-node :right right-branch}
23:10mmarczykf is a function which you wish to call on every element of the tree
23:10Raynesmmarczyk: I'll catch that error and handle it specially. <3
23:10mmarczykand order is a vector of keywords
23:10mmarczykpossible entries: :left :visit :right
23:10mmarczykwalk does these things in order at each node
23:10mmarczyk:left means walk the left subtree, :right similarly
23:11mmarczyk:visit means call the given function on the current node
23:11mmarczykRaynes: :-)
23:11_brian2_I take it its a clssic comp sci problem (?)
23:12_brian2_I never took a comp sci class
23:12Raynesdanlarkin: I don't think I'm on a bot ego trip. :\ I just like to unsuccessfully mess with hiredman about clojurebot.
23:12mmarczyk_brian2_: it's also one of the basic day-to-day programming problems
23:12_brian2_ok, cool
23:12mmarczykwith all the stuff being represented as trees
23:12_brian2_thats better ;-)
23:13mmarczyk:-)
23:21mmarczykvIkSiT: http://gist.github.com/429563
23:22mmarczykhere's a loop/recur-based tree walk
23:22mmarczyknot pretty. :-(
23:25_brian2_danlarkin : I am having a problem with getting clojure-json write to file example
23:26danlarkinoh! yes I saw your issue
23:26danlarkinthen I got distracted :)
23:26_brian2_ok, thanks
23:26vIkSiTmmarczyk, aah. looks interesting though :)
23:26danlarkinI think the problem is you're not opening the FileWriter in a with-open, so it never gets closed (which means the buffer isn't flushed)
23:27danlarkinat least in the example you pasted
23:28_brian2_ok, I dont see any with-open in your posted exmple code
23:29danlarkinit may be poor sample code :)
23:29_brian2_;-)
23:35vIkSiThmm how do I print out a clojure.lang.PersistentQueue?
23:35vIkSiTmmarczyk -to debug?
23:36danlarkin_brian2_: let me know if that works out for you
23:36_brian2_ok
23:36_brian2_thnks!
23:38vIkSiThrm.
23:39mmarczykvIkSiT: just wrap it in a print(ln)
23:39vIkSiTmmarczyk, well, that just shows #<PersistentQueue clojure.lang.PersistentQueue@a2272bf8> :)
23:39vIkSiTDuring my do, I do a (prn (peek q))
23:39vIkSiTwhich works fine .. but just wanted to see the entire thing at once..
23:40mmarczykvIkSiT: really? in that case, perhaps (println (str "#:PQ" (seq the-queue)))
23:40vIkSiTaha
23:40mmarczykor skip the #:PQ if you're not worried about confusing it with a list
23:40vIkSiT(seq q) does the trick
23:40mmarczykyup
23:40vIkSiTyes in my case its a nice tree
23:40vIkSiTwhew. level order is complex
23:41vIkSiThttps://gist.github.com/aa0a0095fe386f490b6f
23:43vIkSiTinteresting I didnt know cond could get a :done
23:46tomojhuh?
23:48mmarczykvIkSiT: hm? :-)
23:48mmarczyk(looking at the new gist now)
23:52trptcolinis there a way to use binding to replace Java methods?
23:53mmarczyktrptcolin: nope. you might be able to use proxy to mock them out though
23:54mmarczyknot that that's likely to help a lot...
23:54trptcolinmmarczyk: it definitely confirms that i'm not crazy :)
23:55mmarczyktrptcolin: happy to hear that ;-)
23:56_brian2_danlarkin : is it supposed to look something like: (with-open [o (FileWriter.) ] (json/encode-to-writer [1 2 3 4 5] o "/tmp/foo.json"))
23:59danlarkinno, pass the path as an arg to the FileWriter constructor