#clojure logs

2009-06-25

00:04holmakThere is that Common Lisp library, too, "Cells"?
00:04holmakSome kind of framework for dealing with lots of interdependent values, as in a spreadsheet.
00:04hiredmanI think there are a few Cells like libraries for clojure
00:05holmakI wonder if their approaches would be relevant to the GUI problem. I imagine they would.
00:06hiredmanholmak: I would check out the libraries page on clojure.org
00:06holmakWill do
00:41codyKcoming from a non-java background, how do people deal with / tolerate classpath? Is setting up a directory with symlinks to jar files and then using a wildcard classpath really considered to be a reasonable solution?
00:43grrrtcodyK: I don't use symlinks. For light-weight projects, I use a simple directory structure and an ant build script that gets all the sources and jars
00:43grrrtfor complex projects I tend to use maven
00:43holmakThe classpath is a nightmare. Wildcards in the classpath don't work as you might expect -- "some/path/*" _supposedly_ includes all the JARs in some/path; you don't want to type *.jar
00:43holmakLet me find the relevant docs, if you haven't seen them
00:44holmakhttp://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html
00:44holmakNote, that is for Windows
00:47codyKthanks for the link
00:48holmakIf you are not developing on Windows, there are lots of people here who know how to work that. I'm doing it the hard way by using Windows...
00:49codyKi'm a unix guy
00:49holmakSo you are in good shape, I think the way to go is ant or Maven, like grrrt said.
00:50codyKyeah, its a bit of a shift to have to worry about library usage on a per-project basis
00:50grrrtwelcome to the java world :)
00:50codyKhahaha
00:51holmakI swear I have spent more time worrying about the classpath than writing JVM code.
00:51grrrtwell once you've got it set up you can forget about it more or less.
00:51grrrthow many jars are you trying to manage?
00:51holmakBut again, it helps if you are not on Windows. I barely have a usable _shell_.
00:52codyKeh, right now just clojure, contrib, enlive, compojure
00:52codyKplus dependencies
00:52grrrtthat's not too bad
00:52grrrtI'd just put those in your WEB-INF/lib
00:53grrrt(since you're doing webapps that is)
00:54grrrtI have used maven-like directory structures,
00:54grrrtsrc/main/clojure has my clojure sources, src/main/webapp/ is the webapp root which contains WEB-INF/lib
03:29hiredmanhttp://jackcoughonsoftware.blogspot.com/2009/06/pimp-vs-just-plain-fix-my-library.html <-- ouch
04:41combasathis works nice `alias clj="rlwrap clj-env-dir"`
06:29frodefwith proxy-super, how do I chose the particular method to invoke, based on argument classes?
06:33frodef..the super method has signature (String Object Object), and I have (String String String), but proxy-super yields an "no method found"?
06:35frodefargh! I had misspelled the method name, even if I thought I'd looked for that.. twice. Sorry about the noise, again.
06:57cemerickrhickey: is new-new the new name for 'instance'?
06:58rhickeycemerick: working title, yes
07:01cemerickrhickey: maybe you're not sure yet, but will it eventually offer a superset of structs, in particular, structs that have slots tied to java-interface getters?
07:02rhickeycemerick: I'm not sure if that will be built in or something you can build with it. I'm concerned about it not becoming laden like genclass
07:03rhickeyin particular, right now there is no way to specify fields, your fields are what you close over
07:03cemerickI've been thinking of reimplementing struct-maps using ASM to generate fields for each slot, which would probably bring things back to java-native perf, but I obviously don't want to make something that's obsolete a month later. :-)
07:04AWizzArdrhickey: (bar xyz) returns lazily a sequence of refs. Now I do return in one of my functions (filter #(foo @%) (bar xyz)). But I was thinking about wrapping a dosync around this, to make sure that while filter is running the refs returned by bar won't change. But as filter itself is lazy, do I need to put the filter inside a doall if I want it to run in a transaction?
07:04clojurebothe works hard so you don't have to
07:05rhickeycemerick: exactly, but a big point of newnew is so I don't have to write Java anymore, so I'd like to think it would give you the tools for structs
07:06rhickeyAWizzArd: yes, you don't want your ref interactions to leak out of the transaction if you want them to reflect a snapshot
07:10cemerickrhickey: well, I'd be aiming for an all-clojure impl (with ASM for the class-generation stuff). To foolishly speculate: am I right in thinking that 'fields' in new-new means 'java fields', as opposed to simple bindings to refs or something?
07:11rhickeycemerick: immutable java fields, yes, even primitive ones - this is a capability of closures right now
07:11rhickeyi.e. locals
07:12rhickeywhen you call fn it creates an instance of a class implementing IFn with a ctor taking all closed-over locals, which become fields of that class. The point of newnew is to get better leverage out of all that capability
07:13rhickeyit'll be a lot like Java anonymous inner classes
07:13rhickeywith the same final constraint
07:13cemerickrhickey: heh, in that case, as long as there was a facility (say, set! for now, though the semantics aren't right), that allowed you to write something like (myMethodImpl [arg] (set! this-foo field-name arg)), which returned a new instance of this-foo with the field-name field's value set to arg, then that'd be pretty sick.
07:13cemerickslick* (although 'sick' works too)
07:14cemerick(hrm, or maybe that's what the factory mention is about...)
07:15rhickeycemerick: what ends up happening is that the fn enclosing a newnew call acts as a factory
07:15rhickeyyour method could call it to construct a new instance
07:16rhickeywhat you *don't* end up with is public ctors
07:16cemerickthat's fine
07:17cemericksounds sufficiently macro-able, anyway. Though round-tripping through a factory to make a copy (modulo one field, say) puts the super-efficient cloning in JDK7 out of reach.
07:17rhickeybut the whole mechanism enforces best practice - only methods defined by interfaces are accessible, class is anonymous, no public ctors, factory functions
07:17cemerickhrm, or maybe not, if one was clever enough with factory fns
07:18rhickeyclone + final fields is a problem in practice
07:18rhickeyyou really need to construct
07:18cemerickhuh, I thought final was just a flag for javac, and that fields were nonetheless always mutable under the covers
07:18cemericke.g. via reflection
07:19rhickeyno
07:19rhickeysecurity violation, plus you'll have the optimizer presuming a constant value and never seeing your changes
07:21rhickeythe latter is the big problem, I finessed final once and was burned
07:22cemerickI guess I'd ask, why make the fields final if the class is anonymous anyway? Inlining?
07:22rhickeyif final had no semantics for the optimizer Clojure would be much slower, I want even more final semantics, like for arrays
07:23cemerickah, there we go
07:23rhickeycemerick: fields not final would be (precisely) like mutable locals
07:28cemericksure, sure. I had just learned about the Object.clone optimizations, which (IIUC) would make consing copies (or near-copies) absurdly fast.
07:28rhickeyand the real objection to mutable locals would be that that could be closed over, creating mutable objects
07:28rhickeycemerick: link?
07:29cemerickrhickey: the original post is here (which I'm sure you've seen): http://blogs.sun.com/jrose/entry/longjumps_considered_inexpensive
07:30cemerickit's relatively old, but it actually looks like the related bug is closed now, and released, even (though I'm not sure what to think of the 'fixed for' tag of hs10(b13)) http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6428387
07:32cemerickrhickey: I'd say that, as long as digging into mutable locals requires knowing what one's doing (similar to set!, etc), it should be allowed (short of making those fields final delivering an irrefutable perf gain due to compiler optimizations).
07:34Chousukecemerick: but then there's the danger that people who don't know what they're doing find out about it and start using it everywhere :P
07:34rhickeycemerick: well, it was a serious design point for Clojure to make them final. I'm really not sure you can trust people not to make a complete mess, which I'd have to support
07:34cemericksince marking fields as final or not is so straightforward, maybe two new's could be available -- new and new!
07:35rhickeyonce you have non-final, than volatile comes into play immediately
07:35rhickeythen
07:36rhickeythat said, it's back on the table again as I need volatiles in a couple of the lowest-level Java classes
07:36cemerickrhickey: yeah, by no means am I suggesting this as a default...far from it. But for people who want to build things on top of new-new, where they want that control, it'd be pretty big.
07:37cemerickChousuke: Virtually no one knows what they're doing. Trying to save everyone from themselves, especially if they're plumbing around in stuff that is explicitly marked as dangerous, seems futile (and liable to hurt people who do know what they're doing).
07:37rhickeybut any such use in a MT environment requires serious Java concurrency skills
07:38cemerickrhickey: well, in my current use-case, it doesn't -- I'm still not modifying any object's fields in-place, I'd only be using it to fiddle a field or two on a newly-created instance in a "setter" impl.
07:39cemerickBut yeah, if people want to screw with mutable fields, they need to know what they're doing. When things go awry, it's their fault, "just don't use new! unless you know what you're doing", etc.
07:40rhickeycemerick: new! wouldn't cut it, people would rightly expect that to be exposed via locals and fn
07:41rhickey(let [!x! 42] ... (set! !x! 13))
07:42cemerickwell, that was just off the top of my head, with the broader point being, getting mutable locals could just be triggered by an explicit declaration of *some* kind.
07:42rhickeywhat are the semantics of a closed-over mutable?
07:43rhickey(rhetorical, early Clojure had mutable locals)
07:43cemerickPresumably the same as an object with a public, mutable field. *shrug*
07:43rhickeyexcept those closures have independent lifetimes
07:43rhickeyfrom the enclosing scope and each other
07:44cemericksee, you just blew right by me there :-)
07:44rhickeyyou end up either having to put them in boxes (there goes your field), or to build object reference chains (keeping things alive in surprising ways)
07:45cemerickThis is all definitely complicated given that new-new is replacing fn as well, which I wasn't really thinking about at all.
07:45rhickeycemerick: it really is the same set of problems, the point of newnew is that it is the same as fn, fn is just needlessly specific
07:46cemerickwell, the usage is pretty different -- you have pretty tight control over what goes on in a fn, whereas a proxy-object gets out into the world and has a much broader set of usage
07:47rhickeycemerick: I don't see the difference
07:47cemericke.g. consider the implementation of an interface that requires mutability, and perhaps a ref in a state field is simply too slow, etc.
07:48rhickeycemerick: the latter is the question, are atoms too slow?
07:48rhickeyI think Atomic* are intrinsified in some ways, not sure about the allocation
07:49cemerickI'm not familiar with the guts of atoms, but I'll bet they're slower than a raw java field.
07:50danlucraftrhickey: hi rich. is your QCon 09 talk available online yet? I keep looking for it...
07:50rhickeycemerick: but to tell you the truth I'm not sure about how much to care about interfaces requiring mutability - is it worth turning Clojure into Java with parens? I'm personally happier saying go to Java for that. But I do want to avoid having to go to Java for method-level perf
07:51rhickeydanlucraft: interview is, 2 talks are not, yet
07:52danlucraftrhickey: ok, thanks.
07:53cemerickrhickey: yeah, I can definitely understand that impulse, but allowing, say, mutable locals in new-new as an option (associated with proxy-like usage only, perhaps, as it doesn't make sense in fn usage AFAICT) means that there'd likely never be a reason to drop to Java. I'm not sure that that narrow affordance turns clojure into Java with parens, though.
07:53cemerickmy glass-half-full side would just say that it closes the interop gap completely :-)
07:55rhickeycemerick: like I said, I'm thinking about it. And volatile/non is a big issue. For me, I don't want to do anything that at least doesn't have some known MT semantics. Making mutable locals always-volatile might be a way, but there are cases where you are using normal synchronization where you wouldn't necessarily want that
07:57rhickeyyou could also prohibit closing-over mutables
07:57rhickeythat plugs a big hole, and can't be an expectation of an interface
07:58rhickeybut even then we'll soon have spaghetti loops etc, right away
07:59cemerickrhickey: yeah, I'm mostly just thinking out loud here. I'm sure you'll land in a good place, either way. I guess I'd only say that, it's impossible to know what people will want/need to use clojure for, so building in escape hatches is generally a good thing (where the current java interop is the best example so far).
08:00cemerickI don't know -- idioms are a very powerful thing, and if the usage of mutables is non-default and not widely used in general, I'm not sure people would flock to them.
08:01cemericks/used/seen
08:01rhickeycemerick: keep hope alive! :)
08:02rhickeycemerick: current java interop is good example, genclass not so much
08:02cemerickrhickey: you say that, but we'd be in quite a pickle if genclass didn't exist and didn't have the flexibility it does.
08:03cemerickactually, I think it was gen-class (v1, probably) that pushed me over into adopting clojure top-to-bottom.
08:03cemerickv1 of gen-class, that is (sometime last summer), not v1 of clojure
08:03rhickeycemerick: doesn't make it less complex or ugly - there's just too much Java cruft, and annotations still to go!
08:04cemerickWe thankfully have zero use for annotations.
08:04cemerickAlthough they continue in their general ascendency, so yeah, supporting them in some way is pretty important, although I don't know enough about them to know what that implies.
08:05rhickeynewnew is a classic case of where adding the last 10% of capability will double or triple the complexity
08:05Chousukerhickey: I remember you mentioning "host-in-parens" a while ago. Is new-new part of that idea, or something else?
08:06rhickeyChousuke: host-in-parens is a way to get out of having to duplicate all of the host's capabilities - instead just a macro language that generates host code directly. I think now it might be preferable to genclass.
08:07rhickeyor preferable as a way to implement genclass
08:07Chousukeah. hmm.
08:09rhickeyit would reduce the burden on newnew to provide every capability of Java
08:09rhickeyJava in parens
08:09clojurebotΜΟΛΩΝ ΛΑΒΕ
08:38Chousukerhickey: By the way, maybe you should add a notification on the Clojure and contrib google code pages that they've moved. Just in case someone ends up there through google.
08:45rhickeyChousuke: done
09:54Lau_of_DKHi guys
09:54Chousergood morning!
10:28Lau_of_DKI assume Rich is the sole editor of the Assembla wiki ?
10:31ChouserLau_of_DK: no, I think any assembla project member can edit the wiki.
10:31Lau_of_DKhttp://www.assembla.com/wiki/show/clojure/Chunked_Seqs
10:31ChouserAnyone with a CA in can become a member just by asking.
10:32ChouserLau_of_DK: http://groups.google.com/group/clojure-dev/browse_thread/thread/99e2728f665c52fa?hl=en
10:32Lau_of_DKReading something like that I feel a little unsatisfied - If I in any way represent the average Joe, then thats to abstract for me. Like "High level sequence model is ideal for code understanding" I cant possible begin to imagine all the implications of that sentence. Could you guys adopt a more reader-friendly style of writing ?
10:32rhickeyLau_of_DK: that's not documentation, that's just my idea scratchpad
10:32rhickeyIt's a dev space, not user space
10:33Lau_of_DKSo that means, no catering to the less intelligent ?
10:34rhickeythat means, before something is finished it's not finished
10:34rhickeyhas nothing to do with intelligence
10:34rhickeyI could keep my notes to myself as I always did
10:35Lau_of_DKIn that specific case it wouldnt make much a difference to me, because its difficult to imagine how your idea will work in practical terms - Personally I would really enjoy following your ideas, but I need to way of relating to what's being put down in writing
10:36rhickeyLau_of_DK: then wait for the feature to be released
10:36Lau_of_DKAlright
10:38duck1123rhickey: I prefer you sharing your notes, even if they are coarse and don't make much sense atm
10:38Chouserme too. I won't claim to understand every statement in such notes, but it's nice to have a sense of what may be in the works.
10:43rhickeythere are some pictures in http://clojure.googlegroups.com/web/chunks.pdf I need to move over into the wiki
10:44Lau_of_DKThat, I can relate to, thanks
10:45danlucraftare there any performance numbers for chunked seqs yet?
10:46Chouserdanlucraft: yes, but they change every day.
10:47rhickeydanlucraft: please try the chunks branch on your own code, there should be no negatives, except right now range is not IReduce, so (reduce + (range n)) demo suffers
10:49danlucraftok.
10:56Chouserclearly slide 4 should be "Isn't Clojure too fast already?"
11:00duck1123too fast only applies when you're playing old dos games
11:00rhickeytoo fast, what's that?
11:03Chouserit's just this vague, lurking fear. In almost every other area going too fast is dangerous, so surely the same applies to software.
11:03ChouserAnd if anything is in danger of going to fast, surely it's Clojure.
11:04rhickeytoo fast performance-wise or development-wise?
11:04Chouserheh. well...
11:05ChouserI guess my ananlogy could be applied to either, but I mean to be talking about performance.
11:05duck1123Chouser: so are you suggesting that first include a (Thread/sleep 200)
11:05Chouseraren't there speed limit laws we need to be careful about?
11:05Chouserduck1123: yes, perhaps that would suffice.
11:06duck1123it'll be great, because anyone employed as a clojure optimizer will have something to tweak to show immediate improvement
11:07dudethe only one I'd worry about is the speed of light (actually, I'm not really that worried about that...)
11:07Chouserduck1123: yes, an excellent point.
11:11Jetienhi, i'd like to write a shell script which sends forms to an running repl, but i can't find any information which could help me. can somebody point me into the right direction?
11:12duck1123Jetien: just a running program, or do you need it to go to the running repl
11:12Jetienyes i need it to go to a running repl
11:12Jetienis this possible?
11:16duck1123I was going to suggest checking out c.c.server-socket, but I don't think that can be used to affect the other repl session. (just the program that repl interfaces)
11:16duck1123which is probably good enough for you, so check it out anyway
11:16duck1123http://code.google.com/p/clojure-contrib/wiki/ServerSocketApiDoc
11:16Jetienthanks!
11:17duck1123I've never used it, as I use swank-clojure to acheive something similar.
11:18Chousukehmm
11:18Chousukedefn has some weird behaviour.
11:18danlucraftso what fun thing should I write to learn clojure this weekend?
11:18Chouserit changed recently.
11:19Chousuke(defn foo a) works and produces a function definition whose arglists metadata is (a) :P
11:19Chouserdanlucraft: reimplement this game in clojure, so that it can be ported to clojurescript with canvas and run on the iPhone: http://www.gamesforwork.com/games/play-12292-Colourshift-Flash_Game
11:20danlucraftcouldn't you fit a prolog interpreter somehwere in that stack?
11:20Chouserdanlucraft: note that the boards are not hand-made -- they're generated randomly based entirely on the attributes listed on the right (size, sources, link, dummies, wrap).
11:21Chouserdanlucraft: :-) :-) ...just write it for regular clojure, drawing into a swing window or whatever. that much will be fun. the rest will be easy.
11:23dudeclojure for iPhone? I'm intrigued, but my google-fu is weak. Do you have a link to more info?
11:24Chouserno, I'm talking about clojure for javascript in a browser (clojurescript), which would be sufficient to get a game like that working in the iPhone's Safari.
11:24dudeah, okay
11:25danlucraftdude: http://clojure-contrib.svn.sourceforge.net/viewvc/clojure-contrib/trunk/clojurescript/
11:25danlucraftChouser: OK done. It's been years since I wrote a game.
11:25danlucraftexcept not the ClojureSciprt thing :)
11:25sgtarrare there any games written in Clojure?
11:25dudedanlucraft: thanks
11:26Chouserdanlucraft: yeah, ignore clojurescript for now.
11:26danlucraftsgtarr: wait a couple of days :)
11:26Chouserdanlucraft: that's awesome. I've been wanting to do that game for a week or two now, but I've just not been able to justify the time.
11:26sgtarrclojurescript sounds neat though, for simple things javascript can be used for
11:26sgtarrusing <canvas> perhaps?
11:27Chouserdanlucraft: I think it'll have some fun logic challenges, lots of good immutable leveragin, and maybe even concurrency stuff if you feel like it (though hardly necessary).
11:27Chousersgtarr: that was my thought for this game
11:28danlucraftChouser: fiancee on hen weekend == lots of time for clojure fun
11:28Chouserunfortunately clojurescript is pretty outdated now -- clojure has gotten ahead of it.
11:28danlucraftChouser: presumably it could work in an applet?
11:28Chouserdanlucraft: yes
11:28duck1123Chouser: do you have any blog posts or anything on using clojurescript?
11:29Chouserdanlucraft: though that doesn't help me play it on my iPhone. :-)
11:29danlucraftok new plan. ClojureCLR -> Mono -> native iphone. WDYT?
11:29clojurebotnew Class(x) is (Class. x)
11:30ChouserMono can compile to native iphone!?
11:30danlucraftyep. there are a bunch of iphone games that use Unity on Mono.
11:30danlucraftMono can do full AOT so it doesn't break the rules.
11:31Chouserinteresting. yet another reason to not worry about that stage yet and just get it working on Clojure/JVM
11:31sgtarrdanlucraft: but how do you run the application?
11:31duck1123would clojure for the iphone actually make past the apple cops though?
11:31sgtarrdanlucraft: without a jailbroken phone
11:32Chouserduck1123: no, nothing really written about clojurescript.
11:32danlucraftsgtarr: yes
11:32Chouserduck1123: I've had a demo working intermittently, but it appears to be broken at the moment.
11:32sgtarrdanlucraft: ?
11:35danlucraftduck1123, sgtarr: oh sorry. Mono compiles your app all the way to native code, so there is no interpretation, so it doesn't break the Apple law.
11:35sgtarrdanlucraft: Ok so people are already distributing Unity apps through the App Store?
11:36sgtarrbecause that's pretty much the only way to reach the public
11:36danlucraftyes they are.
11:36sgtarrneat
11:37sgtarrseems like the best way so far to develop iPhone apps
11:37sgtarrdanlucraft: is the Unity dev kit expensive?
11:37sgtarrseems I can download a trial but can't find anything about pricing for now
11:38sgtarrok, found it: $399
11:38sgtarr+ $199
11:42duck1123is there an alternative to conj anywhere that accepts [coll & xs] so that when xs is empty, only coll is returned?
11:44duck1123I was doing (apply conj ["a" "b"] ["c" "d"]) but (apply conj ["a" "b"] []) fails
11:45Chouserwhy not 'reduce' instead?
11:46Chousuke,(into [1 2] nil)
11:46clojurebot[1 2]
11:46Chousereven better
11:49duck1123into is working, thanks
11:55jackdempseyrhickey: you find people overuse it?
11:55jackdempsey(apply that is)
11:56jackdempseyanyone have a second to talk let vs binding?
11:57Chouserjackdempsey: go for it.
11:57rhickeyjackdempsey: I dunno, I guess I use it often myself, but some usages I wonder about
11:57jackdempseyah gotcha
11:57jackdempseyits description still didn't quite click for me......i think i'm overthinking it
11:57jackdempseyso for let vs binding, i was a bit surprised with an example in Programming Clojure
11:57jackdempseyhttp://gist.github.com/135941
11:57Chouserlet and binding are actually very different
11:58jackdempseythe reason print-foo prints the top level foo and not the foo in let
11:58jackdempseylet foo is making a local foo that print-foo doesn't know about?
11:58Chouserjackdempsey: exactly
11:59jackdempseyso without completely misusing terms, that feels like print-foo closes on the originally defined foo
11:59jackdempseyis that accurate to say?
11:59Chouserlet creates locals with lexical scope. Only chunks of code that are visibly, syntactically, within the let can see that local.
11:59Chouserjackdempsey: no, that's inaccurate.
11:59jackdempseyok
11:59jackdempseyso its more that print-foo just doesn't see the local foo
11:59jackdempseybut does see the original globally defined foo
12:00jackdempseyif it wantedt o see the local foo, you'd have to pass it in
12:00Chouserprint-foo closes over nothing -- it (presumably) refers to a var named user/foo
12:00jackdempseyright, yep
12:01Chouserif it were closing over something, binding couldn't be used to change it the way you do on line 11
12:01jackdempseyah i see
12:01jackdempseyso at a high level binding changes where the function will look up variables?
12:02jackdempseyyou said they were very different, so i dont' want to stupidly oversimplify :-)
12:02Chouserprint-foo is printing the currnt thread-local value of user/foo (or the root value of user/foo if there is not thread-local binding).
12:03Chouser'binding' temporarily changes the thread-local value of user/foo so that when you call print-foo it sees that new value.
12:03duck1123the way I see it, binding is like redefing a global var temporarily, and thread locally
12:04jackdempseyok
12:04jackdempseycool. thank you!
13:28stuartsierraIs it possible to launch a REPL from an Ant task?
13:29duck1123can't ant tasks shell out?
13:30duck1123if so, then sure
13:30stuartsierraYes, but calling <java fork="true" spawn="true"> does wacky things to the REPL display.
13:31duck1123I wasted a good day trying to get a repl launched from within maven
13:31stuartsierraI take it you didn't succeed?
13:31duck1123I gave up
13:33stuartsierrahm, ok
13:40duck1123It seemed like I had to jump through a
13:44stuartsierra<java fork="true" spawn="true"> actually doesn't seem to do anything at all.
13:44stuartsierra<java> without fork/spawn works, but prints " [java] " before every line.
13:45duck1123It seemed like I had to jump through a lot of hoops to simply pipe the input and output of a spawned process to stdin/stdout
13:45stuartsierraYeah, that's basically what I want. Not sure if Ant even supports that without writing a custom task.
13:48duck1123it also tripped me up that .getInputStream() was the output, and vice versa
14:04stuartsierraok, giving up and going back to shell scripts
14:06xenolol
14:07slink_why do you want a repl from an ant task anyway? just curious
14:08stuartsierraSingle place to configure classpath/environment, platform-neutral for contributors.
14:11Jetienis there a way to force the reader to process what has been entered so far? generally it waits for matching parens etc.
14:11rhickeystuartsierra: thanks for your quick response and flexibility on template
14:13stuartsierrarhickey: no problem. The arg vector was a good idea, resulted in simpler implementation and cleaner usage.
14:13stuartsierraWhen I first wrote template, I hoped it might be generally useful for macros, but that proved not to be the case.
14:14rhickeyI'm trying to integrate gtic now
14:14stuartsierracool
14:15Chouserwalk and template will be public?
14:40rhickeyall done
14:40rhickeysomeone should do contrib
14:41rhickeycommit listed here: http://www.assembla.com/wiki/show/b4-TTcvBSr3RAZeJe5aVNr/Getting_Tests_Into_Clojure
14:46Chousukeeverything seems to work fine
14:48Chousukecontrib should probably be branched, though, because these changes will break applications using contrib for tests with 1.0
14:48weissjnone of the seq functions listed here: http://clojure.org/sequences , seem to add an item onto the end of the sequence. can someone tell me the magic function name
14:48jackdempseydoesn't conj?
14:49jackdempseyoh, i guess thats for vectors
14:49weissj,(conj '(1 2) 3)
14:49clojurebot(3 1 2)
14:49weissjthat adds the item at the beginning, like cons
14:49Chouserweissj: concat
14:49jackdempsey,(conj [1 2 3 4] 5)
14:49clojurebot[1 2 3 4 5]
14:50jackdempseyconcat for when you have a seq though hm?
14:50ChouserChousuke: the branch doesn't necessarily have to happen before gtic
14:50jackdempseynot a.....whats the term....seq-able?
14:50stuartsierra"lists grow at the beginning, vectors grow at the end"
14:50Chouserthe branch can be made in the past
14:51stuartsierraso to add something to the end of a sequence, yes, you use (concat the-sequence [x])
14:52weissjstuartsierra: ah ok, i had tried (concat seq x)
14:52weissj,(concat '(1 2) [3])
14:52clojurebot(1 2 3)
14:53Chouserweissj: note that's lazy, so you get a closure hanging around that knows how to supply the [3] when its asked for.
14:53Chouserweissj: if you are sure you want to add to the end, do consider a vector. Vectors are good at that.
14:54weissjChouser: ok, but i am basically reading s-expressions from a file and writing them back out, i don't know what'll happen when i start using square brackets
14:54weissjhopefully will 'just work' :)
14:55ChousukeChouser: sure, you can branch from any commit at any time; I'm just saying it should be done at some point )
14:55Chousuke:)
14:55Chouseryes, I completely agree.
14:58Chousukehm, looks like no-one has bothered any contrib issues to assembla
14:58Chousukeand the only open one is not relevant to contrib after GTIC :P
14:58Chousukealso, +moving
14:59stuartsierraAnyone tried maintaining multiple Slime configurations with different startup scripts?
14:59stuartsierrai.e. different projects, different classpath,...
15:19duck1123there was some elisp code on the list that would reset the classpath for each project. I think it assumed a certain layout though
15:20drewrstuartsierra: I do that with jars in a project-specific dir and then set the classpath from elisp.
15:20drewrIt requires java 6 to get /* behavior.
15:21drewrI need to clean it up and paste it.
15:30stuartsierraok
15:42cemerickech, can someone remind me how to override only the void-returning overload of a method via proxy (or do I need gen-class and its -methodName-void magic)?
15:45Chousera method can't be overloaded on return value only, can it?
15:45shoover`stuartsierra: I also like Phil's slime-project function, assuming you don't mind unpacking all your jars into one location: http://groups.google.com/group/clojure/browse_thread/thread/855804aa6fdd74a1?hl=en
15:46rhickeyChouser: not in Java, but generics can generate bridge methods with that property
15:46cemerickChouser: no, I was momentarily confused :-/
15:47Chouserdo the return values have to have anything in common? are you supposed to call the one from the most-derivative class?
15:50Anniepoolisppaste8: url?
15:50lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
15:51lisppaste8Anniepoo pasted "keeping the current" at http://paste.lisp.org/display/82507
15:53Anniepoook, I'm still working at my little toy Clojure browser thingy. I'm going to turn it into an editor. So I need to keep some state - to start, i'm just going to have a 'current scope'
15:54Anniepooso in defn d I want there to be some entity that knows how to warn the swing panels they have become the
15:54Anniepoocurrent scope.
15:55Anniepoofrom a users perspective, up and down arrow keys navigate to enclosing/first enclosed scope, and
15:55Anniepooright left navigate to siblings.
15:56Anniepoowhat's the idiomatic way to hang onto this state info?
15:56Anniepoomake a ref in defn d's let?
15:57Chouserif you have things that need to be notified when some state changes, watchers might be a nice way to do that.
15:58Chouserif you have the "current scope" state in a single reference obj, then when it changes all the watchers will be notified and they can check to see if they're current or not.
15:58Anniepooyes, I'm implementing watcher pattern. Though I'm not totally clear how watcher works in a non OO environment
15:59Chouseron the other hand, you could have one ref per panel, each ref holding true or false. Then in a single dosync you could turn off one and turn on the other -- only the watchers for those two refs would fire.
16:00cemerickwhoo, converting gen-class stuff to proxies makes for much simpler code. It's too bad we can't use it everywhere.
16:00ChouserOur hope lies in new-new, may he quickly come.
16:01Anniepootrue. Since this is essentially a 'focus' it makes sense to have a single one - order current to nonselected, change, order new to selected
16:02Anniepoobut I guess my core question is answered - yes, this is a reasonable place to have a ref
16:02rhickeycemerick: what keeps you from using proxy? (I know there are things, just wondering which ones)
16:03cemerickChouser: indeed. I'm looking forward to it. Chunked seqs are nifty, but I've no obvious use for them -- for new-new on the other hand, I'm waiting with bated breath.
16:03Anniepoothanks for help
16:12cemerickrhickey: the a lot of reasons were cut down when you significantly improved proxy some months ago (January-ish?). At this point, the only remaining issues I can think of off the top of my head are (a) proxies don't provide any Java-visible factory or constructor, and (b) proxies (AFAIK) don't have a reliable class, making things dicey w.r.t. print-dup
16:13kotarak... and multimethods in general.
16:14Chouserouch -- new-new doesn't fix either of those.
16:14cemerickright...we just happen to take advantage of the ClassName/create idiom to allow for simple deserialization.
16:14rhickeycemerick: hmm, the first is likely to be true also of newnew, re: the second, there may be an option to name class, but will be abstract, and changing hierarchy will require restart
16:15cemerickthat's fine -- I can get around (a) without much trouble, and an abstract classname will do just fine.
16:16Chouserwill new-new's abstract base class have a more reliable name than proxy's do?
16:16Chouseroh, I see -- maybe a new parameter that proxy doesn't currently take.
16:17cemerickI'm guessing there's some additional issues that keep us using gen-class (aside from us already having a pile of gen-class code), but I can't think of them now.
16:17ChouserBut proxy could be augmented in that way, couldn't it?
16:17cemerickChouser: it just gloms the superclass+interfaces together, I think
16:17Chousercemerick: yes
16:17Chouserreliably.
16:17Chouser:-)
16:17cemerick...not necessarily in a deterministic way, either, IIRC
16:17cemerickright
16:18rhickeynames are still inherently static, so I'm not sure what you could use a dynamic name for
16:18ChouserI don't think the barrier for a named base class is any higher for proxy than it will be for new-new, right?
16:19rhickeyLet's say you could call your proxy Foo, when could you use that name?
16:19cemerickmultimethods
16:19rhickeyonly if the same classloader could find it
16:19Chousercatch block
16:19rhickeyditto
16:19rhickeyalso load order issues
16:20cemerickhrm, I'm not grokking the class loader issue. AFAIC, all our stuff is going to be in the same jar, so classloader issues are irrelevant.
16:20rhickeycemerick: that's ok for you, but not generally
16:20cemerickthose "other people", always causing trouble
16:21kotarak:)
16:21rhickeywell, it comes down to right tool for the job, dynamic things shouldn't be based on classnames
16:22rhickeyI've been thinking about a type field akin to meta in the bases, this could be set to a stable thing regardless of true class identity or class accessibility, and would participate in the hierarchy system
16:22lisppaste8Anniepoo annotated #82507 "untitled" at http://paste.lisp.org/display/82507#1
16:23cemerickAt some point, I may just mandate that we never expose concrete classnames to clients, and only dispatch on interfaces and such, assuming only one implementation (made via new-new or proxy, etc)
16:23Anniepoohmm... let is lexically scoped. so I'm doing something fundamentally wrong.
16:23rhickeycemerick: that is a great plan
16:23rhickeyand the mechanism I want to best support
16:24cemerickrhickey: depends on how the business goes. If our services plan pans out, then that'll be fine. If we end up continuing to be dependent upon selling libs to Java and .NET devs, then not so much.
16:24rhickeylet interfaces be the only static part of your system
16:24rhickeythere is still genclass, also appropriately static
16:25rhickeyinterfaces + newnew + factory fns + maybe something to package up factory fns for Java
16:26ChouserI just did this
16:26Chouserit's pretty, both from the java client viewpoint and from the clojure code.
16:27rhickeyright, I just want to remove any negatives about proxy, perf and super/protected access-wise
16:28Chouserhaving no thread-safe access to a proxy's parent class is a bit unsettling
16:28Chouserso that'll be quite welcome
16:28cemerickyeah, proxy-super scares the hell out of me :-)
16:56Jetieni don' understand...if the reader receives a EOF it should stop waiting for further input, right?
17:17lisppaste8Anniepoo annotated #82507 "untitled" at http://paste.lisp.org/display/82507#2
17:17Anniepoook, I'm still stuck on this
17:17Anniepoohere's what I'm trying to do
17:18Anniepoohave some dynamicly scoped variable
17:18Anniepoonotionally lots of people could be ordering taco salads
17:19Anniepoothought let made local bindings, but it's lexically local
17:20hiredmangenerally you do something like (def *user* nil)
17:21hiredmanthen (binding [*user* whatever] do stuff here)
17:21hiredman,(doc binding)
17:21clojurebot"([bindings & body]); binding => var-symbol init-expr Creates new bindings for the (already-existing) vars, with the supplied initial values, executes the exprs in an implicit do, then re-establishes the bindings that existed before."
17:21Anniepooah, ok. But that pollutes the global namespace
17:22Anniepooah! it doesn't, cause this is per thread, hence we're not gonna get back
17:22Anniepoocool
17:22hiredmanwhy not just, you know, pass arguments to functions?
17:23Anniepoobecause in the real example that gets ugly quick
17:23Anniepoolook at my previous annotation, it's got the real code attempt (broken)
17:24hiredmansorry, c formated lisp is not something I force myself to read
17:24JAS415might want to hyphenate set-focal-scope as a matter of style
17:25Anniepookk, I'll reformat it
17:25hiredmanclojurebot: style?
17:25clojurebotexcusez-moi
17:26JAS415I guess it doesn't matter because you can camel case in clojure, but I like to make it apparent when i'm doing java and when i'm doing clojure
17:26Anniepoook
17:28hiredmanclojurebot: style is http://paste.lisp.org/display/81021
17:28clojurebotRoger.
17:30Anniepoodoesn't help that IntelliJ assumes java rules for double click selection of a name
17:33JAS415Annie I read up the chat channel and am thinking there are a couple ways you can do it depending
17:34JAS415on what you really want
17:34Anniepoook
17:34Anniepoolistens
17:34JAS415ok so
17:35JAS415if you think about it
17:35JAS415you can write functions that define functions
17:35Anniepooyes
17:35JAS415so if you are really worried about cluttering the name space
17:35JAS415you wrap all of your functions in a function that takes a user argument
17:36JAS415then when you change users you call that function and it defines all your functions using that user
17:37JAS415might have to declare them first
17:38hiredmanyou would use with-local-vars
17:38hiredman,(doc with-local-vars)
17:38clojurebot"([name-vals-vec & body]); varbinding=> symbol init-expr Executes the exprs in a context in which the symbols are bound to vars with per-thread bindings to the init-exprs. The symbols refer to the var objects themselves, and must be accessed with var-get and var-set"
17:39Anniepoohmm... my ultimate goal is a little debugger. so you can go (d form) and you get a swing window that displays the form in a neatly colored way, lets you navigate around,
17:39Anniepooah, cool
17:41lisppaste8Jonathan Smith annotated #82507 "annotation" at http://paste.lisp.org/display/82507#3
17:41JAS415well i put what i was thinking about up there
17:42Anniepoothanks
17:42JAS415user could even be a hash table that gets destructured containing user information
17:43Anniepooyes, for the moment it's just the ref to the swing panel. I'm (obviously) a total noob and making small things
17:44JAS415:-)
17:45Anniepoothanks for the help
17:48JAS415i'm a java noob so i'm struggling here too if it makes you feel any better :-)
17:50AnniepooI've written java since the early java days. Last functional language I wrote in was LiSP in college (cards, I have gray hair)
17:51lisppaste8Anniepoo annotated #82507 "untitled" at http://paste.lisp.org/display/82507#4
17:52lisppaste8Anniepoo annotated #82507 "untitled" at http://paste.lisp.org/display/82507#5
17:52Anniepoook, I seem to have found what I wanted with def/binding but it's flipping when I do the swap!
17:52Jetiencan somebody tell me how to get a repl which throws an error when an unexpected EOF is detected?
17:53hiredman,(doc swap!)
17:53clojurebot"([atom f] [atom f x] [atom f x y] [atom f x y & args]); Atomically swaps the value of atom to be: (apply f current-value-of-atom args). Note that f may be called multiple times, and thus should be free of side effects. Returns the value that was swapped in."
17:53hiredmanswap! takes a function
17:53Anniepoohmm
17:54hiredmanI imagine you are doing something like (swap! some-atom some-jpanel)
17:54Anniepooyes
17:54hiredmanwell, swap! takes a function
17:54hiredman,(doc reset!)
17:54clojurebot"([atom newval]); Sets the value of atom to newval without regard for the current value. Returns newval."
17:54Anniepoothanks
17:55lisppaste8mblinn pasted "compile" at http://paste.lisp.org/display/82519
17:55mblinnso, should that work?
17:55hiredmandon't put the compile in there
17:55mblinnas in, should I be able to compile that code using (compile)
17:55mblinnwell
17:55hiredmanthat will cause a loop
17:55mblinnI'm running the compile from a repl
17:56hiredmanwhat happens?
17:56mblinncom.randomfault.cimeleon=> (compile 'com.randomfault.cimeleon)
17:56mblinn#<CompilerException java.lang.ClassNotFoundException: (org.jibble.pircbot.PircBot) (cimeleon.clj:1)>
17:56mblinnand yeah
17:56Anniepoo8cD
17:56mblinnit's on the classpath
17:56hiredmanare you sure?
17:56mblinnthat is, the library is
17:56mblinnwell
17:57mblinnhmm
17:57hiredmanok
17:57hiredman:entends does not take a list
17:57hiredmanso remove the parens
17:58hiredmanhttp://clojure.org/API#gen-class
17:59hiredmanjava has single inheritence, you are generating a java class, so why would there be a list of classes extended?
18:00mblinnyeah, stupid mistake
18:00mblinnthanks
18:02hiredmanI've found pircbot to be very usable with proxy, just setNick after you connect
18:02mblinnah
18:03hiredmanclojurebot uses pircbot
18:03hiredmanclojurebot: where are you?
18:03clojurebothttp://github.com/hiredman/clojurebot/tree/master
18:03mblinnhmm
18:03mblinnyeah that makes sense, just seemed like a good opportunity to figure out how gen-class worked
18:03mblinnthanks mate
18:03hiredman~proxy
18:03clojurebotproxy is <Chouser> proxy teases with its ease of use, then suddenly betrays.
18:03mblinnheh
18:22JAS415cool i just did persistent caching via memoization (more or less) :-)
18:41JAS415what does 'no matching ctor found for class clojure.core$complement_3539$fn3541
18:41JAS415'
19:02cemerickhiredman: heh, I've been completely ignorant of reset!. I've been doing (swap! atom (constantly foo)) all this time. :-(
19:36combashow long has clojure been in development, about when did it start?
19:45duck1123combas: AFAIK, about a year and a half
19:45duck1123less than 2 years
19:46duck1123the 1 year birthday was in nov or oct IIRC
19:46mblinnI think it's been public for that long, but in development for over 3 years
19:53rhickeyhttp://www.apress.com/book/view/9781430272311
19:55rhickeyhttp://code.google.com/p/clojure/source/browse/trunk/src/org/clojure/runtime/Cons.java?r=3
20:09jackdempseyhow far things have come, eh? :-)
20:09rhickeyyup
20:13rhickeya mere 1400 checkins
20:31jackdempseyanyone know of people using clojure with a lot of text analysis, NLP, etc?
20:31jackdempseyreally considering porting some stuff, curious to learn what others have who've gone before me :-)
20:40combasthat's quite amazing really
20:41jackdempseyyeah, i can't believe its not more checkisn
20:45combasman programming book titles always make me laugh when they use words like definitive, might as well just say 'best evar!'
20:45combasim sure its a fine book though
20:48hiredmanI'm going to be gone for a week, so no one break clojurebot
20:50holmak_clojurebot: P =? NP
20:50clojurebotExcuse me?
20:53grrrtwhat a disappointment clojurebot!
20:55holmak_Clearly Clojurebot was not manufactured to the highest of standards.
20:55holmak_I think #haskell has the most epic ircbot
20:55holmak_They may have as many as 3, I don't remember...
20:56holmak_I think #haskell's lambdabot actually knows how to write Haskell, which makes it smarter than me.
20:56duck1123,(= :p :np)
20:56clojurebotfalse
20:57duck1123$1,000,000 please
20:58holmak_Your proof... I find it somehow suspicious.
21:12combas,(+ 2 4)
21:12clojurebot6
21:12combascool
21:33weissjhow do i get map to return a vector
21:33weissjor convert list to vector i guess
21:34weissj,(map inc [2 3 4])
21:34clojurebot(3 4 5)
21:36weissj,(vec [2 4 5])
21:36clojurebot[2 4 5]
21:36weissj,(vec '(2 3 4))
21:36clojurebot[2 3 4]
21:36weissjah there we go
22:05dreishmap doesn't return a list.
22:14stuarthallowayI am going to bring contrib up to date with the move of test-is to clojure.test
22:15Chouserstuarthalloway: thanks!!
22:15stuarthallowayshould I add stub packages that throw exceptions?
22:15stuarthallowayand document to the mailing list the breaking change?
22:15InaHello
22:18ChouserIna: hi.
22:18InaIs there a good introduction to Clojure for someone unfamiliar with the functional paradigm?
22:18Ina+Somewhere
22:19Chouserstuarthalloway: I don't know what you mean. stub packages for what?
22:19stuarthallowayclojure.contrib.test-is
22:19Chouserohhh...
22:19Chousersorry, just got it.
22:19codyKina, stuart halloways book is good
22:19stuarthallowaycodyK: thanks! :-)
22:19InaSomething no-budget?
22:19codyKseriously i would have said the same thing were you not on
22:20codyKi got it for less than $20 USD
22:20codyKdunno if thats feasible for your financial situation
22:20codyKbut its not an expensive book as computer books go
22:20stuarthallowaywhich raises the question of a (deprecate [namespace options]) function to automate deprecating namespaces and functions
22:21codyKhttp://jnb.ociweb.com/jnb/jnbMar2009.html
22:21codyKthats also a good tutorial
22:21ChouserIna: I learned by trying to solve projecteuler problems
22:21InaI know computer books are expensive
22:22ChouserIna: they start simple, but doing them in clojure will definitely reward solving them functionally.
22:22ChouserIna: and when you get stuck, the problems are small enough that people here can help.
22:23Chouserstuarthalloway: I dunno -- seems to me that announcing the change on the g.group and just removing the old namespace should be sufficient.
22:24Chouserstuarthalloway: we still need a 1.0 tag + download
22:24clojurebotdownload is http://code.google.com/p/clojure/downloads/list
22:24stuarthallowaywell, I will start with that
22:24stuarthallowayChouser: yeah--any particular reason that is held up
22:25Chouserstuarthalloway: nope, just no selfless soul has stepped up to do it yet.
22:25InaIf I have the eclipse clojure plugin, does that come with the necessary libs?
22:25stuarthallowayis it that nobody wants to step forward and say "I am the person in charge"
22:25Chouserstuarthalloway: perhaps
22:26ChouserI imagine I'll do it eventually if nobody else does, but I think I'm a poor fit for release engineering in general.
22:34durka42~forget download
22:34clojurebotI forgot download
22:34durka42~download is http://github.com/richhickey/clojure/downloads
22:34clojurebot'Sea, mhuise.
22:34durka42~svn
22:34clojurebotsvn is http://clojure.googlecode.com/svn/trunk/
22:34durka42~svn is passé
22:34clojurebotOk.
22:35durka42~svn is also use git
22:35clojurebotOk.
22:35durka42~git is http://github.com/richhickey/clojure/tree/master
22:35durka42hmm
22:35durka42clojurebot: git?
22:35clojurebotgit is http://www.github.com
22:35durka42~forget git
22:35clojurebotI forgot git
22:35durka42~git is http://github.com/richhickey/clojure/tree/master
22:42jackdempseyfwiw, just have to say, the Programming Clojure book is excellent
22:43jackdempseyfirst computer programming book i've actually bought and gotten mostly through in a few days :)
22:44hainit helps that there's aren't ten chapters on syntax alone :)
22:45codyKthe contrast with the scala book i read near the same time is amazing
22:47Chouserstuarthalloway: did you see there's another book in the works?
22:47stuarthallowaychouser: no, that's awesome
22:48codyKhopefully it's better than practical ocaml
22:48Chouserstuarthalloway: http://www.apress.com/book/view/9781430272311
22:49stuarthallowayinteresting... not on amazon yet
22:50stuarthallowayhopefully the second of many
22:50stuarthallowaypractical common lisp was very good, so high hopes
22:59Drakesonwhat it takes to search, obtain, and maintain the latest version of set of libraries (plus their dependencies), from the maven repository?
23:01drewrWhat's Luke's nick?
23:04Chouserhe doesn't appear to be a registered contributor.
23:06Chouserand grepping for various obvious derivitives of his name isn't turning up anything in the logs.
23:07drewrHm.
23:08Chouserhe's posted quite a bit on the g.group.
23:08drewrAh.
23:09drewrI thought his name sounded familiar.
23:10ChouserTo the DC study group as well.
23:18jackdempseynice, would love to see some DC clojure get togethers
23:21Chouserjackdempsey: I believe they meet regularly
23:21jackdempseyah cool
23:21jackdempseywill have to look it up
23:22Chouserhttp://groups.google.com/group/clojure-study-dc
23:24jackdempseyoh nice, thanks!
23:24jackdempseynow to just find the time :-)
23:45combasIna: still around? I think this is quite a good free book http://en.wikibooks.org/wiki/Clojure_Programming