2008-03-29
| 00:52 | vagif | Hello, any webjure users ? |
| 00:55 | alec | Does clojure not have an equivalent to values/multiple-value-bind, or am I missing it in the documentation? Is there a suggested way to return multiple values from a function besides making a list out of them? |
| 10:45 | jonathan_ | Thanks for the pointer to that PLT scheme paper on automata, rh ... of course your solution included at least one new keyword I'll have to go find ... |
| 10:45 | ericthor | rich: I see SourceDebugExtensionAttribute in compiler.java but where it is used? Is this till how you are writing the debug extention stuff to the bytecode? |
| 10:47 | ericthor | nevermind...found it |
| 10:47 | rhickey | eric: it's not used, the smap string is just passed to ASM's visitSource in FnExpr.compile |
| 10:48 | ericthor | yup...i see that. thx |
| 10:48 | rhickey | jonathan: just be careful, the Scheme version requires TCO. You could do a Clojure version with fns and recur, but I like the maps better |
| 10:51 | jonathan_ | yeah, I'd kind of spotted there would be a transformation to recur possibly, ok I'll read your solution very carefuly, thanks |
| 11:53 | gren | hi - i have a newbie question |
| 11:53 | gren | I am just playing with getting a moving piece of text on a JFrame |
| 11:54 | gren | and I have some text displaying - however, now I want it to move |
| 11:54 | gren | my question is (probably common): what is the most idiomatic way for me to keep the current X,Y position of the text? |
| 11:55 | gren | and update it? |
| 12:07 | hoeck | gren: i would use getLocation() |
| 12:07 | gren | ah, i see: rely on java's mutable state? |
| 12:07 | gren | i am playing around with a view to writing a game in clojure |
| 12:08 | gren | and wanted to have some clojure data structures for player etc. |
| 12:08 | rhickey | if you want a separate model, and you want to do that synchronously - refs, asynchronously - agents, but UI stuff tends to have its own state |
| 12:08 | gren | yeah - my example is probably a bit simplistic |
| 12:09 | gren | i was looking more to get an understanding of how i create/update/mutate state within clojure itself |
| 12:10 | rhickey | refs/agents are the way |
| 12:10 | gren | e.g. if i (def *myscore* 78), then to rebind i would do (def *myscore* (inc *myscore*))? |
| 12:10 | gren | i'll take a look into agents |
| 12:11 | rhickey | (def score (ref 0))... |
| 12:11 | rhickey | (sync nil (alter score inc)) |
| 12:11 | gren | ok |
| 12:11 | rhickey | but don't re-def |
| 12:12 | gren | i have a large array (representing a 'map') - presumably (def map (ref (make-array Object 300))) is ok too |
| 12:13 | gren | then (sync nil (alter map (update-map))) or something? |
| 12:13 | rhickey | you shouldn't put anything in a ref that you intend to mutate, i.e. if you intend to modify the Object array |
| 12:14 | rhickey | Instead you could use a Clojure vector |
| 12:14 | gren | yes - makes more sense |
| 12:14 | rhickey | I have an ant colony simulation for a talk I gave last week... |
| 12:14 | gren | essentially, (map-update) would just alter the members of the vector (actually a tile map of characters) |
| 12:15 | gren | yes, i read about that |
| 12:15 | rhickey | waiting for the audio, but then I'll make available - does everything you are talking about |
| 12:15 | gren | eagerly awaiting the video :) |
| 12:15 | rhickey | literally not in my hands |
| 12:15 | gren | thanks for the help - very helpful community |
| 13:33 | ericthor | rich: the debugger change did break my stuff but I'm able to get around it by changing the range of the final source lines. |
| 13:34 | ericthor | e.g. 10#1,6:1,10000 |
| 13:37 | ericthor | This still limits the source file mapping. Not sure if this will interfere with the eclipse problem though. Any thoughts? |
| 14:31 | rhickey | eric: 10#1,6:1,10000 => InputStartLine # LineFileID , RepeatCount : OutputStartLine , OutputLineIncrement |
| 14:31 | rhickey | I don't see how that works |
| 14:40 | ericthor | it may not make sense (yet) but it does work. |
| 14:41 | rhickey | but is says that line 10 corresponds to line 1? |
| 14:41 | ericthor | in the output yes? |
| 14:42 | rhickey | inputstartline -> outputstartline |
| 14:42 | rhickey | should be the same |
| 14:42 | ericthor | let me try it again that way |
| 14:42 | ericthor | it will take a minute |
| 14:43 | ericthor | are they referring to the binary output? |
| 14:44 | rhickey | Clojure emits output line numbers 1:1 with the source line 10 == line 10 |
| 14:46 | rhickey | a virtual mapping between Clojure source and imaginary java file |
| 14:56 | ericthor | ok. |
| 14:56 | ericthor | here is the next question: |
| 14:58 | ericthor | if i put a breakpoint on the (defn ..., when it compiles the breakpoint gets hit 2x. When I call the function, it appears the 1st line I can break on is the 1st line after the defn |
| 14:59 | ericthor | all the other breakpoints on other lines work prefectly |
| 14:59 | ericthor | just not the defn |
| 14:59 | rhickey | but defn isn't inside the function being defined, it's defining the function |
| 15:00 | ericthor | yes...we're ok there |
| 15:01 | rhickey | so can't expect to stop there when calling the function |
| 15:01 | ericthor | remote REPL dubugging is working and finding source |
| 15:01 | ericthor | pretty cool |
| 15:01 | rhickey | wow |
| 15:01 | ericthor | I have it with a checkbox on the REPL to run it locally (which is probably only relevant for developing the module?) |
| 15:02 | rhickey | yeah, I think it will almost always be remote |
| 15:02 | ericthor | yup |
| 15:02 | ericthor | it's still great to modify the debugger while I'm running through |
| 15:02 | ericthor | though |
| 15:03 | ericthor | there may be some value in attempting to determine the namespace of a breakpoint to help out with the preferred class stuff. |
| 15:04 | ericthor | It finds it immediately when I include the namespace |
| 15:05 | ericthor | I think Mark/Frank has something for that...optimization for the future. |
| 15:05 | ericthor | It looks like I have to handle stepping myself but I do not think that will be a big deal. |
| 15:06 | rhickey | stepping yourself seems like more work than you should have to do |
| 15:07 | ericthor | nevermind...stepping works fine |
| 15:08 | ericthor | was in the wrong...REPL...might be time for a break |
| 15:08 | ericthor | any recommendations on handling the remote java process? Just using Runtime.getRuntime().exec... |
| 15:09 | rhickey | simplest thing that works... |
| 15:09 | rhickey | may be some platform issues |
| 15:10 | ericthor | true...but time to move onto shoal....who knows where that will go :) |
| 15:10 | rhickey | cool |
| 15:18 | rhickey | single-page API docs: http://clojure.sourceforge.net/reference/api.html |
| 15:20 | ericthor | excellent! |
| 15:51 | jgracin | The HEAD of webjure to compile. Says package javax.portlet does not exist. |
| 15:51 | jgracin | i.e. the HEAD doesn't compile. |
| 19:30 | rhickey | new release: http://clojure.sourceforge.net/news/20080329_release.html |
| 19:30 | rhickey | old hat to all svn-ers |
| 19:37 | ericthor | I'm currently debugging and modifying a live instance of the netbeans enclojure module. This is an amazing way to work! |
| 19:38 | ericthor | ...oh..and debugging the remote REPL with the module being written |
| 19:38 | ericthor | a much nicer java experience for sure |
| 20:33 | rhickey | eric: sounds cool |
| 21:29 | ericthor | can i unmap a symbol in a namespace? |
| 21:29 | rhickey | ns-unmap |
| 21:30 | ericthor | thx |
| 21:32 | ericthor | is there a magic syntax? |
| 21:32 | ericthor | (ns-unmap 'remote-repl-manager 'get-embedded-clojure-lib) |
| 21:32 | rhickey | it takes a namespace and a symbol |
| 21:33 | rhickey | not the name of a namespace |
| 21:33 | rhickey | but I'm thinking of enhancing all of the ns functions to take either |
| 21:33 | ericthor | (ns-unmap 'emote-repl-manager 'get-embedded-clojure-lib)? |
| 21:34 | rhickey | for now: (ns-unmap (find-ns 'remote-repl-manager) 'get-embedded-clojure-lib) |
| 21:34 | ericthor | got it |
| 21:35 | ericthor | way too much typing for that |