Re: Code arrangement for understandability

2009-12-10 Thread David Brown
On Thu, Dec 10, 2009 at 09:13:33AM -0800, samppi wrote: >notation before, and it is fine. For my tastes, however, I think that >it repeats the symbol (in this case, 'x) too much. Sometimes it may be >the best way, but usually I would instead use ->, ->>, and/or letfn. The problem I have using ->

Re: Renaming 1.1.0-alpha-SNAPSHOT is causing problems with projects on Clojars

2009-12-10 Thread Phil Hagelberg
liebke writes: > I like the new naming scheme, but would it be possible to add 1.1.0- > alpha-SNAPSHOT back to the repository (in addition to the new names), > so that builds dependent on projects in Clojars will be able to > download their dependencies correctly again, at least until everybody >

Re: Slides that accompany the Rich's QCon talk

2009-12-10 Thread Krukow
On Dec 11, 12:21 am, Dragan Djuric wrote: > HI, > > I have just watched Rich's QCon talk and in some parts he is referring > to the slides that are not displayed in the video. Of, course, the > talk is perfectly fine without that, but I need to understand some > specific tricky details, and I beli

Re: dumb noob ceremony question

2009-12-10 Thread Richard Newman
> (clojure.set/union #{1} #{2}) > > what'd I do wrong, please & thanks? Nothing wrong! Try this: (use 'clojure.set) -- 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 n

dumb noob ceremony question

2009-12-10 Thread rebcabin
I'd like to say (union #{1} #{2}) but I'm forced to say (clojure.set/union #{1} #{2}) what'd I do wrong, please & 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

Re: Main class not found when starting clojure: java -cp clojure.jar clojure.lang.Repl

2009-12-10 Thread Stephen C. Gilardi
On Dec 9, 2009, at 3:54 PM, HerbM wrote: > As I was preparing the post a message requesting help for > an error (see below) generated when I entered the quick start > suggest, I realized that suggestion is generic, and not technically > accurate. > >java -cp clojure.jar clojure.lang.Repl >

Re: how 'bout a debug-repl?

2009-12-10 Thread George Jahad
It's definitely on my todo list. But probably like yours, that list ain't short. On Dec 10, 12:56 pm, kyle smith wrote: > Yes, I just figured that out.  Is there a way to use this with slime? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post

Re: Code arrangement for understandability

2009-12-10 Thread Richard Newman
> The spy macro from c.c.logging does that. ;) I knew it was there somewhere; I just couldn't remember where, or what it was called! :) -- 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 N

Re: Code arrangement for understandability

2009-12-10 Thread ataggart
On Dec 10, 11:02 am, Richard Newman wrote: > > They're especially useful for inserting println calls for seeing the > > value of something when I'm debugging; in fact, this is the primary > > way I do debugging. > > (defn tee (x) >    (println "Debug: " (prn-str x)) >    x) > > (let [x (tee (foo

Re: update-in and get-in why no default?

2009-12-10 Thread ataggart
Seconded; I like the intention of both changes, and do something similar in a lot of my code (e.g., parsing functions that take an extra arg if the parse is unsuccessful). Also, testing the type of update-in2's second arg is a bad idea, imo. As for the breaking change of adding another arg to upd

Re: Pull request for clojure.contrib.sql?

2009-12-10 Thread Stephen C. Gilardi
On Dec 10, 2009, at 7:18 PM, Graham Fawcett wrote: > Thank you! I'm already a registered Clojure contributor. Tomorrow I'll > prepare a ticket and attach the patch. Excellent! > If you'd rather discuss it first on or off-list, let me know & I'll > hold off on the ticket. Please do put in a tic

Re: Expanding the unit tests for clojure

2009-12-10 Thread devender
Thanks for updating my clojure-dev membership On Dec 10, 1:33 pm, devender wrote: > Hi, I am interested in expanding the unit test coverage for clojure, I > have signed and mailed in the Agreement and my name now appears on the > clojure contributer page. Could someone PLEASE take my patches and

Re: Refs scalability

2009-12-10 Thread Phil Hagelberg
Dragan Djuric writes: > Is it a good idea, from the performance standpoint, to use many refs > in the program? By many, I mean thousands or even millions? The question isn't how many refs you should instantiate, it's how many refs you should read or write to at once in a transaction as well as h

Re: Pull request for clojure.contrib.sql?

2009-12-10 Thread Graham Fawcett
Hi Steve, On Thu, Dec 10, 2009 at 4:53 PM, Stephen C. Gilardi wrote: > Hi Graham, > >> To whom should I send a pull-request for an enhancement for >> clojure.contrib.sql? I see that scgilardi is listed as the author, but >> I'm not very clear on how the contrib community works. > > The contributi

Renaming 1.1.0-alpha-SNAPSHOT is causing problems with projects on Clojars

2009-12-10 Thread liebke
It looks like renaming the version of Clojure in the build.clojure.org repository from 1.1.0-alpha-SNAPSHOT to 1.1.0-master-SNAPSHOT will require every project previously uploaded to Clojars, using the former name, to rewrite its pom and resubmit. I like the new naming scheme, but would it be poss

Refs scalability

2009-12-10 Thread Dragan Djuric
Is it a good idea, from the performance standpoint, to use many refs in the program? By many, I mean thousands or even millions? -- 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 po

Slides that accompany the Rich's QCon talk

2009-12-10 Thread Dragan Djuric
HI, I have just watched Rich's QCon talk and in some parts he is referring to the slides that are not displayed in the video. Of, course, the talk is perfectly fine without that, but I need to understand some specific tricky details, and I believe that the referred slides would help. Are they avai

Re: Fine-grained locals clearing

2009-12-10 Thread Richard Newman
> Also, it may be very useful to try all your code on 'new' *without* > taking > advantage of the new features, and reporting back on any > breakage. That's more what I was thinking. While I find the new features interesting, I'm less jazzed about spending the time to build on features that

Re: Pull request for clojure.contrib.sql?

2009-12-10 Thread Stephen C. Gilardi
Hi Graham, > To whom should I send a pull-request for an enhancement for > clojure.contrib.sql? I see that scgilardi is listed as the author, but > I'm not very clear on how the contrib community works. The contributing process is described at: http://clojure.org/contributing The patch

[RFC/patch] teaching duck-streams to support byte streams

2009-12-10 Thread B Smith-Mannschott
I've posted an attempt to teach duck-streams to be as convenient for byte streams as it now is for textual streams. I'm looking for review and feedback and hoping for inclusion in clojure-contrib. http://wiki.github.com/bpsm/clojure-contrib/about-branch-ducks-byte http://github.com/bpsm/clojure-c

Expanding the unit tests for clojure

2009-12-10 Thread devender
Hi, I am interested in expanding the unit test coverage for clojure, I have signed and mailed in the Agreement and my name now appears on the clojure contributer page. Could someone PLEASE take my patches and apply it to the code ? Yes I did read "Before you invest time working on a change, discus

Re: Idiomatic way to return the key of a map, which matches a vector containing a search value.

2009-12-10 Thread Meikel Brandmeyer
Hi, Am 10.12.2009 um 20:40 schrieb mudphone: > So, I have a search string, for example "rabble". And a map which > contains keyword keys, and vectors of strings as values: > > (def players > { > :amit ["a" "b" "c"] > :roger ["rabble" "x" "y"] > }) > > (defn key-from-match [search-str] > (let

Pull request for clojure.contrib.sql?

2009-12-10 Thread Graham Fawcett
Hi folks, To whom should I send a pull-request for an enhancement for clojure.contrib.sql? I see that scgilardi is listed as the author, but I'm not very clear on how the contrib community works. My patch provides an :external key to (get-connection), which lets you pass in an existing db connect

Re: Fine-grained locals clearing

2009-12-10 Thread Paul Mooser
I can't express how thrilled I am that you did this work.Thanks so much - since I've run into a few of these classes of bugs, I'll see if I can switch over to new and try to run against some big data sets and give some feedback, if I can find the time. On Dec 10, 6:10 am, Rich Hickey wrote: > I'm

Re: Fine-grained locals clearing

2009-12-10 Thread Chouser
On Thu, Dec 10, 2009 at 2:26 PM, Richard Newman wrote: >> +1  As cool as the new branch is, this is the first compelling reason >> I've seen to go to my boss and say we need to switch to it now. >> >> Thanks Rich! > > Speaking of which... I know the new branch is where Rich publishes his > current

Re: how 'bout a debug-repl?

2009-12-10 Thread kyle smith
Yes, I just figured that out. Is there a way to use this with slime? -- 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

Re: how 'bout a debug-repl?

2009-12-10 Thread George Jahad
are you using slime? Currently, you need to use a non-slime repl, (I think because of how slime handles io redirection) On Dec 10, 12:14 pm, kyle smith wrote: > I'm having some trouble with Alex's macro.  I can type in the debug- > repl, but when I hit enter, it just hangs and nothing happens.

Re: Idiomatic way to return the key of a map, which matches a vector containing a search value.

2009-12-10 Thread Sean Devlin
Oops! Slight mistake (ffirst (filter (comp (partial some #{"rabble"}) val) players)) On Dec 10, 3:27 pm, Sean Devlin wrote: > Try this... > > (second (first (filter (comp (partial some #{"rabble"}) val) > players))) > > On Dec 10, 2:40 pm, mudphone wrote: > > > Hi Folks, > > > So, I have a sea

Re: Idiomatic way to return the key of a map, which matches a vector containing a search value.

2009-12-10 Thread Sean Devlin
Try this... (second (first (filter (comp (partial some #{"rabble"}) val) players))) On Dec 10, 2:40 pm, mudphone wrote: > Hi Folks, > > So, I have a search string, for example "rabble".  And a map which > contains keyword keys, and vectors of strings as values: > > (def players > { > :amit ["a"

Idiomatic way to return the key of a map, which matches a vector containing a search value.

2009-12-10 Thread mudphone
Hi Folks, So, I have a search string, for example "rabble". And a map which contains keyword keys, and vectors of strings as values: (def players { :amit ["a" "b" "c"] :roger ["rabble" "x" "y"] }) Is there an idiomatic way to search for "rabble" in the vector values, then return the keyword tha

Re: how 'bout a debug-repl?

2009-12-10 Thread kyle smith
I'm having some trouble with Alex's macro. I can type in the debug- repl, but when I hit enter, it just hangs and nothing happens. -- 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

Re: Fine-grained locals clearing

2009-12-10 Thread Richard Newman
> +1 As cool as the new branch is, this is the first compelling reason > I've seen to go to my boss and say we need to switch to it now. > > Thanks Rich! Speaking of which... I know the new branch is where Rich publishes his current work. Does anyone (Rich included!) have any opinion on whether

Re: Code arrangement for understandability

2009-12-10 Thread Richard Newman
> They're especially useful for inserting println calls for seeing the > value of something when I'm debugging; in fact, this is the primary > way I do debugging. (defn tee (x) (println "Debug: " (prn-str x)) x) (let [x (tee (foo 1))] ...) -- You received this message because you are s

Re: Code arrangement for understandability

2009-12-10 Thread Richard Newman
> How to rearrange the Clojure code for understandability? One approach I've used in Common Lisp to avoid multiple lets is to do (let* ((x (let ((v 1)) (f v) ; for side-effects v)) (y (+ x 2))) (g y)) This calls to mind Clojure's doto, which instantiates a

Re: Apply performance and logging JIT compilation

2009-12-10 Thread Krukow
Doh... -- 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 post. To unsubscribe from this group, send email t

Re: Image scaling libraries. Request for recommendations

2009-12-10 Thread Joost
On 10 dec, 09:25, Frédéric Morain-Nicolier wrote: > ImageJ is considered as an excellent lib for image processing > :http://rsbweb.nih.gov/ij/ > > It is a java lib so integration in clojure is direct. You can even > find a fork with clojure inside (Fiji) > :http://pacific.mpi-cbg.de/wiki/index.p

Re: autocomplete

2009-12-10 Thread Meikel Brandmeyer
Hi, On Dec 10, 4:06 pm, Laurent PETIT wrote: > If you want to rewrite from scratch, it's not very difficult, given that you > have clojure.core/ns-*  (e.g. ns-public ...) functions at your disposal "for > free". > > The code in VimClojure is particularly clear, stable and complete, I guess > (at

Re: Code arrangement for understandability

2009-12-10 Thread samppi
If it's for side-effects, then using _ is fine, in my opinion—they're nicely identifiable. They're especially useful for inserting println calls for seeing the value of something when I'm debugging; in fact, this is the primary way I do debugging. I would say, though, that usually if you're going

Re: Fine-grained locals clearing

2009-12-10 Thread George Jahad
+1 As cool as the new branch is, this is the first compelling reason I've seen to go to my boss and say we need to switch to it now. Thanks Rich! On Dec 10, 6:40 am, "Stephen C. Gilardi" wrote: > On Dec 10, 2009, at 9:10 AM, Rich Hickey wrote: > > What a great change! We ran into the problem

Re: Code arrangement for understandability

2009-12-10 Thread David Brown
On Thu, Dec 10, 2009 at 09:26:07AM -0500, Graham Fawcett wrote: >(let [x 1 > _ (f x) > y (+ x 2) > _ (g y)] > ...) What do people in general think of this style? I remember using this trick a lot with O'Caml, and I've certainly used it a few times in Clojure, but something feels

Re: Code arrangement for understandability

2009-12-10 Thread Sean Devlin
A few things might help: * Judging by you examples, I looks like you're still getting used to the lisp style of coding. Everything is a chained function call. Write your code to support with that in mind. * Practice using comp & partial. Write a few small apps where you NEVER use a let form. * P

Re: update-in and get-in why no default?

2009-12-10 Thread Sean Devlin
Tim, I like both of these ideas. I agree, get-in2 seems to make sense as a drop in replacement. With update-in2 I prefer a new name, because I do occasionally write code that constructs lists of functions. I'd hate to get a weird bug while doing this. Sean On Dec 10, 7:20 am, Timothy Pratley

Re: Code arrangement for understandability

2009-12-10 Thread Chouser
On Thu, Dec 10, 2009 at 9:15 AM, ngocdaothanh wrote: > > My Clojure code: > (let [x 1] >  ... >  (f x) >  ... >  (let [y (+ x 2)] >    ... >    (g y))) > > It is very difficult to capture the "algorithm" behind the Clojure > code because things of the same "abstractness" level do not have the > sa

Re: autocomplete

2009-12-10 Thread Laurent PETIT
If you want to rewrite from scratch, it's not very difficult, given that you have clojure.core/ns-* (e.g. ns-public ...) functions at your disposal "for free". The code in VimClojure is particularly clear, stable and complete, I guess (at least for the clojure part of the story, don't know about

Re: Where is the Clojure 1.0 API documentation?

2009-12-10 Thread Sean Devlin
Tom, I like the idea of an "added in version", javadocs do it too. Perhaps it could go in the metadata? There is an issue to figure out, though. In the upgrade to 1.1, slurp got a new arity. In JavaLand this would be a non issue, because the new arity would have its own docs. However, in Cloju

Re: Code arrangement for understandability

2009-12-10 Thread Laurent PETIT
I'm not sure either what you mean by "abstraction level", but I would say that I tend more to think about abstraction level to be at function definition level. 2009/12/10 ngocdaothanh > Hi, > > I want to ask about code arrangement and understandability > (readability). > > Consider this "normal"

Re: Fine-grained locals clearing

2009-12-10 Thread Stephen C. Gilardi
On Dec 10, 2009, at 9:10 AM, Rich Hickey wrote: > I'm happy to announce I have implemented this fine-grained locals > clearing in the compiler, in the 'new' branch. It should automatically > cover all cases in which the code doesn't explicitly reuse the head - > including non-tail usage, destruct

Re: Code arrangement for understandability

2009-12-10 Thread Graham Fawcett
On Thu, Dec 10, 2009 at 9:15 AM, ngocdaothanh wrote: > Hi, > > I want to ask about code arrangement and understandability > (readability). > > Consider this "normal" code: > x = 1 > ... > f(x) > ... > y = x + 2 > ... > g(y) > > x, f, y, g have the same "abstractness" level, so they are indented to

Re: Fine-grained locals clearing

2009-12-10 Thread Garth Sheldon-Coulson
Rockin'. On Thu, Dec 10, 2009 at 9:10 AM, Rich Hickey wrote: > One of the objectives of Clojure is to reduce incidental complexity. > And one of the biggest sources of incidental complexity in Clojure was > the retention of the head of a lazy sequence due to its being > referenced by some local

Code arrangement for understandability

2009-12-10 Thread ngocdaothanh
Hi, I want to ask about code arrangement and understandability (readability). Consider this "normal" code: x = 1 ... f(x) ... y = x + 2 ... g(y) x, f, y, g have the same "abstractness" level, so they are indented to the same level. My Clojure code: (let [x 1] ... (f x) ... (let [y (+ x

Fine-grained locals clearing

2009-12-10 Thread Rich Hickey
One of the objectives of Clojure is to reduce incidental complexity. And one of the biggest sources of incidental complexity in Clojure was the retention of the head of a lazy sequence due to its being referenced by some local (argument or local (let) binding). One might expect that, if no subseque

Re: simple journal-based persistenсe for Clojure

2009-12-10 Thread Sergey Didenko
Yes, it uses agents for writing operations. So on the account of disk failure it's possible that in-memory state will be a few transactions ahead of what is actually persisted. Thus it's not a strict transactional solution. I consider it as a good fit for project prototyping and may be production

autocomplete

2009-12-10 Thread Mike
In my earlier posts this week I was talking about integrating a repl into our application; thanks to your help I was able to get this to work. I appreciate it! So we actually have a number of "scripting" languages we have done this with, such as Jython and SISC Scheme. We have a primitive autoco

Re: Apply performance and logging JIT compilation

2009-12-10 Thread Rich Hickey
On Tue, Dec 8, 2009 at 3:51 PM, Krukow wrote: > I am writing a function that has to wrap other code. One simple > approach is to do > > user> (defn wrap-fun [f] >        (fn [& args] >          (println "pre-processing") >          (let [res (apply f args)] >            (println "post-processing")

update-in and get-in why no default?

2009-12-10 Thread Timothy Pratley
Hi, update-in is an especially useful function but I find the update function inevitably requires a check for nil. If I could supply a not- found value then my code would get better golf scores. When I reach for update-in, I usually want to pass it a numerical operator like inc or +, but these do

1.0 Compatible Terracotta Integration Module

2009-12-10 Thread Paul Stadig
Hey everyone, I haven't been in #clojure that often lately, but when I have been there were people asking about Terracotta integration on two separate occasions. What are the chances of that?! :) There is a new repo at http://github.com/pjstadig/tim-clojure-1.0.0/ that has a 1.0 compatible version

Re: How to internally refer to other keys in a hashmap?

2009-12-10 Thread Meikel Brandmeyer
Hi, On Dec 9, 10:16 pm, Richard Newman wrote: > > However, if you would want to do something like an evolvable trade-off > > between epitopes and mutations in viruses, you would like to be able > > to store the functions inside each virus. > > And you can do that if you change how you retrieve v

Re: simple journal-based persistenсe for Clojure

2009-12-10 Thread Laurent PETIT
Hello, without going too deep in the detail of your implementation, I just can't keep thinking that, as far as I know, it's currently impossible with clojure to extend the scope of the transaction outside the STM, without changes in the STM itself (STM being aware of TransactionManagers being cer

Re: Image scaling libraries. Request for recommendations

2009-12-10 Thread Frédéric Morain-Nicolier
ImageJ is considered as an excellent lib for image processing : http://rsbweb.nih.gov/ij/ It is a java lib so integration in clojure is direct. You can even find a fork with clojure inside (Fiji) : http://pacific.mpi-cbg.de/wiki/index.php/Clojure_Scripting -- You received this message because y