#clojure logs

2008-02-19

00:01jonathan_Yeah, but a good architect can make up for a lot, Word 5.0 on the Mac was fantastic, Excel was great ... MS are pretty sad now, I remember being so excited over VC++ 1.0 and Access
00:02ChouserI worked for a guy who refused to upgrade to Word 5 for Mac, because he didn't think the features were worth the bloat over Word 4.
00:03Chouserwell, refused for a while anyway. I suppose he may have upgraded by now.
00:04jonathan_this was like 89, about 3 years pre-dating wndows
00:05Chouseryep, I was in high school. Before Macs stagnated for a decade.
00:06jonathan_yeah, I had a Performa 6100, it was just terrible
00:06jonathan_freeze, bong
00:07ChouserI think the SE/30 was the last I dealt with directly. Then I went to college and found unix, and haven't really left.
00:08ChouserI did buy my wife a MacBook a year ago, but I wasn't as impressed with the software as I assumed I would be.
00:08jonathan_Really? I love mine ... Leper is awesome
00:08jonathan_Beats tiger
00:09jonathan_Having svn pre-installed is just one of the many cool things
00:09ChouserShe's still on Tiger.
00:09ChouserHeh. She'd have no use for svn. ;-)
00:09jonathan_If you upgrade, wipe it out
00:10Chouseroh, yeah? back up user files and do a clean install?
00:10jonathan_totally, I upgraded and it was terrible, needs a clean slate, same with my wifes machine, and my MBP
00:15ChouserI'm surprised (seq? []) is false
00:15jonathan_I've been wrestling with that
00:16jonathan_(defn empty ([s] (or (= s []) (= s {}) (=s ())))
00:16jonathan_is the yukky solution
00:16Chouserhm. yeah.
00:17jonathan_I tend to test (nil? (first seq))
00:17jonathan_now, which works
00:17Chouser(= nil (list* x))
00:17Chouserstill rather icky
00:18jonathan_is there a built-in that does what you need?
00:19ChouserI'm not acutally sure that [] not being a seq in my problem.
00:20Chousereh. I need to take a step back. Each angle I've tried so far ends up with a messy solution, even the ones I get working.
00:20jonathan_yeah, I know what you mean, Rich is good at helping out with fixing stuff up like that
00:20jonathan_Lisp has a definite 'nap'
00:21Chouserheh, that's a good description.
00:21ChouserActually, I found Scala to be that way too. I think it may be a property of sufficiently well designed functional languages.
00:21jonathan_I spent two hours today refactoring some crappy code, just because I was too lazy to parse an int
00:22jonathan_nil <> "" <> "0" etc etc
00:22Chouseryou *can* do it whatever way you want, but it's all so clumsy until you're doing it the right way.
00:22Chouserah. hm.
00:22jonathan_yep exactly
00:23Chouserwell, I'm trying to build an API for filtering the vector/map tress the xml.clj produces.
00:24ChouserI want something as powerful and succint as xpath, but I want it in "native" clojure (not a parsed string) so I can drop into regular lisp expressions at any moment.
00:24ChouserAnyway, I've got 2 or 3 working solutions that are sufficiently flexible but *so* *wordy*.
00:24jonathan_*consults Haskell bookmarks*
00:25ChouserAnd then I've got a couple sufficiently succinct solutions that I've abandoned because of the amount of special-case code I end up building into the framework.
00:25jonathan_this sort of thing? http://www.cs.vu.nl/Strafunski/gmap/#paradise
00:27ChouserHm, maybe.
00:28jonathan_I wrote a tree based filter query tool once. It was 90% boilerplate
00:28ChouserLike if I want to take an atom blog feed and list the titles of all entries with author "agriffis", in XPath I can say: /feed/entry[ author/name = "agriffis" ]/title/node()
00:29jonathan_cool
00:30ChouserAfter xml.clj has parsed something, it seems I should be able to store it's parsed tree in var "feed", and do something like: (xml-filter feed :entry [:author :name #(= % "agriffis")] :title :*node)
00:31jonathan_cool
00:32Chouserright. But I can't get it to work. For instance, in that example xml-filter is assuming a lot about each level, and it's hard to see how to get the flexibility you need. Mainly I'm tripped up over when to assume we're going into a child's content, and when we're just filtering at the current level.
00:33ChouserAnyway, if it were easy, it would be done already. Or at least it wouldn't be as much fun to poke at.
00:33jonathan_yeah, I find XPath kinda confusing
00:34Chouseroh, really? I kinda love it, at least compared with the rest of the XML world. :-)
00:34jonathan_I'd write my own content handler
00:34Chouserwhat does that mean?
00:34jonathan_rather than using Rich's
00:34Chouserah.
00:34Chouserparse it into a different tree?
00:35jonathan_you could just throw it away
00:35jonathan_keep the filtered stuff
00:35jonathan_pas in a callback
00:35Chouseryeah. I don't know that I want to require a re-parse every time you want to look for something different.
00:36ChouserBut I am beginning to wonder if a different tree structure wouldn't be easier to work with.
00:36jonathan_You can always tie it down later
00:38Chouserwell, I ought be sleeping. Thanks for your help.
00:39jonathan_k, ttyl
15:42NarayanSI have "docType" string and want to convert into the symbol :docType for lookup in the map. how do i convert it?
15:42rhickey(keyword "docType")
15:42NarayanSthx
22:00NarayanSclojure=>(< 1 3 10 2 1)
22:00NarayanSnil
22:00NarayanSclojure=>(< 1 3 10 2)
22:00NarayanSfalse
22:01NarayanSI should get false for both, right?
22:04rhickeyprobably, but does it matter?
22:05NarayanSmay be not
22:15MarkJP (= (< 1 3 10 2) (< 1 3 10 2 1))
22:32rhickeyok fixed
22:47Chouser*whew* barely got it in under a half hour
22:52rhickeyBasic relational algebra is 64 lines of Clojure
22:54rhickeyunion/difference/intersection/project/select/rename/index/join
23:15Chouser(defmacro seq-test [& exprs] `#(and (seq-filter % ~@exprs) %))
23:15Chouser Can't use qualified name as parameter
23:17Chouserany ideas?