Re: Trait-like behavior with Protocols

2010-02-09 Thread Jeff Rose
I think the extend function is made exactly to support the concrete implementation of protocols. It takes a type, and then any number of protocol + function map pairs, where keyword names map to functions. Checkout the protocol docs on assembla and look for extend:

Re: Please share your thoughts on dependency injection

2010-02-09 Thread Steve Purcell
On 8 Feb 2010, at 16:53, Boris Mizhen - 迷阵 wrote: Hello all, I am playing with the idea of a little library for dependency injection. The idea is to declare injectable values as metadata-to-function map. I started with a sketch of what the client code may look like. Please let me know

Re: Prepping clojure for packaging (was: Re: Clojure for system administration)

2010-02-09 Thread Ramakrishnan Muthukrishnan
On Tue, Feb 9, 2010 at 12:27 PM, Meikel Brandmeyer m...@kotka.de wrote: Hi, maybe I don't understand the problem. Why can't the system provide some kind of local repository? The package system (deb, rpm, ports, whatever) just installs the dependencies there. A wrapper script reads in the

Re: scope of binding

2010-02-09 Thread Alex
D'oh! Thanks. I fall for that trap yet again. Sounds so simple when explained. 2010/2/9 Sean Devlin francoisdev...@gmail.com: The problem is that map returns a lazy seq, and the lazy seq is evaluated outside of the binding by the REPL.  If you add a doall inside the binding, it behaves as you

Re: error reporting for macro expansion

2010-02-09 Thread Jeff Rose
I agree, the error reporting from the compiler can often be hard to dig through. Besides showing both the location of the macro definition and its usage, it would be nice to hide all of the clojure.lang.* calls in the stack trace by default, or fold them into a single line. That way the user

Re: Trait-like behavior with Protocols

2010-02-09 Thread Konrad Hinsen
On 09.02.2010, at 02:14, Stuart Sierra wrote: On Feb 8, 6:13 pm, aria42 ari...@gmail.com wrote: (defprotocol Span (start [self]) (stop [self]) (span-length [self])) Now I know I can just make span-length a function on Span as opposed to part of the protocol. Is that what one should

clojure gen-class questions

2010-02-09 Thread Аркадий Рост
Hi! For example: (ns exaple_class (:gen-class)) (defn -main [args*] (...do smth...)) (defn -method_name1 [args*] (...do smth...)) (defn- -method_name2 [args*] (...do smth...)) (def -a 5) (defn fun1 [args*] (...do smth...)) (defn- fun2 [args*] (...do smth...)) (def b 5) As I understand, in

Re: clojure gen-class questions

2010-02-09 Thread Meikel Brandmeyer
Hi, On Feb 9, 4:22 pm, Аркадий Рост arkr...@gmail.com wrote: For example: (ns exaple_class     (:gen-class)) (defn -main [args*] (...do smth...)) (defn -method_name1 [args*] (...do smth...)) (defn- -method_name2 [args*] (...do smth...)) (def -a 5) (defn fun1 [args*] (...do smth...))

Re: clojure gen-class questions

2010-02-09 Thread Аркадий Рост
Thaks for yor answer. It's really help me with studying. -- 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 be patient with your first

Re: clojure gen-class questions

2010-02-09 Thread Аркадий Рост
Oh...So to make methods I must declare them in gen-class clause and if some function wasn't include in gen-class clause, it wouldn't be a method even if it had a prefix from gen-class clause. I mean: (ns example.class (:gen-class :prefix pre- :methods [[method_name1 [... arg types here

Re: clojure gen-class questions

2010-02-09 Thread Аркадий Рост
And one more, when and why methods should be used? (except main) -- 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 be patient with your

Re: clojure gen-class questions

2010-02-09 Thread Brian Wolf
Hi, I also am confused about gen-class, looking for a pointer to some code examples. Thanks, Brian ??? wrote: Oh...So to make methods I must declare them in gen-class clause and if some function wasn't include in gen-class clause, it wouldn't be a method even if it had a prefix

Re: Detecting Number of Available CPU Threads

2010-02-09 Thread Chouser
On Mon, Feb 8, 2010 at 8:37 PM, Wardrop t...@tomwardrop.com wrote: That seems like what I'm after, thanks. I assume this would be pretty reliable across all platforms running the JVM. By the way, I did google the Java API with various keywords but never cam across this object property. It

Re: Prepping clojure for packaging (was: Re: Clojure for system administration)

2010-02-09 Thread Peter Schuller
That's exactly what Debian does. For every Java package also provide the maven xml file and the jar is discoverable from maven. The installed packages on the local system acts as a local maven repo.  http://wiki.debian.org/Java/MavenRepoSpec I see they also solved the problem of not

Re: Trait-like behavior with Protocols

2010-02-09 Thread aria42
If this situation is common enough, shouldn't defprotocol support optional implementations which are implicitly merged? On Feb 9, 6:01 am, Konrad Hinsen konrad.hin...@fastmail.net wrote: On 09.02.2010, at 02:14, Stuart Sierra wrote: On Feb 8, 6:13 pm, aria42 ari...@gmail.com wrote:

Re: clojure gen-class questions

2010-02-09 Thread Meikel Brandmeyer
Hi, I wrote up a post: http://tr.im/NwCL Hope it helps. Sincerely Meikel -- 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 be patient

Re: clojure gen-class questions

2010-02-09 Thread Meikel Brandmeyer
Hi, Am 09.02.2010 um 18:10 schrieb Аркадий Рост: Oh...So to make methods I must declare them in gen-class clause and if some function wasn't include in gen-class clause, it wouldn't be a method even if it had a prefix from gen-class clause. I mean: (ns example.class (:gen-class :prefix

Re: Trait-like behavior with Protocols

2010-02-09 Thread Konrad Hinsen
On 9 Feb 2010, at 22:29, aria42 wrote: If this situation is common enough, shouldn't defprotocol support optional implementations which are implicitly merged? Yes, if it is common enough. It's perhaps too early to decide. Konrad. -- You received this message because you are subscribed to