Re: Detecting Number of Available CPU Threads

2010-02-11 Thread Daniel Werner
On Feb 9, 2:37 am, 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. In .NET, on the other hand, this value is stored in System.Environment.ProcessorCount. Perhaps it would be worthwhile to

Re: Detecting Number of Available CPU Threads

2010-02-11 Thread Meikel Brandmeyer
Hi, On Feb 9, 9:29 pm, Chouser chou...@gmail.com wrote: It may be worth noting that using 'send' to dispatch actions to an agent already takes into account the number of CPUs available. This essentially means it's safe to queue up sends on as many agents as you want -- hundreds, even

Importing a class with an ambiguous name

2010-02-11 Thread igorrumiha
Hi, I'm exploring the jexcelapi library (http:// jexcelapi.sourceforge.net), and one of the classes there is jxl.write.Number. So, when I do: = (import 'jxl.write.Number) I get: Number already refers to: class java.lang.Number in namespace: user [Thrown class java.lang.IllegalStateException]

Re: Importing a class with an ambiguous name

2010-02-11 Thread Joop Kiefte
If I remember correctly it will work just fine if you don't import it and you refer to it like (jxl.write.Number... Please correct me if I'm wrong. Joop Kiefte 2010/2/11 igorrumiha igorrum...@gmail.com Hi, I'm exploring the jexcelapi library (http:// jexcelapi.sourceforge.net), and one of

Clojure and OOP

2010-02-11 Thread HB
Hey, Since Clojure is a LISP dialect, does this mean that it doesn't support OOP? Thanks. -- 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 -

Re: Clojure and OOP

2010-02-11 Thread Timothy Pratley
On 11 February 2010 22:46, HB hubaghd...@gmail.com wrote: Since Clojure is a LISP dialect, does this mean that it doesn't support OOP? You might find this article interesting: http://blog.thinkrelevance.com/2009/8/12/rifle-oriented-programming-with-clojure-2 And related:

Re: Importing a class with an ambiguous name

2010-02-11 Thread igorrumiha
On Feb 11, 1:24 pm, Joop Kiefte iko...@gmail.com wrote: If I remember correctly it will work just fine if you don't import it and you refer to it like (jxl.write.Number... Please correct me if I'm wrong. You are correct! Thanks! -- Igor Rumiha -- You received this message because you are

Re: Clojure and OOP

2010-02-11 Thread James Reeves
On Feb 11, 12:46 pm, HB hubaghd...@gmail.com wrote: Hey, Since Clojure is a LISP dialect, does this mean that it doesn't support OOP? Thanks. To quote Dr. Alan Kay: OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all

Re: Clojure and OOP

2010-02-11 Thread Joel Westerberg
You can work with java objects. But clojure itself is not object oriented, because it's functional, and object orientation requires state manipulation. Other lisps support object orientation, common-lisp for example. cheers, /J On Thu, Feb 11, 2010 at 1:46 PM, HB hubaghd...@gmail.com wrote:

Re: clojure.contrib.test-contrib.test-jmx build error

2010-02-11 Thread Eamonn McManus
I think you're running into http://bugs.sun.com/view_bug.do?bug_id=6924497 which is unrelated to JMX itself but is a problem of incompatibility between the JDK class library and the JVM, if for example you are running with HotSpot Express. A fix should appear in a JDK 6 update but in the meantime

Re: Clojure and OOP

2010-02-11 Thread Jeff Schwab
Joel Westerberg wrote: You can work with java objects. But clojure itself is not object oriented, because it's functional, and object orientation requires state manipulation. By whose definition? Are you saying there is no such thing as an immutable object? Other lisps support object

Multimethods vs. cond?

2010-02-11 Thread Bryce
I'm wondering what the rationale is for using multimethods vs. cond, and where it's best to use either? Multimethods seem to be very seldom used, usually to dispatch on type, but I can see advantages to using data to dynamically define only the methods you need, rather than having

Re: Clojure and OOP

2010-02-11 Thread Laurent PETIT
The problem is about the overloading of the object based expression. A step forward could be to recognize that: * Java is a weak/simplified version of a class based language (simplifications made for several well known reasons: ease of adoption by C/C++ crowd: - algol like syntax-, reduced

Clojure NYC Users Group looking for speakers!

2010-02-11 Thread Eric Thorsen
We had about 60 people show up for our first meeting and I've had some very positive feedback and a couple of companies have approached me about sponsoring our next meeting. We are looking for speakers to talk about anything Clojure. The group is a mix of people using Clojure commercially to

Re: Multimethods vs. cond?

2010-02-11 Thread Laurent PETIT
2010/2/11 Bryce fiat.mo...@gmail.com: I'm wondering what the rationale is for using multimethods vs. cond, and where it's best to use either?  Multimethods seem to be very seldom used, usually to dispatch on type, but I can see advantages to using data to dynamically define only the methods

Re: Clojure and OOP

2010-02-11 Thread John Pall
can we creat threads in clojure? On Feb 11, 8:11 pm, Laurent PETIT laurent.pe...@gmail.com wrote: The problem is about the overloading of the object based expression. A step forward could be to recognize that:  * Java is a weak/simplified version of a class based language (simplifications

Re: error reporting for macro expansion

2010-02-11 Thread John Williams
I'm concerned specifically about exceptions that occur during macro expansion. As often as not, these exceptions are the result of calling the macro with incorrect arguments rather than any problem in the macro itself, but the stack trace doesn't contain enough information to locate the offending

Re: error reporting for macro expansion

2010-02-11 Thread Joop Kiefte
In the example, you can find a reference to the actual macro (line and name) in the second part (Caused by:). By the nature of macro's I think this might be not the most human way to get the line number, but surely the way the JVM sees it. 2010/2/11 John Williams shponglesp...@gmail.com I'm

Re: Multimethods vs. cond?

2010-02-11 Thread Jeff Rose
Yeah, in practice it seems like multimethods are pretty much just used as a way to let users of a library extend the API to support additional types. If you had a cond expression dispatching on the type of an argument, for example, then the user would have to modify the source code of your

Re: Clojure and OOP

2010-02-11 Thread Michał Marczyk
On 11 February 2010 13:46, HB hubaghd...@gmail.com wrote: Hey, Since Clojure is a LISP dialect, does this mean that it doesn't support OOP? Thanks. Regardless of whether Clojure supports OOP, not supporting it certainly doesn't follow from being a Lisp dialect. Take a look at CLOS (Common

Re: Request for Feedback: Improve VimClojure's documentation

2010-02-11 Thread e
i can echo that last reply. I wanted to use clojure and may return to it ... awesome idea. But haven't had ANY luck with dev environments ... VC, included. gone down many blind alleys. It was almost a year ago that I tried, though. perhaps I should try again. On Thu, Feb 11, 2010 at 12:44

small code review..

2010-02-11 Thread Martin Hauner
Hi, I'm doing my first steps in Clojure and I would like to get some feedback on my implementation of the Bowling Game Kata. The code is here http://softnoise.wordpress.com/2010/02/07/the-bowling-kata-in-clojure. I can post the code here if that's preferred. I'm mostly interested if there is

Re: Clojure and OOP

2010-02-11 Thread .Bill Smith
Instead of getting caught up in whether or not it supports OOP, and how to define OOP, I recommend watching http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey. On Feb 11, 6:46 am, HB hubaghd...@gmail.com wrote: Hey, Since Clojure is a LISP dialect, does this mean that it doesn't

Re: Clojure and OOP

2010-02-11 Thread Tayssir John Gabbour
Hi, On Feb 11, 1:46 pm, HB hubaghd...@gmail.com wrote: Since Clojure is a LISP dialect, does this mean that it doesn't support OOP? Careful not to come to the conclusion that if something's a Lisp, it's not OOP. For instance, Common Lisp has a powerful OOP system which includes

Re: Clojure and OOP

2010-02-11 Thread Richard Newman
I suspect that Clojure is actually more suited to OOP than Java, assuming you're going by Dr. Kay's definition. :) Another Kay quote: I invented Object-Oriented Programming, and C++ is not what I had in mind. -- You received this message because you are subscribed to the Google Groups

Re: small code review..

2010-02-11 Thread Brenton
Martin, It's very simple, I like it. There two things that stand out to me, both having to do with readabiliby. Instead of using (def score) you should use (declare score). declare exists for the purpose of making forward declarations. That one is black and white. You have to do it. The other

Simple clojure and contrib install, with SLIME ... ?

2010-02-11 Thread Paul Mooser
I struggle fairly often with keeping clojure/contrib/slime up to date on my machine - it seems that every time I update it, something fundamental has broken (like build.xml going away in contrib). There are a few things that seem to try to make this easier (like clojure- mode's install-clojure, or

Re: Simple clojure and contrib install, with SLIME ... ?

2010-02-11 Thread Richard Newman
What are other people doing to maintain their installations? Is there some simple way to keep all of these projects up to date? Or do people simply not update all of these projects often? I suck it up. Fortunately I was in the process of switching to Leiningen when contrib suddenly moved to

Re: Simple clojure and contrib install, with SLIME ... ?

2010-02-11 Thread Paul Mooser
I just have a hard time keeping it working when I update. I understand that being on the bleeding edge is rough, but it's hard for me to think that this isn't especially frustrating for new users, who I suspect will find that most tutorials or guides to setting up clojure with slime (for example)

Re: Simple clojure and contrib install, with SLIME ... ?

2010-02-11 Thread Michał Marczyk
On 11 February 2010 19:59, Paul Mooser taron...@gmail.com wrote: What are other people doing to maintain their installations? Is there some simple way to keep all of these projects up to date? Or do people simply not update all of these projects often? If you don't need to insist on running

Re: Multimethods vs. cond?

2010-02-11 Thread Raoul Duke
hi, the expression problem (http://en.wikipedia.org/wiki/Expression_Problem) talks about some of the relevant trade-offs. sincerely. -- 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

Re: Contributing to Clojure.Contrib

2010-02-11 Thread Michał Marczyk
On 11 February 2010 00:44, Sean Devlin francoisdev...@gmail.com wrote: Take a look here: http://clojure.org/contributing Um... I strongly suspect that this may be a supremely silly question, but I can't seem to figure out what's supposed to go in some of the fields. Does one specify Clojure

Re: Request for Feedback: Improve VimClojure's documentation

2010-02-11 Thread Sean Devlin
Here are some windows friendly options: http://vimeo.com/tag:install_clojure Sean On Feb 11, 1:11 pm, e evier...@gmail.com wrote: i can echo that last reply.  I wanted to use clojure and may return to it ... awesome idea.  But haven't had ANY luck with dev environments ... VC, included.  

Help me make this more idiomatic clojure

2010-02-11 Thread Greg Bowyer
Hi all, long time lurker first time irritant. I have been playing with clojure for a little while, and finding it most excellent; however my lack of lisp thinking keeps leading me to write ugly code. I have the following code in java: -- static final String CONNECTOR_ADDRESS =

Reading data from a file into a struct

2010-02-11 Thread Base
Hi All – I would like to read in a text file and map the results to a struct, and seem to be hung up. The data set would look like: Minneapolis\tMN\t55409 Beverly Hills\tCA\t90210 New York City\tNY\t10023 Etc…. Using duck streams: (defn load-data [f] (into [] (ds/read-lines f))) Yields a

Re: Help me make this more idiomatic clojure

2010-02-11 Thread Richard Newman
You can use get on Properties. Use .foo for method calls. Use literal vec syntax, not list. Use or for conditional branches instead of (if foo foo ...). Untested: (defn obtain-local-connection [vmid] (let [vm (VirtualMachine/attach vmid) props (.getSystemProperties vm)

Re: Help me make this more idiomatic clojure

2010-02-11 Thread Brenton
You can also you #_ to comment out a line of code #_(.vm detach) so that you don't have to put )) on the next line. Brenton On Feb 11, 10:39 am, Greg Bowyer gbow...@fastmail.co.uk wrote: Hi all, long time lurker first time irritant. I have been playing with clojure for a little while, and

Re: Help me make this more idiomatic clojure

2010-02-11 Thread Brenton
Sorry, you are not commenting out a line of code but ignoring the next form. On Feb 11, 12:49 pm, Brenton bashw...@gmail.com wrote: You can also you #_ to comment out a line of code #_(.vm detach) so that you don't have to put )) on the next line. Brenton On Feb 11, 10:39 am, Greg Bowyer

Re: Help me make this more idiomatic clojure

2010-02-11 Thread CuppoJava
Most of that java code is just pasting together library function calls. I'm not sure if there's any more elegant ways of doing that. Your clojure code looks fine for the most part I think. It's mostly just a question of style. The only thing that sticks out is the call to (list). That's generally

Re: Simple clojure and contrib install, with SLIME ... ?

2010-02-11 Thread Michael Wood
On 11 February 2010 21:07, Richard Newman holyg...@gmail.com wrote: What are other people doing to maintain their installations? Is there some simple way to keep all of these projects up to date? Or do people simply not update all of these projects often? I suck it up. Fortunately I was in

Re: Clojure and OOP

2010-02-11 Thread Michael Wood
On 11 February 2010 17:57, John Pall johnabcd.a...@gmail.com wrote: can we creat threads in clojure? Yes. Clojure 1.2.0-master-SNAPSHOT user= (Thread.) #Thread Thread[Thread-0,5,main] But often you would use an agent or pmap etc. instead of creating explicit threads. -- Michael Wood

Re: Simple clojure and contrib install, with SLIME ... ?

2010-02-11 Thread Phil Hagelberg
On Thu, Feb 11, 2010 at 10:59 AM, Paul Mooser taron...@gmail.com wrote: I struggle fairly often with keeping clojure/contrib/slime up to date on my machine - it seems that every time I update it, something fundamental has broken (like build.xml going away in contrib). There are a few things

Re: Reading data from a file into a struct

2010-02-11 Thread Michał Marczyk
How about (for [line (ds/read-lines file)] (apply struct location (rest (re-match #([\w ]+)\t([\w ]+)\t([\w ]+)\t line ? Or (for [line (ds/read-lines file)] (let [[_ city state zip] (re-match #... line)] ; possibly with regex from above (struct location city state zip))) Use

Re: refs, agents and add-watch

2010-02-11 Thread ataggart
As Michael said, your original code works fine for me (running 1.2.0 master). user= (do (send artisan manufacture) (println @material @products @products-store)) 4 3 2 nil user= (do (send artisan manufacture) (println @material @products @products-store)) 3 0 6 nil user= (do (send artisan

Re: Reading data from a file into a struct

2010-02-11 Thread Base
Fantastic! A million thank yous Michal! On Feb 11, 3:40 pm, Michał Marczyk michal.marc...@gmail.com wrote: How about (for [line (ds/read-lines file)]   (apply struct location     (rest (re-match #([\w ]+)\t([\w ]+)\t([\w ]+)\t line ? Or (for [line (ds/read-lines file)]   (let [[_

More contrib renaming: c.c.java is gone

2010-02-11 Thread Stuart Sierra
As part of our clojure-contrib clean-up effort: * c.c.java is gone * as-str moved to c.c.string * as-file and as-url moved to c.c.io * properties stuff moved to c.c.properties * wall-hack stuff move to c.c.reflect These changes have been committed to the master branch on Github. -SS -- You

Re: Reading data from a file into a struct

2010-02-11 Thread Michał Marczyk
On 11 February 2010 22:48, Base basselh...@gmail.com wrote: Fantastic! A million thank yous Michal! Not at all. :-) Sincerely, Michał -- 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

Re: Simple clojure and contrib install, with SLIME ... ?

2010-02-11 Thread Paul Mooser
Thanks a lot for your reply, Phil - I had no idea it was deprecated. I'll make an effort to do what you've suggested! On Feb 11, 1:29 pm, Phil Hagelberg p...@hagelb.org wrote: On Thu, Feb 11, 2010 at 10:59 AM, Paul  Mooser taron...@gmail.com wrote: I struggle fairly often with keeping

Re: Clojure/SLIME/Emacs questions

2010-02-11 Thread Jeff Kowalczyk
On Jan 1, 1:45 pm, Phil Hagelberg p...@hagelb.org wrote: You can get this to work, but as you can see it's very manual and error-prone. The basicslimeREPL is working using automated installation from ELPA. I am using the ELPA installation method, it's working well via the automatic install.

Re: refs, agents and add-watch

2010-02-11 Thread MiltondSilva
I'm using counterclockwise, clojure version 1.1.0. The exception stopped occurring I think I had to recompile the code. I structured the code this way because of the way the problem is formulated (e.g. the owner should be the only one to inc materials etc), yet, the more I look at it the more it

Re: refs, agents and add-watch

2010-02-11 Thread MiltondSilva
I now have another problem. When I run this in the repl: (add-watch products :prodkey send-products) (add-watch material :matkey ask-material) (dump material products products-store) (loop [cnt 10] (map #(send % client-act) clients) (map #(send % manufacture) artisans) (if (zero?

Re: Seattle Clojure meeting

2010-02-11 Thread Phil Hagelberg
On Fri, Feb 5, 2010 at 12:50 PM, Phil Hagelberg p...@hagelb.org wrote: Wow, I certainly was not expecting that level of response; this is great. Looks like the 11th (Thursday) is the crowd favorite. Once again, the location is http://bit.ly/c9jinW We'll be meeting in the back. Zoka is a big

Re: Simple clojure and contrib install, with SLIME ... ?

2010-02-11 Thread Brent Millare
Paul, I first struggled to find a way to do everything manually cause I didn't like someone else's self installer messing up my distributions setup. I think I've found a satisfactory hybrid approach to setup my IDE on any machine now in 4 chunked steps. 1. I rely on the distro to install emacs,

Re: small code review..

2010-02-11 Thread Timothy Pratley
On 12 February 2010 03:19, Martin Hauner martin.hau...@gmx.net wrote: I'm mostly interested if there is anything in my code one would/should never do that way. Looks excellent, you've aced it! I'd like to discuss switching... You wrote: (cond (empty? rolls) 0 (strike? rolls)(+

Re: Simple clojure and contrib install, with SLIME ... ?

2010-02-11 Thread Paul Mooser
Sadly, it looks like trying to follow the ELPA instructions to get package.el going on my emacs (carbon emacs) on the Mac doesn't actually work - I'll have to debug into it later to figure out what's actually going on, but unfortunately, for now, it's another dead end. On Feb 11, 1:59 pm, Paul

Re: refs, agents and add-watch

2010-02-11 Thread Timothy Pratley
On 12 February 2010 10:22, MiltondSilva shadowtr...@gmail.com wrote: (add-watch products :prodkey send-products) (add-watch material :matkey ask-material) (dump material products products-store)  (loop [cnt 10]    (map #(send % client-act) clients)    (map #(send % manufacture) artisans)    

Re: refs, agents and add-watch

2010-02-11 Thread ataggart
(e.g. the owner should be the only one to inc materials etc) What's so special about the inc function as opposed to any other function? Also, ask-materials and send-products should be call immediately after a certain threshold. ask-materials  != dec, one decrements the other increments and

Re: refs, agents and add-watch

2010-02-11 Thread ataggart
On Feb 11, 4:22 pm, MiltondSilva shadowtr...@gmail.com wrote: I now have another problem. When I run this in the repl: (add-watch products :prodkey send-products) (add-watch material :matkey ask-material) (dump material products products-store)   (loop [cnt 10]     (map #(send %

Re: small code review..

2010-02-11 Thread ataggart
On Feb 11, 4:34 pm, Timothy Pratley timothyprat...@gmail.com wrote: On 12 February 2010 03:19, Martin Hauner martin.hau...@gmx.net wrote: I'm mostly interested if there is anything in my code one would/should never do that way. Looks excellent, you've aced it! I'd like to discuss

Re: Clojure/SLIME/Emacs questions

2010-02-11 Thread Phil Hagelberg
On Thu, Feb 11, 2010 at 1:20 PM, Jeff Kowalczyk jeff.kowalc...@gmail.com wrote: The installed packages: clojure-mode-1.6 slime-20091016 slime-repl-20091016 swank-clojure-1.1.0 include snapshots of slime and slime/contrib/slime-repl.el. Will these be merged with upstream slime soon? I

Re: Simple clojure and contrib install, with SLIME ... ?

2010-02-11 Thread Brent Millare
Michael, I'm not sure of the full feature list of leiningen but since it maintains a local repo, there might be a way (or if not, it should be added) to install locally built libs and clojure versions (projects normally without project.clj files). Perhaps there is a way to add that information