#clojure log - Feb 19 2008

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:01 jonathan_: 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

0:02 Chouser: I 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.

0:03 well, refused for a while anyway. I suppose he may have upgraded by now.

0:04 jonathan_: this was like 89, about 3 years pre-dating wndows

0:05 Chouser: yep, I was in high school. Before Macs stagnated for a decade.

0:06 jonathan_: yeah, I had a Performa 6100, it was just terrible

0:06 freeze, bong

0:07 Chouser: I think the SE/30 was the last I dealt with directly. Then I went to college and found unix, and haven't really left.

0:08 I did buy my wife a MacBook a year ago, but I wasn't as impressed with the software as I assumed I would be.

0:08 jonathan_: Really? I love mine ... Leper is awesome

0:08 Beats tiger

0:09 Having svn pre-installed is just one of the many cool things

0:09 Chouser: She's still on Tiger.

0:09 Heh. She'd have no use for svn. ;-)

0:09 jonathan_: If you upgrade, wipe it out

0:10 Chouser: oh, yeah? back up user files and do a clean install?

0:10 jonathan_: totally, I upgraded and it was terrible, needs a clean slate, same with my wifes machine, and my MBP

0:15 Chouser: I'm surprised (seq? []) is false

0:15 jonathan_: I've been wrestling with that

0:16 (defn empty ([s] (or (= s []) (= s {}) (=s ())))

0:16 is the yukky solution

0:16 Chouser: hm. yeah.

0:17 jonathan_: I tend to test (nil? (first seq))

0:17 now, which works

0:17 Chouser: (= nil (list* x))

0:17 still rather icky

0:18 jonathan_: is there a built-in that does what you need?

0:19 Chouser: I'm not acutally sure that [] not being a seq in my problem.

0:20 eh. 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.

0:20 jonathan_: yeah, I know what you mean, Rich is good at helping out with fixing stuff up like that

0:20 Lisp has a definite 'nap'

0:21 Chouser: heh, that's a good description.

0:21 Actually, I found Scala to be that way too. I think it may be a property of sufficiently well designed functional languages.

0:21 jonathan_: I spent two hours today refactoring some crappy code, just because I was too lazy to parse an int

0:22 nil <> "" <> "0" etc etc

0:22 Chouser: you *can* do it whatever way you want, but it's all so clumsy until you're doing it the right way.

0:22 ah. hm.

0:22 jonathan_: yep exactly

0:23 Chouser: well, I'm trying to build an API for filtering the vector/map tress the xml.clj produces.

0:24 I 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.

0:24 Anyway, I've got 2 or 3 working solutions that are sufficiently flexible but *so* *wordy*.

0:24 jonathan_: *consults Haskell bookmarks*

0:25 Chouser: And 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.

0:25 jonathan_: this sort of thing? http://www.cs.vu.nl/Strafunski/gmap/#paradise

0:27 Chouser: Hm, maybe.

0:28 jonathan_: I wrote a tree based filter query tool once. It was 90% boilerplate

0:28 Chouser: Like 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()

0:29 jonathan_: cool

0:30 Chouser: After 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)

0:31 jonathan_: cool

0:32 Chouser: right. 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.

0:33 Anyway, if it were easy, it would be done already. Or at least it wouldn't be as much fun to poke at.

0:33 jonathan_: yeah, I find XPath kinda confusing

0:34 Chouser: oh, really? I kinda love it, at least compared with the rest of the XML world. :-)

0:34 jonathan_: I'd write my own content handler

0:34 Chouser: what does that mean?

0:34 jonathan_: rather than using Rich's

0:34 Chouser: ah.

0:34 parse it into a different tree?

0:35 jonathan_: you could just throw it away

0:35 keep the filtered stuff

0:35 pas in a callback

0:35 Chouser: yeah. I don't know that I want to require a re-parse every time you want to look for something different.

0:36 But I am beginning to wonder if a different tree structure wouldn't be easier to work with.

0:36 jonathan_: You can always tie it down later

0:38 Chouser: well, I ought be sleeping. Thanks for your help.

0:39 jonathan_: k, ttyl

15:42 NarayanS: I have "docType" string and want to convert into the symbol :docType for lookup in the map. how do i convert it?

15:42 rhickey: (keyword "docType")

15:42 NarayanS: thx

22:00 clojure=>(< 1 3 10 2 1)

22:00 nil

22:00 clojure=>(< 1 3 10 2)

22:00 false

22:01 I should get false for both, right?

22:04 rhickey: probably, but does it matter?

22:05 NarayanS: may be not

22:15 MarkJP: (= (< 1 3 10 2) (< 1 3 10 2 1))

22:32 rhickey: ok fixed

22:47 Chouser: *whew* barely got it in under a half hour

22:52 rhickey: Basic relational algebra is 64 lines of Clojure

22:54 union/difference/intersection/project/select/rename/index/join

23:15 Chouser: (defmacro seq-test [& exprs] `#(and (seq-filter % ~@exprs) %))

23:15 Can't use qualified name as parameter

23:17 any ideas?

Logging service provided by n01se.net