Re: i'm having a lot of trouble dealing with events.

2008-11-19 Thread notallama
well, it has changed quite a lot now: (i'm not sure if this all actually works yet. they key map does, though) ;;gui imports. hurray! (import '(javax.swing JFrame) '(java.awt Canvas) '(java.awt.event KeyListener KeyEvent MouseListener MouseEcent FocusListen

Re: i'm having a lot of trouble dealing with events.

2008-11-19 Thread notallama
figured it out. my prints were going to the inferior lisp buffer. i feel kinda silly now. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.co

Re: i'm having a lot of trouble dealing with events.

2008-11-19 Thread notallama
so i made a typo. KeyPressed should be keyPressed still nothing, though. tried making the listener seperate, adding it to the frame, making the frame implement KeyListener and adding itself. nothing. --~--~-~--~~~---~--~~ You received this message because you are s

i'm having a lot of trouble dealing with events.

2008-11-19 Thread notallama
so, for a key listener, the keypressed method is called when you press a key, right? or am i misunderstanding how events work? this is what i have: (import '(javax.swing JFrame) '(java.awt Canvas) '(java.awt.event KeyListener KeyEvent)) (def app (JFrame.)) (def canvas (proxy [Canvas Ke

Re: Clojure for LISP programmers....

2008-11-17 Thread notallama
the vector syntax seems nice to me. you get the whole "() means function", "[] means sequential binding", "{} means associative binding", and it makes code easier to read/skim over. you could have lists for seq binding, but i think using a different syntax gets you out of that "everything is a lis

Re: A value that equals everything, or, ignoring things in multi-dispatch

2008-11-16 Thread notallama
what i think would be nice here is multimethods taking multiple dispatch functions. (i'm not sure how you'd do that without breaking the default value syntax) so it'd try the first function, and if it doesn't match any method, then it tries the second, etc. then :default, then throws an exception

Re: Newbie question: Can a collection contain itself?

2008-11-14 Thread notallama
you can have a collection that contains a ref to itself. or you could cook something up with lazy-cons, having it produce a copy of itself when needed. (this will be a lazy seq, though) --~--~-~--~~~---~--~~ You received this message because you are subscribed to t

iterate

2008-11-12 Thread notallama
i put this at the end of my boot.clj for added fun: (defn iterate "returns a lazy seq of arg1, arg2 ... argn, (f arg1 ... argn), (f arg2 ... argn (f arg1 ... argn)), etc." [f & [x & rest :as all]] (lazy-cons x (apply iterate f (concat rest [(apply f all)] user=> (take 10 (iterate + 1

java interop question

2008-10-27 Thread notallama
this may be more of a java question than a clojure question. i dunno. how do i use a java class from clojure? it's easy enough if it's one of the default java libraries, but so far all i have managed with classes i wrote is "unable to resolve to classname" i tried running the repl from the dire