Re: Threadring Benchmark

2009-06-05 Thread Sean Devlin
This problem came up on the mailing list recently: http://groups.google.com/group/clojure/browse_thread/thread/5e0c078d0ad8b8bc# You might want to compare your code to what was done here, but at a glance the implementations are similar. You provide relative speed comparisons (Such and such is %

Threadring Benchmark

2009-06-05 Thread Parth Malwankar
Hello, In order to understand the agent model of Clojure better I wrote the alioth shootout threadring benchmark [1]. I ran some tests to compare it with the Java and Scala implementation [2, 3] which I picked from the published benchmarks. The clojure code can be found here: http://gist.github.

Re: CA without mail (was: Contributing tests)

2009-06-05 Thread Ray Baquirin
or use a digital signature service such as the one reported here: http://www.techcrunch.com/2009/05/29/make-your-mark-rightsignature-lets-you-sign-documents-online-or-on-your-iphone/ servus, Ray On Jun 6, 12:16 am, Phil Hagelberg wrote: > Frantisek Sodomka writes: > > As a general rule to con

Re: performance concerns (again)

2009-06-05 Thread kyle smith
> I am dealing w/ some performance constraints in the current > implementation of my application. More information, please. What in general is your app? What are the specs of your machine? What kind of data does your app deal with? > So, although Clojure offers some > features that would solv

Re: Question for Clojure-Mode users.

2009-06-05 Thread Phil Hagelberg
"Stephen C. Gilardi" writes: > I've attached a patch to allow namespace qualification. I wonder if we > should treat the "def" prefix in every namespace like we treat "with-" > after this patch. (Right now it's only allowing an optional namespace > of "clojure".) I'll be happy to provide a patch

Re: performance concerns (again)

2009-06-05 Thread Boris Mizhen - 迷阵
Try also visualvm (comes with jdk 1.6 ) https://visualvm.dev.java.net/ Boris On Fri, Jun 5, 2009 at 5:22 PM, Jonah Benton wrote: > > Hi Robert, > > I haven't been able to dig into Clojure/JVM/GC details, so I can't > speak in particular about problems e.g. with the ants application, but > there

Re: performance concerns (again)

2009-06-05 Thread Jonah Benton
Hi Robert, I haven't been able to dig into Clojure/JVM/GC details, so I can't speak in particular about problems e.g. with the ants application, but there are few useful conclusions that one can draw from a JVM's RSS and VIRT. It's unfortunate, but in general, Java app memory behavior can't be re

Re: New library 'redis-clojure': Feedback and questions

2009-06-05 Thread kyle smith
I just took a quick look, but string-to-seq can be defined as (re-seq #"\S+" string), and similarly for string-to-map. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email

Re: Question for Clojure-Mode users.

2009-06-05 Thread Stephen C. Gilardi
On Jun 5, 2009, at 5:18 PM, Phil Hagelberg wrote: My implementation only works when the with- form is referred in the current namespace, but you could fix that with a little more regex tweakage. Thanks, it's working great. I've attached a patch to allow namespace qualification. I wonder if w

Re: New library 'redis-clojure': Feedback and questions

2009-06-05 Thread J. McConnell
On Fri, Jun 5, 2009 at 2:09 PM, Ragnar Dahlén wrote: > > This turned out to be problematic since a couple of the commands have > the same names as some clojure.core functions, most notably get and > set. > > I solved this by checking if *ns* already contained a mapping for the > name, and if so,

Re: Question for Clojure-Mode users.

2009-06-05 Thread CuppoJava
Thank you very much Phil. That fix worked perfectly. -Patrick --~--~-~--~~~---~--~~ 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 me

Re: Question for Clojure-Mode users.

2009-06-05 Thread Chris Dean
Does anyone know what the functional difference is between clojure-indent-function and common-lisp-indent-function ? Or even the cl-indent:function from slime ? I assume there is a difference, I just don't know what it is. Cheers, Chris Dean --~--~-~--~~~---~--~---

Re: Question for Clojure-Mode users.

2009-06-05 Thread Phil Hagelberg
"Stephen C. Gilardi" writes: > (my-cool-database-operation the-database > (arg-exp-1 with operands) > literal-arg > angstroms) > > There doesn't seem to be an easy way to distinguish these two types of > initial operands (or the N-2 other types I've missed). "with-*" would > probably seldo

Why is this using reflection?

2009-06-05 Thread tsuraan
I have a function to get the path out of a lucene searcher (documentation at http://lucene.apache.org/java/2_3_2/api/core/org/apache/lucene/search/IndexSearcher.html). The searcher has a Reader, which has a Directory. The Directory is abstract, but in my case I know that it's a FSDirectory, so I

Re: Question for Clojure-Mode users.

2009-06-05 Thread Phil Hagelberg
"Stephen C. Gilardi" writes: > While I often like lining up all the arguments generally, it is the > one thing that I "fix" manually from time to time when the loss of > horizontal real estate becomes too great to tolerate. > > One possible improvement would be to change clojure-mode so that > "

Re: Question for Clojure-Mode users.

2009-06-05 Thread Stephen C. Gilardi
On Jun 5, 2009, at 4:35 PM, Stephen C. Gilardi wrote: What are the downsides to always indenting list contents that start on a new line as indented 2 (possibly optionally 1) from their opening paren? Playing with this some, I see that when all the arguments to the function are equal in s

Re: Question for Clojure-Mode users.

2009-06-05 Thread CuppoJava
Honestly, I really don't like indenting to align with the first argument. The only case where that seems sensible is for functions where the arguments have equal importance/characteristics. eg. (bit-and GL_DEPTH_BUFFER_BIT GL_COLOR_BUFFER_BIT) But this situation rarely comes about in m

Re: A few ideas

2009-06-05 Thread Howard Lewis Ship
It would be nice if (doc) adapted to the type of thing (function, etc.) that is being displayed, that nil (where parameters would normally show) is ugly. Very low priority, of course. On Thu, Jun 4, 2009 at 8:26 PM, Chouser wrote: > > On Thu, Jun 4, 2009 at 8:31 PM, Howard Lewis Ship wrote: >> >

Re: Question for Clojure-Mode users.

2009-06-05 Thread Stephen C. Gilardi
On Jun 5, 2009, at 3:52 PM, Phil Hagelberg wrote: You may be able to customize the indentation to behave differently, but that's going to be even worse than using define-clojure-indent with regard to consistency when other people contribute to your project. Any time you stray from the stan

Re: Question for Clojure-Mode users.

2009-06-05 Thread Phil Hagelberg
CuppoJava writes: > Is there anyway to turn off the feature completely? I don't mind at > all if my arguments are not aligned with the first one, and I don't > want to maintain a elisp file along with my clojure source. Turn off what feature? You can rebind TAB to another function if you want t

Re: Question for Clojure-Mode users.

2009-06-05 Thread CuppoJava
Thanks Phil for your help. Heh, I'm still not used to seeing my words separated with dashes. I'll switch over eventually. =) Is there anyway to turn off the feature completely? I don't mind at all if my arguments are not aligned with the first one, and I don't want to maintain a elisp file along

Re: Question for Clojure-Mode users.

2009-06-05 Thread Phil Hagelberg
CuppoJava writes: > Hi fellow emacs users! > I'm using Jeffrey Chu's Clojure-mode right now, and I'm wondering how > I can turn off the "align with first argument" feature. > > A lot of my code currently looks like this: > (with_draw_mode :raycast > (with_blending >

Re: Help with Math Question

2009-06-05 Thread CuppoJava
Thanks everybody for their help! I solved the problem (almost) but only for my specific f(x,y), which is enough for me for now. Paul Mooser's hint about accumulating state was the key I needed. By introducing another accumulator I got my color compositing to blend correctly from front to back. T

New library 'redis-clojure': Feedback and questions

2009-06-05 Thread Ragnar Dahlén
Hello everyone, I have spent a few days implementing a client library for Redis (http://code.google.com/p/redis/), a key value storage system, that is slightly more than 'just' a key value storage system. My Lisp experience before Clojure is basically limited to a couple of hundred lines of ELIS

Question for Clojure-Mode users.

2009-06-05 Thread CuppoJava
Hi fellow emacs users! I'm using Jeffrey Chu's Clojure-mode right now, and I'm wondering how I can turn off the "align with first argument" feature. A lot of my code currently looks like this: (with_draw_mode :raycast (with_blending (with_palette_shader

Re: performance concerns (again)

2009-06-05 Thread Chris Dean
> Simply stated, given that it stated clearly in this group that Clojure > runs, on average, slower than the JVM, is the JVM's high memory- > utilization a non-issue for the Clojure community as well? For my part, I'm relatively happy with the jvm's performance. I agree that the memory is usa

Re: Contributing tests

2009-06-05 Thread Richard Newman
> As a general rule to contribute, you need to fill-in and mail the CA: > http://clojure.org/contributing It's in the mail today. > Files in test_clojure represent different areas - feel free to take > your pick and do whatever you like :-) Great! Looking forward to getting started. --~--~

Re: performance concerns (again)

2009-06-05 Thread Richard Newman
Hi Robert, Thanks for a thoughtful email! > Simply stated, given that it stated clearly in this group that Clojure > runs, on average, slower than the JVM, is the JVM's high memory- > utilization a non-issue for the Clojure community as well? In short: yes. I'm only bothered by the JVM's memor

performance concerns (again)

2009-06-05 Thread Robert Lehr
First, Clojure has renewed my interest in Java, specifically the JVM and the plethora of available libraries. Clojure and Scala are the kind of projects that inspire peoples' imaginations in a world that they might otherwise overlook. Thank you, Rich Hickey. However, I have some concerns that f

Re: Silly question from Programming Clojure

2009-06-05 Thread Jim Weirich
On Jun 5, 2009, at 11:40 AM, Laurent PETIT wrote: > * OOSC: Object Oriented Software Construction ( general about object > orientation, see http://archive.eiffel.com/doc/oosc/page.html ) Good book, although weak on the dynamic language side of things. > * SICP: Structure and Interpretation of

Re: Silly question from Programming Clojure

2009-06-05 Thread Paul Stadig
Concepts of Programming Languages by Sebesta is a book that we used that as the text for my comparative programming languages class. I haven't read CTMCP, so I cannot compare. However, after taking that class during my undergraduate, I couldn't believe that it was an elective! There should definite

Re: Optimizing cross-product mappings

2009-06-05 Thread Sean Devlin
Sounds like a candidate for the daily WTF... On Jun 5, 12:54 pm, Daniel Jomphe wrote: > You guessed mostly right, Daniel :) This guy hashed some fields of his > client's database, replacing the original content with its hashed > version. I don't know everything, but he at least obfuscated the >

Re: Optimizing cross-product mappings

2009-06-05 Thread Daniel Jomphe
You guessed mostly right, Daniel :) This guy hashed some fields of his client's database, replacing the original content with its hashed version. I don't know everything, but he at least obfuscated the addresses. He (and the client who asked to "encrypt with MD5") thought he was actually encryptin

Re: Optimizing cross-product mappings

2009-06-05 Thread Daniel Lyons
Daniel, I guess I have to ask... why do you need to do this in the first place? :) Zip codes are already unique. Are you searching through data where someone else MD5'd some zip codes to obfuscate them? Just curious. — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--~

CA without mail (was: Contributing tests)

2009-06-05 Thread Phil Hagelberg
Frantisek Sodomka writes: > As a general rule to contribute, you need to fill-in and mail the CA: > http://clojure.org/contributing > > When Rich receives your CA and updates the clojure.org website, you > can start creating issues in clojure-contrib and attaching patches to > it. Example: > htt

Re: Optimizing cross-product mappings

2009-06-05 Thread Daniel Jomphe
Stuart, I took a second look at your suggestion. I integrated it directly in my code, which became much more elegant as a direct consequence. :) And it's a tiny, tiny little bit faster too. :) (defn all-zips [] "Returns a lazy list of all possible American zipcodes." (let [zips5 (zip-format

Re: swing-utils: another set of helpers

2009-06-05 Thread Stephen C. Gilardi
On Jun 4, 2009, at 4:37 PM, Meikel Brandmeyer wrote: These are certainly valid thoughts. I'm not a Swing guru coming from a non-Java background. Maybe your last version is the best, though I'm not sure about the queueing stuff... Checked in: http://code.google.com/p/clojure-contrib/s

Re: Optimizing cross-product mappings

2009-06-05 Thread Daniel Jomphe
Thanks for your replies. Sean: Type-hinting the String didn't help. And for some reason, defn'd function is 1.5x slower than my anonymous one. Daniel: Thanks for the info. Once my algorithms are fine (if they can get finer), I'll definitely narrow down the zips5 seed, and use your suggested MD5 d

Re: Wish: (-> x) should be legal

2009-06-05 Thread Max Suica
Oh! Sweet : ) On Jun 4, 6:29 pm, "Stephen C. Gilardi" wrote: > On Jun 4, 2009, at 5:56 PM, Max Suica wrote: > > > But > > (-> x identity) => (identity x) => x, so what our friend ozzi suggest > > sounds pretty on the level. > > If (identity x) is not equivalent to evaluating x, then, well, that'

Re: Error not bubbling up from clojure.contrib.sql insert-values function?

2009-06-05 Thread BrianS
Stephen, Sorry I removed the question as you were answering, as we determined our problem was exactly what you described, our own cause, rather than anything to do with clojure.contrib. Still, thanks for the prompt reply, much appreciated, as is your library, which is being put to good use wit

Re: Silly question from Programming Clojure

2009-06-05 Thread Laurent PETIT
Yes, It's rare to see books about programming concepts/models and not programming languages. As far as I know the following 3 ones deserve being mentioned : * OOSC: Object Oriented Software Construction ( general about object orientation, see http://archive.eiffel.com/doc/oosc/page.html ) * S

Re: Optimizing cross-product mappings

2009-06-05 Thread Sean Devlin
On Jun 5, 11:14 am, Daniel Lyons wrote: > On Jun 5, 2009, at 8:56 AM, Daniel Jomphe wrote: > > > I need to generate a list of all possible American zipcodes, MD5- > > digested. Later on, I will need to do much more involving stuff, > > processor-wize, with this. But already, generating a naive

Re: Optimizing cross-product mappings

2009-06-05 Thread Stuart Sierra
On Jun 5, 10:56 am, Daniel Jomphe wrote: > I need to generate a list of all possible American zipcodes, MD5- > digested. Later on, I will need to do much more involving stuff, I'm not sure if this is exactly what you want, but maybe this will help: (defn all-zipcodes [] (for [x (range 1 9

Re: Optimizing cross-product mappings

2009-06-05 Thread Daniel Lyons
On Jun 5, 2009, at 8:56 AM, Daniel Jomphe wrote: > I need to generate a list of all possible American zipcodes, MD5- > digested. Later on, I will need to do much more involving stuff, > processor-wize, with this. But already, generating a naive list of all > possible zipcodes is taking quite a d

Re: Optimizing cross-product mappings

2009-06-05 Thread Sean Devlin
Try adding type hints. Assuming all-zips returns a list of strings: (defn all-zips-MD5 [] "Returns a lazy list of all possible American zipcodes, as MD5 digests." (let [digester (java.security.MessageDigest/getInstance "MD5")] (map (fn [#^java.util.String to-digest] (.update

Re: Silly question from Programming Clojure

2009-06-05 Thread Daniel Jomphe
I support the CTMCP recommendation. I learned a lot from its first few hundred pages. (Kept the rest for later.) On Jun 5, 2:45 am, Laurent PETIT wrote: > I just got my own copy of the CTM book (Concepts, Techniques and > Models of computer programming) (http://www.info.ucl.ac.be/~pvr/book.html)

Re: Are agents transaction'y in dosync?

2009-06-05 Thread mifrai
Great! Thanks for your reply, it turned out I had a bug somewhere in my code and I was bleeding send-offs. On Jun 5, 12:06 am, Tassilo Horn wrote: > mifrai writes: > > Hi! > > > I noticed that there's a send-off in the dosync clause of ants.clj > > > Does send-off hold off enqueue'ing the actio

Optimizing cross-product mappings

2009-06-05 Thread Daniel Jomphe
I need to generate a list of all possible American zipcodes, MD5- digested. Later on, I will need to do much more involving stuff, processor-wize, with this. But already, generating a naive list of all possible zipcodes is taking quite a deal of time: user> (time (dorun (take 100 (all-zips)))

Re: Where is group by?

2009-06-05 Thread Sean Devlin
For those of you that may have the same problem in the future, check the index: http://code.google.com/p/clojure-contrib/wiki/ApiDocIndex Great work. On Jun 5, 10:25 am, Sean Devlin wrote: > Okay, found it. > > clojure.contrib.seq-utils > > On Jun 5, 10:15 am, Sean Devlin wrote: > > > Okay, I

Re: Where is group by?

2009-06-05 Thread Sean Devlin
Okay, found it. clojure.contrib.seq-utils On Jun 5, 10:15 am, Sean Devlin wrote: > Okay, I may be going nuts here.  I can seem to find the group by > function anymore.  Where is it? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Where is group by?

2009-06-05 Thread Sean Devlin
Okay, I may be going nuts here. I can seem to find the group by function anymore. Where is it? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroup

Re: regression

2009-06-05 Thread kyle smith
I have generalized the code to allow more than one independent variable. The calling convention has changed: instead of separate x and y seqs, there is one "xylist". Each element of xylist is a tuple containing the dependent variable *first*, and then any independent variables. I haven't had ti

Re: Error not bubbling up from clojure.contrib.sql insert-values function?

2009-06-05 Thread Stephen C. Gilardi
On Jun 5, 2009, at 9:16 AM, BrianS wrote: It sounds like you're running the code in an environment where *err* is bound to an OutputStreamWriter. The default binding is to a PrintWriter which does provide println. I see that the API page describes *err* as a Writer whose default bind

Error not bubbling up from clojure.contrib.sql insert-values function?

2009-06-05 Thread BrianS
We are seeing a strange problem with the insert-values function in clojure.contrib.sql. Basically, we passed in a single record for insert that in fact violated a foreign key constraint in the database (we were adding an accountid that was not in the accounts table). Usually when using clojure.con

Re: defnk addition to c.c.def

2009-06-05 Thread Sean Devlin
I'm writing a numerical methods library, and I already found a use for you macro. Here's the old way: (defn solve [f & params] (let [param-map (merge {:start 1 :target 0 :diff-method :forward :iter-method :new

Re: Contributing tests

2009-06-05 Thread Frantisek Sodomka
Hello Richard, any contributions to test_clojure are very welcome! As a general rule to contribute, you need to fill-in and mail the CA: http://clojure.org/contributing When Rich receives your CA and updates the clojure.org website, you can start creating issues in clojure-contrib and attaching

Re: Laziness vs. Program Flow: what can be done?

2009-06-05 Thread Konrad Hinsen
On 05.06.2009, at 02:48, Howard Lewis Ship wrote: > Again, I'm not sure what the solution is or what the implementation > would look like, but I'd love it if Clojure could relate back to me, > when an exception occurred, what lazy operations were taking place > that caused the bad code to be invo

Re: Are agents transaction'y in dosync?

2009-06-05 Thread Tassilo Horn
mifrai writes: Hi! > I noticed that there's a send-off in the dosync clause of ants.clj > > Does send-off hold off enqueue'ing the action when a dosync fails/ > repeats or do the actions keep getting added? send and send-off actions will only be enqueued if the transactions succeeds. Bye, Tas