#clojure logs

2009-06-13

01:04bradfordwhat is the best way to do a with-open file and go through a for comprehension doing a write-line ot the file for each member of a sequence?
01:27slashus2bradford: Probably want to use doseq for side-effects.
03:30slashus2I was playing around with sending objects over sockets, and it won't let me send a clojure.lang.Keyword because it doesn't implement Serializable.
03:34slashus2I was trying to send a hash map, but using :keywords in the map didn't allow this to happen. Works fine without them.
03:38slashus2Just adding Serializable to the list of things it implements in Keyword.java seemed to work. Is there a reason that a keyword isn't serializable?
03:40carkwhy not print then read ?
03:41slashus2cark: I was trying to use writeObject over a socket.
03:43carkright, what i mean is that you don't have to go the java way
03:44carkit's pretty usual in the lisp world to just print readably, then rebuild your objects with read-string
03:44slashus2So I just make the data structure into a string and then read it back?
03:44carkright
03:44cark,(prn :bleh)
03:44clojurebot:bleh
03:44cark(read-string ":bleh")
03:45slashus2I was doing this because I was going to eventually send over image data.
03:45kotarakbeware of references....
03:45carkand cycles =)
03:46carkthough references should be top level
03:46carkand cycles couldn't exist without references
11:35drewrWhy does (future (Thread/sleep 1000) :foo) block?
11:36drewrI thought that should return the Future object directly and only block with a deref.
11:40lisppaste8drewr pasted "future behavior confusion" at http://paste.lisp.org/display/81814
11:41rhickeydrewr: getting deref'ed to print
11:41rhickeyfixed in latest
11:42rhickeyhttp://github.com/richhickey/clojure/tree/master
11:42drewrOK, that was from 1.0.0.
11:42rhickeyhrm - how do people refer to particular revisions in git?
11:42drewrJust a shortened commit id.
11:43rhickeyugh, hard to intuit the order of those things
11:43drewrLike, "that was from 8c2b2b04fed," in my case.
11:43drewrYeah, that's the only downside to DVCS IMO.
11:44rhickeythe only one, eh?
11:44rhickey:)
11:44drewrActually, probably so.
11:52drewrThis is cool. I think it will replace agents in one codebase I have and manual Executor stuff in another.
11:52rhickeydrewr: what will, futures or promises?
11:53drewrfutures
11:54drewrOne application I have kicks off agents to query a db in parallel, with an await at the end.
11:55drewrLatch-like.
11:55rhickeydrewr: yeah, that use of agent-as-thread is better done with futures
11:59drewrCatching up on promise/deliver.. interesting.
12:43Lomonowould anyone have some time to answer some questions on Reddit?
12:43Lomonohttp://www.reddit.com/r/programming/comments/8s8gv/from_c_on_mono_to_clojure_on_the_jvm/c0a9l98
12:48blbrown_winthe invokeStaticMethod in lang.Reflector takes an Object array. How do I pass that in clojure. I tried this invokeStaticMethod(c, [ "abc" ])
12:58Chouserblbrown_win: (to-array ["abc"])
12:58Chouser,(to-array ["abc"])
12:58clojurebot#<Object[] [Ljava.lang.Object;@160b5e>
13:02blbrown_winChouser you are the man, are you a bot?
13:03blbrown_win,Chouser (+ 1 1)
13:03clojurebotjava.lang.Exception: Unable to resolve symbol: Chouser in this context
13:08ChouserNot only am I not a bot, I'm not even here.
13:09ChouserI should go mow
14:26lisppaste8Anniepoo pasted "forward reference" at http://paste.lisp.org/display/81821
14:27Anniepooso how do I handle forward references in Clojure? I've got the common case of a couple functions that call each other in the common lisp-y 'first is special case' situation
14:28Anniepoo(FWIW this code is my feeble attempt to translate a form into a structure of swing panels, an early stage towards a Clojure editor in Clojure)
14:30lisppaste8Anniepoo annotated #81821 "untitled" at http://paste.lisp.org/display/81821#1
14:30Anniepoobut it's complaining about the forward ref of FirstFormBrowser from FormBrowser
14:33Anniepoofoo, no response
14:39hoeckAnniepoo: you can just use (def my-name) or (declare my-name)
14:41Anniepoothanks, the defn will overwrite the old value?
14:41hoeckyes
14:44Anniepoofeels like a hack, but I'
14:44AnniepooI'm a happy camper
14:45hoeckor use declare, to give a hint about your intention
14:46Anniepooah, that feels more self documenting 8cD
14:46hoeckdeclare just expands to a def for each name
17:04JasonFeliceAny vimclojure users here?
17:04kotarakyup
17:04JasonFeliceWhy do I get a three second lag when I use 'o'?
17:05kotarakdon't know. No one could explain it to me.
17:05kotarakI also don't see where this should come from, since <CR> in insert works normally.
17:06JasonFeliceIt's kind of a showstopper. If I turn off gorilla, I don't get highlighting.
17:07kotarakYou should get highlighting for core.
17:07JasonFelicewhat do you mean?
17:08JasonFelicevim-core?
17:08kotarakclojure.core
17:08kotarakWith gorilla you get dynamic highlighting based on the required/used namespaces.
17:08kotarakWithout Gorilla you get static highlighting for clojure.core
17:11JasonFeliceI guess I am getting highlighting, just not recognizing any keywords. Just parens and strings, it looks like.
17:11kotarakhmmm...
17:12kotarakWhat are your configuration optionsß
17:12kotarak?
17:12kotarakFor vimclojure I mean.
17:14JasonFeliceI guess the defaults. All I put in vimrc is the gorilla thing.
17:16kotaraktry: let clj_highlight_builtins = 1
18:23JasonFelicekotarak: you can use normal lisp indenting with the rest of vimclojure with a small edit of the indent file. That solves the "o" problem.
18:24kotaraknormal lisp indenting is not sufficient due to clojure's specialties like [] or {}.
18:26kotarakWhat I don't understand is, that 'o' has a delay, but the "normal" <CR> does not.
18:26JasonFeliceDon't know. I actually use ruby for scripting vim, so I don't know how much of the vim guts works.
18:28kotarakI used Ruby before Gorilla was merged into VimClojure. It was to instable and the interfacing was quite ugly. So I tried to get back to pure VimScript.
18:29Anniepoohmm.... I take it subclassing a Java class is painful? I'm making a new sort of swing component, actually making it extend JPanel would make my life easier
18:29JasonFeliceReall? I have about 500 lines of ruby in my vimrc (for C++) and it works pretty well.
18:30kotarakAnniepoo: (ns my.swing.Component (:gen-class :extends javax.swing.JPanel :main false)) should get you started.
18:30Anniepoothanks!
18:31JasonFelicekotarak: how do you switch from the repl split? It traps C-w.
18:31kotarakHuh? It surely doesn't.
18:32kotarakI use C-w + up/down or another C-w. Works for me.
18:34JasonFeliceAh, ok... the repl puts you in insert mode.
18:35kotarakYeah. The modes are a bit in the way there...
18:37JasonFeliceThis is a bit of a detour from "let me play with clojure." :)