2009-06-13
| 01:04 | bradford | what 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:27 | slashus2 | bradford: Probably want to use doseq for side-effects. |
| 03:30 | slashus2 | I 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:34 | slashus2 | I was trying to send a hash map, but using :keywords in the map didn't allow this to happen. Works fine without them. |
| 03:38 | slashus2 | Just 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:40 | cark | why not print then read ? |
| 03:41 | slashus2 | cark: I was trying to use writeObject over a socket. |
| 03:43 | cark | right, what i mean is that you don't have to go the java way |
| 03:44 | cark | it's pretty usual in the lisp world to just print readably, then rebuild your objects with read-string |
| 03:44 | slashus2 | So I just make the data structure into a string and then read it back? |
| 03:44 | cark | right |
| 03:44 | cark | ,(prn :bleh) |
| 03:44 | clojurebot | :bleh |
| 03:44 | cark | (read-string ":bleh") |
| 03:45 | slashus2 | I was doing this because I was going to eventually send over image data. |
| 03:45 | kotarak | beware of references.... |
| 03:45 | cark | and cycles =) |
| 03:46 | cark | though references should be top level |
| 03:46 | cark | and cycles couldn't exist without references |
| 11:35 | drewr | Why does (future (Thread/sleep 1000) :foo) block? |
| 11:36 | drewr | I thought that should return the Future object directly and only block with a deref. |
| 11:40 | lisppaste8 | drewr pasted "future behavior confusion" at http://paste.lisp.org/display/81814 |
| 11:41 | rhickey | drewr: getting deref'ed to print |
| 11:41 | rhickey | fixed in latest |
| 11:42 | rhickey | http://github.com/richhickey/clojure/tree/master |
| 11:42 | drewr | OK, that was from 1.0.0. |
| 11:42 | rhickey | hrm - how do people refer to particular revisions in git? |
| 11:42 | drewr | Just a shortened commit id. |
| 11:43 | rhickey | ugh, hard to intuit the order of those things |
| 11:43 | drewr | Like, "that was from 8c2b2b04fed," in my case. |
| 11:43 | drewr | Yeah, that's the only downside to DVCS IMO. |
| 11:44 | rhickey | the only one, eh? |
| 11:44 | rhickey | :) |
| 11:44 | drewr | Actually, probably so. |
| 11:52 | drewr | This is cool. I think it will replace agents in one codebase I have and manual Executor stuff in another. |
| 11:52 | rhickey | drewr: what will, futures or promises? |
| 11:53 | drewr | futures |
| 11:54 | drewr | One application I have kicks off agents to query a db in parallel, with an await at the end. |
| 11:55 | drewr | Latch-like. |
| 11:55 | rhickey | drewr: yeah, that use of agent-as-thread is better done with futures |
| 11:59 | drewr | Catching up on promise/deliver.. interesting. |
| 12:43 | Lomono | would anyone have some time to answer some questions on Reddit? |
| 12:43 | Lomono | http://www.reddit.com/r/programming/comments/8s8gv/from_c_on_mono_to_clojure_on_the_jvm/c0a9l98 |
| 12:48 | blbrown_win | the invokeStaticMethod in lang.Reflector takes an Object array. How do I pass that in clojure. I tried this invokeStaticMethod(c, [ "abc" ]) |
| 12:58 | Chouser | blbrown_win: (to-array ["abc"]) |
| 12:58 | Chouser | ,(to-array ["abc"]) |
| 12:58 | clojurebot | #<Object[] [Ljava.lang.Object;@160b5e> |
| 13:02 | blbrown_win | Chouser you are the man, are you a bot? |
| 13:03 | blbrown_win | ,Chouser (+ 1 1) |
| 13:03 | clojurebot | java.lang.Exception: Unable to resolve symbol: Chouser in this context |
| 13:08 | Chouser | Not only am I not a bot, I'm not even here. |
| 13:09 | Chouser | I should go mow |
| 14:26 | lisppaste8 | Anniepoo pasted "forward reference" at http://paste.lisp.org/display/81821 |
| 14:27 | Anniepoo | so 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:28 | Anniepoo | (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:30 | lisppaste8 | Anniepoo annotated #81821 "untitled" at http://paste.lisp.org/display/81821#1 |
| 14:30 | Anniepoo | but it's complaining about the forward ref of FirstFormBrowser from FormBrowser |
| 14:33 | Anniepoo | foo, no response |
| 14:39 | hoeck | Anniepoo: you can just use (def my-name) or (declare my-name) |
| 14:41 | Anniepoo | thanks, the defn will overwrite the old value? |
| 14:41 | hoeck | yes |
| 14:44 | Anniepoo | feels like a hack, but I' |
| 14:44 | Anniepoo | I'm a happy camper |
| 14:45 | hoeck | or use declare, to give a hint about your intention |
| 14:46 | Anniepoo | ah, that feels more self documenting 8cD |
| 14:46 | hoeck | declare just expands to a def for each name |
| 17:04 | JasonFelice | Any vimclojure users here? |
| 17:04 | kotarak | yup |
| 17:04 | JasonFelice | Why do I get a three second lag when I use 'o'? |
| 17:05 | kotarak | don't know. No one could explain it to me. |
| 17:05 | kotarak | I also don't see where this should come from, since <CR> in insert works normally. |
| 17:06 | JasonFelice | It's kind of a showstopper. If I turn off gorilla, I don't get highlighting. |
| 17:07 | kotarak | You should get highlighting for core. |
| 17:07 | JasonFelice | what do you mean? |
| 17:08 | JasonFelice | vim-core? |
| 17:08 | kotarak | clojure.core |
| 17:08 | kotarak | With gorilla you get dynamic highlighting based on the required/used namespaces. |
| 17:08 | kotarak | Without Gorilla you get static highlighting for clojure.core |
| 17:11 | JasonFelice | I guess I am getting highlighting, just not recognizing any keywords. Just parens and strings, it looks like. |
| 17:11 | kotarak | hmmm... |
| 17:12 | kotarak | What are your configuration optionsß |
| 17:12 | kotarak | ? |
| 17:12 | kotarak | For vimclojure I mean. |
| 17:14 | JasonFelice | I guess the defaults. All I put in vimrc is the gorilla thing. |
| 17:16 | kotarak | try: let clj_highlight_builtins = 1 |
| 18:23 | JasonFelice | kotarak: 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:24 | kotarak | normal lisp indenting is not sufficient due to clojure's specialties like [] or {}. |
| 18:26 | kotarak | What I don't understand is, that 'o' has a delay, but the "normal" <CR> does not. |
| 18:26 | JasonFelice | Don't know. I actually use ruby for scripting vim, so I don't know how much of the vim guts works. |
| 18:28 | kotarak | I 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:29 | Anniepoo | hmm.... 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:29 | JasonFelice | Reall? I have about 500 lines of ruby in my vimrc (for C++) and it works pretty well. |
| 18:30 | kotarak | Anniepoo: (ns my.swing.Component (:gen-class :extends javax.swing.JPanel :main false)) should get you started. |
| 18:30 | Anniepoo | thanks! |
| 18:31 | JasonFelice | kotarak: how do you switch from the repl split? It traps C-w. |
| 18:31 | kotarak | Huh? It surely doesn't. |
| 18:32 | kotarak | I use C-w + up/down or another C-w. Works for me. |
| 18:34 | JasonFelice | Ah, ok... the repl puts you in insert mode. |
| 18:35 | kotarak | Yeah. The modes are a bit in the way there... |
| 18:37 | JasonFelice | This is a bit of a detour from "let me play with clojure." :) |