Re: confused on set!

2013-05-22 Thread Phillip Lord
Ah, okay, I see the idea. I'm not sure why it doesn't work. For now, I think, using an atom and reset! seems to do the job! Phil atkaaz writes: > The following idea came to me in the shower, sort of out of the blue, and I > don't know why I didn't think of it before(I'm disappointed with mys

Re: confused on set!

2013-05-21 Thread atkaaz
The following idea came to me in the shower, sort of out of the blue, and I don't know why I didn't think of it before(I'm disappointed with myself) so, why not use the same thing as clojure does? even though it does it in java, you can do it in clojure, the only thing is that you have to do it onc

Re: confused on set!

2013-05-17 Thread Phillip Lord
Jim writes: > On 17/05/13 11:00, Phillip Lord wrote: >> It's a nice language, I think. It inherits however the some of the >> nastiness of Java, in particular it doesn't integrate at all into the >> OS; the makes it not a good fit for little scripting, one-off jobs which >> form the basis of a lo

Re: confused on set!

2013-05-17 Thread Jim
On 17/05/13 11:00, Phillip Lord wrote: It's a nice language, I think. It inherits however the some of the nastiness of Java, in particular it doesn't integrate at all into the OS; the makes it not a good fit for little scripting, one-off jobs which form the basis of a lot of scientific computing.

Re: confused on set!

2013-05-17 Thread Phillip Lord
"Jim - FooBar();" writes: > You can count on that! In addition, whenever I find some free time I'd like to > have a look at the lib and familiarise myself with it...and who knows, I may > even have some (humble yet constructive) comments/feedback. Also, I think > you'll find Clojure is a joy to wo

Re: confused on set!

2013-05-16 Thread Jim - FooBar();
On 16/05/13 16:48, Phillip Lord wrote: I have one main user at the moment, although she is my PhD student; I claim no coercion. I am a Ph.D student myself and that's exactly where I will most likely need ontologies... Something tells me we're going to be in contact soon :) Give me a shout if

Re: confused on set!

2013-05-16 Thread Phillip Lord
Jim writes: > On 16/05/13 15:07, Phillip Lord wrote: >> Yep, that's the problem. The library in question >> (https://github.com/phillord/tawny-owl) is meant to be usable by people >> who don't want to know that they are writing clojure. > Funny that you're writing an ontology lib - my research is

Re: confused on set!

2013-05-16 Thread Jim
On 16/05/13 15:07, Phillip Lord wrote: Yep, that's the problem. The library in question (https://github.com/phillord/tawny-owl) is meant to be usable by people who don't want to know that they are writing clojure. Funny that you're writing an ontology lib - my research is increasingly driving me

Re: confused on set!

2013-05-16 Thread Phillip Lord
Jim writes: > On 16/05/13 12:45, Phillip Lord wrote: >> I have a process that >> produces logging output, and I want the user to be able to define >> where that output goes. > > or you can define a multi-method or a tiny protocol with 2-3 > implementations (for GUI, raw-text or file-output) and

Re: confused on set!

2013-05-16 Thread Phillip Lord
Jim writes: > On 16/05/13 13:56, AtKaaZ wrote: >> In a way I'm in his shoes, but I always assumed that the user would use >> binding even if that meant encompassing the whole program in it. > > personally, I find it rather unpleasant to depend on a lib that forces me to > use 'binding' in such a

Re: confused on set!

2013-05-16 Thread Phillip Lord
Jim writes: > On 16/05/13 12:52, AtKaaZ wrote: >> why not ref and dosync? > > a bit heavyweight isn't it? Yep, that's the problem. The library in question (https://github.com/phillord/tawny-owl) is meant to be usable by people who don't want to know that they are writing clojure. > > dynamic s

Re: confused on set!

2013-05-16 Thread Jim
On 16/05/13 13:56, AtKaaZ wrote: In a way I'm in his shoes, but I always assumed that the user would use binding even if that meant encompassing the whole program in it. personally, I find it rather unpleasant to depend on a lib that forces me to use 'binding' in such a top-level fashion...Clo

Re: confused on set!

2013-05-16 Thread AtKaaZ
you're right, I somehow didn't read what he was using it for, just looked at the examples he gave and assumed generic var In a way I'm in his shoes, but I always assumed that the user would use binding even if that meant encompassing the whole program in it. Like if you wanted to disable asserts

Re: confused on set!

2013-05-16 Thread Jim
On 16/05/13 12:52, AtKaaZ wrote: why not ref and dosync? a bit heavyweight isn't it? A bit off topic but I remember when Clojure came out, STM was the big selling point! I've been programming Clojure for more than 3 years now and I've yet to write code that uses STM but that wasn't intention

Re: confused on set!

2013-05-16 Thread Jim
On 16/05/13 12:45, Phillip Lord wrote: I have a process that produces logging output, and I want the user to be able to define where that output goes. or you can define a multi-method or a tiny protocol with 2-3 implementations (for GUI, raw-text or file-output) and let your user select what

Re: confused on set!

2013-05-16 Thread AtKaaZ
why not ref and dosync? On Thu, May 16, 2013 at 2:45 PM, Phillip Lord wrote: > Jim writes: > > > On 16/05/13 11:33, Phillip Lord wrote: > >> And if it is okay to use set! > >> on*warn-on-reflection*, why is it not okay to allow me, as the library > >> developer, to define similar properties fo

Re: confused on set!

2013-05-16 Thread Phillip Lord
Jim writes: > On 16/05/13 11:33, Phillip Lord wrote: >> And if it is okay to use set! >> on*warn-on-reflection*, why is it not okay to allow me, as the library >> developer, to define similar properties for my library which work in a >> similar way. > > well, nothing stops you from providing bind

Re: confused on set!

2013-05-16 Thread Jim
On 16/05/13 11:33, Phillip Lord wrote: And if it is okay to use set! on*warn-on-reflection*, why is it not okay to allow me, as the library developer, to define similar properties for my library which work in a similar way. well, nothing stops you from providing bindings at the main entry point

Re: confused on set!

2013-05-16 Thread Neale Swinnerton
On Thu, May 16, 2013 at 11:33 AM, Phillip Lord wrote: > "Jim - FooBar();" writes: > causes an error. What it doesn't explain is why > > (set! *warn-on-reflection* true) > > works just fine. Is the REPL running inside a binding? Is it possible to > add other forms of this binding? Or not? And if

Re: confused on set!

2013-05-16 Thread Jim
You can do (set! *warn-on-reflection* true) because *warn-on-reflection* is already thread-locally bound... Is the REPL running inside a binding? essentially yes... Is it possible to add other forms of this binding? Or not? as Atkaaz pointed out yesterday these vars are in Java code so I'm

Re: confused on set!

2013-05-16 Thread Phillip Lord
"Jim - FooBar();" writes: >>> (set!*my-test* true) >> >> (alter-var-root #'*my-test* (constantly true)) > > here explains what you're asking: > http://clojure.org/Vars > > scroll down to until you see No, this only explains why (def ^{:dynamic true} *my-test* false) (set! *my-test* true) c

Re: confused on set!

2013-05-15 Thread AtKaaZ
I think the answer is in RT 's doInit Var.pushThreadBindings( RT.mapUniqueKeys(CURRENT_NS, CURRENT_NS.deref(), WARN_ON_REFLECTION, WARN_ON_REFLECTION.deref() ,RT.UNCHECKED_MATH, RT.UNCHECKED_MATH.deref())); it basically does a (binding [*warn-on-r

Re: confused on set!

2013-05-15 Thread Jim - FooBar();
On 15/05/13 17:28, Jim - FooBar(); wrote: On 15/05/13 17:23, Phillip Lord wrote: I cannot do (set!*my-test* true) (alter-var-root #'*my-test* (constantly true)) Jim here explains what you're asking: http://clojure.org/Vars scroll down to until you see (*set!*var-symbol expr) HT

Re: confused on set!

2013-05-15 Thread Jim - FooBar();
On 15/05/13 17:23, Phillip Lord wrote: I cannot do (set!*my-test* true) (alter-var-root #'*my-test* (constantly true)) Jim -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note tha

confused on set!

2013-05-15 Thread Phillip Lord
I'm still a bit confused on the use of set! I would like to define a configuration variable that is easy to change, but which is not critical to my infrastructure; it's will set some default behaviours. Now, I can do things like (binding [*warn-on-reflection* true] (do-some-function)) an