sharing multiple jogl opengl contexts in clojure

2010-04-19 Thread strattonbrazil
Has anyone done any work sharing OpenGL contexts in Clojure? I was wondering the best way to create a GLCanvas if I want all of them to share the same context. Right now it seems calling (.getContext (new GLCanvas)) returns nil, which may be a JOGL thing, but I was hoping to create one canvas wit

matching symbols in a dictionary

2010-04-13 Thread strattonbrazil
I want to map a dictionary and do different things depending on the key. I was planning on using an if-clause, but I'm not sure how to compare symbols to strings. Something like (map (fn [k v] (if (== k "hello") ... ...) {:hello 1 :goodbye 2}) How would I normally compare symbols and strings?

mutating multiple java swing components

2010-04-08 Thread strattonbrazil
What's the function to call java code on multiple java components? If I have a sequence of Java swing components and I want to go through and set the same properties for each one, I would use a for loop in Java. If I were using immutable structs in clojure, I'd just a map and just change the keys

holding types or units in metadata vs pattern matching

2010-04-02 Thread strattonbrazil
What's the best way to keep track of what kind of value something is? For example, if I have a hash of floats and I want to go through each one and see if a given key-value, which happens to be a float, if it's a distance or a frequency? Or if something is a struct or a specific struct? I'm somew

intuitive stack trace

2010-03-29 Thread strattonbrazil
In the relatively short time of using clojure, I'm a little frustrated with it's limited information the stack provides. I'm assuming there's something I just don't know or am not doing. Many times when I do something wrong, I have to read through the stack which sometimes just says there's an er

Re: copying structures

2010-03-28 Thread strattonbrazil
Is this the common way to do it? (def sister (assoc brother :name "Cindy")) Reading up more on structs, it seems they have base keys that can't be dissoc. Is that the main difference then between it and a hash? On Mar 28, 2:48 pm, strattonbrazil wrote: > I did a poor job

Re: copying structures

2010-03-28 Thread strattonbrazil
plications? Why wouldn't I just use a hash if structs can hold new values anyway? When should I use one over the other? On Mar 28, 11:52 am, B Smith-Mannschott wrote: > On Sun, Mar 28, 2010 at 18:29, strattonbrazil > wrote: > > This may be really basic.  So much so that it&

copying structures

2010-03-28 Thread strattonbrazil
This may be really basic. So much so that it's hard to find on the internet, but is there something like a copy constructor in clojure, where I can copy everything in a structure except one or two keys? Maybe something like struct-map, but fills in the other variables not supplied by another data

referencing an atom inside a function used for swapping

2010-03-25 Thread strattonbrazil
I have a function that I use for adding a JPanel to a ui atom. When I call swap! that ui atom is sent to that function I call with the swap! on and is dereferenced inside the function so I don't need to call @ui on it. However, I want to add listeners to my JPanel that can affect that atom, but I

separating ui and content in clojure

2010-03-20 Thread strattonbrazil
I'd like to separate my ui Swing/JOGL from the content, so my code is relatively unaware of the UI around it. For example, I create a global context that holds on my content. I then make a UI that when the user does some interaction like a mouse click or drag, the UI creates a new context. My OO

Re: clojure naming convention for accessors vs. local variables

2010-03-20 Thread strattonbrazil
efficient" access, > thennamingthe struct with an uppercase first letter works, and isn't > too uncommon; besides this is a special-case performance issue, right? > > On Mar 19, 4:36 pm, strattonbrazil wrote: > > > If am creating accessors to access structures, how should

clojure naming convention for accessors vs. local variables

2010-03-19 Thread strattonbrazil
If am creating accessors to access structures, how should they be named? (defstruct employer :employee) (defstruct employee :employer) (def employee-name (accessor employee :employer)) (def employer-name (accessor employer :employee)) In a situation where one struct is pointing to the other, is t

Re: jogl classpath not found

2010-03-12 Thread strattonbrazil
-amd64/lib/ nativewindow.all.jar clojure.main test.lsp On Mar 12, 8:20 am, Michał Marczyk wrote: > On 12 March 2010 17:09, strattonbrazil wrote: > > > java -cp -Djava.library.path=./jogl-2.0-linux-amd64/lib ~/clojure/ > > clojure-1.0.0.jar:./jogl-2.0-linux-amd64/lib/jogl.

Re: jogl classpath not found

2010-03-12 Thread strattonbrazil
ib/nativewindow/all/jar I don't know if adding to the library path is causing the new error, or if this is just the next error in getting the script to run. Am I setting the library path incorrectly? On Mar 11, 5:01 pm, strattonbrazil wrote: > Hrmm, that's weird.  Well thanks for tha

Re: jogl classpath not found

2010-03-11 Thread strattonbrazil
ting-started/16. > Hopefully some variation on that should work for you. > > On Mar 11, 1:28 pm, strattonbrazil wrote: > > > I downloaded the new jogl 2.0 libs and can't get jogl to be recognized > > in my classpath.  It's stuck on the import. > > > (impo

jogl classpath not found

2010-03-11 Thread strattonbrazil
I downloaded the new jogl 2.0 libs and can't get jogl to be recognized in my classpath. It's stuck on the import. (import '(javax.media.opengl.awt GLCanvas)) In my shell I have clojure aliased to 'java -jar clojure-1.0.0.jar' I have my CLASSPATH as echo $CLASSPATH ./jogl-2.0-linux-amd64/lib/jo

Re: enclojure install killed netbeans 6.8

2010-03-10 Thread strattonbrazil
n Sun, Mar 7, 2010 at 6:44 PM, strattonbrazil > wrote: > > I am on Linux.  I have a 6.6 and a 6.8 directory in my .netbeans > > folder.  6.6 still runs.  I have tried moving individual jars in and > > out of that dir, but I still get the error.  I even moved the entire >

Re: enclojure install killed netbeans 6.8

2010-03-08 Thread strattonbrazil
Mar 5, 2010 at 11:34 PM, strattonbrazil > > wrote: > > Has anyone had problems with netbeans starting with the enclojure > > alpha?  I restarted my session and it died.  Now when I try to run > > netbeans, it throws a classpath exception.  Can I remove this plugin > >

enclojure install killed netbeans 6.8

2010-03-06 Thread strattonbrazil
Has anyone had problems with netbeans starting with the enclojure alpha? I restarted my session and it died. Now when I try to run netbeans, it throws a classpath exception. Can I remove this plugin or am I missing something in my install? Exception in thread "main" java.lang.NoClassDefFoundErr

mutable half-edge data structures to immutable languages

2010-03-04 Thread strattonbrazil
I have implemented the half-edge data structure several times now for mesh representation. Basically there are three main data structures (vertex, edge, face). I'll explain them a bit, but I think this is a more functional programming/Clojure question than actual geometry. A vertex is a corner o

appropriate uses of clojure

2010-02-22 Thread strattonbrazil
Object-oriented design has been frequently sourced as becoming standard for simulations. Even on the clojure website, it states, "[Object-oriented design is ] Born of simulation, now used for everything, even when inappropriate". I've also heard GUIs are more easily developed using object orienta