#clojure logs

2008-08-08

04:41ChouserHuh. My clojure entry made it to trial 6 of the lighting round: http://icfpcontest.org/results/lightning/results-by-score-Lightning-6.html
04:42ChouserIt was completely blind. :-/
04:42rhickeyChouser: neat! I didn't know if anyone found time to compete
04:43ChouserYeah, I barely did. Lotsa chores to do that weekend too, so I never got to the obstacle avoidance stuff.
04:44rhickeyyeah - competing means a lost weekend...
04:44Chouserand I submitted what may be the ugliest clojure code ever.
04:44rhickeyah
05:45hoeckwow, reflection + macros + clojure proxy rocks!
05:46hoeckjust implemented a macro that implements to an interface using an existing object, this way i can implement a PersistentVector on-the-fly and change eg. its equal semanitcs
05:47hoecksemantics
05:49rhickeyhoeck: hmm... the interface is one already supported by the object?
05:50hoeckyes, well, I'd like to overwrite a vectors equal method
05:51rhickeyhoeck: to do what instead?
05:53hoeckto be able to define 'tuples' where, for example, only the first item is responsible for equality to other tuples
06:44mattreplwhat's an efficient way to construct a 2d Java primitive array? specifically, I'm trying to construct Jama.Matrix objects from float[][] types
06:45blackdogto-array-2d ?
06:46blackdogactually make-array takes dimensions
06:47rhickey(make-array Float/TYPE 200 200)
06:48ChouserSo for what it's worth, here's the code I submitted: http://n01se.net/paste/j4Cb
06:48ChouserNobody should use any of that as an example of how to write Clojure!
06:48ChouserSpecifically, I think I'm doing Bad Things with flying reads and dosync.
06:48mattreplI was hoping for something closer to a literal, though I know that's explicitly not supported. to-array-2d only gives Objects, into-array-2d doesn't do primitives. ok, make-array and iterative fill it is
06:50mattreplwhat I really could use is make-array to support primitives or float-array to support higher dimensions
06:50rhickeymattrepl: define (init-array [type init-fn & dims] ...) where init-fn is a function of the number of dims, should be pretty useful
06:51rhickeymattrepl: that make-array call makes a primitive float[][] array
06:53mattreploh, good. sorry, I missed the last sentence of the description
07:16lisppaste8rhickey pasted "init-array macro" at http://paste.lisp.org/display/65023
07:44rhickeymattrepl: you missed: "init-array macro" at http://paste.lisp.org/display/65023
07:44mattreplrhickey: thanks
09:26cemerickuytrewsfgtyrew2eryp[]iuytdfgp;['[hj]\\][]\\]['
09:26cemerick\\
10:04cemerickrhickey: any reason why there's no ArraySeq_byte?
11:21Chouserrhickey: "Out of the Tar Pit" is very interesting.
11:21drewrI've been reading it too.
11:22rhickeyChouser: I thought so - it inspired me to 'go all the way' with FP in Clojure
11:22ChouserI'm curious about Clojure's "let" in light of "Complexity caused by Control"
11:22rhickeyI took a different route with state, but share the philosophy of minimizing it
11:23rhickeyChouser: let being a multi-expression block?
11:23ChouserIf let bound in parallel, there would be no implicity ordering.
11:24Chouserloop/recur are parallel
11:24rhickeyChouser: you'd just nest lets, then reinvent let*
11:25Chouseryes, but you'd only nest lets when you needed to (since it's annoying and a pain), which would be a hint to the (human) reader that there is actually a dependent expression.
11:26rhickeyIf you don't reuse names it's equally clear
11:27Chouserto use the paper's example, (let [a (+ b 3) c (+ d 2) e (* 4 f)]) currently implies an order, and you have to look carefully to see that e is arbitrarily at the end instead of somewhere else.
11:28Chouserhowever if let bound in parallel, e *couldn't* depend on a or c, and the order would be guaranteed arbitrary.
11:28ChouserA nested let would be a clue that there really is a dependency and that the order of the nesting matters.
11:29rhickeyI don't think it's a big deal - the real deal is having some sort of declarative programming option, like an embedded prolog
11:30Chouserok, fair enough. I'll be curious to see what you come up with there. :-)
11:30rhickeyno one will tolerate nested lets when they need them, so you'll have to have let*, and then most people will use that by default
11:30kotarakto be honest: I also like more the compiler to figure out, whether something depends on something else or not. Like CPUs do with their pipelines.
11:31Chouserrhickey: yeah, you're probably right. let is very convenient as it is.
11:32rhickeyIt was more important to me to have only one let
11:32ChouserI'm not at all deeply invested in a parallel let, just thought I'd make an argument from the paper. Thanks for engaging me. :-)
11:34rhickeynp, I think the paper is really good provocation, though I don't think they have all the answers
11:42fanda_hello all!
11:42rhickeyhi
11:43fanda_could you please help me? I am trying to add metadata to some object
11:43fanda_what's the syntax for it?
11:43fanda_can I do: (def x 5)
11:43fanda_and then add any metadata to 'x'?
11:43Chousermaybe a keyword to separate a single let into batches: (let [a 1 b 2 --batch-- c (+ a b)] ...)
11:44Chouserhaha. nevermind. ;-)
11:44kotarakfanda_: you can do: (def #^{:some :metadata} x 5)
11:45fanda_and how do I get this metadata back?
11:45fanda_- meaning read it from 'x'?
11:45Chouserthat's metadata on the symbol x by the way, not on the value 5
11:45Chouser^#'x
11:45fanda_i see!
11:46Chouserwhich is short for (meta (var x))
11:46fanda_thanks! there was my error
11:59fanda_i saw a note about prolog implementation
11:59fanda_for inspiration, try:
12:00fanda_http://en.wikipedia.org/wiki/Unification
12:00fanda_and example:
12:00fanda_http://www.newlisp.org/downloads/newlisp_manual.html#unify
12:00fanda_:-)
12:30kotarakis there a vim user around, who volunteer as a beta tester? I currently work on "Chimp", (Clojure with Limp, but Cimp looked strange..) and I'd like to hear a second opinion before releasing it.
12:31ChouserI vim.
12:31kotarakyou vim? :) Would you be interested?
12:31ChouserI dunno what Limp is, but I'll try whatever you've got.
12:32kotarakPut the cursor in a sexp in vim, \es et voila. sexp evaluated in Clojure running in a screen.
12:33Chousersounds good to me.
12:34kotarakOk. I'll put it together. Please let me know your impressions.
12:35ChouserI guess I do that now, but I use the mouse to grab and drop the expression into a rlwrap-ed repl.
12:35Chouserso a key sequence would be nice. :-)
12:36kotarakUp to now there are actually three: evalblock, eval-inner-sexp, eval-top-sexp
12:37kotarakThe namespaces are automatically changed based on (in-ns) in the file.
12:37Chouserhm! interesting.
12:37kotarakHeuristic: in-ns there, use that one, no in-ns, use 'user
12:37kotarakSo will be probably overrideable
12:37Chouseryou built the whole thing, or are you using some existing framework?
12:38kotarakI used ideas from VILisp and Limp: run a screen and put some glue around it. It is basically independent from Clojure. It would equally work well with Python or Ruby....
12:39kotarakVILisp uses some Perl magic, I like the screen solution more, and Limp is too complicated for my taste, too much mentions of SBCL
12:41Chouserscreen means this probably won't work out of the box on Windows, right?
12:42kotarakoerks. Yeah. One would need Cygwin. I have no idea how to do this natively on Windows. Sorry.
12:42Chouserno worries, I don't use Windows. Just pondering aloud.
12:43kotarakI used it today at work. So with Cygwin it works. But a native version would be better.
12:44kotarakAnd it's one-way. No feedback to Vim.
12:45Chouserhm. well, sounds better than what I'm doing now, anyway.
12:46Chouseryou launch screen from vim, or vice-versa? Or set up the communication some other way?
12:46Chousersorry, if you're writing all this up somewhere I'll leave you alone and read it when you're done.
12:47kotarakStart vim and screen separately. Screen tells you the id. On first evaluation request you have to supply the id. This then saved for further calls.
12:47kotarakCommunication works via temporary file.
12:47kotarakWhat you start in the screen is up to you: Clojure, Python, Ruby, whatever.
12:47Chousersounds interesting.
12:48kotarakftplugin in Vim can be adapted to different languages, eg. recognizing Sexp for Clojure etc.
12:48Chousersure.
12:49kotarakAnd manual use in the screen is also possible in parallel. An advantage over pipe solutions
12:49ChouserI had thought about trying to do something like having vim post code via http to a tcp-port repl running in clojure which could run it and spit back the results.
12:51kotarakThe problems I had with something like that is: a) the response you have to handle, b) you probably need Perled or Pythoned vim (is this possible with VimL)
12:51Chouserthat, and I'm too lazy to try. ;-)
12:52kotarak:)
12:52ChouserI keep hoping to make the jump to netbeans + enclojure + jvi, but it just hasn't happened yet.
12:52ChouserI'd miss vim, but not viml.
12:52kotarakI already came back again. Netbeans and Eclipse and all these programs are the huuuge. :|
12:53kotarakI'd like to have a mixture between Emacs and Vim: Vim with emacs-style (but Scheme (or Clojure ;)) programming
12:53Chouseryes they are, but vim feels like such a hack.
12:54blackdogif anyone's interested i have done a little work on jedit to integrate clojure
12:54Chouseryes! that's what I want too.
12:54blackdogjedit runs at about 63mb for me, not too big
12:54Chouseryou don't think enclojure + jvi == emacs + clojure?
12:55Chouserblackdog: any vi keybindings? :-)
12:55blackdogoh :/
12:56Chousersorry, that sounded more snarky than I meant it to be.
12:56blackdogno i didn't take it snarkylike :)
12:56ChouserI don't know anything about jedit. Can I customize key bindings easily?
12:56blackdogyes, it's a very full featured editor,
12:57kotarakChouser: I don't know, I have some Vim specific stuff floating around. It's sooo hard to leave that behind. (I tried emacs again, this week, but emacs + viper just doesn't catch it)
12:58blackdogi have mostly got a repl running but it's buggy, and syntax hightlighting and i ripped out the browser from enclojure
12:58blackdogbut it's only a partially done been meaning to get back to it
13:00blackdogthe problem i have with netbeans is the enforced project structures, i like jedit cos it's an editor first, with plugins, but it doesn't dictate
13:00Chouserkotarak: last time I tried emacs (my 2nd or 3rd attempt) I nearly made it -- I had email set up, basic navigation learned, etc, but ended up defeated by emacs/xemacs incompatibilities and lack of support for a code search tool that was pretty much a requirement.
13:01Chouserblackdog: hm...
13:03kotarakchouser: the time I last used it (1998), it took hours to start-up. For programming that's not a problem. But I started to work as a sysadmin to finance my studies and had to edit little files all the day. emacs... baah. So I used vi. And shortly thereafter I always got confused <Esc> in emacs, <C-x><C-s> in vi.... So I totally switched to vim. And now, after 10years of hardwiring my finger nerves, it's hard to switch.....
13:05Chouserwell, we could always write a new editor in clojure that feels like vim.
13:06kotarako.O That's looooot of work. ... Ok. One could restrict the work to the 3% of Vim one actually uses...
13:06Chouseryeah, you're supposed to be laughing by now.
13:07kotarakhahahahahhahahahaha
13:07Chouserthat's better, thanks.
13:08Chouserhttp://activestate.com/Products/komodo_ide/feature_showcase.mhtml
13:08Chouser*sigh*
13:09Chouserhow can there be so many editors and yet none just right?
13:09arjehm emacs is not right? :)
13:09ChouserI guess that's pretty much how I feel about languages too, although Clojure has improved my mood a bit.
13:09Chouserarj: elisp. enough said. ;-)
13:11kotarakThat's what I don't like with such project like Eclipse or Netbeans: (from the above link) "interfaces with Perforce, SVN and something else", but eg. not hg. So to write a plugin you first have to grok a 100-pages manual, understand 65 classes and ... latest at that point I loose interest....
13:12Chouseryeah. :-/ I was hoping that being able to write my editor extensions in Clojure (for NetBeans) would help reduce that pain.
13:32kotarakChouser: ok. Email is out. I'd like to hear your feedback. But now I go to bed. It's approaching midnight.
13:32Chouserkotarak: thanks. sleep well!
13:32kotarakChouser: thanks, bye
14:27drewrDang, someone 1-starred my message today on the clojure group.
14:28drewrI was hoping for some kind of discussion.
14:32drewr(Hoping for list discussion, not IRC. :-))
14:36ChouserI'm already implementing it for my files (that I've changed).
14:36ChouserBut I feel I have that freedom because nobody's using my contrib contributions.
14:36drewrDo you think my message made sense?
14:37Chouseryep, although "lock step" isn't a real possibility.
14:37drewrSure it is.
14:38Chousernot for both HEADs.
14:38drewrMaybe not with HEAD, but the latest working revision.
14:38Chousergotta entertain the kids. back in a while.