#clojure logs

2008-03-29

00:52vagifHello, any webjure users ?
00:55alecDoes 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:45jonathan_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:45ericthorrich: 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:47ericthornevermind...found it
10:47rhickeyeric: it's not used, the smap string is just passed to ASM's visitSource in FnExpr.compile
10:48ericthoryup...i see that. thx
10:48rhickeyjonathan: 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:51jonathan_yeah, I'd kind of spotted there would be a transformation to recur possibly, ok I'll read your solution very carefuly, thanks
11:53grenhi - i have a newbie question
11:53grenI am just playing with getting a moving piece of text on a JFrame
11:54grenand I have some text displaying - however, now I want it to move
11:54grenmy question is (probably common): what is the most idiomatic way for me to keep the current X,Y position of the text?
11:55grenand update it?
12:07hoeckgren: i would use getLocation()
12:07grenah, i see: rely on java's mutable state?
12:07greni am playing around with a view to writing a game in clojure
12:08grenand wanted to have some clojure data structures for player etc.
12:08rhickeyif 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:08grenyeah - my example is probably a bit simplistic
12:09greni was looking more to get an understanding of how i create/update/mutate state within clojure itself
12:10rhickeyrefs/agents are the way
12:10grene.g. if i (def *myscore* 78), then to rebind i would do (def *myscore* (inc *myscore*))?
12:10greni'll take a look into agents
12:11rhickey(def score (ref 0))...
12:11rhickey(sync nil (alter score inc))
12:11grenok
12:11rhickeybut don't re-def
12:12greni have a large array (representing a 'map') - presumably (def map (ref (make-array Object 300))) is ok too
12:13grenthen (sync nil (alter map (update-map))) or something?
12:13rhickeyyou shouldn't put anything in a ref that you intend to mutate, i.e. if you intend to modify the Object array
12:14rhickeyInstead you could use a Clojure vector
12:14grenyes - makes more sense
12:14rhickeyI have an ant colony simulation for a talk I gave last week...
12:14grenessentially, (map-update) would just alter the members of the vector (actually a tile map of characters)
12:15grenyes, i read about that
12:15rhickeywaiting for the audio, but then I'll make available - does everything you are talking about
12:15greneagerly awaiting the video :)
12:15rhickeyliterally not in my hands
12:15grenthanks for the help - very helpful community
13:33ericthorrich: 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:34ericthore.g. 10#1,6:1,10000
13:37ericthorThis still limits the source file mapping. Not sure if this will interfere with the eclipse problem though. Any thoughts?
14:31rhickeyeric: 10#1,6:1,10000 => InputStartLine # LineFileID , RepeatCount : OutputStartLine , OutputLineIncrement
14:31rhickeyI don't see how that works
14:40ericthorit may not make sense (yet) but it does work.
14:41rhickeybut is says that line 10 corresponds to line 1?
14:41ericthorin the output yes?
14:42rhickeyinputstartline -> outputstartline
14:42rhickeyshould be the same
14:42ericthorlet me try it again that way
14:42ericthorit will take a minute
14:43ericthorare they referring to the binary output?
14:44rhickeyClojure emits output line numbers 1:1 with the source line 10 == line 10
14:46rhickeya virtual mapping between Clojure source and imaginary java file
14:56ericthorok.
14:56ericthorhere is the next question:
14:58ericthorif 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:59ericthorall the other breakpoints on other lines work prefectly
14:59ericthorjust not the defn
14:59rhickeybut defn isn't inside the function being defined, it's defining the function
15:00ericthoryes...we're ok there
15:01rhickeyso can't expect to stop there when calling the function
15:01ericthorremote REPL dubugging is working and finding source
15:01ericthorpretty cool
15:01rhickeywow
15:01ericthorI have it with a checkbox on the REPL to run it locally (which is probably only relevant for developing the module?)
15:02rhickeyyeah, I think it will almost always be remote
15:02ericthoryup
15:02ericthorit's still great to modify the debugger while I'm running through
15:02ericthorthough
15:03ericthorthere may be some value in attempting to determine the namespace of a breakpoint to help out with the preferred class stuff.
15:04ericthorIt finds it immediately when I include the namespace
15:05ericthorI think Mark/Frank has something for that...optimization for the future.
15:05ericthorIt looks like I have to handle stepping myself but I do not think that will be a big deal.
15:06rhickeystepping yourself seems like more work than you should have to do
15:07ericthornevermind...stepping works fine
15:08ericthorwas in the wrong...REPL...might be time for a break
15:08ericthorany recommendations on handling the remote java process? Just using Runtime.getRuntime().exec...
15:09rhickeysimplest thing that works...
15:09rhickeymay be some platform issues
15:10ericthortrue...but time to move onto shoal....who knows where that will go :)
15:10rhickeycool
15:18rhickeysingle-page API docs: http://clojure.sourceforge.net/reference/api.html
15:20ericthorexcellent!
15:51jgracinThe HEAD of webjure to compile. Says package javax.portlet does not exist.
15:51jgracini.e. the HEAD doesn't compile.
19:30rhickeynew release: http://clojure.sourceforge.net/news/20080329_release.html
19:30rhickeyold hat to all svn-ers
19:37ericthorI'm currently debugging and modifying a live instance of the netbeans enclojure module. This is an amazing way to work!
19:38ericthor...oh..and debugging the remote REPL with the module being written
19:38ericthora much nicer java experience for sure
20:33rhickeyeric: sounds cool
21:29ericthorcan i unmap a symbol in a namespace?
21:29rhickeyns-unmap
21:30ericthorthx
21:32ericthoris there a magic syntax?
21:32ericthor(ns-unmap 'remote-repl-manager 'get-embedded-clojure-lib)
21:32rhickeyit takes a namespace and a symbol
21:33rhickeynot the name of a namespace
21:33rhickeybut I'm thinking of enhancing all of the ns functions to take either
21:33ericthor(ns-unmap 'emote-repl-manager 'get-embedded-clojure-lib)?
21:34rhickeyfor now: (ns-unmap (find-ns 'remote-repl-manager) 'get-embedded-clojure-lib)
21:34ericthorgot it
21:35ericthorway too much typing for that