Re: java/Clojure MPI ..

2010-12-31 Thread Sunil S Nandihalli
Here is quick summary of results I obtained by googling. There are bunch of libraries out there ... among them are 1. mpiJava a java wrapper for the corresponding c libraries but seems dated... 2. MPJExpress .. seems to be under more active development. But yet to find any parallel linear

Re: java/Clojure MPI ..

2010-12-31 Thread Tim Daly
On 12/31/2010 3:36 AM, Sunil S Nandihalli wrote: Here is quick summary of results I obtained by googling. There are bunch of libraries out there ... among them are 1. mpiJava a java wrapper for the corresponding c libraries but seems dated... 2. MPJExpress .. seems to be under more active

Re: java/Clojure MPI ..

2010-12-31 Thread Konrad Hinsen
On 31 Dec 2010, at 09:36, Sunil S Nandihalli wrote: Here is quick summary of results I obtained by googling. There are bunch of libraries out there ... among them are 1. mpiJava a java wrapper for the corresponding c libraries but seems dated... 2. MPJExpress .. seems to be under more

Re: java/Clojure MPI ..

2010-12-31 Thread Sunil S Nandihalli
Hi Konrad, Have you looked at http://nativelibs4java.sourceforge.net/ It is created using a java native interface generater called jnaerator .. it does not seem to have any linear algebra library .. but may be a start .. I am only introduced to java from clojure .. Sunil.

Re: Do type hints cause auto casting?

2010-12-31 Thread Laurent PETIT
2010/12/31 Jarl Haggerty fictivela...@gmail.com I think I asked the wrong question, not only that but I guess I answered the question I asked, what I want to know is what exactly is a type hint. I think I've failed to understand exactly what a type hint is, I assumed to give a hint was to

Re: java/Clojure MPI ..

2010-12-31 Thread Konrad Hinsen
On 31 Dec 2010, at 10:56, Sunil S Nandihalli wrote: Have you looked at http://nativelibs4java.sourceforge.net/ I have seen it, but not looked any closer. It is created using a java native interface generater called jnaerator .. it does not seem to have any linear algebra library .. but

Re: Time/size bounded cache?

2010-12-31 Thread Peter Schuller
The problem is that seen will grow without bounds. Is there a built in way to have some sort of LRU cache or should I use external libraries (like plru)? I wrote a persistent LRU cache: https://github.com/scode/plru It's not going to be as memory efficient as a LInkedArrayList, but if it

using aset in clojure-1.3-alpha4

2010-12-31 Thread Sunil S Nandihalli
Hello Everybody, why does this give an error in clojure-1.3-alpha4 (aset (make-array Integer/TYPE 3 4 5) 1 2 3 -1) can anybody tell me as to how to do this right? Thanks, Sunil. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group,

A Web Server in Clojure

2010-12-31 Thread limux
I have read Fast Track Clojure's serials tutorial. lession 5 is about a web server. Below is part of demo code: (use 'clojure.contrib.server-socket) (create-server 8080 (fn [in out] (binding [*out* (java.io.PrintWriter. out)] (println HTTP/1.0 200 OK) (println

A Web Server in Clojure

2010-12-31 Thread limux
I have read Fast Track Clojure's serials tutorial. lession 5 is about a web server. Below is part of demo code: (use 'clojure.contrib.server-socket) (create-server 8080 (fn [in out] (binding [*out* (java.io.PrintWriter. out)] (println HTTP/1.0 200 OK) (println

Re: Do type hints cause auto casting?

2010-12-31 Thread nickik
The hints are not use for static type analysis they are there for speed. There is no type checker. In your example the compiler tries using it as an int if that is not working the compiler uses reflaction to find out the type. no auto casts are by design. On 31 Dez., 05:57, Jarl Haggerty

A Web Server in Clojure

2010-12-31 Thread limux
I have read Fast Track Clojure's serials tutorial. lession 5 is about a web server. Below is part of demo code: (use 'clojure.contrib.server-socket) (create-server 8080 (fn [in out] (binding [*out* (java.io.PrintWriter. out)] (println HTTP/1.0 200 OK) (println

Re: A Web Server in Clojure

2010-12-31 Thread limux
Sorry for my net speed is too slow result in duplicate post. -- 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: using aset in clojure-1.3-alpha4

2010-12-31 Thread Allen Johnson
This worked for me on 1.3.0: (aset-int (make-array Integer/TYPE 3 4 5) 1 2 3 -1) Might have something to do with the enhanced primitive support which causes array handling to be stricter than it was in 1.2? Just a guess. Allen On Fri, Dec 31, 2010 at 8:53 AM, Sunil S Nandihalli

Re: Clojure in Small Pieces -- Literate Clojure

2010-12-31 Thread Robert McIntyre
This looks very cool, and the opportunities for fully exploiting the power of a cross-referenced book format are very appealing Might I suggest two possible improvements: 1) Colored syntax highlighting for all clojure code. 2) Cross references for every clojure symbol used in the code --- I'd

Re: Chunking is making my life more difficult.

2010-12-31 Thread ehanneken
On Dec 31, 12:48 am, Ken Wesson kwess...@gmail.com wrote: Is mapcat also semi-eager, then? I guess so. The Clojure 1.1 release notes also say, Some of the sequence processing functions (like map and filter) are now chunk-aware and leverage this efficiency. I should have mentioned that. --

Re: an object of class created using defrecord does not implement IFn .. while it behaves very similar to map otherwise ..

2010-12-31 Thread Alyssa Kwan
Generating readable code for IDEs is not a good reason. You should think carefully about variable capture and decide which you want. Usually, in a macro-generated defn, I do want to capture the parameters, so I would use ~'this. On Dec 30, 11:54 pm, André Thieme splendidl...@googlemail.com wrote:

Re: Time/size bounded cache?

2010-12-31 Thread Miki
I wrote a persistent LRU cache: https://github.com/scode/plru Yup, I've looked at it (mentioned in the original post). I might end up using it, thanks. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: A Web Server in Clojure

2010-12-31 Thread Miki
Both of these examples work for me (clojure 1.2). Is there an error on the console when you access the site? Also, if this is not a learning exercise, I recommend having a look at Compojure for web development. HTH, -- Miki -- You received this message because you are subscribed to the

Re: an object of class created using defrecord does not implement IFn .. while it behaves very similar to map otherwise ..

2010-12-31 Thread Robert McIntyre
Be sure to also implement the version of get which takes a not-found argument so that your objects will work with map code which uses this functionality. (defrecord map-like-object [field-1 field-2 etc] clojure.lang.IFn (invoke [this k] (get this k)) (invoke [this k not-found] (get this k

Re: using aset in clojure-1.3-alpha4

2010-12-31 Thread Sunil S Nandihalli
Hi Allen .. is 1.3.0 out? and I did not know that aset had so many variants.. glad I asked .. now I know .. :) thanks Allen. Sunil. On Fri, Dec 31, 2010 at 8:19 PM, Allen Johnson akjohnso...@gmail.comwrote: This worked for me on 1.3.0: (aset-int (make-array Integer/TYPE 3 4 5) 1 2 3 -1)

Re: clojure can't see a method in my protocol

2010-12-31 Thread Stuart Halloway
Ken, Classloader visibility (http://dev.clojure.org/jira/browse/CLJ-371) is one possible point of confusion. If you have an AOT-compiled class, you can't replace it from the REPL which works from a child classloader. This is correct from a Java perspective, and easy enough to deal with one you

Re: using aset in clojure-1.3-alpha4

2010-12-31 Thread Allen Johnson
Sorry I should have written 1.3.0-master-SNAPSHOT or whatever the convention is that represents the latest master build :) On Fri, Dec 31, 2010 at 11:21 AM, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Hi Allen ..  is 1.3.0 out? and I did not know that aset had so many variants.. glad

Re: using aset in clojure-1.3-alpha4

2010-12-31 Thread Miki
(aset (make-array Integer/TYPE 3 4 5) 1 2 3 -1) can anybody tell me as to how to do this right? (aset (make-array Long/TYPE 3 4 5) 1 2 3 -1) I *think* that number by default are long, and the array is of ints. HTH, -- Miki http://clojurewise.blogspot.com/ -- You received this message

Re: Chunking is making my life more difficult.

2010-12-31 Thread Steven E. Harris
ehanneken ehanne...@pobox.com writes: I spent a long time debugging some Clojure code yesterday. The essence of it looked similar to this: (defn items [] (mapcat expensive-function (range 0 4000 100))) . . . (take 5 (items)) . . . I tried to distill the problem down by defining a

Re: Do type hints cause auto casting?

2010-12-31 Thread Stuart Sierra
In Clojure 1.2, type hints only help the compiler avoid reflection and thus generate faster Java interop code. Starting in 1.3, function arguments and return values can have ^long or ^double type hints (int and float are not supported). These are enforced at compile time, but they are not

Re: using aset in clojure-1.3-alpha4

2010-12-31 Thread Stuart Sierra
Yes, integer literals are longs by default in 1.3. As noted, this works: (aset-int (make-array Integer/TYPE 3 4 5) 1 2 3 -1) My intuition says this should work as well, but it doesn't: (aset ^ints (make-array Integer/TYPE 3 4 5) 1 2 3 (int -1)) IllegalArgumentException argument

Re: Chunking is making my life more difficult.

2010-12-31 Thread ehanneken
Chas, Thanks for your help. However, modifying the code to use mapcat instead of (map println) seems to cause some chunking: (defn tenify [n] (do (println \ n \) [n n n n n n n n n n])) = (- (range 50) (mapcat list) (mapcat tenify) first) 0 1 2 3 0 And indeed,

Re: Clojure in Small Pieces -- Literate Clojure

2010-12-31 Thread Tim Daly
On 12/31/2010 10:36 AM, Robert McIntyre wrote: This looks very cool, and the opportunities for fully exploiting the power of a cross-referenced book format are very appealing Might I suggest two possible improvements: 1) Colored syntax highlighting for all clojure code. 2) Cross references

chunked-seq? is lying?

2010-12-31 Thread Mike K
In 1.2, I don't understand why one of the sequences below is chunked, but the other is not. Also, chunked-seq? seems to be lying about the second one. user (take 1 (map #(do (print .) [% %2]) (range 100) (range 100))) (.[0 0]) user (take 1 (map #(do (print .) [%]) (range 100)))

Vars problem

2010-12-31 Thread xlarsx
Good day Before anything I'd like to thank you for your time I've the following problem: user= (def x 1) #'user/x user= (def y 1) #'user/y user= (+ x y) 2 user= (binding [x 2 y 3] (+ x y)) IllegalStateException Can't dynamically bind non-dynamic var: user/x clojure.lang.Var.pushThreadBindings

Re: chunked-seq? is lying?

2010-12-31 Thread Meikel Brandmeyer
Hi, Am 31.12.2010 um 19:57 schrieb Mike K: In 1.2, I don't understand why one of the sequences below is chunked, but the other is not. Also, chunked-seq? seems to be lying about the second one. user (take 1 (map #(do (print .) [% %2]) (range 100) (range 100))) (.[0 0]) user (take 1 (map

Re: Vars problem

2010-12-31 Thread Meikel Brandmeyer
Hi, Am 31.12.2010 um 20:12 schrieb xlarsx: Good day Before anything I'd like to thank you for your time I've the following problem: user= (def x 1) #'user/x user= (def y 1) #'user/y user= (+ x y) 2 user= (binding [x 2 y 3] (+ x y)) IllegalStateException Can't dynamically bind

Re: Vars problem

2010-12-31 Thread Sean Corfield
On Fri, Dec 31, 2010 at 11:12 AM, xlarsx xla...@gmail.com wrote: user= (binding [x 2 y 3] (+ x y)) IllegalStateException Can't dynamically bind non-dynamic var: user/x clojure.lang.Var.pushThreadBindings (Var.java:339) The origin of this code is: http://clojure.org/vars The docs refer to

Re: chunked-seq? is lying?

2010-12-31 Thread Mike K
OK, I understand the difference in behavior between the two maps. But why is chunked-seq? incorrect? user (take 1 (map #(do (print .) [%]) (range 100))) ([0]) user (chunked-seq? (range 100)) false user (chunked-seq? (map #(do (print .) [%]) (range 100))) false

Re: Loading JNI

2010-12-31 Thread dysinger
Msd, something like this java -Djava.library.path=/usr/local/lib -cp clojure-1.2.0.jar:src clojure.main or in lein add :native-path /usr/local/lib:/usr/lib to your project def then you should be able to make the JNI/JNA calls On Dec 31, 12:39 pm, ax2groin ax2gr...@gmail.com wrote: I'm

Re: A Web Server in Clojure

2010-12-31 Thread limux
There is no any error when I access http://127.0.0.1:8080 by browser. While with wget, there will be some messages as below: --2011-01-01 09:22:49-- (try:20) http://127.0.0.1:8080/ Connecting to 127.0.0.1:8080... connected. HTTP request sent, awaiting response... 200 No headers, assuming HTTP/

Re: chunked-seq? is lying?

2010-12-31 Thread Chas Emerick
On Dec 31, 2010, at 5:53 PM, Mike K wrote: OK, I understand the difference in behavior between the two maps. But why is chunked-seq? incorrect? Also, Chas Emerick stated in another discussion that ranges always produce chunked seqs, but the value of (chunked-seq? (range 100)) seems to