#clojure logs

2009-02-25

01:25durka42...is clojurebot self-aware now?
01:25hiredmanso every hour it sends tweets since the last hour about clojure (limit 3)
01:26hiredmanin theory it does that
01:26durka42ah
01:26hiredmanwe will see in an hour
01:31durka42are tweets tagged? or do you just grep on "clojure"?
01:31hiredmanhttp://search.twitter.com/search?q=clojure
01:32durka42cool
01:33hiredmanI pushed with the tweet plugin
01:33hiredmanI mean, source of the tweet plugin is pushed
01:34durka42is if-let what lispers refer to as anaphoric if?
01:38hiredmanlooks similar (as far I as I can tell)
01:43hiredmanthat has occured to me
01:44durka42it could just be elapsed time since last message
01:44durka42clojurebot reads every message anyway looking for , or ~
01:45hiredmanyes
01:50durka42(Thread/sleep)
02:23__marius__so i have a strange error - if i launch slime (both slime an dclojure are completely up to date), i get java.lang.ClassNotFoundException: swank.swank (NO_SOURCE_FILE:9) after trying to start the swank serer
02:23__marius__however
02:23__marius__if i recompile clojure, it works
02:23__marius__but only once...
02:29hiredmanis swank up-to-date?
02:31__marius__yep.
02:32adakkak,(.split "this" "h")
02:32clojurebot#<String[] [Ljava.lang.String;@1a05bdb>
02:32adakkakhow do go from String[] to a clojure type?
02:38cmvkk,(seq (.split "this" "h"))
02:38clojurebot("t" "is")
02:40adakkakthanks
02:44hiredman,(vec (.split "this" "h"))
02:44clojurebot["t" "is"]
02:44hiredmanooh
02:51adakkak,(isa? \a ::char)
02:51clojurebotfalse
02:52hiredmancorrect
02:52hiredman(doc isa?)
02:52clojurebotReturns true if (= child parent), or child is directly or indirectly derived from parent, either via a Java type inheritance relationship or a relationship established via derive. h must be a hierarchy obtained from make-hierarchy, if not supplied defaults to the global hierarchy; arglists ([child parent] [h child parent])
02:52jochu__marius__: Bah, swank-clojure compiling must be broken. You can turn it off by (setq swank-clojure-compile-p nil). If it ends up being a recurring issue, I'll have it turned off on default. In the mean time, I'm curious - are there compiled class files in your ~/.slime/cljclass/ directory?
02:52hiredman,(isa? \a Character)
02:52clojurebotfalse
02:52adakkakis there a clojure name for java.lang.char ? like ::a-collection
02:52hiredman,(isa? \a Character/TYPE)
02:52clojurebotfalse
02:53hiredman,(isa? (Character. \a) Character)
02:53clojurebotfalse
02:53hiredmanoh
02:53hiredmanduh
02:53hiredman,(isa? Character Object)
02:53clojurebottrue
02:54hiredmanisa? is for inheritence, not determining types
02:54hiredman(instance? \a Character)
02:54hiredman,(instance? \a Character)
02:54clojurebotjava.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Class
02:54hiredman,(instance? Character \a)
02:54clojurebottrue
02:54cmvkkinstance? is backwards from isa?
02:54cmvkkoh wait that makes sense.
02:56__marius__jochu: thanks, i'll try that
02:56__marius__jochu: yep
02:56__marius__jochu: (re: compiled classes there)
03:02jochu__marius__: Boo, so does turning off compilation or deleting the directory fix it? (deleting would be a one time fix)
03:36adakkakis there a reason why the following would not work: http://paste.lisp.org/display/76135
03:36adakkakin particular the defmulti part
03:37hiredmanwhere is the exception?
03:37hiredmanwell
03:37hiredmanthere are a few things
03:37hiredmanbut I am not going to say until you paste the exception
03:42adakkakjava.lang.IllegalArgumentException: No matching method found: split for class java.lang.Character (NO_SOURCE_FILE:0)
03:43adakkakactually : java.lang.ClassCastException: Cannot cast java.lang.Character to java.lang.String (NO_SOURCE_FILE:0
03:44hiredmanwell
03:45hiredman~jdoc Character
03:45hiredmanas you can see Character does not have a .split
03:46hiredmanalso, generally you don't deal with Characters you deal with chars which are a primitive type and have no methods
03:46hiredmanand you method with ::collection will never be used because (class ...) will never return ::collection
03:47hiredmanand the syntax of defmulti has changed
03:47cmvkk,(.split "baha" \h)
03:47clojurebotjava.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.String
03:48cmvkk,(.split "baha" (str \h))
03:48clojurebot#<String[] [Ljava.lang.String;@19a6087>
03:48hiredmanand?
03:48adakkak,(instance? \a ::chars)
03:48clojurebotjava.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Class
03:48hiredmanadakkak: ::chars is not a type
03:48hiredman::chars is a keyword
03:49hiredman,(instace? Character \a)
03:49clojurebotjava.lang.Exception: Unable to resolve symbol: instace? in this context
03:49adakkakI though you said there was a type called chars
03:49hiredman,(instance? Character \a)
03:49clojurebottrue
03:49adakkakan I should be using it
03:49hiredmanthere is a primitive type called char
03:49hiredmanno, you shouldn't
03:49hiredman:foo is a keyword
03:49hiredmannot a type
03:50hiredman::collection is not a type, but java.util.Collection is
03:51hiredman::collection is a keyword
03:51adakkakahh.. http://clojure.org/multimethods confused me ; you said that the syntax for defmulti has changed. is there a documentation for that.
03:51hiredman,(doc defmulti)
03:51clojurebot"([name docstring? attr-map? dispatch-fn & options]); Creates a new multimethod with the associated dispatch function. The docstring and attribute-map are optional. Options are key-value pairs and may be one of: :default the default dispatch value, defaults to :default :hierarchy the isa? hierarchy to use for dispatching defaults to the global hierarchy"
03:52hiredmanactually, that will still work
03:52adakkakany examples of its use?
03:52cmvkkyours is still right, i think.
03:53hiredman,(class [])
03:53clojurebotclojure.lang.PersistentVector
03:53hiredman,(class "foo")
03:53clojurebotjava.lang.String
03:53hiredman,(class \a)
03:53clojurebotjava.lang.Character
03:53cmvkk,(class '(1 2))
03:53clojurebotclojure.lang.PersistentList
03:53hiredmanthese are the things your dispatch fn will be returning
03:55hiredmanwhat are you even trying to do?
03:55adakkakI am trying to split a string based on a few seperators without using regex
03:56cmvkkyou want the function to take either a char or a list of chars.
03:56cmvkkmaybe try using (seq? x) for dispatch then methods for true and false?
03:56hiredmanjust use mapcat
03:57hiredman,(.split "a|b;c'd" "|")
03:57clojurebot#<String[] [Ljava.lang.String;@1b7a553>
03:57hiredman,(mapcat #(.split % ";") (.split "a|b;c'd" "|"))
03:57clojurebot("" "a" "|" "b" "c" "'" "d")
03:58hiredmanodd
03:58cmvkk,(seq (.split "a|b;c'd" "|"))
03:58clojurebot("" "a" "|" "b" ";" "c" "'" "d")
03:58hiredman,(.split "a|b;c'd" "\|")
03:58clojurebotUnsupported escape character: \|
03:59hiredman,(.split "a|b;c'd" "\\|")
03:59clojurebot#<String[] [Ljava.lang.String;@1335207>
03:59hiredman,(seq (.split "a|b;c'd" "\\|"))
03:59clojurebot("a" "b;c'd")
03:59cmvkkweird escape stuff? that's weird.
03:59hiredmannot really
03:59hiredmansplit uses its arg as a regex
03:59hiredmanso you need to escape |
04:00cmvkk,(seq (mapcat #(.split % "y") (.split "axbyc" "x")))
04:00clojurebot("a" "b" "c")
04:00hiredmanand \ needs to be escaped in strings because \ is used for character literals
04:00hiredmanso you need \\
04:02adakkakthanks, that is what I was looking for
04:03hiredman(really you should just use a regex)
04:04hiredman,(seq (.split "axbyc" "x|y"))
04:04clojurebot("a" "b" "c")
04:06hiredman,(seq (.split "axbyc" (apply str (interpose "|" "xy"))))
04:06clojurebot("a" "b" "c")
04:12adakkakI should be using it with regex, but part of thing I am doing requires one not to use regex
04:36Lau_of_DKMorning all
04:48cgrandHi Lau_of_DK!
04:57nietis clojure ore for concurrency thatn distributed systems?
04:57nietmore
04:58AWizzArdkotarak: hoi
05:00hiredmanniet: yes
05:01hiredmanalthough I think I recall rhickey mentioning something about amq
05:02hiredmanbut presnetly there isn't a "blessed" distributed mechanism
05:38AWizzArdhiredman: is that thine blog?
05:39hiredmaneh?
05:39hiredmanclojurebot tracks twitter now
05:40hiredmanso, No, that is not my blog
05:42Lau_of_DKdescent article
05:45lisppaste8Bracki pasted "What's wrong with the dispatch fn?" at http://paste.lisp.org/display/76137
05:46BrackiCan the dispatch fn for a multimethod be any kind of function?
05:48BrackiI get an NPE when calling the defmethods but I have no clue why and where.
05:49Lau_of_DKMissing a \space after keyword?
05:50Lau_of_DKAnd are you sure what re-find will return for your call ?
05:52BrackiYes but no, I forgot to put a + after [A-Z].
05:52Brackithx.
05:53Lau_of_DKYea, maybe it'd be easier with something like this
05:53Lau_of_DKuser> (re-find #"\b([^\/]\w+)(\s.*)+" "/part #clojure")
05:53Lau_of_DK["part #clojure" "part" " #clojure"]
05:53Lau_of_DK ?
05:55BrackiLau_of_DK: But IRC clients transform "/nick Bracki" to "NICK Bracki".
05:56Lau_of_DKoh
05:56Lau_of_DKuser> (re-seq #"\b([^\/]\w+)(\s.*)+" "PART #clojure")
05:56Lau_of_DK(["PART #clojure" "PART" " #clojure"])
05:56Lau_of_DK
05:56Lau_of_DKSo thats better?
05:57Bracki,(re-find #"^[A-Z]+\b" "PART #clojure")
05:57clojurebot"PART"
05:57Brackiis sufficient for me.
05:58Bracki,(doc re-seq)
05:58clojurebot"([re s]); Returns a lazy sequence of successive matches of pattern in string, using java.util.regex.Matcher.find(), each such match processed with re-groups."
05:58Lau_of_DKk
06:33AWizzArdyeah great, news spam :)
06:34cemerickwow, lots of heat coming from the CL world these days
06:54AWizzArdyup
06:54AWizzArdthey are scared
06:55AWizzArdthey are happy because they have fset and some basic implementation of a STM
06:55cemerickI doubt they're scared -- I don't think the CL world can lose any more relevance than it already has.
06:55cemerickI suppose a big vendor disappearing would be another notch down...
06:58AWizzArdAnd I hope that won't happen too soon.
06:58AWizzArdBut well, evolution is in progress, so, anything can happen.
06:58AWizzArdsurvival of the ...
06:59AWizzArdIn fact, we can congratulate them. They were able to survive way longer than most others.
07:02cemerickI suppose.
07:03cemerickI've had enough bad experiences with the community that I can't easily work myself up to be congratulatory.
07:05AWizzArdalthough:
07:05AWizzArd,(= 'community 'vendors)
07:05clojurebotfalse
07:06AWizzArdAnd btw, I am also one of those CL guys ;)
07:06AWizzArdAt least that's what I've been doing in the past 6 years.
07:06AWizzArdBut for me the age of Clojure began.
07:09cemerickWell, I've seen some serious venom poured forth by people with emails from some of those vendors' domains, but yeah, point taken.
07:11cemerickThere's thousands of perfectly peaceful CL programmers tending their own gardens, but those that throw stones in very public forums (perhaps only *in* those public, at-arms-length forums) end up defining the public profile of the community as a whole.
07:12Lau_of_DKcemerick: Pride goes before a fall :)
07:13cemerickAWizzArd: BTW, I was tinkering with javafx over the weekend -- it's a pretty pleasant environment. Not clojure, obviously, but it actually has a lot of primitives that make building UIs a lot easier. It might make a really good front end to some clojure libs that contain the real workings of an app. Are you still plowing ahead in netbeans/swing?
07:13Lau_of_DKcemerick: You're driving fx from clojure?
07:15cemerickLau_of_DK: not really -- but fx can call into clojure as readily as any other java lib. I only brought it up because it's actually looking like it has serious potential to be better than swing (as we've known it).
07:16Lau_of_DKOk cool - I had a look at it a while ago, but didnt use it (primarily because I was investing my time in QtJambi)
07:16cemerick...and I know AWizzArd was looking for UI solutions -- driving a UI with clojure is appealing, but if the javafx guys do well, the "right tool for the job" rule might override any impulse to do everything with our favorite language.
07:16rhickeycemerick: I wonder how much of fx goodness is in libs we can drive from Clojure
07:17rhickeyI know a lot of it is
07:17cemerickI was pretty disappointed to see jambi dropped so quickly -- that could have had real potential in some usages
07:17Lau_of_DKcemerick: Im still on Jambi - I use it for my GitDoc project
07:17Lau_of_DKI just paralized it with CQL and a 3D game :)
07:18cemerickrhickey: I'm not entirely clear on it all, but from interviews I've listened to (I'm a podcast junkie), the plan is to start opening up the object model for any jvm language later this year.
07:19cemerickearly releases had the object model very tied up with specifics of javafx script, which is no longer true. I'll bet you can drive the scenegraph and such using any language today, but they just haven't publicly documented the API and such yet.
07:20cemerickrhickey: good show on c.l.l, BTW. It was a valiant effort. :-)
07:21cemerickLau_of_DK: the project has already been open-sourced, so it could be maintained. Being 'unendorsed' is a big blow, though -- it'll probably lag the core libs forever.
07:26AWizzArdcemerick: yes, I am doing netbeans/swing, but would be highly interested in JavaFX. The quesion is though: can one use all FX libs from Clojure?
07:26AWizzArdI would want to use it without writing a line (well, 1% of the overall project) in JavaFX
07:26Lau_of_DKcemerick: which project has been open-sourced, fx? And which valiant effort, on which c.l.l ?
07:27AWizzArdmy NetBeans+Clojure approach works by clicking until I have the gui, and then I write one export function in Java. This just returns an Object[] in which all the components sit which I want to touch in Clojure.
07:27cemerickrhickey: Did you happen to see my post yesterday on the reader oddness in #= forms? http://groups.google.com/group/clojure/browse_frm/thread/34e4d47fc5144512 I need to start serializing certain object graphs (excuse my likely wrong terminology), and these things are hanging me up.
07:27AWizzArdIn Clojure then I have a (def my-frame (MyNetBeansStuff.)) and (def my-components (.getComponents my-frame))
07:27cemerickmaybe I'm just missing something fundamental...
07:28AWizzArdNow I can happily add event handlers, change texts, etc.
07:28cemerickAWizzArd: ostensibly, yes, and using them from any jvm language is promised for later this year
07:28cemerickLau_of_DK: I was referring to jambi and comp.lang.lisp, respectively.
07:28AWizzArdwell, I would love to have something better than Swing. Swing is nice but could be way nicer.
07:29AWizzArdOne solution that could work for FX and maybe also frameworks such as RIFE: writing lots of code in Clojure, and in Java then call it.
07:30cemerickAWizzArd: using fx-script may just be a perfectly reasonable thing to do -- it has a lot of very nice primitives for binding state, timers, etc etc that would likely require some/a lot of work in any other language.
07:30rhickeyuser usage of #= is not yet supported - it is not full eval
07:30AWizzArdMy experience with Rife so far was, that it can't handle the .class files generated by Clojure.
07:30AWizzArdcemerick: okay sure, if it is just abount handling boring GUI work it may be fine. The application logic however can and should still be 99% Clojure.
07:31cemerickrhickey: OK, I wasn't clear on that. Is that going to change anytime soon, or should we just create normal fns to be used in #= forms (find-enum, make-char-array, etc)?
07:32cemerickAWizzArd: Right, right. I think the plan is to make it reasonably easy for other languages to create "binding sites" that can be readily tapped by fx-script-driven UIs.
07:36Lau_of_DKcemerick: thats news to be regarding Jambi... and bad news :(
07:37cemerickLau_of_DK: oh, you hadn't heard? http://www.qtsoftware.com/about/news/preview-of-final-qt-jambi-release-available
07:37AWizzArdAnd if we can get our fingers on JavaFX then sooner or later there maybe a ClojureFX lib which will offer all the nice things from JavaFX, so that we can drive a 100% Clojure solution.
07:38cemerickAWizzArd: that last 5 or 1% will kill you -- and probably result in zero real benefit (IMO).
07:39rhickeycemerick: I guess you'll have to do that, but note it is still not full eval - all args must be readable constants
07:40cemerickrhickey: ah, OK. That criteria clarifies the class cast in the second example.
07:41rhickeycemerick: #= is subject to change
07:41cemerickrhickey: I think we're used to that ;-)
07:42rhickey:(
07:42cemerickthere's not really any other reasonable option, though. bean serialization is really painful, especially for arrays and such.
07:43rhickeycemerick: ah, well I'm glad you agree about that, too bad though
07:43cemerickrhickey: oh, no worries. Sometimes that's the price one must pay to use the good stuff. I do feel bad for Stuart, though.
07:43AWizzArdcemerick: have you combined a JavaFX (toy-)app in any way with Clojure so far?
07:43cemerickAWizzArd: No -- I just played with it for the first time this weekend (as the demos now run reasonably, so I figured I was duty-bound to check it out).
07:44AWizzArdmaybe you can find the time to call a clojure function wich returns "Hello JavaFX" and display that? ;)
07:44rhickeycemerick: I pushed on lazy just for Stuart, since I knew it would be breaking. There hasn't been any breaking other than that since AOT
07:45cemerickrhickey: Yeah -- it only feels worse for me because we didn't port to post-AOT until a couple weeks ago :-D
07:45rhickeyah
07:46cemerickwe're probably going to come up to date with the lazy stuff, and then fall behind for another cycle.
07:47cemerick...or maybe we'll try to track things in real time, and be adventurous.
07:47cemerickAWizzArd: yeah, maybe this coming weekend
07:48cemerickit shouldn't be hard -- fx script can call any java lib. The real trick is enabling jvm languages to expose fx script "native" structures, I think.
07:48cemericks/is/will be
07:49AWizzArdwould be nice, yes
07:58AWizzArdwb kotarak
08:00clojurebotsvn rev 1306; made line-seq fully lazy
08:11Lau_of_DKThis question might be spawned out of a lack of coffee, but here goes
08:11Lau_of_DKuser> (defn myAdd [ x y ] (+ x y))
08:11Lau_of_DK#'user/myAdd
08:11Lau_of_DKuser> (myAdd (map #(* 2 %) [ 1 2 ]))
08:11Lau_of_DK; Evaluation aborted.
08:11Lau_of_DK
08:12Lau_of_DKIs there anyway that I can make this possible? Because I have scenarios where I would like to use map as a type-caster/value-modifier, before the result should be passed to a javafunc which expects a certain number of arguments...?
08:13gnuvince(hi "everyone")
08:13ChousukeLau_of_DK: use apply
08:15Chousuke,(apply (fn [x y] (+ x y)) (map #(* 2 %) [1 2]))
08:15clojurebot6
08:15Chousuke,(apply (fn [x y] (Math/pow x y)) (map #(* 2 %) [1 2]))
08:15clojurebot16.0
08:16ChousukeLau_of_DK: and just as an aside, the spaces after [ and before ] look ugly :)
08:16Lau_of_DKChousuke: Thank you for the first part of your input :)
08:17ChousukeI've seen some people use (defn foo[x y]) which I don't like either :/
08:17Chousukeit makes the argument vector look like special syntax
08:17Lau_of_DKHang on, while I fetch my little violin :)
08:19cemerickI love the smell of snark in the morning.
08:22Lau_of_DK"The Snark is the fictional monster that Lewis Carroll created in his nonsense poem The Hunting of the Snark. His descriptions of the creature were, in his own words, unimaginable, and he wanted that to remain so."
08:22Lau_of_DK"Snark is a 1974 text-based computer game for BASIC designed by People's Computer Company in which one must "net" the "snark," a point on a 10x10 ..."
08:23cemerickooh, I didn't realize -clojurebot was watching twitter!
08:25cemerickrhickey: is there any reason why EvalReader couldn't simply pass the read object to Compiler.eval? Or am I turning over stones that are going to get bulldozed to make way for a subdivision?
08:29AWizzArdcemerick: duh, another such a Swing incompetency: I can't simply add new Elements to a JList. First I need to put in a new Modell and do 300 extra calls and create objects.
08:31cemerickAWizzArd: nah, just ((DefaultListModel)jlist.getModel()).add(0, "my new item's name")
08:31cemericksimpler in clojure with reflection, of course
08:32cemerickand you can add any object -- its .toString will be used to generate the label
08:33cemerickJLists always start with a DefaultListModel, JTables always start with a DefaultTableModel, etc., so it's safe to assume their base functionality
08:38AWizzArd,(class (.getModel (javax.swing.JList.)))
08:38clojurebotjavax.swing.JList$3
08:38AWizzArd,(cast (.getModel (javax.swing.JList.)) 'javax.swing.DefaultListModel)
08:38clojurebotjava.lang.ClassCastException: javax.swing.JList$3 cannot be cast to java.lang.Class
08:39AWizzArd,(cast (.getModel (javax.swing.JList.)) javax.swing.DefaultListModel)
08:39clojurebotjava.lang.ClassCastException: javax.swing.JList$3 cannot be cast to java.lang.Class
08:40AWizzArd,(.add (.getModel (javax.swing.JList.)) 0 "Hallo")
08:40clojurebotjava.lang.IllegalArgumentException: No matching method found: add for class javax.swing.JList$3
08:40cemerickoh no, I think I just dished out a steaming pile, instead of advice! :-(
08:42cemerickAWizzArd: JList is the exception -- JTable does use DefaultTableModel, JComboBox uses DefaultComboBoxModel, etc.
08:42AWizzArdthings like this maybe improved in JavaFX?
08:44cemerickAWizzArd: you mean common things made easy? One can only hope. I honestly didn't get that far -- was looking more at the binding and widget layout mechanisms.
08:44AWizzArdIn Swing there is even not a center method for JFrames. As if people were not interested to center their windows from time to time.
08:44cemerickthere's always....
08:45cemerick,(.add (.getModel (javax.swing.JList. (javax.swing.DefaultListModel.))) 0 "fooey")
08:45clojurebotnil
08:45AWizzArdcemerick: yes, it is just that I already created the JList in NetBeans and placed it at the right position.
08:45AWizzArdMaybe in NetBeans I can make it so that the JList will be created with a DefaultListModel
08:46cemerickAWizzArd: See Window.setLocationRelativeTo(Component)
08:46cemerickyeah, you can do that
08:46cemerickmodel is just another bean "property"
08:49AWizzArdWhat I did is: right-clicked the JList, selected "Customize Code" and made the new JList() ==> new JList(new DefaultListModel())
08:49cemerickyeah, that'll work
08:52heanolis lazy-seq supposed to be commented out in core.clj? i'm trying to run swank-clojure and it seems to use it..
08:52rhickeyheanol: you've got mismatched versions
08:53heanolwell i got trunk/head of both, i think
08:54heanolwhich one of them is too new? :-)
08:54cemerickAWizzArd: the more idiomatic way would be to hang the 'new DefaultListModel()' code off of the widget's model property
08:55AWizzArdcemerick: yes, but this would add one more line cof code ;)
09:04heanolto answer my own question, jumping back to commit 581954d1fc0cb115a87233426bae5d53455eb4bb for swank-clojure made it work.. was before it started using lazy-seq
09:17AWizzArd,(isa? 25 Integer)
09:17clojurebotfalse
09:17AWizzArd,(class 25)
09:17clojurebotjava.lang.Integer
09:17AWizzArdhow should isa? be used?
09:17danlarkinwith clojure hierarchies
09:23rhickeyAWizzArd: isa? isn't instance?
09:24AWizzArdthx
09:24rhickeybut it can be used with Java classes too
09:24rhickey,(isa? String Object)
09:24clojurebottrue
09:24AWizzArdinstance? works for me, thanks
09:25Lau_of_DKhiredman: Why does clojurebot repeat the same news ?
09:26AWizzArdLau_of_DK: it posted this link now at least 3x
09:27AWizzArdIs there an easier way to extract values out of a hashmap for a vector of specific keys? Easier than (map #(apply % %2) [:a :b :c] some-map)
09:27gnuvinceselect-keys?
09:28AWizzArdgood
09:28gnuvince,(select-keys {:a 1, :b 2, :c 3} [:a :c])
09:28clojurebot{:c 3, :a 1}
09:28AWizzArdbtw, the #(apply % %2) should be just apply
09:28gnuvince,(vals (select-keys {:a 1, :b 2, :c 3} [:a :c]))
09:28clojurebot(3 1)
09:28gnuvincetadam
09:28AWizzArd,(map apply [:a :c] {:a 1, :b 2, :c 3})
09:28clojurebot(1 2)
09:29gnuvincefail
09:29AWizzArdsure, of course
09:29AWizzArdselect-keys is good, thanks
09:29gnuvinceNp
09:30cemerickLau_of_DK: -clojurebot is monitoring twitter, so dupes are likely
09:34Lau_of_DKThen I'd like to suggest (remove-duplets (monitor-twitter))
09:35cemerickthat'd get dicey with the diversity of url-shortening services out there
09:39Lau_of_DKthen I'd like to suggeste (filter *.* (monitor-twitter)) ? :)
09:39cooldude127is wanting to write a better java mode for emacs a completely crazy idea?
09:40BrackiAre structs ordered? Can I rely on their keys being in order as defined?
09:40Brackicooldude127: Yes, use Vim.
09:40Lau_of_DKhaha
09:40Lau_of_DK"use Vim" - Bracki you know this is 1981 anymore right?
09:40Lau_of_DKman that was fun...
09:41rhickeyBracki: yes, see: http://clojure.org/data_structures - "A struct map will retain its base keys in order."
09:41cooldude127Bracki: i should clarify that i have no real beefs with emacs' java syntax highlighting or anything like that, it's just that actually coding java requires a little more help, like some better project management
09:42cooldude127and JDEE is a big box of FAIL
09:42BrackiWell, IntelliJ IDEA is nice.
09:42cooldude127i've used all the IDEs, i find myself dissatisfied
09:43cooldude127idea is the least awful
09:43cooldude127lol
09:43cemerickyou could spend a lifetime building a good java toolchain in emacs
09:43jbondesonRaynes: D= whyyyyyy?
09:43cooldude127cemerick: well it doesn't have to do everything, just needs to fill in the gaps that keep me using eclipse
09:43cemerickbest to live with the 90% that NetBeans or IDEA or Eclipse gets you (w.r.t. your ideal state)
09:44cooldude127NO, i've tried that for too long
09:44cooldude127i can't take it anymore
09:45cooldude127plus i figure this an AWESOME way to learn emacs-lisp
09:45Raynesjbondeson: "because I can".
09:45Raynes;)
09:46jbondesonRaynes: my soul weeps for you
09:46RaynesGive me a break, they aren't that bad. At least they're improving.
09:46jbondesonevery time i see the eclipse startup screen a little piece of me dies
09:47RaynesOh, you just don't like Eclipse in general.
09:47cemerickI'm becoming very happy with enclojure of late for straightforward editing and development. Hopefully the debugging and profiling aren't too far behind.
09:47Raynescemerick: Enclojure isn't bad at all, but I get persecuted for using Netbeans. :|
09:48jbondesonRaynes: i first used eclipse back when it when you could type faster than it could display because of all the extra work it was doing.
09:48cooldude127haha
09:48RaynesI switch between the two all the time though.
09:58BrackiIs there something that does exception to nil conversion with out using excessive try/catch blocks?
09:58ChouserBracki: sure, the macro you're about to write.
09:59Bracki,(doc defmacro)
09:59clojurebot"([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?]); Like defn, but the resulting function name is declared as a macro and will be used as a macro by the compiler when it is called."
09:59Chouseror the one cgrand already wrote for you: http://clj-me.blogspot.com/2009/01/try-or-or-try-try-else-or-else-try.html
09:59Chousergotta love that url.
10:00BrackiHm what does ~ do?
10:00AWizzArdit unquotes
10:01gnuvince,(let [x 10] `(x ~x))
10:01clojurebot(sandbox/x 10)
10:01Bracki?
10:01AWizzArd,'(a b c)
10:01clojurebot(a b c)
10:02AWizzArd,(quote (a b c))
10:02clojurebot(a b c)
10:02AWizzArdnow imagine b is a variable of the value 10
10:02AWizzArdand you want to give that 10 back
10:02AWizzArdinstead of the symbol "b"
10:02AWizzArdthen you unquote
10:03AWizzArd,`(1 2 (+ 1 2) ~(+ 1 2))
10:03clojurebot(1 2 (clojure.core/+ 1 2) 3)
10:03BrackiAight, the wholde code is data/data is code drama.
10:03AWizzArdjust imagine the clojure.core/ would not be there
10:03AWizzArd`(1 2 (+ 1 2) ~(+ 1 2)) ==> (1 2 (+ 1 2) 3)
10:04gnuvinceIf it were Ruby, ~ would be sort of like #{} in strings
10:04Chousergah!
10:04gnuvincegu!
10:08gnuvinceDamn
10:08gnuvincecgrand just left
10:09Chousercgrand1 is still here. Hi, cgrand1!
10:09gnuvinceoh
10:09Chouseror maybe not. *shrug*
10:09gnuvinceHis try-or looks sort of the opposite of the Maybe monad, does it not?
10:10Chouser"real world hasekll" is on my reading list. or would be if I had a reading list.
10:10cgrand1I'm here!
10:15cgrand1gnuvince: try-or is somewhat related to mplus in the Maybe monad
10:29cemerickasymptotically so as clojure gains in popularity, I suspect
10:29gnuvinceIf people find it annoying, a lot of IRC clients have ignore and soft ignore features.
10:31cemerickat a certain point, that convention would repel newcomers to the channel. A similar feed of mentions of python (or whatever) would get XXX updates each minute.
10:31cemerickit's nice for now, though :-)
10:33gnuvinceAt one point, we could just have a planet.clojure.org site to keep the channel cleaner.
10:36cemerickdefinitely
10:36danlarkin+100
10:52Raynes"I suppose I should learn Lisp, but it seems so foreign." - Paul Graham, Nov 1983
10:52Chouserwow, nice.
10:54cemerickjust wait 'til you get to the forest of hooks
10:54cooldude127lol
10:56RaynesMarch 4th is the 50th anniversary of LISP.
10:57arbscht_again? :)
10:57RaynesYessir.
11:00lisppaste8cgrand pasted "form-scoped expansion-time bindings" at http://paste.lisp.org/display/76144
11:01BrackiHm, I need help w/ ns problems.
11:01Brackijava.lang.Exception: namespace 'protocol' not found after loading '/protocol' (urkle.clj:0)
11:04Chousercgrand2: is this enlive-related?
11:05cgrand2Chouser: yup
11:06ChouserI haven't tried that yet, but I just recommended it to a friend.
11:06AWizzArdA (sorted-set) will stay sorted, right? Even if I conj elements into it.
11:06ChouserAWizzArd: yes
11:07ChouserAWizzArd: that is its purpose
11:07cgrand2Chouser: while coding enlive, I didn't find a good way to make the current node contextual for other (lexically scoped) macroexpansions
11:09cgrand2and I ended using unquote as a quick and dirty way to say "here I need to pass the current node"
11:09AWizzArdIs there a better way to do this:
11:09AWizzArd,(get {:x 25} :y (delay (throw (Exception.))))
11:09AWizzArdthrowing an exception if a key is not present in a map/set
11:10cgrand2(since ~ expands to a fully qualified clojure.core/unquote it's easy to find)
11:10ChouserAWizzArd: Jason Wolfe wrote a safe-get or safe-map thing to do that.
11:10cgrand2Chouser: thanks for recommending it
11:11Chousercgrand2: oh, you used ~ outside of ` ?
11:11cgrand2yes
11:11BrackiHm, what do I need to set the classpath to if I've got multiple source files?
11:12cgrand2and the above paste is my attempt to get rid of those ~ by "controlling" macroexpansion
11:12BrackiI have this layout: start.clj start/other.clj
11:12BrackiI can't call the stuff in other.clj from start.clj
11:13cooldude127Bracki: start/other.clj is a new namespace
11:13cooldude127you need to use it
11:15Chousera couple dozen lines of Clojure is a lot of Clojure. It's likely to contain the same level of complexity as pages of Java.
11:19Chouserso propagate is a tree walker
11:19cgrand2yup
11:19Chousercgrand2: did you look at clojure.contrib.walk?
11:20ChouserI don't know if it would help or not.
11:21cgrand2Chouser: I looked at it
11:21Chouserok
11:22cgrand2propagate is not a complete tree-walker: it cooperates with the compiler
11:23Bracki(ns start :use [other])
11:23Brackiright?
11:25gnuvinceBracki: (ns start (:use [other]))
11:26cgrand2and the around-form macro can be seen as a continuation passing mechanism
11:26gnuvincecgrand2: do you work in Clojure at work?
11:28cgrand2gnuvince: I try to (I'm a freelancer)
11:28gnuvinceAh OK.
11:31RaynesRemove the free part and it makes sense.
11:33cemerickuh...
11:34Raynes"lances cgrand2 in the neck!"
11:34RaynesStop being dicks :<
11:36brianhcgrand2: OT but is that a rock outcropping behind you in your picture? you a climber?
11:38cgrand2brianh: it's a sycamore :-)
11:40brianhcgrand2: ahh
11:41brianhcgrand2: was just curious. have been to Fountainbleau several times & love visiting France
11:48cgrand2brianh: to climb on the sandstone boulders?
11:48brianhcgrand2: yes
11:50brianhcgrand2: most times i was actually in the area for work
11:51brianhcgrand2: but made sure i had time for fun :)
11:53niet(partial map f) , what the hell is that? just map then?
11:54Chouserniet: that's a bit like #(map f %)
11:54jbondesonChouser: i'm running into some problems persisting xml zippers, have you ever done anything with this, or should i write some code around it to get that to work?
11:55nietwhat is a zipper really?
11:55Chouserjbondeson: persisting as in converting to bytes? I've not done that.
11:56Chouserjbondeson: you want to keep the current node, not just the underlying logical tree?
11:56nietzip(a,b) -> [(a[0],b[0])...(a[n],b[n])] ?
11:57Chouserniet: nope, that's (map vector a b)
11:57cemerickniet: no, Huet zippers
11:57jbondesonChouser: i'm trying to figure out some way to keep the structure sharing without getting crazy. i think i may just have to store raw xml and re-zipper on load
11:58Chouserniet: zippers are clojure.zip -- a data structure for storing a tree plus a "current node" in the tree
11:58cemerickjbondeson: what's the specific problem? I'd think print-dup would serialize a zipper pretty well.
11:58Chouserjbondeson: If you don't need the current node saved, that's probably the most sensible.
11:59Chouserjbondeson: or save as clojure.xml data, printed. Then you can 'read' instead of xml-parsing.
12:02jbondesoncemerick: running into class format issues
12:05cemerickjbondeson: it'd be worth giving print-dup a try, I'd think
12:05jbondesoncemerick: trying it right now
12:06Raynes(doc print-dup)
12:06clojurebotexcusez-moi
12:06RaynesHaha
12:07jbondesoncemerick: takes a little bit since i'm working with quite a bit of data ~25MB of xml
12:07cemerickah-ha. Eww. ;-)
12:07lisppaste8hmm pasted "same result, why?" at http://paste.lisp.org/display/76153
12:08nietcan someone tell me when ^^ gives different results?
12:10Chouserthe fn returned by partial will take any number of args, and pass them all to max
12:10Chouserthe fn created by #(... %) will take only a single arg.
12:11jbondesonhmmm, still getting ClassFormat errors.
12:27Lau_of_DKGood evening cgrand + (rest #clojure)
12:27jbondeson'ello
12:28WizardofWestmarcheya Lau
12:29cgrandHi Lau_of_DK!
12:29gnuvince,#clojure
12:29clojurebotNo dispatch macro for: c
12:30Lau_of_DKI think this is both ridicously funny, and at the sametime it says a lot about most people nowadays: http://i39.tinypic.com/24w7ed0.jpg :)
12:30jbondesonman, this xml is gonna be the death of me.
12:30jbondesonnever trust a technology with an X in it!
12:31Lau_of_DKjbondeson: XML in Clojure is a breeze :)
12:31jbondesonLau_of_DK: except if you want to persist the parsed xml structures =(
12:32jbondesonhaving trouble with xml zippers
12:32Lau_of_DKjbondeson: How is that a problem ? Persist how ?
12:32Lau_of_DKzip-filter?
12:32lisppaste8hmm pasted "euler" at http://paste.lisp.org/display/76155
12:32jbondesoni'm writing them out to file with print-dup and trying to read them back in, and running into ClassCast exceptions
12:32nieti cant figure out how that solution ^^ works
12:33hiredmanjbondeson: you are writting out zippers yes?
12:34jbondesonyeah
12:34Lau_of_DKniet: It looks like it sums all the pairs, starting at the second lowest row, picks the max of that, and does the same on the row above, working its way to the top
12:34nietlau: yes
12:34hiredmanI am not sure about ClassCastE but zippers use metadata, and I dunno if print-dup handles that
12:34nietbut i wasnt clear. the last def , of s . it is recursiv without a basecase
12:35jbondesonhiredman: i'm doing similar things as clojurebot does with svn, just with much more data, and in verbose mode. so i'm caching tons of xml
12:35jbondesonhiredman: that makes sense.
12:36Chouserjbondeson: you're printing the zipper object, or the underlying tree?
12:36jbondesonChouser: the actual zipper, i'm trying to keep the amount of data i have to store in memory down.
12:37Chouser,(binding [*print-dup* true] (prn '(#^{:some :meta} x)))
12:37clojurebot(#^#=(clojure.lang.PersistentArrayMap/create {:some :meta}) x)
12:37Chouserprint-dup does fine with meta-data
12:39jbondesonChouser: i should be able to read that in with a simple "read" right?
12:39cgrandHow are constants stored in clojure class files?
12:42cgrandjbondeson: when you try to serialze zippers on small structures, does it work?
12:42Chouserjbondeson: yes, you should be able to just 'read' and get all of it.
12:42jbondesoncgrand: it works on simple structures, yes
12:43Chousercgrand: I'm not very sure about this (went looking for the code, but haven't found it yet), but I think the constants are printed with print-dup and then read on class load.
12:43jbondesonChouser: i must have been doing the print-dup wrong, when i did it the way you just did i now gett errors about missing anonymous functions
12:44Chouserjbondeson: ah, that sounds better. :-)
12:44jbondesonit's storing things like (clojure.core$complement__3465$fn__3467. )
12:44Chouserthe fns hanging off the zipper node meta-data probably can't be printed/read.
12:45jbondesonmakes sense.
12:45jbondesoni guess i'll have to keep the xml data as well, and then re-zipper the xml on load
12:45cgrandChouser: thanks
12:45jbondesonor just do without a zipper
12:46Chouserjbondeson: there are three stages, right?: xml, parsed xml, and zipper
12:46Chouserparsed xml should print/read ok, I think.
12:46jbondesonChouser: yeah, i was just about to try that.
12:46jbondesonif i'm careful about how much i zipper at a time i can probably do an on-demand zipper
12:56jbondesonhah, the xml read is saying there's no matching ctor for clojure.lang.PersistentStructMap/create
12:57jbondeson,#=(clojure.lang.PersistentStructMap/create {:tag :msg, :attrs nil})
12:57clojurebotNo matching method found: create
12:57jbondesonlots o creates
13:00jbondesonit seems PersistentStructMap/create takes two args...
13:04gnuvince~seen rhickey
13:04clojurebotrhickey was last seen quiting IRC, 152 minutes ago
13:05jbondesonspose i'm back to storing raw xml.
13:09Chouserjbondeson: ah, sorry, forgot about that. structs don't print-dup either
13:09Chouseryou could try plain printing -- they'd be read as array-maps, which are less memory efficient.
13:11jbondesonChouser: think i'm going to just emit when persisting
13:15yasonHmmm, printing from a Swing application under Slime doesn't seem to work when control comes from the Java event loop. Does it sound like a Slime issue?
13:17jbondesonyason: check your inferior-lisp buffer
13:18yasonjbondeson: ah, you're right. Is it possible to redirect it to the *slime-repl clojure* buffer?
13:18jbondesonunfortunately, no.
13:19jbondesonslime only grabs the result of an action.
13:19jbondesonit ignores anything else
13:19yasonjbondeson: OK, good to know. Thanks!
13:19jbondesonif you're going to be doing tons of async printing turn off fancy
13:20jbondesonthat'll give you slime features but drop the redirect buffer iirc
13:21yason"fancy" being which variable/function/mode? Didn't find anything immediately.
13:21jbondesonthe call to slime-setup
13:22jbondesonusually it's (slime-setup '(slime-fancy))
13:22yasonah, that
13:22jbondesonif you just (slime-setup) fancy is disabled
13:23yasonjbondeson: C-c C-z then switches to inferior lisp buffer if there's no repl buffer?
13:23jbondesoni don't have C-c C-z defined, what is it for you?
13:24yasonslime-switch-to-output-buffer
13:25jbondesonhaven't used non-fancy, but i would hope so =D
13:26yasonI'll have to check it out
13:26yasonI don't print much or regularly, but debug prints are handy if you know where to find them
13:27yasonI don't use repl much though so I might stick with non-fancy, actually. Will have to check it out.
13:27yasonThere's so much to configure in Slime I've never bothered to learn all the features :)
13:28gnuvinceyason: just do like I do: use it like you have it now, when you see a configuration from someone else that you don't have try it out.
13:30shooveryason: M-x slime-redirect-inferior-output
13:30yasongnuvince: that's pretty much how I do it :)
13:31jbondesonyason: proof of your point, had no idea that slime-redirect-inferior-output existed.
13:31yasongnuvince: I trust I'll bump into any interesting and useful configurations over time
13:31yasonshoover: ditto!
13:31gnuvinceyason: indeed. You can search for references to slime, init.el, etc. on github, you often find nice little jewels
13:34jbondesonyou can have it always on by putting (add-hook 'slime-connected-hook 'slime-redirect-inferior-output) in your .emacs
13:39Lau_of_DKI asked a question earlier that I probably didnt understand the answer to. I'll try again. Lets say I have a Javafunc which takes 3 floats - clojure doesnt have shorthand for floats yet, so in the meantime, I want to do something like (.javaFunc obj (apply (fn [x] (float x)) [1 2 3])) - Why doesnt this work ?
13:39yasongnuvince: the usual for emacs too. I often end up coding some useful function in elisp until I find out next year that there's a package for it and it has been included in Emacs for years :)
13:39yasonjbondeson: thanks
13:42ChouserLau_of_DK: did you try (.javaMethod obj 1 2 3) ? Numbers seem to be converted automatically.
13:42Chouser,(Float/isNaN 5)
13:42clojurebotfalse
13:42ChouserisNaN takes only a float
13:43Lau_of_DKhmm - Why didnt I think of that
13:43Lau_of_DKI just noticed that 5.0 => double, so I figured it'd never work
13:43jbondesonLau_of_DK: cause it was obvious and we programmers are in the business of making things harder ;)
13:44Lau_of_DKBut ok, on principle, if I want to apply a function to a stream of numbers, and the resulting streams has to be passed as arguments, can that be done?
13:44ChousukeLau_of_DK: for the manual conversion you want (apply #(javafunc %&) (map float [1 2 3]))
13:44Chousukewith a .
13:44Lau_of_DK%& ?
13:44Chousukerest
13:44Lau_of_DKk
13:44Lau_of_DKThanks guys
13:44ChouserChousuke: next. :-)
13:45Chouserhm, not that either, I guess.
13:45Lau_of_DKChouser: I didnt update to LazyTown yet :) Still scared
13:45drewrI'm still using a working copy from late Jan
13:46jbondesonlazy is fun
13:46jbondesonregardless of what clojurebot says
13:46ChousukeI should figure out how to make dd-wrt distribute the 5 DHCP IPs I get from my ISP to machines on my LAN
13:46jbondeson~lazy?
13:46clojurebotlazy is hard
13:47drewrI'm sure it is fun, but I've got a alot of code to change.
13:47jbondesoncome on, nothing is more fun than losing your mind debugging an infinte loop in the new lazy branch.
13:48jbondesonwell, not branch, trunk now
13:48Lau_of_DKjbondeson: Isnt swank-clojure up and running with latest rev of Clojure?
13:48jbondesonyeah, it is
13:48jbondesonbut i spent a couple days trying to fix it before jacho got to it
13:49jbondesonit was an adventure to say the least
13:56danleikwoi
13:57danleioops
14:02Lau_of_DKHow do I get ant to realise where its dependencies are ?
14:03jbondesonant dependencies or the project ant is compiling?
14:04pietiahello, which other language for JVM may be called "language for easier conurrent programming" ?
14:04pietiascala,clojure ... ?
14:05Lau_of_DKjbondeson: seems -lib did something
14:06jbondesonLau_of_DK: i add a classpath node to the java node
14:06Lau_of_DKhow ?
14:08Lau_of_DKits The Hoeck !
14:09jbondesonLau_of_DK: unger the java node you can add <classpath><path location="another.jar"/></classpath>
14:09Lau_of_DKoh ok
14:11jbondesoni'm not an ant expert, but that's how i have it setup
14:12Chouserpietia: I think Clojure addresses concurrent programming more directly than Scala. Another interesting choice may be Erlang.
14:12WizardofWestmarcdoes Erlang have a JVM version?
14:12pietiaChouser, but in must be for jvm :)
14:13WizardofWestmarcErlang does look pretty awesome however, but thanks to clojure it dropped down my must learn list a fair bit
14:13WizardofWestmarcat the very least I want to pick up Haskell before I mess with it now
14:13Chouserpietia: ah, you did say that. Clojure, then. :-)
14:13pietia:)
14:13pietiaany other language?
14:14pietiax10 from ibm
14:14zakwilsonI just saw some Haskell-derived language for the JVM that might do a pretty good job with concurrency. I can't remember what it's called.
14:14ChouserWizardofWestmarc: Haskell's next for me, though mostly to understand monads in their natural habitat, and to see if there are any other goodies to bring back to Clojure.
14:14WizardofWestmarcright
14:15WizardofWestmarcit's a different style of coding then anything else w/o static typing or the like
14:15zakwilsonAhh, here we go: CAL - http://openquark.org/Open_Quark/Welcome.html
14:15WizardofWestmarcand I want to experience it to see what's useful
14:15WizardofWestmarcespecially now that Real World Haskell is out
14:15WizardofWestmarcmy one beef from my super limited time in Haskell is you can't define functions in the REPL >_<
14:21FibWizardofWestmarc: You can, you just have to use 'let'...
14:21Fibe.g. >let my_add a b = (a + b)
14:23shooverwhat is clojurebot up to? Earlier I thought it was really working on a Clojure elevator controller, until I realized it was reporting links from somewhere
14:23WizardofWestmarcthose are tweets
14:25shooverah, thus the deja vu between that and my RSS reader
14:25hoeckLau_of_DK: yes!
14:26WizardofWestmarchave a feed set up for the clojure search?
14:26shooverWizardofWestmarc: yes
14:26WizardofWestmarcI should do that
14:26WizardofWestmarcbut instead I just go back to the page every so often
14:26shooveror just watch this channel, apparently :)
14:27WizardofWestmarctrue enough hah
14:36Lau_of_DKjava.lang.reflect.InvocationTargetException (NO_SOURCE_FILE:1)
14:36Lau_of_DKI keep getting these when constructing an instance of a class - WHY? :)
14:44Lau_of_DK 0: sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
14:44Lau_of_DK 1: sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
14:44Lau_of_DK 2: sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
14:44Lau_of_DK 3: java.lang.reflect.Constructor.newInstance(Constructor.java:513)
14:44Lau_of_DK
14:44Lau_of_DKI mean - What is this?
14:46WizardofWestmarcFib: just saw your comment to me from before. Huh interesting
14:47adakkakcan someone help me in compiling my clojure program into bytecode
14:50adakkakhere is the error http://paste.lisp.org/display/76160
15:01zakwilsonadakkak: you need to have the classes directory in your classpath.
15:01adakkakis that something that I create?
15:03Chouseradakkak: yes, you need to create it and make sure it's in your classpath before you start up the jvm.
15:08adakkakChouser: how does compile know that something is a class directory? also, I placed my class directory "../build/classes/nlp/" in my classpath with the same result
15:09hiredmanadakkak: by default clojure writes out classes to a directory called "classes" in the working directory
15:09hiredmanif "classes" does not exist or is not on the classpath, it will not work
15:10adakkakcreated classes, but I get the same result
15:11hiredmanis "classes" in your classpath?
15:11hiredman(System/getProperty "java.class.path")
15:11hiredmanor something like that
15:12adakkakhere is the output http://paste.lisp.org/display/76160#3
15:12adakkakyes it is
15:13hiredmanah
15:13hiredmanhere is you problem
15:13hiredmandon't compile single segment namespaces
15:13hiredmanswitch to entity.detect
15:13adakkakwhat does that mean?
15:14hiredmansegments are deliminated by dots
15:14adakkakso I should call my file entity.detect.clj and change the namespace accordingly?
15:15hiredmanno
15:15hiredmanthe file would be detect.clj
15:16adakkakand ns will be (ns nlp.entity.calais.entity.detect) right?
15:16adakkakand ns will be (ns nlp.entity.calais.entity.detect) right?
15:16hiredmansorry about that, irssi went ape
15:16adakkaknp
15:17hiredmanif detect.clj is in nlp/entity/clais/entity/ then yes, that would be the namespace
15:17hoeckkotarak: will there be a port of your lazyMap to lazy clojure?
15:19adakkaknothing changed :(
15:21cooldude127~gen-class
15:21clojurebotNo, cooldude127, you want gen-interface + proxy
15:21cooldude127that's what i thought
15:22hiredmanadakkak: "./classes/" still is not in your classpath
15:22cooldude127in that case, can someone explain to me why gen-interface is documented to do nothing if code is not being compiled? can code that uses gen-interface possibly work correctly when not compiled with this being the case?
15:22adakkakyep
15:23hiredmancooldude127: I think the idea is you compile the interface, and then use proxy at runtime
15:23cooldude127hiredman: oh
15:24cooldude127well we'll just see about that
15:24adakkakhiredman: it just worked
15:25adakkakso if I want the classes files to be somewhere else then all I have to do is change the classpath and rerun the (compile...) function
15:25hiredmanthere is some ** var you can rebind to change the place where compile puts classes
15:25hiredman,(doc *compile-path*)
15:25clojurebot"; Specifies the directory where 'compile' will write out .class files. This directory must be in the classpath for 'compile' to work. Defaults to \"classes\""
15:26adakkakalso, will java see the class as calais.detect, or will it be calais.Detect ?
15:27hiredmanit will be whatever the namespace is
15:27hiredmannlp.entity.calais.entity.detect
15:27adakkakdoes the file name play a role?
15:27cooldude127is swank-clojure still broken after the merge?
15:27cooldude127or do i just suck?
15:28hiredmanadakkak: the last segment of the namespace and the filename should be the same
15:28adakkakok
15:29hiredmanadakkak: now, uh, if you are using (gen-class ...) outside of (ns ...) thinks are a little different
15:29hiredmanand even in the (ns ...) there are knobs you can tweak
15:33adakkakfound it. thanks
15:33kotarakhoeck: there will. Just didn't come to it. Lazy branch merge happened with some other time-consuming things here. :)
15:36adakkaknow I have to figure out how to let netbeans know about this new class
15:38hoeckkotarak: fine, i just looked at the lazymap sources today, currently I'm using hand-craftet maps of delays or pseudo-maps
15:39cooldude127ok i don't know what i'm doing wrong, i try compiling a namespace and i get and IOException: no such file or directory
15:39kotarakhoeck: that's what basically happens under the hood. However one needs also a LazyMapEntry to be truly lazy.
15:49BrackiTodays work: http://github.com/bracki/urkle/tree/master
15:49hiredmancooldude127: lets see some details
15:49Brackikotarak: did you see my change to vimclojure? Without that it wouldnt run on my machine.
15:49cooldude127hiredman: (gen-interface
15:49cooldude127 :name clojure.contrib.chrono.Instant
15:49cooldude127 :extends [clojure.lang.IFn])
15:50kotarakBracki: did you send me the pull request?
15:50cooldude127in the clojure.contrib.chrono namespace
15:50Brackikotarak: yesa.
15:50cooldude127hiredman: tried (compile 'clojure.contrib.chrono)
15:50hiredmanBracki: awesome
15:50cooldude127i have an idea
15:50Brackihiredman: aweful
15:50Brackihiredman: poor parsing etc.
15:51kotarakBracki: yes. saw it. Sorry just didn't come around. I'm merging Gorilla with VimClojure and the lazy changes really hit me at difficult time.
15:51BrackiAh ok.
15:51cooldude127nope idea fail
15:51Brackikotarak: I just rebuilt gorilla w/ the lazy changes and it kind of works for me.
15:52cooldude127hiredman: nvm i got it figured out
15:52kotarakBracki: in the bleeding edge there were some changes necessary. Geez. If have to get the changes out soon. :|
16:10durka42writing a program that reads files named ".update"... does anyone know if that name is taken?
16:12kotarakhoeck: pushed some changes for lazymap. I hope they are correct. I'm still not 100% sure about the lazy branch merge things. http://bitbucket.org/kotarak/lazymap/overview There is also a download button for .zip or .tgz. So you don't need hg.
16:25hiredman(doc alter)
16:25clojurebotMust be called in a transaction. Sets the in-transaction-value of ref to: (apply fun in-transaction-value-of-ref args) and returns the in-transaction-value of ref.; arglists ([ref fun & args])
16:34Lau_of_DKDo we have the 'final' keyword in clojure ?
16:34Lau_of_DK(el-finito JPanel.) ?
16:36Lau_of_DK(doc amap)
16:36hiredmanuh
16:36hiredmanI broke clojurebot
16:36hiredmanI'd fix that
16:37hiredman(doc amap)
16:37clojurebotMaps an expression across an array a, using an index named idx, and return value named ret, initialized to a clone of a, then setting each element of ret to the evaluation of expr, returning the new array ret.; arglists ([a idx ret expr])
16:38powr-tocLau_of_DK: which sense of final do you mean?
16:38durka42how do you do (alias 'zip 'clojure.zip) in the ns macro?
16:38Lau_of_DKpowr-toc: the keywords which disallows subclasses
16:38hiredmandurka42: (:require [clojure.zip :as zip])
16:39durka42aha
16:39hiredmanLau_of_DK: you mean for gen-classed classes?
16:39durka42require is the only one i didn't try
16:39Lau_of_DKhiredman: no I mean for instantiations of java classes
16:40powr-tocLau_of_DK: it doesn't look like it
16:40hiredmanLau_of_DK: "the keywords which disallows subclasse" has no meaning in that case
16:41Lau_of_DKWhy
16:41hiredmanbecause you are not doing anything subclass realated
16:41powr-tochiredman: sure it does... final classes can't be specialised
16:41hiredmanyou are instatiating a class
16:42hiredmannot making a new class (which you would declare final)
16:43Lau_of_DK final PhysicsGameState physicsGameState = new PhysicsGameState("Physics tutorial");
16:43Lau_of_DKWhen I port this java code to clojure, it boorks
16:43Lau_of_DKIm wondering if its the keyword final
16:43powr-tocLau_of_DK: that's just an immutable reference type
16:43durka42if you declare a variable in clojure it's going to final, no?
16:43durka42going to be*
16:43powr-tocLau_of_DK: in clojure vars, refs, agents, atoms etc... all have concurrency semantics
16:44durka42,(prn (String. "test"))
16:44powr-tocso you don't really need final
16:44clojurebot"test"
16:45hoeckkotarak: wow, that was fast!
16:45Lau_of_DKk
16:45powr-tocdurka42: not exactly... I don't think clojure has a direct parallel to final, i.e. you can rebind all clojure reference types... it's just they all have concurrency semantics
16:45hoeckkotarak: hg is just one "emerge" away :)
16:46kotarakhoeck: well it's a small library. It can be improved however. Will check whether a LazyMapSeq should extend ASeq.
16:47kotarakhoeck: on the webinterface there are also links to clone the repo. hg clone http://bitbucket.org/kotarak/lazymap IIRC.
16:48hoeckkotarak: yeah, just figured that out, even simpler than downloading, unzipping ... :)
16:48kotarakhoeck: oh, and the changes are without warranty. If you try, please let me know, whether there are problems.
16:50hoeckkotarak: unfortunately there are, the new rest does not work on the lazy map's seq, only next does
16:51kotarakhoeck: huh? I checked in the repl. There it seemed to work. Let me check again.
16:54danlarkinLau_of_DK: is "breena" a good name?
16:55hoeckkotarak: and building lazymap with a assert-if-lazy-seq fails here, but without it works
16:55hiredman,@hiredman.clojurebot.seenx/activity
16:55clojurebotPardon?
16:56hiredmandamn your eyes
16:57danleiwhy did rhickey call it "next" btw? i liked "more" better somehow. (next sounds like "the next element" to me)
16:57tashafahello clojure
16:58tashafaclojure gives me that warm and fuzzy feeling inside
17:00Chousertashafa: and it tastes great, besides.
17:00Chouserdanlei: there a big ol' thread on that topic. You missed it?
17:01Chouserdanlei: 69 messages: http://groups.google.com/group/clojure/browse_thread/thread/88d9fdb5bcad36a/ac087a3c5447a43b
17:01danleiChouser: i'm not following the group closely, i'll read it up, thanks.
17:02tashafaquestion... if I wanted to run a background process that runs every 15mins or so, would I be in the ballpark if I used atoms
17:02tashafa?
17:03Chousertashafa: what's the result of the process? Some side effects, or updating a value.
17:03Chouseractually, either way atom is probably wrong. More likely you want an agent.
17:03tashafahmm... updating a database, i guess that would be a sideeffect
17:03tashafayeah ii was just looking at it
17:04tashafathe book im reading calls for agents
17:04Chouseror maybe even just a Timer
17:04hiredmanugh
17:05hiredmandon't use a Timer
17:05tashafatoo Java?
17:05powr-tocUsing a ScheduledThreadPoolExecutor directly might be a good option
17:05hiredmanyes
17:05hiredman~jdoc ScheduledThreadPoolExecutor
17:05hiredmaner
17:05hiredmanthat is not right
17:06powr-tochttp://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html
17:06hiredmanyeah
17:07Chouserdanlei: even if you don't read all of the group, I'd recommend this higher signal/noise ratio subset: http://tinyurl.com/bntq4v
17:08danleiChouser: thanks for the tip, bookmarked
17:08jbondesonChouser: in my ever continuing xml saga, do you know if there is a reason that rich had clojure.xml/emit println rather than create a string?
17:09ChouserI don't for sure, but my guess is that when printing to disk or network, you wouldn't have to hold the whole thing in memory before you began sending.
17:09Chouserjbondeson: you should be able to rebind *out* if you want it to go to disk or a socket instead of stdout
17:09Chouseror use 'with-out-str' if you want it in a string.
17:09jbondesonalready on it
17:09Chouserok
17:09BrackiI still have those namespace problems.
17:10lisppaste8Bracki pasted "Namespace issues" at http://paste.lisp.org/display/76172
17:12hiredmanBracki: you have your namespace reversed
17:13hiredmanif the namespace is urkle.test the fil should be urkle/test.clj
17:13hiredmanif the filename is test/urkle.clj the namespace should be test.urkle
17:14BrackiThat doesn't change anything unfortunately.
17:15BrackiCan the files be in a different namespace but in the same path?
17:15BrackiOr is this just like Java packages?
17:15hiredmana namespace is a java package
17:16Chousera namespace is like a java package, but is also a java class.
17:17BrackiHm, I just don't get it.
17:18drewrdanlei++
17:18BrackiI have ./urkle.clj and test/urkle.clj, I want to use urkle and urkle.test as namespaces. What's wrong here.
17:18BrackiIs that a classpath issue?
17:19Chouserto use a .clj as a lib, it must be at least one dir down.
17:19hiredmanis test/urkle.clj in the same directory as ./urkle.clj?
17:19Brackiyes.
17:20Chouserbracki/urkle.clj and bracki/urkle/test.clj
17:20jbondesonoy... and that still won't work because i have embedded quotes in the xml now.
17:20Chouserthey should start with the ns macro declaring bracki.urkle and bracki.urkle.test respectively.
17:20jbondesonlooks like i'm rewriting emit
17:20Chouserjbondeson: use clojure.contrib.lazy-xml/emit
17:21Chouserjbondeson: that should work even if you used clojure.xml to parse
17:22jbondesonChouser: that uses println also
17:22Chouseryes, but it escapes quotes and such correctly.
17:23Chouserjbondeson: is there something wrong with 'with-out-str'?
17:23Chouseroh, sorry
17:23Chouserit's the newlines that are bothering you?
17:23jbondesonChouser: no, what i mean is that the resulting string looks like this: "\"<?xml version='1.0' encoding='UTF-8'?>\"\n
17:23jbondesonwhich is invalid xml
17:24jbondesonevery call to print adds a beginning quote and ending quote, which both with-out-str and manual binding
17:25Chouserthat's not right
17:25hiredmanuh
17:27jbondesonChouser: would using *print-dup* potentially cauase any issues?
17:27jbondesonwhen persisting that is
17:27BrackiIt still doesn't work. I'm doing it just like technomancy. http://github.com/technomancy/mire/tree/master
17:28hiredman,(binding [*print-dup* true] (println "foo"))
17:28clojurebot"foo"
17:28hiredman,(binding [*print-dup* false] (println "foo"))
17:28clojurebotfoo
17:28hiredmanI guess so
17:28Chouserjbondeson: ah! yes it would.
17:29kotarakhoeck: pushed a fix (hopefully). Works here with and without assert-if-lazy-seq, though.
17:30kotarakhoeck: ok. And maybe I'm too stupid to the flag. Just a sec.
17:30jbondesonnow i just need to nuke all these '\n's
17:30BrackiMoved everything to src. So now I have src/urkle.clj and src/urkle/test.clj.
17:31BrackiShouldnt java -cp /path/clojure.jar:src/ clojure.main src/urkle.clj work?
17:32hiredmanBracki: depends on the namespaces declared in urkle.clj and test.clj
17:32ChouserBracki: I'm pretty sure a lib with no dot in its name is not valid.
17:32hiredman*namespace
17:32Chouserthat's why I suggested bracki/urkle.clj for the ns bracki.urkle
17:33kotarakhoeck: No. It's ok. Seems to work now. :) Please let me know any more problems. :) Gotta go now, though. I'm around here from time to time or via the email in the README.
17:34lisppaste8Bracki annotated #76172 "namespace" at http://paste.lisp.org/display/76172#1
17:35hiredmanugh
17:35hiredmanBracki: your namespaces are still all wrong
17:35hiredmanfix them.
17:37hiredmanclojurebot: namespaces?
17:37clojurebotexcusez-moi
17:37BrackiSorry for being a dunce. But what is all wrong?
17:37ChouserBracki: I'm pretty sure a lib with no dot in its name is not valid.
17:38Chouserthat's why I suggested bracki/urkle.clj for the ns bracki.urkle
17:38BrackiBut why does the stuff work I posted.
17:38BrackiBecause of that awful (add-classpath) sutff?
17:38Chouseroh, you got it working?
17:39BrackiNo, but my layout is the same as in technomancy's mire. He also has a single ns without any dots.
17:39hiredmanclojurebot: namespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
17:39clojurebotIk begrijp
17:40hiredmanBracki: well, technomancy is doing it wrong, so you will have to ask him how he got "doing it wrong" to work
17:41Chouserthe "at least one dot" rule may only apply when you try to compile to bytecode, I'm not sure.
17:41hiredmanwhich branch of mire are you looking at?
17:41BrackiThe latest.
17:42hiredmanChouser: feel free to alter clojurebot's brain
17:42Brackihttp://github.com/technomancy/mire/tree/master
17:42hiredmanBracki: mire is developed in several steps, which are shown in the branches
17:43BrackiThe master branch has everything.
17:43hiredman;urkle/test.clj
17:43hiredman(ns urkle.test
17:43hiredmanwhoops
17:43Chouserhiredman: either way. nobody wants to find out they have to rename everything just to get it to compile.
17:47BrackiInside a namespace do I have to :use myself?
17:48Chouserno
17:49Brackiwell that's causing the bloody problem.
17:50danleiok, having read the thread, i still feel that "next" connotates returning an item, and would have preferred something like "rest", but that's just words. i'll get used to it.
17:52danleioops s/rest/more/
18:00lisppaste8Bracki annotated #76172 "So close." at http://paste.lisp.org/display/76172#2
18:00BrackiOK, I nearly have it.
18:01BrackiSo how do I include a package that's on the same level? As in test.clj.
18:04hiredmanif you are in the urkle directory, the classpath should not contain "\urkle\"
18:04hiredmanjust "\."
18:04BrackiNo I have urkle\urkle.
18:06Chousertry "urkle" instead of "\urkle" perhaps?
18:07hiredmanif you are remove back-slashes I would just remove the leading one
18:08BrackiCould that be a Windows issue?
18:08BrackiHow do I print the classpath from the repl?
18:11hiredman(System/getProperty "java.class.path")
18:11BrackiYippie. It works.
18:12BrackiThe correct classpath is: java -cp ..\path\clojure.jar;..\path\clojure-contrib.jar;. <--- Notice the dot after the semicolon.
18:13hiredman 15:03 hiredman : if you are in the urkle directory, the classpath should not contain "\urkle\"
18:13Brackihiredman: Yeah, well said.
18:13BrackiThanks and sorry for bothering you guys.
18:17BrackiWhen using clojure.main to run a file, what do I need to do exit back to the shell?
18:18drewrBracki: It'll exit when -main returns.
18:19hiredmanjava clojure.main --help
18:19hiredmanit has a list of different options
18:19hiredmando you mean just kill the repl and exit the jvm?
18:19hiredman(System/exit)
18:19hiredmanor Ctr-Z on windows?
18:22BrackiYes. (System/exit)
18:25tashafaxml question... how do i get the content of every tag with a name into a seq?
18:25tashafai have a fn that does this but there should be an easier way
18:26tashafae.g. every 'link' content in an atom feed
18:26Bracki,(doc xml/parse)
18:26clojurebotjava.lang.Exception: Unable to resolve var: xml/parse in this context
18:26Bracki,(doc clojure.xml/parse)
18:26clojurebot"([s] [s startparse]); Parses and loads the source s, which can be a File, InputStream or String naming a URI. Returns a tree of the xml/element struct-map, which has the keys :tag, :attrs, and :content. and accessor fns tag, attrs, and content. Other parsers can be supplied by passing startparse, a fn taking a source and a ContentHandler and returning a parser"
18:28tashafaBracki: yes, but do i have to walk each hash-set filtering out the results?
18:28hiredmantashafa: how else would you do it?
18:29tashafahiredman: well i thought there would be some easier way in clojur.contrib
18:30Chousertashafa: you might look at clojure.contrib.zip-filter.xml
18:30tashafai wish clojure.contrib had an api documentation on the web
18:30tashafaas cool
18:30tashafaah cool*
18:30tashafathanks
18:32BrackiAny code coverage tools for clojure yet?
18:34tashafaChouser: exactly what i was looking for, even authored by you... you are the man
18:37westajayok.. heading home...
18:37westajaybyeeeee.
18:38westajaysorry.. wrong channel.. :-)
18:42tashafahmm.. any idea on why its called 'zip'
18:42hiredmanit uses zippers
18:42powr-tocjust looking through the implementation of agents... am I right in thinking that watchers only fire, if the state is set to a different object? i.e. if you were to wrap a java.util.HashMap in an agent, and modify the map with the function you pass to the agent, the watchers wouldn't be notified?
18:42tashafahahaha
18:42hiredmanno
18:42hiredmanfor real
18:42hiredmanclojure.zip
18:43tashafayeah im looking at it now
18:43tashafahierarchical zipper
18:43hiredmanthey are way cool
18:43Chouserpowr-toc: that's right. Clojure's reference types generally assume you're using immutable data.
18:44powr-tocChouser: yeah, I knew that was the default... and it makes sense; just something to be aware of i.e. that the test is an identity test, not an equality one
18:45tashafaso much to learn, so little time
18:45Chouseroh, I see what you were asking.
18:45Chousertashafa: yeah -- I don't have a tutorial for zip-filter yet.
18:46Chousertashafa: but hopefully the examples in the comment there are enough for you to make it work, even if you don't know exactly what's going on underneath.
18:46powr-tocI'm loving being able to quickly dig through the implementation source code, clojure's source is way more accessible than almost any other language I know of
18:46tashafaChaouser: problem solved... the tests in zip-filter.xml is enought
18:46Chousertashafa: ah, good.
18:46tashafawere enough*
18:47Chousergreat, so if you wouldn't mind writing up a tutorial...
18:47tashafaeverything just works as advertised and you can write and test your whole application in the repl
18:48tashafai'm in programming heaven
18:49tashafahmm.. write a tutorial? on just contrib.zip-filter?
18:49Chousersure, if you'd like.
18:49ChouserI was joking a bit of course, by any such documentation would be welcom.e
18:50tashafaha
18:50Chouserman, I can't type.
18:50tashafaa tutorial would be nice though... but i think the tests are enough
18:50Chouser"but any such documentation would be welcome"
18:53tashafaall i think we need are the docs of the functions of clojure.contrib in an indexable format... the tests and fns are succint enough to grasp how they work
18:56tashafafor now
18:56tashafadocumentation will be needed later down the road when the dust settles
19:25clojurebotsvn rev 1307; added type
19:26durka42but then sometimes i get annoyed when i type (/ 783 25) at the repl "783/25 is what i typed! i want to know what that is!"
19:28durka42is that svn change for custom print-methoding?
20:18Rayneshttp://paste.pocoo.org/show/105483/ Completely irrelevant, but entertaining either way. The main developer of SharpE (which is the channel I was in.) (he's also a Delphi programmer) agreed with her and I eventually got banned for calling her a bitch.
20:21danlarkinwe're not here to justify your bigotry :)
20:21RaynesMind you, she insulted me 5 times before hand just for trying to explain it to her.
20:21cooldude127lol
20:22RaynesI don't believe it's bigotry, as I have about 25 people on hand right now to agree with me. A command line and a text editor, and knowledge to use them are essential tools for every programmer.
20:23Raynes90% of you use Emacs for Clojure.
20:23cooldude127yes we do
20:23RaynesI use an Netbeans.
20:23RaynesSee my point?
20:23Raynes._.
20:24RaynesI /could/ use emacs and a command line for Clojure, but I choose not too because Enclojure exists.
20:25gnuvincehaha
20:25RaynesThat's true nerdism right there.
20:25RaynesEmbrace the nerd.
20:25cooldude127lol
20:26danlarkinok I've got some actual clojure content to talk about for once... I need some help writing the following functionality in a functional style
20:26gnuvinceThe difference between choosing Emacs or choosing Eclipse/Neatbeans/etc. is whether you want/need something that you can configure completely like you want it or just a package that works well enough
20:26cooldude127danlarkin: i love these probleems
20:27danlarkinit's for my django clone/rewrite/whatever, it's for applying middleware,
20:27danlarkinso there's this function that takes a request-map and returns an response-map
20:28danlarkinand inside this function it examines the URL and then calls another function, a "view" to handle it, depending on the url
20:28cooldude127danlarkin: paste it :)
20:28danlarkinand it also applies "middleware" functions to the request and response at different points
20:29danlarkinso a middleware can define itself to be called before the view runs, after the view runs, etc
20:29danlarkina few places
20:29cooldude127PASTE
20:30cooldude127:)
20:30danlarkinso the way I've got it now (which is wrong) is (merge (map call-middleware list-of-middlewares))
20:30danlarkinfiiiiine
20:30cooldude127lol
20:30cooldude127danlarkin: this sounds like, without seeing it, a problem for reduce
20:31cooldude127rather than map
20:31danlarkinwell
20:31danlarkinI haven't gotten to the problem yet
20:32danlarkinlisppaste8: url
20:32lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
20:32cooldude127i love lisppaste.el
20:33lisppaste8danlarkin pasted "middleware" at http://paste.lisp.org/display/76179
20:33gnuvincecooldude127: link?
20:34cooldude127http://www.ph.ed.ac.uk/~s0198183/lisppaste.el
20:34danlarkinok, so that's the main dispatch function or whatever
20:34Chouserdurka42: I do believe you're right.
20:34durka42should be useful
20:35danlarkinthe problem, though, is if I want a middleware to be able to return a response
20:35danlarkininstead of just modifying the request
20:36danlarkinif I want a middleware that short-circuts all requests for an URL with an "e" in it (whatever), it needs to be able to just return a response, straight up
20:38cooldude127danlarkin: this still seems like you need to do a reduce-like loop/recur, where you check for a certain sentinel value
20:39cooldude127danlarkin: seems like a good way would be a list of before-middleware functions, the view function, and then after-middleware functions
20:40cooldude127that all get a request and response and do their stuff with that
20:40cooldude127but as part of a response, they can signal they are done
20:40cooldude127it's basically a pipeline
20:41cooldude127so instead of that merge call, you just start the loop with that data in the response, and then the pipeline does as it pleases
20:42danlarkinI'm thinking it over
20:43cooldude127each middleware becomes a pure function that takes a request and response and returns modified versions of both/either of them. the response has an attribute that tells if it's done. the loop checks this
20:44cooldude127you could just use reduce if you didn't need to short-circuit, but because you do, loop/recur is a good way
20:46danlarkinyes, originally I was using reduce, but I realized it was unnecessary, since merge takes & args
20:46danlarkinbut yes, I'm going to try to riff on this and I'll get back to you, thanks
20:46cooldude127danlarkin: k cool :)
21:17powr-tocPresumably watchers run in the calling thread when used with refs?
21:18Chousernot currently
21:19powr-tocahh of course... they have to be agents
21:19Chouserwatchers are currently agents
21:19Chouserright
21:19ChouserBut that will change soon, I believe
21:19rhickeyright
21:19powr-tocis it known what the change will be?
21:20Chouserpowr-toc: this is what I know: http://code.google.com/p/clojure/issues/detail?id=80
21:20powr-tocyeah, you showed me that the other day :-)
21:20Chouserwell, there you go then.
21:21powr-tocI was having the same thoughts, when rewriting code from the previous implementation
21:23Chouseryeah, my one real use of watchs was much simpler than when I rewrote to use watchers.
21:24ChouserI await the new API with anticipation.
21:24powr-tocme too :-)
21:30hiredman(doc lazy-seq)
21:30clojurebotTakes a body of expressions that returns an ISeq or nil, and yields a Seqable object that will invoke the body only the first time seq is called, and will cache the result and return it on all subsequent seq calls. Any closed over locals will be cleared prior to the tail call of body.; arglists ([& body])
21:31hiredmanclojurebot: where is your brain?
21:31clojurebotNo entiendo
21:31hiredmanclojurebot: brain dump?
21:31clojurebotbrain dump is http://clj.thelastcitadel.com/clojurebot
21:37durka42clojurebot: it's too late to apologize
21:37clojurebotPardon?
21:37durka42clojurebot: apologize for me, i don't feel like it
21:37clojurebotmea culpa!
21:39danlarkinheh, where are the docs on destructuring? I can't seem to find them ATM :-[
21:40Chouserhttp://clojure.org/special_forms#let
21:40hiredmanclojurebot: destructuring?
21:40clojurebotGabh mo leithsc�al?
21:40hiredmanclojurebot: destructuring is http://clojure.org/special_forms#let
21:40clojurebotIn Ordnung
21:41danlarkinthanks :)
21:42hiredmanhuh
21:43hiredmanjava.lang.management
21:50Chouserdurka42: apparently it's not meant for custom printing, but it'll do
21:50durka42what is it meant for?
21:50Chouser,(.addMethod print-method :foo (fn [o w] (doto w (.write "#<foo: ") (.write (:x o)) (.write ">"))))
21:50clojurebot#<MultiFn clojure.lang.MultiFn@1137792>
21:50Chouser,#^{:type :foo} {:x "whee"}
21:50clojurebot{:x "whee"}
21:50Chouserfail.
21:51durka42bot might not be updated
21:51Chouseroh, of course
21:51Chouserdurka42: http://groups.google.com/group/clojure/msg/a378004f6d7419b8
21:56cmvkki want something where you can write a function that takes a single integer argument, then you can use it like you would a vector, like with get or seq or map.
21:56cmvkkyou'd have to change java stuff to implement something like that right?
21:56Chouseryou can probably do it with proxy, but I'm not quite sure what you want.
21:58cmvkkwell like i mean you could write (defn foo [x] (+ x 2)) and then do (get foo 3)
21:58cmvkkor (map #(* % 3) foo)
21:59powr-toccmvkk: I'm guessing you could use a proxy to implement ISeq, and that'd give you everything except special reader syntax for vectors...
22:00cmvkkoh yeah proxy. but it definitely would involve implementing ISeq.
22:01hiredman~def get
22:02Chouser,(let [z (proxy [clojure.lang.Associative] [] (seq [] '(4 5 6)) (valAt [n] (+ 3 n)))] (prn (get z 5)) (prn (map #(* % 3) z)))
22:02clojurebotjava.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
22:03hiredman:)
22:03cmvkkheh
22:04Chouserno proxy, eh?
22:04hiredmanI guess
22:05cmvkki guess ignoring get, i could just write a function that takes a function like that and returns a lazy seq, which is good enough for map and stuff.
22:05Chouserso, you may not need to implement ISeq, just a seq method that returns an ISeq
22:06cmvkk(defn fnseq ([x] (fnseq x 0 nil)) ([x s e] (map #(x %) (range s e)))) or something
22:10stuhoodis there an equivalent of (contains?) for lists/vectors?
22:10Chouserif you're doing that kind of operation, a set or map might work better.
22:11stuhoodi suppose... its for the arguments to a script
22:11Chouseryou can do a linear scan of the seq if you really want to.
22:11durka42those could be positional
22:11durka42i.e. not a set
22:12Chouser,(some #{'c} '(a b c d e))
22:12clojurebotc
22:12stuhoodwell, it seems reasonable to have something like that in the standard library... understanding that it would be O(n) of course
22:13Chouser,(.contains '(a b c d e) 'c)
22:13clojurebottrue
22:13Chouserhard to get much simpler than those.
22:13stuhoodoh, that works too
22:13stuhoodi forgot clojure collections implement Collection
22:14stuhoodChouser: thanks!
22:15Chouser,('c (set '(a b c d e)))
22:15clojurebotc
22:15Chousersure
22:50danlarkincooldude127: okay, looks like I've got it worked out. It's a lot uglier, but it works
23:18stuhood~defn pmap
23:18clojurebotExcuse me?
23:19stuhoodphooey... what was that command
23:19durka42~source pmap
23:28hiredmanouch
23:35stuhooddurka42: thanks!
23:51iceyWho has the best setup docs for setting up a new machine for developing with clojure? Is it still Bill Clementson's?
23:52arohnericey: probably
23:53iceyarohner: thanks!