Re: order of function definition

2010-02-25 Thread Laurent PETIT
Hi,

2010/2/25 Meikel Brandmeyer 

> Hi,
>
> On Feb 25, 11:24 am, reynard  wrote:
> > I define a function foo in which it calls an auxiliary function bar,
> > which is not yet defined, and a compiler exception is raised claiming
> > unable to resolve symbol bar.
> >
> > Is there a way that I can define the functions in any order I want,
> > without taking care of defining the auxiliary function first?  Thanks.
>
> (declare bar)
> (defn foo ...)
> 
> (defn bar ...)
>

I just thought about it, but a very simple macro one could name 'dotopdown
could help organize parts of code in a "top down first" approach:

(defmacro dotopdown
  "children forms inside the call to dotopdown will be evaluated in the
reverse order, thus allowing a more 'top down first' approach."
  [& body]
  `(do ~@(reverse body)))

So you can with have the important functions of a group of related functions
written first, and the functions definitions on which the important function
relies upon written last.
(note you'll need to exactly revert the dependency graph order : if you have
f1 -> f2 & f3 , f2 -> f3, then you'll define in this order : [f1, f2, f3],
the exact inverse order of [f3, f2, f1])

A little example:

(dotopdown
  (defn print-hello [n] (printf (say-hello n)))
  (defn- say-hello [n] (str "hello " n)))

HTH,

-- 
Laurent

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: no source file

2010-02-25 Thread Konrad Hinsen

On 26 Feb 2010, at 02:21, Glen Rubin wrote:


Here is the code I wrote, sqrs.clj:

  (use '[clojure.contrib.generic.math-functions :only (sqr)])

  (defn square-of-sum [coll]
"adds up collection of numbers and then squares it"
(sqr (reduce + coll)))


A different point: if you can sum your numbers using plain +, using  
generic/sqr is a waste, as it calls multimethod  
clojure.contrib.generic.arithmetic/* to do a multiplication. Just use  
#(* % %) instead.


Konrad.

--
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: clojure.zip - throws exception

2010-02-25 Thread Meikel Brandmeyer
Hi,

On Feb 25, 4:19 pm, Amitava Shee  wrote:

> Just to solidify my understanding, can this be done in the default
> namespace (of "user")?

Yes. Instead of (ns foo.bar (:require [clojure.zip :as zip])) when
setting up the foo.bar namespace you can just use require in the user
namespace. However don't forget to quote the arguments! (Quoting the
vector below, will also quote any contained symbol!)

  (require '[clojure.zip :as zip])

Note, that approach 3 does not work in user, because it has
clojure.core already referred. So next is already aliased to
clojure.core/next. This will only work with a new namespace, or after
manually removing the alias to core/next. However I wouldn't recommend
to fiddle manually with these things.

Also note: there might be different other symbols from a clojure.zip
and core which clash. next just happens to be the first one. So with
approaches 2 or 3 you would have to extend the excludes accordingly.

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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Vimclojure Performance on Windows

2010-02-25 Thread Meikel Brandmeyer
Hi,

On Feb 25, 4:46 pm, Vitaly Peressada  wrote:

> Installed vimclojure-2.1.2 on Windows XP SP3. Have dual-core machine
> and 4GB of RAM. In VimRepl
> (println "Hello World") takes about 10 seconds. Is this expected?

No. Vim shells out to another process. This is the only real portable
and stable way to talk to other process with Vim. This is slow.
However on my MacBook (dual-core, 1G RAM) the delay is not noticeable.
On my crappy Windows Laptop (single-core, 1.7Gh, 2G RAM) at work, the
delay is noticeable but well below a second.

The only exception is the first command, which (as a side effect) sets
up the whole clojure machinery in the background. But subsequent
commands should be much faster.

> Any suggestions how to speed this up?

No clue. You are the first to report such a problem.

Sincerely
Meikel

PS: there is also the vimclojure google group for such support issues.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: let and nesting

2010-02-25 Thread kuniklo
On Feb 25, 7:50 pm, Adrian Cuthbertson 
wrote:
> You can also do stuff in the middle of a let;
>
> (let [a vala
>       b valb
>       _ (do-something-with a b)
>       c (some-fn a b)
>       d (some-fn a b)
>       _ (do-something a b c d)
>       e (fn ...)
>       f (fn )]
>   (and-whatever-else))

Thanks. That's the problem I was trying to solve. Unfortunately I
think I didn't give a very good example in my first post of the kind
of code I'm talking about but it's exactly what you've described -
code that assigns values to a few variables, performs some operations
with unimportant or no return values, then assigns a few more
variables etc. Assigning to _ seems like a easy way to deal with this.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


ClojureCLR status?

2010-02-25 Thread Mike K
I notice there have been no checkins to ClojureCLR in the last month
and a half.  Is something big in the works?  Is absolutely nothing in
the works? :-)

If I check out and build the latest sources, how will it compare in
terms of functionality to the Clojure main branch?  In particular,
does it have cutting edge things like protocols, reify, etc?

   Thanks,
   Mike

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Prefixed or suffixed symbols?

2010-02-25 Thread Sean Devlin
Ah, case "a" is simpler, and I retract my macro suggestions.

As to you question about editors, I know that it's possible to adapt
emacs clojure-mode the change colors based on a regex.  That's how it
knows to color something "pink" for a fn in clojure.core, and green
for a fn in the standard library (e.g. clojure.walk).  You'll have to
make your own customizations, of course.

Sean

On Feb 25, 10:50 pm, joshua-choi  wrote:
> Ah, yes, it is a. (The only thing that I anticipate a computer would
> use this for is different syntax highlighting. Actually, can any
> Clojure editors change symbols’ colors based on if they match a
> pattern like *a*?)
>
> Because Daniel Warner and Jarkko Oranen both said they think
> underscores are undesirable, I suspect that a lot of other Clojure
> users feel the same too. Right now, I’m thus leaning toward using -
> vector-. I’ve just tried replacing all rule symbols in one of my files
> with -blah-, and it actually looks a little pretty. If I don’t hear
> any other good suggestions, I think I’ll use circumfix hyphens, then.
>
> On Feb 25, 8:31 pm, Sean Devlin  wrote:
>
>
>
> > Hmmm... maybe I misunderstood your point.  Is the intent of your
> > naming conventions:
>
> > a.  Something that is human readable but does not affect the execution
> > of code?  Examples include placing I in front of interface names, and
> > A in front of abstract class names.
>
> > b.  Something that other code will use to infer behavior?  Examples of
> > this include JUnit 3.8 & the get/set Java Bean convention.
>
> > If it's a, I made a mistake & my comments don't apply (as a matter of
> > taste I like suffixes).  If it's the behavior version, I think that a
> > special macro is in order (e.g. deftest)
>
> > Sean
>
> > On Feb 25, 10:22 pm, joshua-choi  wrote:
>
> > > Could you explain more what you mean? For instance, how are macros
> > > related to these questions? This just has to do with informal naming
> > > conventions, in the same matter as *e or *print-dup*. Are you talking
> > > about that it’s possible for naming conventions to interfere with
> > > macros that interpret symbols abnormally if they’re named a certain
> > > way?
>
> > > Now, I’ve considered just not using any characters to set apart rules
> > > completely, but that’ll bring me back to my original problems. The
> > > only disadvantage I can think of to using a convention is that it
> > > might make code that use rules more noisy...but I think that’s
> > > preferable to having to recall what a rule is called if it conflicts
> > > with another symbol—which is really common with my rules. What
> > > notation do you all think is the least ugly?
>
> > > On Feb 25, 7:32 pm, Sean Devlin  wrote:
>
> > > > I think using a naming convention isn't a good idea, especially when
> > > > you have a rich macro system like Clojure.  I'm actually going to be
> > > > talking about using a reference to handle things like this in my next
> > > > episode.  For now, you can take a look at my definference macro here:
>
> > > >http://github.com/francoisdevlin/devlinsf-clojure-utils/blob/master/s...
>
> > > > Hope this helps,
> > > > Sean
>
> > > > On Feb 25, 8:59 pm, joshua-choi  wrote:
>
> > > > > Yeah, I don’t really like the underscores either. But I have to work
> > > > > with the set of currently allowed non-alphanumeric symbol characters
> > > > > (*, +, !, -, _, and ?, according to clojure.org/reader).
>
> > > > > There’s actually two different questions here—I’d love for other
> > > > > people to bring in their input.
>
> > > > > I need to set apart “rules”, a certain type of object, from other
> > > > > kinds of Clojure objects. ("Why do you even need to do this?" people
> > > > > ask. Because I really want to graphically set them apart in the
> > > > > programmers mind. And also, rules often shared names with objects that
> > > > > they were representing: it was difficult to remember string-char-r vs.
> > > > > string-char in functions, for instance. It was always a big pain. I
> > > > > think it will be worth it.)
>
> > > > > Question 1: Of the allowed characters, which would be best to
> > > > > distinguish rule symbols from other symbols?
>
> > > > > * can be confused with the REPL vars (*1, *e, etc.) and re-bindable
> > > > > vars.
> > > > > + may be a better choice, though in the other Lisps it already
> > > > > indicates constants.
> > > > > I don’t think ! and ? are good at all, because they really stand out
> > > > > to me to mean destruction and querying respectively.
> > > > > - is apparently used only once in the standard libraries: in defn-.
> > > > > Maybe it would be a good choice.
> > > > > _ is ugly, but it’s not used at all, so that’s good. Well, except when
> > > > > used on its own: “_”, for useless bindings.
>
> > > > > I’m leaning toward +, -, or _.
>
> > > > > Question 2: Prefix, suffix, or circumfix?
>
> > > > > +vector, vector+, or +vector+? -vector, vector-, -vector-? Or
> > > > > whatever. Don’t forget, I’m decidin

Re: Prefixed or suffixed symbols?

2010-02-25 Thread joshua-choi
Ah, yes, it is a. (The only thing that I anticipate a computer would
use this for is different syntax highlighting. Actually, can any
Clojure editors change symbols’ colors based on if they match a
pattern like *a*?)

Because Daniel Warner and Jarkko Oranen both said they think
underscores are undesirable, I suspect that a lot of other Clojure
users feel the same too. Right now, I’m thus leaning toward using -
vector-. I’ve just tried replacing all rule symbols in one of my files
with -blah-, and it actually looks a little pretty. If I don’t hear
any other good suggestions, I think I’ll use circumfix hyphens, then.

On Feb 25, 8:31 pm, Sean Devlin  wrote:
> Hmmm... maybe I misunderstood your point.  Is the intent of your
> naming conventions:
>
> a.  Something that is human readable but does not affect the execution
> of code?  Examples include placing I in front of interface names, and
> A in front of abstract class names.
>
> b.  Something that other code will use to infer behavior?  Examples of
> this include JUnit 3.8 & the get/set Java Bean convention.
>
> If it's a, I made a mistake & my comments don't apply (as a matter of
> taste I like suffixes).  If it's the behavior version, I think that a
> special macro is in order (e.g. deftest)
>
> Sean
>
> On Feb 25, 10:22 pm, joshua-choi  wrote:
>
>
>
> > Could you explain more what you mean? For instance, how are macros
> > related to these questions? This just has to do with informal naming
> > conventions, in the same matter as *e or *print-dup*. Are you talking
> > about that it’s possible for naming conventions to interfere with
> > macros that interpret symbols abnormally if they’re named a certain
> > way?
>
> > Now, I’ve considered just not using any characters to set apart rules
> > completely, but that’ll bring me back to my original problems. The
> > only disadvantage I can think of to using a convention is that it
> > might make code that use rules more noisy...but I think that’s
> > preferable to having to recall what a rule is called if it conflicts
> > with another symbol—which is really common with my rules. What
> > notation do you all think is the least ugly?
>
> > On Feb 25, 7:32 pm, Sean Devlin  wrote:
>
> > > I think using a naming convention isn't a good idea, especially when
> > > you have a rich macro system like Clojure.  I'm actually going to be
> > > talking about using a reference to handle things like this in my next
> > > episode.  For now, you can take a look at my definference macro here:
>
> > >http://github.com/francoisdevlin/devlinsf-clojure-utils/blob/master/s...
>
> > > Hope this helps,
> > > Sean
>
> > > On Feb 25, 8:59 pm, joshua-choi  wrote:
>
> > > > Yeah, I don’t really like the underscores either. But I have to work
> > > > with the set of currently allowed non-alphanumeric symbol characters
> > > > (*, +, !, -, _, and ?, according to clojure.org/reader).
>
> > > > There’s actually two different questions here—I’d love for other
> > > > people to bring in their input.
>
> > > > I need to set apart “rules”, a certain type of object, from other
> > > > kinds of Clojure objects. ("Why do you even need to do this?" people
> > > > ask. Because I really want to graphically set them apart in the
> > > > programmers mind. And also, rules often shared names with objects that
> > > > they were representing: it was difficult to remember string-char-r vs.
> > > > string-char in functions, for instance. It was always a big pain. I
> > > > think it will be worth it.)
>
> > > > Question 1: Of the allowed characters, which would be best to
> > > > distinguish rule symbols from other symbols?
>
> > > > * can be confused with the REPL vars (*1, *e, etc.) and re-bindable
> > > > vars.
> > > > + may be a better choice, though in the other Lisps it already
> > > > indicates constants.
> > > > I don’t think ! and ? are good at all, because they really stand out
> > > > to me to mean destruction and querying respectively.
> > > > - is apparently used only once in the standard libraries: in defn-.
> > > > Maybe it would be a good choice.
> > > > _ is ugly, but it’s not used at all, so that’s good. Well, except when
> > > > used on its own: “_”, for useless bindings.
>
> > > > I’m leaning toward +, -, or _.
>
> > > > Question 2: Prefix, suffix, or circumfix?
>
> > > > +vector, vector+, or +vector+? -vector, vector-, -vector-? Or
> > > > whatever. Don’t forget, I’m deciding this for my parser rules library.
> > > > “vector” means a rule that can parse strings representing vectors.
>
> > > > Could everyone give me their opinion? Which annoys your taste the
> > > > least? I still have time to change the style in my library, and I’d
> > > > like to hear from as many people as possible.
>
> > > > On Feb 25, 3:16 pm, Jarkko Oranen  wrote:
>
> > > > > On Feb 25, 12:17 am, joshua-choi  wrote:
>
> > > > > > When it comes to distinguishing certain types of symbols from other
> > > > > > things, should one use prefixes or suffixes?
>
> > > > > Which

Re: let and nesting

2010-02-25 Thread Adrian Cuthbertson
You can also do stuff in the middle of a let;

(let [a vala
  b valb
  _ (do-something-with a b)
  c (some-fn a b)
  d (some-fn a b)
  _ (do-something a b c d)
  e (fn ...)
  f (fn )]
  (and-whatever-else))

Here _ is just some arbitrary unused variable.

Note that you can also reuse existing variables which sometimes make
things clearer;

(let [a (some...)
   a (if something x y)]
   (some... a))

-Rgds, Adrian.

On Fri, Feb 26, 2010 at 2:28 AM, kuniklo  wrote:
> One of my least favorite things about common lisp was the degree of
> nesting it required for sequential variable definitions. For common
> code like this:
>
> (let (a vala)
>     (b valb)
>     ... do something with a & b...
>     (let (c (fn a b))
>           (d (fn a b))
>     ... do something with a, b, c, d...
>           (let (e (fn ...))
>                (f (fn ))
>
> etc. You eventually get a very deeply nested function simply because
> the values of variables assigned later in the code depend on values
> determined earlier in the code. From what I can this is also the case
> in clojure, correct?
>
> In contrast, the python/ruby/java approach (which I realize has its
> own warts).
> a = 1
> b = 2
> c = a * b
> d = a + c
> e = func(d)
>
> in which new bindings are automatically created in the current scope,
> tends to be more readable in many cases.
>
> I'm new to clojure so I'm wondering - are there idiomatic ways of
> reducing the degree of scope-nesting let incurs or do people just tend
> to try to avoid that kind of code with smaller sub functions etc?
>
> --
> 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 to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Prefixed or suffixed symbols?

2010-02-25 Thread Sean Devlin
Hmmm... maybe I misunderstood your point.  Is the intent of your
naming conventions:

a.  Something that is human readable but does not affect the execution
of code?  Examples include placing I in front of interface names, and
A in front of abstract class names.

b.  Something that other code will use to infer behavior?  Examples of
this include JUnit 3.8 & the get/set Java Bean convention.

If it's a, I made a mistake & my comments don't apply (as a matter of
taste I like suffixes).  If it's the behavior version, I think that a
special macro is in order (e.g. deftest)

Sean

On Feb 25, 10:22 pm, joshua-choi  wrote:
> Could you explain more what you mean? For instance, how are macros
> related to these questions? This just has to do with informal naming
> conventions, in the same matter as *e or *print-dup*. Are you talking
> about that it’s possible for naming conventions to interfere with
> macros that interpret symbols abnormally if they’re named a certain
> way?
>
> Now, I’ve considered just not using any characters to set apart rules
> completely, but that’ll bring me back to my original problems. The
> only disadvantage I can think of to using a convention is that it
> might make code that use rules more noisy...but I think that’s
> preferable to having to recall what a rule is called if it conflicts
> with another symbol—which is really common with my rules. What
> notation do you all think is the least ugly?
>
> On Feb 25, 7:32 pm, Sean Devlin  wrote:
>
>
>
> > I think using a naming convention isn't a good idea, especially when
> > you have a rich macro system like Clojure.  I'm actually going to be
> > talking about using a reference to handle things like this in my next
> > episode.  For now, you can take a look at my definference macro here:
>
> >http://github.com/francoisdevlin/devlinsf-clojure-utils/blob/master/s...
>
> > Hope this helps,
> > Sean
>
> > On Feb 25, 8:59 pm, joshua-choi  wrote:
>
> > > Yeah, I don’t really like the underscores either. But I have to work
> > > with the set of currently allowed non-alphanumeric symbol characters
> > > (*, +, !, -, _, and ?, according to clojure.org/reader).
>
> > > There’s actually two different questions here—I’d love for other
> > > people to bring in their input.
>
> > > I need to set apart “rules”, a certain type of object, from other
> > > kinds of Clojure objects. ("Why do you even need to do this?" people
> > > ask. Because I really want to graphically set them apart in the
> > > programmers mind. And also, rules often shared names with objects that
> > > they were representing: it was difficult to remember string-char-r vs.
> > > string-char in functions, for instance. It was always a big pain. I
> > > think it will be worth it.)
>
> > > Question 1: Of the allowed characters, which would be best to
> > > distinguish rule symbols from other symbols?
>
> > > * can be confused with the REPL vars (*1, *e, etc.) and re-bindable
> > > vars.
> > > + may be a better choice, though in the other Lisps it already
> > > indicates constants.
> > > I don’t think ! and ? are good at all, because they really stand out
> > > to me to mean destruction and querying respectively.
> > > - is apparently used only once in the standard libraries: in defn-.
> > > Maybe it would be a good choice.
> > > _ is ugly, but it’s not used at all, so that’s good. Well, except when
> > > used on its own: “_”, for useless bindings.
>
> > > I’m leaning toward +, -, or _.
>
> > > Question 2: Prefix, suffix, or circumfix?
>
> > > +vector, vector+, or +vector+? -vector, vector-, -vector-? Or
> > > whatever. Don’t forget, I’m deciding this for my parser rules library.
> > > “vector” means a rule that can parse strings representing vectors.
>
> > > Could everyone give me their opinion? Which annoys your taste the
> > > least? I still have time to change the style in my library, and I’d
> > > like to hear from as many people as possible.
>
> > > On Feb 25, 3:16 pm, Jarkko Oranen  wrote:
>
> > > > On Feb 25, 12:17 am, joshua-choi  wrote:
>
> > > > > When it comes to distinguishing certain types of symbols from other
> > > > > things, should one use prefixes or suffixes?
>
> > > > Whichever makes more sense, of course. :)
>
> > > > > Example: naming tests with clojure.test/deftest. If you distinguish
> > > > > your tests’ symbols at all, do you do “t-addition” or “addition-t”?
>
> > > > Name tests descriptively. Putting them in their own namespace helps
> > > > too. If there's absolutely a need to distinguish them from non-tests,
> > > > I would prefer '-test'. Abbreviating it just makes it noisy.
>
> > > > > (I need to know what the standard is, if there is any, because I need
> > > > > a way to distinguish a certain type of symbol—those that represent
> > > > > “rules”— in my libraries. I’m using an underscore suffix right now,
> > > > > like “vector_”, which means “vector-rule” But “_rule” might be better,
> > > > > or even “_rule_”, though the last one might be overkill. In the p

Re: Prefixed or suffixed symbols?

2010-02-25 Thread joshua-choi
Could you explain more what you mean? For instance, how are macros
related to these questions? This just has to do with informal naming
conventions, in the same matter as *e or *print-dup*. Are you talking
about that it’s possible for naming conventions to interfere with
macros that interpret symbols abnormally if they’re named a certain
way?

Now, I’ve considered just not using any characters to set apart rules
completely, but that’ll bring me back to my original problems. The
only disadvantage I can think of to using a convention is that it
might make code that use rules more noisy...but I think that’s
preferable to having to recall what a rule is called if it conflicts
with another symbol—which is really common with my rules. What
notation do you all think is the least ugly?

On Feb 25, 7:32 pm, Sean Devlin  wrote:
> I think using a naming convention isn't a good idea, especially when
> you have a rich macro system like Clojure.  I'm actually going to be
> talking about using a reference to handle things like this in my next
> episode.  For now, you can take a look at my definference macro here:
>
> http://github.com/francoisdevlin/devlinsf-clojure-utils/blob/master/s...
>
> Hope this helps,
> Sean
>
> On Feb 25, 8:59 pm, joshua-choi  wrote:
>
>
>
> > Yeah, I don’t really like the underscores either. But I have to work
> > with the set of currently allowed non-alphanumeric symbol characters
> > (*, +, !, -, _, and ?, according to clojure.org/reader).
>
> > There’s actually two different questions here—I’d love for other
> > people to bring in their input.
>
> > I need to set apart “rules”, a certain type of object, from other
> > kinds of Clojure objects. ("Why do you even need to do this?" people
> > ask. Because I really want to graphically set them apart in the
> > programmers mind. And also, rules often shared names with objects that
> > they were representing: it was difficult to remember string-char-r vs.
> > string-char in functions, for instance. It was always a big pain. I
> > think it will be worth it.)
>
> > Question 1: Of the allowed characters, which would be best to
> > distinguish rule symbols from other symbols?
>
> > * can be confused with the REPL vars (*1, *e, etc.) and re-bindable
> > vars.
> > + may be a better choice, though in the other Lisps it already
> > indicates constants.
> > I don’t think ! and ? are good at all, because they really stand out
> > to me to mean destruction and querying respectively.
> > - is apparently used only once in the standard libraries: in defn-.
> > Maybe it would be a good choice.
> > _ is ugly, but it’s not used at all, so that’s good. Well, except when
> > used on its own: “_”, for useless bindings.
>
> > I’m leaning toward +, -, or _.
>
> > Question 2: Prefix, suffix, or circumfix?
>
> > +vector, vector+, or +vector+? -vector, vector-, -vector-? Or
> > whatever. Don’t forget, I’m deciding this for my parser rules library.
> > “vector” means a rule that can parse strings representing vectors.
>
> > Could everyone give me their opinion? Which annoys your taste the
> > least? I still have time to change the style in my library, and I’d
> > like to hear from as many people as possible.
>
> > On Feb 25, 3:16 pm, Jarkko Oranen  wrote:
>
> > > On Feb 25, 12:17 am, joshua-choi  wrote:
>
> > > > When it comes to distinguishing certain types of symbols from other
> > > > things, should one use prefixes or suffixes?
>
> > > Whichever makes more sense, of course. :)
>
> > > > Example: naming tests with clojure.test/deftest. If you distinguish
> > > > your tests’ symbols at all, do you do “t-addition” or “addition-t”?
>
> > > Name tests descriptively. Putting them in their own namespace helps
> > > too. If there's absolutely a need to distinguish them from non-tests,
> > > I would prefer '-test'. Abbreviating it just makes it noisy.
>
> > > > (I need to know what the standard is, if there is any, because I need
> > > > a way to distinguish a certain type of symbol—those that represent
> > > > “rules”— in my libraries. I’m using an underscore suffix right now,
> > > > like “vector_”, which means “vector-rule” But “_rule” might be better,
> > > > or even “_rule_”, though the last one might be overkill. In the past,
> > > > I’ve used “vector-r", but I don’t like that now.)
>
> > > I personally find underscores offensive, but... Some logic DSLs use ?
> > > foo for variables, maybe you could have something similar for you
> > > rules. Or you could name them using angled brackets (eg. ).
> > > When it comes to naming, you just need to be consistent. And avoid
> > > underscores, please :P

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.g

Re: Prefixed or suffixed symbols?

2010-02-25 Thread Sean Devlin
I think using a naming convention isn't a good idea, especially when
you have a rich macro system like Clojure.  I'm actually going to be
talking about using a reference to handle things like this in my next
episode.  For now, you can take a look at my definference macro here:

http://github.com/francoisdevlin/devlinsf-clojure-utils/blob/master/src/lib/sfd/equations.clj

Hope this helps,
Sean

On Feb 25, 8:59 pm, joshua-choi  wrote:
> Yeah, I don’t really like the underscores either. But I have to work
> with the set of currently allowed non-alphanumeric symbol characters
> (*, +, !, -, _, and ?, according to clojure.org/reader).
>
> There’s actually two different questions here—I’d love for other
> people to bring in their input.
>
> I need to set apart “rules”, a certain type of object, from other
> kinds of Clojure objects. ("Why do you even need to do this?" people
> ask. Because I really want to graphically set them apart in the
> programmers mind. And also, rules often shared names with objects that
> they were representing: it was difficult to remember string-char-r vs.
> string-char in functions, for instance. It was always a big pain. I
> think it will be worth it.)
>
> Question 1: Of the allowed characters, which would be best to
> distinguish rule symbols from other symbols?
>
> * can be confused with the REPL vars (*1, *e, etc.) and re-bindable
> vars.
> + may be a better choice, though in the other Lisps it already
> indicates constants.
> I don’t think ! and ? are good at all, because they really stand out
> to me to mean destruction and querying respectively.
> - is apparently used only once in the standard libraries: in defn-.
> Maybe it would be a good choice.
> _ is ugly, but it’s not used at all, so that’s good. Well, except when
> used on its own: “_”, for useless bindings.
>
> I’m leaning toward +, -, or _.
>
> Question 2: Prefix, suffix, or circumfix?
>
> +vector, vector+, or +vector+? -vector, vector-, -vector-? Or
> whatever. Don’t forget, I’m deciding this for my parser rules library.
> “vector” means a rule that can parse strings representing vectors.
>
> Could everyone give me their opinion? Which annoys your taste the
> least? I still have time to change the style in my library, and I’d
> like to hear from as many people as possible.
>
> On Feb 25, 3:16 pm, Jarkko Oranen  wrote:
>
>
>
> > On Feb 25, 12:17 am, joshua-choi  wrote:
>
> > > When it comes to distinguishing certain types of symbols from other
> > > things, should one use prefixes or suffixes?
>
> > Whichever makes more sense, of course. :)
>
> > > Example: naming tests with clojure.test/deftest. If you distinguish
> > > your tests’ symbols at all, do you do “t-addition” or “addition-t”?
>
> > Name tests descriptively. Putting them in their own namespace helps
> > too. If there's absolutely a need to distinguish them from non-tests,
> > I would prefer '-test'. Abbreviating it just makes it noisy.
>
> > > (I need to know what the standard is, if there is any, because I need
> > > a way to distinguish a certain type of symbol—those that represent
> > > “rules”— in my libraries. I’m using an underscore suffix right now,
> > > like “vector_”, which means “vector-rule” But “_rule” might be better,
> > > or even “_rule_”, though the last one might be overkill. In the past,
> > > I’ve used “vector-r", but I don’t like that now.)
>
> > I personally find underscores offensive, but... Some logic DSLs use ?
> > foo for variables, maybe you could have something similar for you
> > rules. Or you could name them using angled brackets (eg. ).
> > When it comes to naming, you just need to be consistent. And avoid
> > underscores, please :P

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Prefixed or suffixed symbols?

2010-02-25 Thread joshua-choi
Yeah, I don’t really like the underscores either. But I have to work
with the set of currently allowed non-alphanumeric symbol characters
(*, +, !, -, _, and ?, according to clojure.org/reader).

There’s actually two different questions here—I’d love for other
people to bring in their input.

I need to set apart “rules”, a certain type of object, from other
kinds of Clojure objects. ("Why do you even need to do this?" people
ask. Because I really want to graphically set them apart in the
programmers mind. And also, rules often shared names with objects that
they were representing: it was difficult to remember string-char-r vs.
string-char in functions, for instance. It was always a big pain. I
think it will be worth it.)

Question 1: Of the allowed characters, which would be best to
distinguish rule symbols from other symbols?

* can be confused with the REPL vars (*1, *e, etc.) and re-bindable
vars.
+ may be a better choice, though in the other Lisps it already
indicates constants.
I don’t think ! and ? are good at all, because they really stand out
to me to mean destruction and querying respectively.
- is apparently used only once in the standard libraries: in defn-.
Maybe it would be a good choice.
_ is ugly, but it’s not used at all, so that’s good. Well, except when
used on its own: “_”, for useless bindings.

I’m leaning toward +, -, or _.

Question 2: Prefix, suffix, or circumfix?

+vector, vector+, or +vector+? -vector, vector-, -vector-? Or
whatever. Don’t forget, I’m deciding this for my parser rules library.
“vector” means a rule that can parse strings representing vectors.

Could everyone give me their opinion? Which annoys your taste the
least? I still have time to change the style in my library, and I’d
like to hear from as many people as possible.

On Feb 25, 3:16 pm, Jarkko Oranen  wrote:
> On Feb 25, 12:17 am, joshua-choi  wrote:
>
> > When it comes to distinguishing certain types of symbols from other
> > things, should one use prefixes or suffixes?
>
> Whichever makes more sense, of course. :)
>
>
>
> > Example: naming tests with clojure.test/deftest. If you distinguish
> > your tests’ symbols at all, do you do “t-addition” or “addition-t”?
>
> Name tests descriptively. Putting them in their own namespace helps
> too. If there's absolutely a need to distinguish them from non-tests,
> I would prefer '-test'. Abbreviating it just makes it noisy.
>
> > (I need to know what the standard is, if there is any, because I need
> > a way to distinguish a certain type of symbol—those that represent
> > “rules”— in my libraries. I’m using an underscore suffix right now,
> > like “vector_”, which means “vector-rule” But “_rule” might be better,
> > or even “_rule_”, though the last one might be overkill. In the past,
> > I’ve used “vector-r", but I don’t like that now.)
>
> I personally find underscores offensive, but... Some logic DSLs use ?
> foo for variables, maybe you could have something similar for you
> rules. Or you could name them using angled brackets (eg. ).
> When it comes to naming, you just need to be consistent. And avoid
> underscores, please :P

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: let and nesting

2010-02-25 Thread Mike Meyer
On Thu, 25 Feb 2010 16:28:05 -0800 (PST)
kuniklo  wrote:

> One of my least favorite things about common lisp was the degree of
> nesting it required for sequential variable definitions. For common
> code like this:
> 
> (let (a vala)
>  (b valb)
>  ... do something with a & b...
>  (let (c (fn a b))
>(d (fn a b))
>  ... do something with a, b, c, d...
>(let (e (fn ...))
> (f (fn ))

You might want to check out let*.

> etc. You eventually get a very deeply nested function simply because
> the values of variables assigned later in the code depend on values
> determined earlier in the code. From what I can this is also the case
> in clojure, correct?

Nope. Clojure's let is like CL's let*

> In contrast, the python/ruby/java approach (which I realize has its
> own warts).
> a = 1
> b = 2
> c = a * b
> d = a + c
> e = func(d)

In clojure, you'd do:
(let [a 1
  b 2
  c (* a b)
  d (+ a c)
  e (func d)]
  (calculation using a, b, c, d and e))

> I'm new to clojure so I'm wondering - are there idiomatic ways of
> reducing the degree of scope-nesting let incurs or do people just tend
> to try to avoid that kind of code with smaller sub functions etc?

Anything particularly wrong with the example I gave you?

  http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: possible errors in ns documentation

2010-02-25 Thread j1n3l0
Please forgive my mistake. I missed out a set of parentheses in there.
It should be something like this:

(ns foo
  (:use (some.lib)))

There are othe scenarios of different use cases:

;; see link for example 
http://github.com/technomancy/leiningen/blob/master/src/lancet.clj
(ns foo
  (:use [some.lib :only (some-function)]))

I guess I need to read a few more tutorials before I start trying
things like that.

On that note, are there any good tutorials for non-java/lisp and/or
beginner programmers out there?

Thanks.

Ps:

I am using clojure version 1.1.0.

On Feb 25, 2:48 pm, Sean Devlin  wrote:
> What Clojure version are you using?
>
> On Feb 24, 4:17 pm, j1n3l0  wrote:
>
> > Hi all,
>
> > I'm not sure if this is the right place to raise this. I am new to
> > clojure and was going through the docs for namespaces here:
>
> >http://richhickey.github.com/clojure/clojure.core-api.html#clojure.co...
>
> > In the example there it implies that the way to import functions into
> > your namespace is as follows:
>
> > (ns foo
> >   (:use some.lib))
>
> > In actuality you (at least I did) need to this to get this to load:
>
> > (ns foo
> >   (:use [some.lib]))
>
> > Is this correct? Could that possibly be clarified in the docs if so?
> > If I am wrong could someone point me in the right direction for the
> > correct usage.
>
> > 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 - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: clojure.zip - throws exception

2010-02-25 Thread Amitava Shee
Thank you - this really helped. To Sean's question - I am using 1.1.0

Just to solidify my understanding, can this be done in the default
namespace (of "user")?

-Amitava

On Feb 25, 9:50 am, Meikel Brandmeyer  wrote:
> Hi,
>
> On Feb 24, 8:59 pm, Amitava Shee  wrote:
>
> > I am getting the following exception while trying to use clojure.zip
>
> > user=> (use '[clojure.zip :as zip])
> > java.lang.IllegalStateException: next already refers to:
> > #'clojure.core/next in namespace: user (NO_SOURCE_FILE:0)
>
> > What I am I missing?
>
> 1. (ns foo.bar (:require [clojure.zip :as zip])) => you have to prefix
> elements from c.z with zip (eg. zip/down), etc.
> 2. (ns foo.bar (:use [clojure.zip :as zip :exclude (next)])) => you
> can use all functions from c.z directly (eg. down), only next has to
> be called as zip/next.
> 3. (ns foo.bar (:refer-clojure :exclude (next)) (:use clojure.zip)) =>
> you can call all function from c.z directly including next, but you
> have to qualify calls to the next from core: clojure.core/next.
>
> Hope that helps. The first alternative is probably what you wanted to
> do in the first place.
>
> 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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


let and nesting

2010-02-25 Thread kuniklo
One of my least favorite things about common lisp was the degree of
nesting it required for sequential variable definitions. For common
code like this:

(let (a vala)
 (b valb)
 ... do something with a & b...
 (let (c (fn a b))
   (d (fn a b))
 ... do something with a, b, c, d...
   (let (e (fn ...))
(f (fn ))

etc. You eventually get a very deeply nested function simply because
the values of variables assigned later in the code depend on values
determined earlier in the code. From what I can this is also the case
in clojure, correct?

In contrast, the python/ruby/java approach (which I realize has its
own warts).
a = 1
b = 2
c = a * b
d = a + c
e = func(d)

in which new bindings are automatically created in the current scope,
tends to be more readable in many cases.

I'm new to clojure so I'm wondering - are there idiomatic ways of
reducing the degree of scope-nesting let incurs or do people just tend
to try to avoid that kind of code with smaller sub functions etc?

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Vimclojure Performance on Windows

2010-02-25 Thread Vitaly Peressada
Installed vimclojure-2.1.2 on Windows XP SP3. Have dual-core machine
and 4GB of RAM. In VimRepl
(println "Hello World") takes about 10 seconds. Is this expected? Any
suggestions how to speed this up?

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: no source file

2010-02-25 Thread Stephen C. Gilardi

On Feb 25, 2010, at 8:21 PM, Glen Rubin wrote:

> whenever I try (load-file sqrs.clj) i get a no source file exception.

Does (load-file "sqrs.clj") work?

--Steve

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

no source file

2010-02-25 Thread Glen Rubin
Hi,

I wrote some code, put it in a file, and now want to load that file.

Here is the code I wrote, sqrs.clj:

   (use '[clojure.contrib.generic.math-functions :only (sqr)])

   (defn square-of-sum [coll]
"adds up collection of numbers and then squares it"
(sqr (reduce + coll)))

whenever I try (load-file sqrs.clj) i get a no source file exception.
I have tried placing this file on my desktop, c:\, and clojure
directory, but always get a no source file exception.  Where should I
put it?

thx!

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: ANN: midi-clj and osc-clj

2010-02-25 Thread Jeff Rose
Luckily there are already good Java libraries for doing all three of
these: jlayer, jorvis and jflac.  We will probably integrate these in
with Overtone eventually, but for now we just use wav files for
samples.

-Jeff

On Feb 25, 8:53 pm, Anders Rune Jensen 
wrote:
> On Thu, Feb 25, 2010 at 4:41 PM, Jeff Rose  wrote:
> > Just a quick announcement for any musical Clojurians out there.  I've
> > pushed midi-clj for simple MIDI communication, and osc-clj for
> > communicating with new school instruments via Open Sound Control.
> > Both were developed for project Overtone, but they might be useful for
> > other projects.
>
> Interesting. The JVM could use a good sound library. Any chance of
> writing a mp3, ogg + flac decoder in clojure? :-)
>
> > Get them with leiningen by adding them to your project.clj:
>
> >  [midi-clj "0.1"]
> >  [osc-clj "0.1"]
>
> > or from github:
>
> >http://github.com/rosejn/midi-clj
> >http://github.com/rosejn/osc-clj
>
> > Cheers,
> > Jeff
>
> --
> Anders Rune Jensen
>
> http://www.iola.dk

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Prefixed or suffixed symbols?

2010-02-25 Thread Jarkko Oranen
On Feb 25, 12:17 am, joshua-choi  wrote:
> When it comes to distinguishing certain types of symbols from other
> things, should one use prefixes or suffixes?

Whichever makes more sense, of course. :)

>
> Example: naming tests with clojure.test/deftest. If you distinguish
> your tests’ symbols at all, do you do “t-addition” or “addition-t”?
>

Name tests descriptively. Putting them in their own namespace helps
too. If there's absolutely a need to distinguish them from non-tests,
I would prefer '-test'. Abbreviating it just makes it noisy.

> (I need to know what the standard is, if there is any, because I need
> a way to distinguish a certain type of symbol—those that represent
> “rules”— in my libraries. I’m using an underscore suffix right now,
> like “vector_”, which means “vector-rule” But “_rule” might be better,
> or even “_rule_”, though the last one might be overkill. In the past,
> I’ve used “vector-r", but I don’t like that now.)

I personally find underscores offensive, but... Some logic DSLs use ?
foo for variables, maybe you could have something similar for you
rules. Or you could name them using angled brackets (eg. ).
When it comes to naming, you just need to be consistent. And avoid
underscores, please :P

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Prefixed or suffixed symbols?

2010-02-25 Thread Daniel Werner
Hello Joshua,

I don't think there is an official standard in Clojure, at least not
yet. For a source of inspiration, you may be interested in this
thread, in case you haven't found it yourself yet:

http://groups.google.com/group/clojure-dev/browse_thread/thread/d090b5599909497c

Personally, I prefer to annotate functions that have specific meaning
(like being a filter function used in templates, or a widget that
spits out HTML) with a tag that explicitely states what they are (be
it metadata in Clojure, or a decorator in Python which sets a specific
instance variable on the function object) so functions of a kind can
be programmatically queried at runtime (e.g., "give me all widgets in
this namespace").

Regarding tests, in the Clojure code I've seen so far, people haven't
used any specific notation, probably since tests are usually split off
from the rest of the source anyway.

Actually I had to smirk while reading your post, because only a few
weeks ago I browsed your fnparse project's git repository out of
interest. Looking at your "renaming" branch where you started adding
underscores to the most important rule building functions, I just
thought "what the heck is he doing here, and why?".

So, generally I find _underscore_ naming to be less readable,
especially when these names are being used regularly throughout the
code, and avoid it myself. (Unless it is forced by language
conventions, like __init__ and __repr__ etc. in Python.)

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: ANN: midi-clj and osc-clj

2010-02-25 Thread Anders Rune Jensen
On Thu, Feb 25, 2010 at 4:41 PM, Jeff Rose  wrote:
> Just a quick announcement for any musical Clojurians out there.  I've
> pushed midi-clj for simple MIDI communication, and osc-clj for
> communicating with new school instruments via Open Sound Control.
> Both were developed for project Overtone, but they might be useful for
> other projects.

Interesting. The JVM could use a good sound library. Any chance of
writing a mp3, ogg + flac decoder in clojure? :-)

> Get them with leiningen by adding them to your project.clj:
>
>  [midi-clj "0.1"]
>  [osc-clj "0.1"]
>
> or from github:
>
> http://github.com/rosejn/midi-clj
> http://github.com/rosejn/osc-clj
>
> Cheers,
> Jeff

-- 
Anders Rune Jensen

http://www.iola.dk

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Announce: Introductory article about Clojure in Russian

2010-02-25 Thread Alex Ott
Hi all

In new issue of Russian FP journal (http://fprog.ru/) was published an
article about Clojure (http://fprog.ru/2010/issue4/alex-ott-clojure/ -
HTML, and http://fprog.ru/2010/issue4/ - different PDF sizes).

This is introduction-level article, that could be used as basis for
studying Clojure.

Discussion of article is Livejournal community -
http://community.livejournal.com/fprog/7703.html

P.S. There is one bug in HTML version - there is no indentation in
examples - we're working on fixing this issue

-- 
With best wishes, Alex Ott, MBA
http://alexott.blogspot.com/http://alexott.net/
http://alexott-ru.blogspot.com/

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Got a Clojure library?

2010-02-25 Thread Nurullah Akkaya
> The name of your library

clodiuno

> Library home page URL

http://nakkaya.com/clodiuno.markdown

> Your name

Nurullah Akkaya

> Category (db, web, UI, parsing etc)

Physical Computing

> License

Beerware Revision 42

> A one-paragraph description. Include 3rd party dependencies if any.

Clodiuno is a library that allows you to control Arduino via Firmata protocol.
The purpose of this library is to allow Clojure developers to interface with
real world using Arduino hardware.

Dependencies: RXTX

--
Nurullah Akkaya
http://nakkaya.com

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


ANN: midi-clj and osc-clj

2010-02-25 Thread Jeff Rose
Just a quick announcement for any musical Clojurians out there.  I've
pushed midi-clj for simple MIDI communication, and osc-clj for
communicating with new school instruments via Open Sound Control.
Both were developed for project Overtone, but they might be useful for
other projects.

Get them with leiningen by adding them to your project.clj:

  [midi-clj "0.1"]
  [osc-clj "0.1"]

or from github:

http://github.com/rosejn/midi-clj
http://github.com/rosejn/osc-clj

Cheers,
Jeff

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Newbie suggestion for an implementation - rosettacode pythagorean means

2010-02-25 Thread Aviad Reich
thanks!



On 25 February 2010 15:28, fra  wrote:

> Hi,
>
> I have a small improvement.
> The function / called with only argument returns the inverse, so you
> can define g-mean and h-mean more shortly:
>
> (defn g-mean [coll]
>  (expt (reduce * coll) (/ (count coll
>
> (defn h-mean [coll] ;; Michael Kohl's function
>  (/ (count coll) (reduce + (map / coll
>
>
>
>
> On Feb 25, 9:07 am, Aviad Reich  wrote:
> > here is the final version of the implementation.
> http://gist.github.com/313558
> >
> > again, any thought would be great.
> > Aviad.
> >
> > On 22 February 2010 22:11, Aviad Reich  wrote:
> >
> >
> >
> > > I don't mean to signal the end of this thread, but I just wanted to
> thank
> > > you all for you replies.
> > > I will update the draft (and add Colin and Mikel's infinite seq code as
> > > well) possible in a day or two (no at home till then), and post the new
> code
> > > before posting to Rosetta.
> >
> > > Cheers,
> > > Aviad
> >
> > > On 22 February 2010 14:47, Michael Kohl  wrote:
> >
> > >> On Mon, Feb 22, 2010 at 11:43 AM, Johnny Kwan <
> johnny.c.k...@gmail.com>
> > >> wrote:
> > >> > Whichever is faster depends on the size of the argument list
> >
> > >> I see, thanks for clarifying. I'd then change my version to this since
> > >> I still like map with an anonymous function more than the
> > >> for-comprehension in this case.
> >
> > >> defn h-mean [coll]
> > >>(/ (count coll) (reduce + (map #(/ 1 %) coll
> >
> > >> Michael
> >
> > >> --
> > >> 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 to
> > >> clojure+unsubscr...@googlegroups.com
> >
> > >> For more options, visit this group at
> > >>http://groups.google.com/group/clojure?hl=en
>
> --
> 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 to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: clojure.zip - throws exception

2010-02-25 Thread Tobias Hauth
Use require instead of use:

(require '[clojure.zip :as zip])

Tobias

On Wed, Feb 24, 2010 at 8:59 PM, Amitava Shee wrote:

> I am getting the following exception while trying to use clojure.zip
>
> user=> (use '[clojure.zip :as zip])
> java.lang.IllegalStateException: next already refers to:
> #'clojure.core/next in namespace: user (NO_SOURCE_FILE:0)
>
> What I am I missing?
>
> --
> 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 to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: prn to a file with large data structures?

2010-02-25 Thread Adrian Cuthbertson
Try including [*print-dup* true] in the binding;

(defn write-nick-sets [file-name obj]]
  (with-open [w (FileWriter. (File. file-name))]
(binding [*out* w *print-dup* true] (prn obj

You can read it back with;

(defn rec-load
  "Load a clojure form from file"
  [#^File file]
  (with-open [r (PushbackReader. (FileReader. file))]
(let [rec (read r)]
  rec)))

See clojure.core_print.clj in the clojure source for details.

-Regards, Adrian.


On Thu, Feb 25, 2010 at 5:17 AM, NovusTiro  wrote:
> I'm trying to prn a large data structure to a file so I can later read
> it back in, like so -
>
> (defn write-nick-sets [file-name obj]
>  (binding [*out* (java.io.FileWriter. file-name)]
>    (prn obj)))
>
> obj here is a map with a string as its key and another map as its
> value.  The nested map has a list as its key and a set as its value.
> When I prn the structure to a file as above, it doesn't print out all
> my data, only 40 key-value pairs for each nested map are printed, and
> an ellipsis is inserted after them (I guess to represent the
> remainder).
>
> Anyone know what I'm doing wrong here?  How can I print the whole data
> structure to a file, in a way that the reader can understand?
>
> --
> 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 to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: clojure.zip - throws exception

2010-02-25 Thread Meikel Brandmeyer
Hi,

On Feb 24, 8:59 pm, Amitava Shee  wrote:

> I am getting the following exception while trying to use clojure.zip
>
> user=> (use '[clojure.zip :as zip])
> java.lang.IllegalStateException: next already refers to:
> #'clojure.core/next in namespace: user (NO_SOURCE_FILE:0)
>
> What I am I missing?

1. (ns foo.bar (:require [clojure.zip :as zip])) => you have to prefix
elements from c.z with zip (eg. zip/down), etc.
2. (ns foo.bar (:use [clojure.zip :as zip :exclude (next)])) => you
can use all functions from c.z directly (eg. down), only next has to
be called as zip/next.
3. (ns foo.bar (:refer-clojure :exclude (next)) (:use clojure.zip)) =>
you can call all function from c.z directly including next, but you
have to qualify calls to the next from core: clojure.core/next.

Hope that helps. The first alternative is probably what you wanted to
do in the first place.

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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: possible errors in ns documentation

2010-02-25 Thread Sean Devlin
What Clojure version are you using?

On Feb 24, 4:17 pm, j1n3l0  wrote:
> Hi all,
>
> I'm not sure if this is the right place to raise this. I am new to
> clojure and was going through the docs for namespaces here:
>
> http://richhickey.github.com/clojure/clojure.core-api.html#clojure.co...
>
> In the example there it implies that the way to import functions into
> your namespace is as follows:
>
> (ns foo
>   (:use some.lib))
>
> In actuality you (at least I did) need to this to get this to load:
>
> (ns foo
>   (:use [some.lib]))
>
> Is this correct? Could that possibly be clarified in the docs if so?
> If I am wrong could someone point me in the right direction for the
> correct usage.
>
> 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 - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: prn to a file with large data structures?

2010-02-25 Thread Meikel Brandmeyer
Hi,

On Feb 25, 4:17 am, NovusTiro  wrote:

> I'm trying to prn a large data structure to a file so I can later read
> it back in, like so -
>
> (defn write-nick-sets [file-name obj]
>   (binding [*out* (java.io.FileWriter. file-name)]
>     (prn obj)))
>
> obj here is a map with a string as its key and another map as its
> value.  The nested map has a list as its key and a set as its value.
> When I prn the structure to a file as above, it doesn't print out all
> my data, only 40 key-value pairs for each nested map are printed, and
> an ellipsis is inserted after them (I guess to represent the
> remainder).
>
> Anyone know what I'm doing wrong here?  How can I print the whole data
> structure to a file, in a way that the reader can understand?

Checkout *print-length* and *print-level*. I guess you are caught be
*print-length*. Although the default is to print everything. So maybe
it is bound to something else somewhere in your call chain.

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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: possible errors in ns documentation

2010-02-25 Thread Meikel Brandmeyer
Hi,

On Feb 24, 10:17 pm, j1n3l0  wrote:

> (ns foo
>   (:use some.lib))

This works find for me.

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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: clojure.zip - throws exception

2010-02-25 Thread Sean Devlin
Hmm...  what versions of Clojure (and other libs) are you using?

Sean

On Feb 24, 2:59 pm, Amitava Shee  wrote:
> I am getting the following exception while trying to use clojure.zip
>
> user=> (use '[clojure.zip :as zip])
> java.lang.IllegalStateException: next already refers to:
> #'clojure.core/next in namespace: user (NO_SOURCE_FILE:0)
>
> What I am I missing?

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Newbie suggestion for an implementation - rosettacode pythagorean means

2010-02-25 Thread fra
Hi,

I have a small improvement.
The function / called with only argument returns the inverse, so you
can define g-mean and h-mean more shortly:

(defn g-mean [coll]
  (expt (reduce * coll) (/ (count coll

(defn h-mean [coll] ;; Michael Kohl's function
  (/ (count coll) (reduce + (map / coll




On Feb 25, 9:07 am, Aviad Reich  wrote:
> here is the final version of the implementation.http://gist.github.com/313558
>
> again, any thought would be great.
> Aviad.
>
> On 22 February 2010 22:11, Aviad Reich  wrote:
>
>
>
> > I don't mean to signal the end of this thread, but I just wanted to thank
> > you all for you replies.
> > I will update the draft (and add Colin and Mikel's infinite seq code as
> > well) possible in a day or two (no at home till then), and post the new code
> > before posting to Rosetta.
>
> > Cheers,
> > Aviad
>
> > On 22 February 2010 14:47, Michael Kohl  wrote:
>
> >> On Mon, Feb 22, 2010 at 11:43 AM, Johnny Kwan 
> >> wrote:
> >> > Whichever is faster depends on the size of the argument list
>
> >> I see, thanks for clarifying. I'd then change my version to this since
> >> I still like map with an anonymous function more than the
> >> for-comprehension in this case.
>
> >> defn h-mean [coll]
> >>    (/ (count coll) (reduce + (map #(/ 1 %) coll
>
> >> Michael
>
> >> --
> >> 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 to
> >> clojure+unsubscr...@googlegroups.com >>  >
> >> For more options, visit this group at
> >>http://groups.google.com/group/clojure?hl=en

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: order of function definition

2010-02-25 Thread Tom Danielsen
(declare bar)

-- 
Freedom's just another word for nothing left to lose

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


prn to a file with large data structures?

2010-02-25 Thread NovusTiro
I'm trying to prn a large data structure to a file so I can later read
it back in, like so -

(defn write-nick-sets [file-name obj]
  (binding [*out* (java.io.FileWriter. file-name)]
(prn obj)))

obj here is a map with a string as its key and another map as its
value.  The nested map has a list as its key and a set as its value.
When I prn the structure to a file as above, it doesn't print out all
my data, only 40 key-value pairs for each nested map are printed, and
an ellipsis is inserted after them (I guess to represent the
remainder).

Anyone know what I'm doing wrong here?  How can I print the whole data
structure to a file, in a way that the reader can understand?

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


possible errors in ns documentation

2010-02-25 Thread j1n3l0
Hi all,

I'm not sure if this is the right place to raise this. I am new to
clojure and was going through the docs for namespaces here:

http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/ns

In the example there it implies that the way to import functions into
your namespace is as follows:

(ns foo
  (:use some.lib))

In actuality you (at least I did) need to this to get this to load:

(ns foo
  (:use [some.lib]))

Is this correct? Could that possibly be clarified in the docs if so?
If I am wrong could someone point me in the right direction for the
correct usage.

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 - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


clojure.zip - throws exception

2010-02-25 Thread Amitava Shee
I am getting the following exception while trying to use clojure.zip

user=> (use '[clojure.zip :as zip])
java.lang.IllegalStateException: next already refers to:
#'clojure.core/next in namespace: user (NO_SOURCE_FILE:0)

What I am I missing?

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: clojure-clr how to wire up a delegate

2010-02-25 Thread dmiller
Parallel to proxy, clojure-clr adds a gen-delegate.  Example code is
in

http://github.com/richhickey/clojure-clr/blob/master/Clojure/Clojure.Source/clojure/samples/celsius.clj

Specifically, for adding an EventHandler:

(.add_Click button
  (gen-delegate EventHandler [sender args]
(let [c (Double/Parse (.Text tb)) ]
  (.set_Text f-label (str (+ 32 (* 1.8 c)) " Fahrenheit")

-David


On Feb 24, 1:43 am, adam11235  wrote:
> Hi,
>
> I've made progress in creating a simple app to show a windows form,
> however I am having trouble wiring up a delegate (to handle button
> clicks).
>
> The Java version uses Proxy to implement ActionListener, instead I am
> just trying to create an EventHandler passing as the 2nd constructor
> argument the code I would like executed. (see the .add_Click line)
>
> The delegate code gets invoked immediately instead of when the button
> click occurs, and then complains it expected a function pointer rather
> than the DialogResult it received (due to execution of the code)
>
> I tried quoting that code but no success.
>
> How do you wire up delegates?
>
> (import '(System.Windows.Forms MessageBox Form Button))
>
> (defn windowsPlay []
>         (let
>                 [       win (Form.)
>                         temp-button (Button.)
>                 ]
>         (.. win (get_Controls) (Add temp-button))
>         (doto temp-button
>                 (.set_Top 50)
>                 (.set_Text "Clicky")
>                 (.add_Click (EventHandler. temp-button (MessageBox/Show "I got
> clicked"
>         (doto win
>                 (.set_Text "hello")
>                 (.ShowDialog
>
> (windowsPlay)
>
> Thanks, Adam.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: order of function definition

2010-02-25 Thread Meikel Brandmeyer
Hi,

On Feb 25, 11:24 am, reynard  wrote:
> I define a function foo in which it calls an auxiliary function bar,
> which is not yet defined, and a compiler exception is raised claiming
> unable to resolve symbol bar.
>
> Is there a way that I can define the functions in any order I want,
> without taking care of defining the auxiliary function first?  Thanks.

(declare bar)
(defn foo ...)

(defn bar ...)

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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: order of function definition

2010-02-25 Thread Laurent PETIT
not yet.

But you can just declare the function, before implementing it:

(declare bar)
(defn foo [] (bar "hello"))

(defn bar [man] (println "hello" man))

Be aware that if you need to typehint bar, you'll also need to type
hint the bar declaration, so that the compilation of foo can use this
information ; see:

user=> (set! *warn-on-reflection* true)
true
user=> (declare bar)
#'user/bar
user=> (defn foo [] (.length (bar "laurent")))
Reflection warning, NO_SOURCE_PATH:5 - reference to field length can't
be resolved.
#'user/foo
user=> (declare #^String bar)
#'user/bar
user=> (defn foo [] (.length (bar "laurent")))
#'user/foo
user=>

HTH,

-- 
Laurent



2010/2/25 reynard :
> I define a function foo in which it calls an auxiliary function bar,
> which is not yet defined, and a compiler exception is raised claiming
> unable to resolve symbol bar.
>
> Is there a way that I can define the functions in any order I want,
> without taking care of defining the auxiliary function first?  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 - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


order of function definition

2010-02-25 Thread reynard
I define a function foo in which it calls an auxiliary function bar,
which is not yet defined, and a compiler exception is raised claiming
unable to resolve symbol bar.

Is there a way that I can define the functions in any order I want,
without taking care of defining the auxiliary function first?  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 - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Newbie suggestion for an implementation - rosettacode pythagorean means

2010-02-25 Thread Aviad Reich
here is the final version of the implementation.
http://gist.github.com/313558

again, any thought would be great.
Aviad.


On 22 February 2010 22:11, Aviad Reich  wrote:

> I don't mean to signal the end of this thread, but I just wanted to thank
> you all for you replies.
> I will update the draft (and add Colin and Mikel's infinite seq code as
> well) possible in a day or two (no at home till then), and post the new code
> before posting to Rosetta.
>
> Cheers,
> Aviad
>
>
>
> On 22 February 2010 14:47, Michael Kohl  wrote:
>
>> On Mon, Feb 22, 2010 at 11:43 AM, Johnny Kwan 
>> wrote:
>> > Whichever is faster depends on the size of the argument list
>>
>> I see, thanks for clarifying. I'd then change my version to this since
>> I still like map with an anonymous function more than the
>> for-comprehension in this case.
>>
>> defn h-mean [coll]
>>(/ (count coll) (reduce + (map #(/ 1 %) coll
>>
>> Michael
>>
>> --
>> 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 to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>>
>
>

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en