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
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
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
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
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
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
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
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
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