Hi,
On Jul 24, 7:56 am, Laurent PETIT wrote:
> Here is an example from clojure-contrib where Chouser uses explicit use of
> :arglists to fine-tune the public API signature of macro deferror:
Note, that this is also useful for multimethods, since they don't have
an explicit argument vector. (An
Hi,
I think it is fair to consider that everything the client of your (public)
function can find in the printed value from a call to (doc some-public-fun)
is part of the contract of the fun. And the arglist(s) are printed as part
of the call to 'doc.
But sometimes, one may want to leverage the po
> He has no other solution than to audit all his code
> to locate (not necessarily a trivial task) and update the
> destructuring patterns which concern foo data.
As mentioned, this is a problem in any language. However, clojure lets
you do things in much, much less code, so I don't think it
Hi David,
I would say that this is a problem in any programming language that makes
use of an external library. If the public API of a library changes, you're
going to need to update the code that acts as a consumer of that library.
It's an inherent risk in upgrading without doing proper vetting
On Jul 22, 10:15 am, Chouser wrote:
> Java and therefore Clojure does not play nicely in this
> niche as far as I can tell. Even if a service allows ssh
> access such that you can install a JVM, Clojure, etc. it's
> almost certain you will not be allowed to keep
> a long-running process going
> Coming from an OO background which puts a strong focus on data
> encapsulation,
> this makes me a little nervous.
The same problem exists with OO. For example, maybe you return a
Headers object from a request. A couple of releases down the line you
realize you need to include some additio
Hi.
I'm learning Clojure, and I like a lot what I've seen so far. Thank
you Rich for designing
such a nice langage, and Stuart for writing such a great book!
I'm a little worried about the pattern matching/destructuring binding
feature though. It
looks very powerful, but also very dangerous. It
Hey Travis,
I just went through your article, worked through your code, tinkered. Great
job. I'm learning Clojure now and these are definitely the types of
articles that make it a lot easier to see how to work with all of the
concurrency mechanisms that the language provides.
- Jeremy
On Wed,
Hmm, I like "spy" since it doesn't mimic a logging level like "debug"
and "trace" do. Making the change now, thanks.
On Jul 23, 11:01 am, Laurent PETIT wrote:
> What about 'spy instead of 'debug ? Or 'trace ?
>
> 2009/7/23 ataggart
>
>
>
>
>
> > Tim is correct. The log macro is what you wan
What about 'spy instead of 'debug ? Or 'trace ?
2009/7/23 ataggart
>
> Tim is correct. The log macro is what you want to use when you're
> really just wanting to log something; in that case the message
> expression won't get evaluated unless the particular logging level is
> enabled.
>
> The de
Tim is correct. The log macro is what you want to use when you're
really just wanting to log something; in that case the message
expression won't get evaluated unless the particular logging level is
enabled.
The debug function is for when you want to execute an expression
regardless, but would a
Yes it works ! :
1:172 user=> (doto (java.awt.Point.) (-> .x (set! 2)))
#
I hadn't thought about this possible combination, thanks Meikel.
So now, is mset! worth the trouble ?
Let's compare them again:
(doto (SomeBeanCtor.)
(-> .field1 (set! expr1))
(-> .field2 (set! expr2))
(-> .field4 (s
I see in clojure.core that you have gen-and-load-class . This may be what
you are after ?
HTH,
--
Laurent
2009/7/22 Howard Lewis Ship
>
> I'm using (:gen-class) to create javax.servlet.Filter, then creating a
> Jetty instance around the filter.
>
> Alas, for this to work, I have to go through
Hi,
Am 23.07.2009 um 18:24 schrieb Laurent PETIT:
Hello,
I want to call set! several times on a same instance, e.g. :
(let [instance (SomeBeanCtor.)]
(set! (. instance field1) expr1)
(set! (. instance field2) expr2)
...)
Do you know if a macro simplifying this already exists ?
How abo
Hello,
I want to call set! several times on a same instance, e.g. :
(let [instance (SomeBeanCtor.)]
(set! (. instance field1) expr1)
(set! (. instance field2) expr2)
...)
Do you know if a macro simplifying this already exists ?
Anyway, I've created one as an exercise, and here it is:
(def
> pmap will only use 1 thread per
> CPU/core, and therefore is only useful for computationally intensive
> functions.
> send-off definitely sounds like the right solution for this type of problem.
Cool, thanks for the info!
--~--~-~--~~~---~--~~
You received this
On Wed, Jul 22, 2009 at 9:56 PM, tmountain wrote:
>
> I've written a short blog post on using Clojure to search for
> available ssh servers on my companies VPN. It starts with a single-
> threaded example and then adds concurrency. The performance difference
> in this case was pretty extreme. Swe
Thanks for the answer, that's exactly what I wanted to know.
On Jul 23, 1:59 pm, Rich Hickey wrote:
> On Wed, Jul 22, 2009 at 4:33 PM, Dragan Djuric wrote:
>
> > I've just read in the Stuart's book that multimethod dispatching on
> > something other than Java inheritance is rarely used. It seems
> How fast the multimethods dispatch performs with large taxonomies
> compared to Java inheritance or small taxonomies? For example, a 1000
> or thousands elements in different taxonomies (or even a million?). Is
> it designed to perform well in such cases?
I've used hundreds of keywords in a hie
Ah. Thanks.
On Thu, Jul 23, 2009 at 8:45 AM, Stuart Halloway
wrote:
>
> Clojure's derive function creates an inheritance relationship between
> keywords (or symbols). I have taken to calling this "keyword
> inheritance" to emphasize that the inheritance is at the level of
> *names*, not of interf
I have an update since my last post. It is technically possible to
completely bypass the HBM-XML files and do the mapping stuff
programmatically, a route that I will likely take (XML generation does
not fit well in the arrangement and should be avoided). Taking this
route will bring the defmodel/h
Clojure's derive function creates an inheritance relationship between
keywords (or symbols). I have taken to calling this "keyword
inheritance" to emphasize that the inheritance is at the level of
*names*, not of interfaces or methods.
The book covers this in the section "Adding Inheritance
I am learning JMX as a I go here (by writing tests) and was hoping
that registerMBean doesn't depend on the actual class (or its name).
What's the point of interfaces if you write APIs that require classes?
I am still hoping to make this work with a proxy, but I will try out a
genclass-bas
Wow. I wasn't trying to be a trouble maker. :)
I was just looking to clarify my understanding and didn't understand the
conflict between the definition and example.
Unless "?" was idiomatic for things other than predicates.
Thanks for the clarification.
I have yet to encounter the situation of
Hi Stuart,
Could you give me a two-sentence description, or a pointer to a description,
of what keyword inheritance is? Apparently this is something I haven't
encountered or don't remember...
Thanks a lot.
On Wed, Jul 22, 2009 at 10:48 PM, Stuart Halloway wrote:
>
> I certainly agree with the
On Wed, Jul 22, 2009 at 4:33 PM, Dragan Djuric wrote:
>
> I've just read in the Stuart's book that multimethod dispatching on
> something other than Java inheritance is rarely used. It seems to me
> that there is a huge potential for their use in something that I do,
> so I'd add "yet" to his word
On Wed, Jul 22, 2009 at 10:45 PM, Stuart
Halloway wrote:
>
> I have a failing test in the JMX server code [1]:
>
> (deftest dynamic-mbean
> (let [mbean-name "clojure.contrib.test_contrib.test_jmx:name=Foo"]
> (jmx/register-mbean
> (jmx/dynamic-mbean
> (ref {:string-attribute "a-st
I've also looked into the dynamic-map stuff, but found only
rudimentary documentation, which caused me to give up. It's nice to
see that you seem to have gotten further.
For me personally, well-polished defmodel/hbm-property functionality
would be much more important than a query-DSL (since you p
Thanks for the explanation, that makes sense.
2009/7/23 Timothy Pratley
>
> Hi Laurent,
>
> I believe using
> (log :fine (expensive-calc))
> will do precisely what you describe (not do anything unless
> level :fine is enabled, and return nil)
>
> (debug (some-expr)) is intended when you want
I'd been doing some playing with JMX too. I was mostly just
interested in exposing a function that returns a map, eg:
#(@deref counters), as a JMX bean that exposed properties representing
the fields in the map.
I'm not very experienced with JMX, but I got the impression that it
would probably
> A remote process (process not running on the same machine as JMX
> client) can usually be accessed through an RMI connection.
I might be totally wrong here, but jconsole lets you connect to any
java process on Java 1.6, without needing jmxremote properties.
I got the impression, that this is
Hi Laurent,
I believe using
(log :fine (expensive-calc))
will do precisely what you describe (not do anything unless
level :fine is enabled, and return nil)
(debug (some-expr)) is intended when you want to leave the logic
precisely as is but display part of the calculation;
(+ a b (- c d))
;
Hello,
2009/7/23 ataggart
>
> Ok, I've updated the code with some of Tim's code:
> http://paste.lisp.org/display/84053
>
> The "public" functions/macros are:
>
> enabled? [level] [level log-name]
> true/false whether that level is enabled for the current namespace
> or log-name
>
> log [level m
Ok, I've updated the code with some of Tim's code:
http://paste.lisp.org/display/84053
The "public" functions/macros are:
enabled? [level] [level log-name]
true/false whether that level is enabled for the current namespace
or log-name
log [level message ...]
logs the message either directly
That solved it, thank you!
Volker
--~--~-~--~~~---~--~~
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 that posts from new members are moderated - please
Hi,
the macro only works with the vector itself,
because otherwise it only sees the symbol,
but not the vector. What you want is a doseq
loop.
(defn add-elements
[model elements]
(doseq [elem elements]
(.addElement model elem)))
Then you can do:
(doto (DefaultListModel.)
(add-element
36 matches
Mail list logo