Aw: Re: Where to place Arguments

2011-06-14 Thread Meikel Brandmeyer
Hi,

another one which caught me recently is nthnext. I expected (nthnext 5 
some-seq), but Clojure complained about 5 being not a sequence. :]

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

Aw: Re: help--reading keyboard input from Clojure is surprisingly difficult

2011-06-14 Thread Meikel Brandmeyer
Hi,

indeed. On the other hand the atom has the advantage of making the loop 
easily interuptible from the outside. YMMV. :)

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: Wisdom sought for functional iterative processing

2011-06-14 Thread Matthew Phillips
On Jun 15, 12:41 pm, Christian Schuhegger
 wrote:
> Ah, sorry, perhaps I misunderstand you, but if you use multimethods
> (defmulti) in Clojure you do not need to "attach" methods to anything.
> The defmulti will allow you "dispatch-on-type" based on the key which
> is present in the map  (e.g. if :delete is present or if :insert is
> present).
>
> The nice thing about multimethods the lisp style is that they are
> additive, e.g. you do not have to change anything in your op
> structure.

A very good point. I think it would be overkill here, but you're
absolutely right that multimethods would be an elegant way to do it if
I went that route. Another aspect I need to get used to considering,
moving from OO :/

-- 
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 any? function

2011-06-14 Thread Ambrose Bonnaire-Sergeant
Could someone add this as a Jira ticket or similar to be reviewed?

Ambrose

On Wed, Jun 15, 2011 at 2:43 AM, Ambrose Bonnaire-Sergeant <
abonnaireserge...@gmail.com> wrote:

> Inspired by "seq"/"empty?" docstrings.
>
> not-any?
>
> Returns false if (pred x) is logical true for any x in coll,
> else true - same as (not (some pred coll)).
>
>
> some
>
> Returns the first logical true value of (pred x) for any x in coll,
> else nil. One common idiom is to use a set as pred, for example
> this will return :fred if :fred is in the sequence, otherwise nil:
> (some #{:fred} coll)
> Please use the idiom (not-any? pred coll) rather than (not (some pred
> coll))
>
> Thoughts?
>
> Ambrose
>
> On Wed, Jun 15, 2011 at 2:31 AM, Kevin Baribeau 
> wrote:
>
>> I actually had the same thought as the OP when reading through docs not
>> too long ago.
>>
>> +1 for adding a pointer to "some" in the docstring of "not-any?"
>>
>> -kb
>>
>> On Tue, Jun 14, 2011 at 11:29 AM, Ambrose Bonnaire-Sergeant <
>> abonnaireserge...@gmail.com> wrote:
>>
>>> Hi David,
>>>
>>> any? would be redundant and less general than some, if I am not mistaken.
>>> Compare the docstrings for the hypothetical "any?".
>>>
>>> (some p coll)
>>> Returns the *first logical true value* of (pred x) for any x in coll,
>>>   else *nil*.
>>>
>>> (any? p coll)
>>> Returns *true* if (pred x) is logical true for any x in coll,
>>>  else *false*.
>>>
>>>
>>> Since *nil* and *false* are both falsy, "some" can be used as a
>>> predicate that is truthy
>>> when it finds truthy result, otherwise falsy. This is exactly the
>>> behavior expected from
>>> an any? function.
>>>
>>> "some" is a poster boy for Clojure's well thought out truthyness system,
>>> this is a great example
>>> of the types of general functions it allows.
>>>
>>> Perhaps a pointer to "some" should be added in the docstring of
>>> "not-any?". Although
>>> a quick look at the source makes it crystal clear. I wasn't aware of
>>> "not-any?"s existence,
>>> maybe noting it in "some"s docstring could be beneficial also.
>>>
>>> Thanks,
>>> Ambrose
>>>
>>> On Tue, Jun 14, 2011 at 3:08 PM, de1976 wrote:
>>>
 Hello everyone. In looking through the API documentation, I've noticed
 that there is a "not-any?" function available, but there is no
 corresponding inverse "any?" function that I can find. There are,
 however, "every?" and "not-every?" functions available. The closest I
 could find was "some", but wouldn't it make sense to have an "any?"
 function for more obvious consistency? 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
>>>
>>
>>  --
>> 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: No any? function

2011-06-14 Thread Ambrose Bonnaire-Sergeant
On Wed, Jun 15, 2011 at 9:14 AM, CuppoJava wrote:

> There is one use of any? over some which hasn't been mentioned:
> checking whether a list contains a nil.
>
> ie. (when (any? nil? xs) (do stuff))
> vs. (when (some nil? xs) (do stuff))
>
>
Actually, this case works with `some`.

user=> (def any? (comp not not some))
#'user/any?
user=> (any? nil? [1 nil 2])
true
user=> (any? nil? [1 2])
false
user=> (some nil? [1 nil 2])
true
user=> (some nil? [1 2])
nil


Comparing the general semantics, I can see no (useful) distinction between
the two in
`any?`s favor.

`some`
returns nil (falsy) on "failure"
else truthy

`any?`
returns false (falsy) on "failure"
else true (truthy)

.. defining "failure" as all (pred x) in coll being falsy.

Thanks,
Ambrose

 -Patrick
>
> On Jun 14, 9:00 pm, Ken Wesson  wrote:
> > On Tue, Jun 14, 2011 at 12:29 PM, Ambrose Bonnaire-Sergeant
> >
> >  wrote:
> > > "some" is a poster boy for Clojure's well thought out truthyness
> system,
> > > this is a great example of the types of general functions it allows.
> >
> > Notably, with a map as first argument it returns the first (truthy)
> > mapped value for any of the keys in a coll:
> >
> > (if-let [f (some fn-map [:super-override :override :normal])]
> >   (f args))
> >
> > --
> > Protege: What is this seething mass of parentheses?!
> > Master: Your father's Lisp REPL. This is the language of a true
> > hacker. Not as clumsy or random as C++; a language for a more
> > civilized age.
>
> --
> 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: help--reading keyboard input from Clojure is surprisingly difficult

2011-06-14 Thread Albert Cardona
Hi Meikel,

it surprised me that you used an atom to run the event loop. A simple
loop/recur also works, at least in clojure 1.2.1:

(loop []
  (let [input (read-line)]
(when (pos? (count input))
  (println (pick phrases))
  (recur


Just for the record.

Best,

Albert


-- 
http://albert.rierol.net
http://www.ini.uzh.ch/~acardona/

-- 
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: Wisdom sought for functional iterative processing

2011-06-14 Thread Christian Schuhegger
Ah, sorry, perhaps I misunderstand you, but if you use multimethods
(defmulti) in Clojure you do not need to "attach" methods to anything.
The defmulti will allow you "dispatch-on-type" based on the key which
is present in the map  (e.g. if :delete is present or if :insert is
present).

The nice thing about multimethods the lisp style is that they are
additive, e.g. you do not have to change anything in your op
structure.

On Jun 15, 4:38 am, Matthew Phillips  wrote:
> On Jun 14, 12:05 pm, gaz jones  wrote:
>
> > if i was writing the java i would probably do a "tell dont ask"
> > refactoring so that the operations had an applyTo method:
>
> > List items = initialItems ();
>
> > for (Op op : operations)
> > {
> >   op.applyTo(items);
>
> > }
>
> > not sure what your op data structure is, but i would image you could
> > translate that to the clojure code also -- is that reasonable?
>
> I think you're right that the above is a better OO design, but that
> was really just a Java translation of the sort of think I'd like to do
> in Clojure (minus the mutable list).
>
> The ops in this case have abstract meaning (they are [source target
> delta] tuples describing list transformations), and attaching
> "methods" to them (presumably as fn's) in this case would be weird I
> think, as well as requiring a switch from tuples to maps or records.

-- 
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: Wisdom sought for functional iterative processing

2011-06-14 Thread Matthew Phillips
On Jun 15, 11:51 am, Mark Engelberg  wrote:
> On Tue, Jun 14, 2011 at 7:41 PM, Matthew Phillips  wrote:
> > Yes. I agree that can work, and that's what I've done in some other
> > situations, but it has the downside of lots of "recur" points
> > sprinkled around the loop body, which I think makes it almost as hard
> > to reason about as having lots of "return" statements in a Java
> > method. For small problems like this it's just as good/bad as my
> > solution, but what I'm really looking for is a good general idiom to
> > use whenever this sort of thing comes up.
>
> To summarize what others have already pointed out, the main problem
> with your approach is that you're trying to do to much in the loop.
> It's convertible to Clojure, but clunky to read.  The key to making
> this readable is to focus on writing a separate function of the form:
>
> processOp: items op -> items
>
> If you have such a function, the loop is trivial (or use reduce as in
> your original post).

Wouldn't such a processOp be the same as the anonymous fn in my reduce-
based example? I'm really asking how to write that fn better or, more
generally, what is a good idiom for threading conditional
transformations.

I think I'll pursue the -> (or ->>) based approach and see where it
leads, because it seems to fit best with my mental model of pipelining
data transforms.

And it's entirely possible that I'm over-thinking this, but I treat it
as part of learning how to use this tool in its most effective way,
rather than just mentally translating Java into Clojure ;)

-- 
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: Wisdom sought for functional iterative processing

2011-06-14 Thread Mark Engelberg
On Tue, Jun 14, 2011 at 7:41 PM, Matthew Phillips  wrote:
> Yes. I agree that can work, and that's what I've done in some other
> situations, but it has the downside of lots of "recur" points
> sprinkled around the loop body, which I think makes it almost as hard
> to reason about as having lots of "return" statements in a Java
> method. For small problems like this it's just as good/bad as my
> solution, but what I'm really looking for is a good general idiom to
> use whenever this sort of thing comes up.

To summarize what others have already pointed out, the main problem
with your approach is that you're trying to do to much in the loop.
It's convertible to Clojure, but clunky to read.  The key to making
this readable is to focus on writing a separate function of the form:

processOp: items op -> items

If you have such a function, the loop is trivial (or use reduce as in
your original post).

It's hard to know the cleanest way to write such a function without
knowing the details of your problem, but that's really the key.

-- 
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: Wisdom sought for functional iterative processing

2011-06-14 Thread Matthew Phillips
On Jun 14, 4:40 pm, Alex Osborne  wrote:
> Matthew Phillips  writes:
> > The only way I can think of to write it in Clojure is:
>
> > (reduce
> >   (fn [items op]
> >     (let [items1 (if (:delete op) (drop-index (:delete op) items)
> > items)]
> >       (if (:insert op) (cons (:insert op) items1) items1)))
> >   items ops)
>
> > i.e. I'm using a cascade of conditional let's. This isn't _too_ bad in
> > this case, but you can image how unreadable this could get.
>
> To avoid a "cascade of lets" I've occasionally defined a function called
> conj-if (or disj-if or assoc-if...). Like so:
>
>     (defn conj-if [coll test x]
>       (if test (conj coll x) coll))
>
>     (fn [items op]
>       (-> (conj-if (foo? op) "one")
>           (conj-if (bar? op) "two")))
>           (conj-if (baz? op) "three")))
>

Yes, I have thought about using -> to chain transformations together,
in fact it's a little like what I imagine the ST monad (or is it the
State monad?) does by chaining a series of apparent-variable-
assignments together.

I like this idea, but something about writing "xxx-if" functions
doesn't seem right, perhaps due to the number of xxx's there might be.
Perhaps I need a "do-if" fn that takes a target, predicate and a
transform fn, and applies the transform when pred is true. Will have a
think about that.

> On the other hand the cascading lets are really not that bad especially
> if you pull any complex predicate or value-manipulation logic out into
> separate functions:
>
>     (fn [items op]
>       (let [items (if (foo? op) (assoc items "foo" 1) items)
>             items (if (bar? op) (dissoc items "bar")  items)
>             items (if (baz? op) (empty items)         items)]
>         items))

Interesting, it hadn't occurred to me that I could just keep shadowing
"items" in the same let. Usually I think shadowing is a bad idea, but
perhaps it's better than "items1", "items2", etc.

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: Wisdom sought for functional iterative processing

2011-06-14 Thread Matthew Phillips
On Jun 14, 12:30 pm, Mark Engelberg  wrote:
> On Mon, Jun 13, 2011 at 7:37 PM, Matthew Phillips  wrote:
> > List items = initialItems ();
>
> > for (Op op : operations)
> > {
> >  if (op.requiresDelete ())
> >    items.remove (op.indexToDelete ());
>
> >  if (op.requiresAdd ())
> >    items.add (op.indexToAdd (), op.newItem ());
> > }
>
> One way to transform this is loop-recur.
> (loop [items initialitems, ops (seq operations)]
>   (if-not ops items
>     (let [op (first ops)]
>         ;; Now you can write the logic pretty much the way you did in java
>         (cond
>              (.requiresDelete op)  (recur (.remove items (.op
> indexToDelete)) (next ops))
>              (.requiresAdd op) (recur (.add items (.op indexToAdd)
> (.op newItem)) (next ops)

Yes. I agree that can work, and that's what I've done in some other
situations, but it has the downside of lots of "recur" points
sprinkled around the loop body, which I think makes it almost as hard
to reason about as having lots of "return" statements in a Java
method. For small problems like this it's just as good/bad as my
solution, but what I'm really looking for is a good general idiom to
use whenever this sort of thing comes 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: Wisdom sought for functional iterative processing

2011-06-14 Thread Matthew Phillips
On Jun 14, 12:05 pm, gaz jones  wrote:
> if i was writing the java i would probably do a "tell dont ask"
> refactoring so that the operations had an applyTo method:
>
> List items = initialItems ();
>
> for (Op op : operations)
> {
>   op.applyTo(items);
>
> }
>
> not sure what your op data structure is, but i would image you could
> translate that to the clojure code also -- is that reasonable?

I think you're right that the above is a better OO design, but that
was really just a Java translation of the sort of think I'd like to do
in Clojure (minus the mutable list).

The ops in this case have abstract meaning (they are [source target
delta] tuples describing list transformations), and attaching
"methods" to them (presumably as fn's) in this case would be weird I
think, as well as requiring a switch from tuples to maps or records.

-- 
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: Using clojure-csv

2011-06-14 Thread David Santiago
I think the basic problem is Clojure is not able to find the
clojure-csv jar file. I'm afraid I'm not quite clear enough on your
specific setup to know exactly what has gone wrong. I'm not sure where
you have this jar, or what exactly the shell scripting stuff is in
that command you're using to launch it... Can you double-check to make
sure that clojure-csv is on the classpath?

  - David

On Tue, Jun 14, 2011 at 2:26 PM, octopusgrabbus
 wrote:
> I am trying to use clojure-csv, but am having a lot of cockpit error.
>
> Here is my current configuration:
> Running Clojure 1.2.1.
> Modified a shell script installed by Synaptic to include clojure-
> contrib.jar:
>
> exec java -cp /usr/share/java/clojure.jar:/usr/share/java/clojure-
> contrib.jar"$extra_classpath" clojure.main "$@"
>
> clojure.jar and clojure-contrib.jar are links
> lrwxrwxrwx 1 root root      25 2011-06-09 18:38 /usr/share/java/
> clojure-contrib.jar -> clojure-contrib-1.2.0.jar
> lrwxrwxrwx 1 root root      17 2011-06-09 18:23 /usr/share/java/
> clojure.jar -> clojure-1.2.1.jar
> c
>
> This fails:
>
> (ns test-csv
>  (:import (java.io BufferedReader)))
>  (use clojure-csv.core)
>
> with java.lang.ClassNotFoundException: clojure-csv.core
> (NO_SOURCE_FILE:6)
>
> What am I doing wrong?
>
> Thanks.
> cmn
>
> --
> 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: Early Registration has opened for Clojure Conj 2011!

2011-06-14 Thread Sean Corfield
On Tue, Jun 14, 2011 at 5:00 PM, Sean Corfield  wrote:
> On Tue, Jun 14, 2011 at 10:29 AM, Chris Redinger  wrote:
>> http://clojure-conj.org
>> Ticket, venue and initial speaker information has been posted. Sign up
>> today!
>
> Already bought my ticket :)
>
> The link to the hotel reservation system doesn't seem to be working at
> the moment tho'...

This appeared to be a browser issue (with RockMelt).
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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 any? function

2011-06-14 Thread CuppoJava
There is one use of any? over some which hasn't been mentioned:
checking whether a list contains a nil.

ie. (when (any? nil? xs) (do stuff))
vs. (when (some nil? xs) (do stuff))

  -Patrick

On Jun 14, 9:00 pm, Ken Wesson  wrote:
> On Tue, Jun 14, 2011 at 12:29 PM, Ambrose Bonnaire-Sergeant
>
>  wrote:
> > "some" is a poster boy for Clojure's well thought out truthyness system,
> > this is a great example of the types of general functions it allows.
>
> Notably, with a map as first argument it returns the first (truthy)
> mapped value for any of the keys in a coll:
>
> (if-let [f (some fn-map [:super-override :override :normal])]
>   (f args))
>
> --
> Protege: What is this seething mass of parentheses?!
> Master: Your father's Lisp REPL. This is the language of a true
> hacker. Not as clumsy or random as C++; a language for a more
> civilized age.

-- 
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 any? function

2011-06-14 Thread Ken Wesson
On Tue, Jun 14, 2011 at 12:29 PM, Ambrose Bonnaire-Sergeant
 wrote:
> "some" is a poster boy for Clojure's well thought out truthyness system,
> this is a great example of the types of general functions it allows.

Notably, with a map as first argument it returns the first (truthy)
mapped value for any of the keys in a coll:

(if-let [f (some fn-map [:super-override :override :normal])]
  (f args))

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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: Where to place Arguments

2011-06-14 Thread Ken Wesson
On Tue, Jun 14, 2011 at 8:12 PM, Sean Corfield  wrote:
> On Tue, Jun 14, 2011 at 1:28 PM, Nick Zbinden  wrote:
>> Stu said:
>> Objects should be the first parameter to a function (like it would be
>> in traditional OO).
>> Collections sould be in the last place in th parameter list.
>>
>> This is because it makes the use of the threading operater easy -> for
>> Objects ->> for Collections really easy and can make code much better
>> to read.
>
> Timely. This came up in another thread recently and it was pointed out
> that several core functions have the collection argument first: nth,
> assoc, contains?, get-in, assoc-in, update-in ...
>
> Given the stated preference for collections appearing as the last
> argument, is there some particular reason why these functions are
> exceptions? Or is it just a legacy accident before the "standard" of
> collection-last was established?

Most of those are map rather than sequence ops. The one that stands
out as awkward is nth. (nth 3 [1 2 3 4 5]) should probably be the way
it goes.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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: Using clojure-csv

2011-06-14 Thread Ken Wesson
On Tue, Jun 14, 2011 at 3:26 PM, octopusgrabbus
 wrote:
> This fails:
>
> (ns test-csv
>  (:import (java.io BufferedReader)))
>  (use clojure-csv.core)
>
> with java.lang.ClassNotFoundException: clojure-csv.core
> (NO_SOURCE_FILE:6)
>
> What am I doing wrong?

One thing that stands out is that it should be (:use ...) and not (use
) in an (ns ...) form. But I wouldn't expect that to cause a
ClassNotFoundException.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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: Where to place Arguments

2011-06-14 Thread Sean Corfield
On Tue, Jun 14, 2011 at 1:28 PM, Nick Zbinden  wrote:
> Stu said:
> Objects should be the first parameter to a function (like it would be
> in traditional OO).
> Collections sould be in the last place in th parameter list.
>
> This is because it makes the use of the threading operater easy -> for
> Objects ->> for Collections really easy and can make code much better
> to read.

Timely. This came up in another thread recently and it was pointed out
that several core functions have the collection argument first: nth,
assoc, contains?, get-in, assoc-in, update-in ...

Given the stated preference for collections appearing as the last
argument, is there some particular reason why these functions are
exceptions? Or is it just a legacy accident before the "standard" of
collection-last was established?
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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: Early Registration has opened for Clojure Conj 2011!

2011-06-14 Thread Sean Corfield
On Tue, Jun 14, 2011 at 10:29 AM, Chris Redinger  wrote:
> http://clojure-conj.org
> Ticket, venue and initial speaker information has been posted. Sign up
> today!

Already bought my ticket :)

The link to the hotel reservation system doesn't seem to be working at
the moment tho'...
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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: Using clojure-csv

2011-06-14 Thread octopusgrabbus
In regards to the extra_classpath question, this is what Synaptic
installed in /usr/bin/clojure

#!/bin/sh

if [ "x$CLASSPATH" = "x" ] ; then
extra_classpath=""
else
extra_classpath=":$CLASSPATH"
fi

while true ; do
case "$1" in
-cp | -classpath)
extra_classpath=":$2"
shift 2 ;;
--)
shift
break ;;
*)
break ;;
esac
done

exec java -cp /usr/share/java/clojure.jar"$extra_classpath"
clojure.main "$@"
#exec java -cp /usr/share/java/clojure.jar:/usr/share/java/clojure-
contrib.jar"$extra_classpath" clojure.main "$@"

On Jun 14, 4:04 pm, Chas Emerick  wrote:
> clojure-csv is not a part of clojure-contrib.  What is at $extra_classpath?  
> For this to work, it would need to include the jar for clojure-csv.
>
> - Chas
>
> P.S. Mostly off-topic: the sooner you can get away from whatever re-packaging 
> your distro has put together for Clojure, the better off you'll be.  Linux 
> package managers are generally not kind with Java (or python or ruby, etc) 
> libraries, at least in my experience.
>
> On Jun 14, 2011, at 3:26 PM, octopusgrabbus wrote:
>
>
>
>
>
>
>
> > I am trying to use clojure-csv, but am having a lot of cockpit error.
>
> > Here is my current configuration:
> > Running Clojure 1.2.1.
> > Modified a shell script installed by Synaptic to include clojure-
> > contrib.jar:
>
> > exec java -cp /usr/share/java/clojure.jar:/usr/share/java/clojure-
> > contrib.jar"$extra_classpath" clojure.main "$@"
>
> > clojure.jar and clojure-contrib.jar are links
> > lrwxrwxrwx 1 root root      25 2011-06-09 18:38 /usr/share/java/
> > clojure-contrib.jar -> clojure-contrib-1.2.0.jar
> > lrwxrwxrwx 1 root root      17 2011-06-09 18:23 /usr/share/java/
> > clojure.jar -> clojure-1.2.1.jar
> > c
>
> > This fails:
>
> > (ns test-csv
> >  (:import (java.io BufferedReader)))
> >  (use clojure-csv.core)
>
> > with java.lang.ClassNotFoundException: clojure-csv.core
> > (NO_SOURCE_FILE:6)
>
> > What am I doing wrong?
>
> > Thanks.
> > cmn
>
> > --
> > 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: Using clojure-csv

2011-06-14 Thread octopusgrabbus
Thanks. You've answered my question. I've got to set up a real
projects directory and build the jar file.
I appreciate everyone's patience during this "cockpit error" phase of
my learning Clojure.

On Jun 14, 4:04 pm, Chas Emerick  wrote:
> clojure-csv is not a part of clojure-contrib.  What is at $extra_classpath?  
> For this to work, it would need to include the jar for clojure-csv.
>
> - Chas
>
> P.S. Mostly off-topic: the sooner you can get away from whatever re-packaging 
> your distro has put together for Clojure, the better off you'll be.  Linux 
> package managers are generally not kind with Java (or python or ruby, etc) 
> libraries, at least in my experience.
>
> On Jun 14, 2011, at 3:26 PM, octopusgrabbus wrote:
>
>
>
>
>
>
>
> > I am trying to use clojure-csv, but am having a lot of cockpit error.
>
> > Here is my current configuration:
> > Running Clojure 1.2.1.
> > Modified a shell script installed by Synaptic to include clojure-
> > contrib.jar:
>
> > exec java -cp /usr/share/java/clojure.jar:/usr/share/java/clojure-
> > contrib.jar"$extra_classpath" clojure.main "$@"
>
> > clojure.jar and clojure-contrib.jar are links
> > lrwxrwxrwx 1 root root      25 2011-06-09 18:38 /usr/share/java/
> > clojure-contrib.jar -> clojure-contrib-1.2.0.jar
> > lrwxrwxrwx 1 root root      17 2011-06-09 18:23 /usr/share/java/
> > clojure.jar -> clojure-1.2.1.jar
> > c
>
> > This fails:
>
> > (ns test-csv
> >  (:import (java.io BufferedReader)))
> >  (use clojure-csv.core)
>
> > with java.lang.ClassNotFoundException: clojure-csv.core
> > (NO_SOURCE_FILE:6)
>
> > What am I doing wrong?
>
> > Thanks.
> > cmn
>
> > --
> > 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: Early Registration has opened for Clojure Conj 2011!

2011-06-14 Thread Anthony Grimes
Awesome! Looking forward to it. :)

-- 
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

Where to place Arguments

2011-06-14 Thread Nick Zbinden
Hallo all,

I just watched the talk Radical Simplicity (bit.ly/lsub9h)  by Stuart
Halloway. Very Intressting but one little thing he says I wanted to
threw in the groupe because its kind of a half know thing and it
should really move into the Clojure Coding Standard.

Stu said:
Objects should be the first parameter to a function (like it would be
in traditional OO).
Collections sould be in the last place in th parameter list.

This is because it makes the use of the threading operater easy -> for
Objects ->> for Collections really easy and can make code much better
to read.

I'm writing this here because of two reasons:
1. The universial threading operator keeps showing up. Im not saying
its a always a bad thing but I think we should trie to avoid it in
most cases and the standard on the parameter order would help.

2. The Question of where to put this stuff pops up again and again
(IRC, Stackoverflow). We, as a Communety, should have a standard
answer to this.


What do you guys think?






-- 
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: bug in partition?

2011-06-14 Thread Razvan Rotaru
Thanks for the hint. And don't worry about the meaning of this
function. :) Name parameter has no use. And the regex stuff's for the
url.

Razvan

-- 
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: Using clojure-csv

2011-06-14 Thread Chas Emerick
clojure-csv is not a part of clojure-contrib.  What is at $extra_classpath?  
For this to work, it would need to include the jar for clojure-csv.

- Chas

P.S. Mostly off-topic: the sooner you can get away from whatever re-packaging 
your distro has put together for Clojure, the better off you'll be.  Linux 
package managers are generally not kind with Java (or python or ruby, etc) 
libraries, at least in my experience.

On Jun 14, 2011, at 3:26 PM, octopusgrabbus wrote:

> I am trying to use clojure-csv, but am having a lot of cockpit error.
> 
> Here is my current configuration:
> Running Clojure 1.2.1.
> Modified a shell script installed by Synaptic to include clojure-
> contrib.jar:
> 
> exec java -cp /usr/share/java/clojure.jar:/usr/share/java/clojure-
> contrib.jar"$extra_classpath" clojure.main "$@"
> 
> clojure.jar and clojure-contrib.jar are links
> lrwxrwxrwx 1 root root  25 2011-06-09 18:38 /usr/share/java/
> clojure-contrib.jar -> clojure-contrib-1.2.0.jar
> lrwxrwxrwx 1 root root  17 2011-06-09 18:23 /usr/share/java/
> clojure.jar -> clojure-1.2.1.jar
> c
> 
> This fails:
> 
> (ns test-csv
>  (:import (java.io BufferedReader)))
>  (use clojure-csv.core)
> 
> with java.lang.ClassNotFoundException: clojure-csv.core
> (NO_SOURCE_FILE:6)
> 
> What am I doing wrong?
> 
> Thanks.
> cmn
> 
> -- 
> 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: hammock driven development...

2011-06-14 Thread Devin Walters
It might get people to quit looking at their infernal phones and laptops for 5 
minutes. ;)

-- 
Devin Walters


On Tuesday, June 14, 2011 at 2:50 PM, Laurent PETIT wrote:

> Would be very funny if for the upcoming clojure conj, attendants as
> well as speakers were all lying in hammocks !
> That certainly would make the Buzz ! :-D
> 
> 2011/6/12 Nick Brown mailto:nwbr...@gmail.com)>:
> > Going for walks also helps me. Having some form a mild physical
> > activity that I don't have to concentrate on seems to help me think.
> > It can be a walk around the block, a hike through the park, or just
> > walking around the office. You also get the added benefits of it
> > being good for your health, and you can get away with it easier at
> > work.
> > And while I like my hammock, lying down it in often results in me
> > falling asleep (and waking up covered in mosquito bites). Though I
> > seem to remember Rich suggesting much of your thinking goes on while
> > you are asleep (but in your bed will probably result in fewer mosquito
> > bites, especially in North Carolina summers).
> > 
> > I think my notes from that talk read something like this:
> > Bring hammock to work. :)
> > Go to sleep sober. :(
> > 
> > Nick Brown
> > http://standardout.wordpress.com/
> > 
> > On Jun 9, 1:09 pm, Brian Marick http://exampler.com)> 
> > wrote:
> > > On Jun 9, 2011, at 3:27 PM, Jules wrote:
> > > 
> > > > I'd also like to say this - TAKE THE HAMMOCK BIT SERIOUSLY - there is a 
> > > > growing body or research that indicates that you can problem solve 
> > > > better lying down. This may stem from the release of certain hormones, 
> > > > increased blood supply, maybe simply the fact that you are not wasting 
> > > > cycles and bandwidth trying to stay upright etc...
> > > 
> > > I heard Guy Steele say he gets his best ideas in the shower. Since he has 
> > > more brilliant ideas than any ten impressive people, he must take a lot 
> > > of showers.
> > > 
> > > I too get my best ideas in the shower. Or on long walks.
> > > 
> > > Mileage varies.
> > > 
> > > -
> > > Brian Marick, Artisanal Labrador
> > > Contract programming in Ruby and Clojure
> > > Occasional consulting on Agilewww.exampler.com 
> > > (http://www.exampler.com),www.twitter.com/marick 
> > > (http://www.twitter.com/marick)
> > 
> > --
> > 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 
> > (mailto: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 
> > (mailto: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 
> (mailto: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 
> (mailto: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: hammock driven development...

2011-06-14 Thread Laurent PETIT
Would be very funny if for the upcoming clojure conj, attendants as
well as speakers were all lying in hammocks !
That certainly would make the Buzz ! :-D

2011/6/12 Nick Brown :
> Going for walks also helps me.  Having some form a mild physical
> activity that I don't have to concentrate on seems to help me think.
> It can be a walk around the block, a hike through the park, or just
> walking around the office.  You also get the added benefits of it
> being good for your health, and you can get away with it easier at
> work.
> And while I like my hammock, lying down it in often results in me
> falling asleep (and waking up covered in mosquito bites).  Though I
> seem to remember Rich suggesting much of your thinking goes on while
> you are asleep (but in your bed will probably result in fewer mosquito
> bites, especially in North Carolina summers).
>
> I think my notes from that talk read something like this:
> Bring hammock to work.  :)
> Go to sleep sober.  :(
>
> Nick Brown
> http://standardout.wordpress.com/
>
> On Jun 9, 1:09 pm, Brian Marick  wrote:
>> On Jun 9, 2011, at 3:27 PM, Jules wrote:
>>
>> > I'd also like to say this - TAKE THE HAMMOCK BIT SERIOUSLY - there is a 
>> > growing body or research that indicates that you can problem solve better 
>> > lying down. This may stem from the release of certain hormones, increased 
>> > blood supply, maybe simply the fact that you are not wasting cycles and 
>> > bandwidth trying to stay upright etc...
>>
>> I heard Guy Steele say he gets his best ideas in the shower. Since he has 
>> more brilliant ideas than any ten impressive people, he must take a lot of 
>> showers.
>>
>> I too get my best ideas in the shower. Or on long walks.
>>
>> Mileage varies.
>>
>> -
>> Brian Marick, Artisanal Labrador
>> Contract programming in Ruby and Clojure
>> Occasional consulting on Agilewww.exampler.com,www.twitter.com/marick
>
> --
> 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: Vim Nailgun setup - access to REPL from outside Vim

2011-06-14 Thread Razvan Rotaru
You may also want to have a look at slimv. 
http://www.vim.org/scripts/script.php?script_id=2531
It performs quite nice (can't compare it with vimclojure though,
'cause I don't know vimclojure).

Razvan

-- 
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


Using clojure-csv

2011-06-14 Thread octopusgrabbus
I am trying to use clojure-csv, but am having a lot of cockpit error.

Here is my current configuration:
Running Clojure 1.2.1.
Modified a shell script installed by Synaptic to include clojure-
contrib.jar:

exec java -cp /usr/share/java/clojure.jar:/usr/share/java/clojure-
contrib.jar"$extra_classpath" clojure.main "$@"

clojure.jar and clojure-contrib.jar are links
lrwxrwxrwx 1 root root  25 2011-06-09 18:38 /usr/share/java/
clojure-contrib.jar -> clojure-contrib-1.2.0.jar
lrwxrwxrwx 1 root root  17 2011-06-09 18:23 /usr/share/java/
clojure.jar -> clojure-1.2.1.jar
c

This fails:

(ns test-csv
  (:import (java.io BufferedReader)))
  (use clojure-csv.core)

with java.lang.ClassNotFoundException: clojure-csv.core
(NO_SOURCE_FILE:6)

What am I doing wrong?

Thanks.
cmn

-- 
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 any? function

2011-06-14 Thread Kevin Baribeau
Looks good to me.

I wasn't familiar with the docs around (seq x) vs (not (empty? x)). That
seems like a good place to draw the language from.

-kb

On Tue, Jun 14, 2011 at 1:43 PM, Ambrose Bonnaire-Sergeant <
abonnaireserge...@gmail.com> wrote:

> Inspired by "seq"/"empty?" docstrings.
>
> not-any?
>
> Returns false if (pred x) is logical true for any x in coll,
> else true - same as (not (some pred coll)).
>
>
> some
>
> Returns the first logical true value of (pred x) for any x in coll,
> else nil. One common idiom is to use a set as pred, for example
> this will return :fred if :fred is in the sequence, otherwise nil:
> (some #{:fred} coll)
> Please use the idiom (not-any? pred coll) rather than (not (some pred
> coll))
>
> Thoughts?
>
> Ambrose
>
> On Wed, Jun 15, 2011 at 2:31 AM, Kevin Baribeau 
> wrote:
>
>> I actually had the same thought as the OP when reading through docs not
>> too long ago.
>>
>> +1 for adding a pointer to "some" in the docstring of "not-any?"
>>
>> -kb
>>
>> On Tue, Jun 14, 2011 at 11:29 AM, Ambrose Bonnaire-Sergeant <
>> abonnaireserge...@gmail.com> wrote:
>>
>>> Hi David,
>>>
>>> any? would be redundant and less general than some, if I am not mistaken.
>>> Compare the docstrings for the hypothetical "any?".
>>>
>>> (some p coll)
>>> Returns the *first logical true value* of (pred x) for any x in coll,
>>>   else *nil*.
>>>
>>> (any? p coll)
>>> Returns *true* if (pred x) is logical true for any x in coll,
>>>  else *false*.
>>>
>>>
>>> Since *nil* and *false* are both falsy, "some" can be used as a
>>> predicate that is truthy
>>> when it finds truthy result, otherwise falsy. This is exactly the
>>> behavior expected from
>>> an any? function.
>>>
>>> "some" is a poster boy for Clojure's well thought out truthyness system,
>>> this is a great example
>>> of the types of general functions it allows.
>>>
>>> Perhaps a pointer to "some" should be added in the docstring of
>>> "not-any?". Although
>>> a quick look at the source makes it crystal clear. I wasn't aware of
>>> "not-any?"s existence,
>>> maybe noting it in "some"s docstring could be beneficial also.
>>>
>>> Thanks,
>>> Ambrose
>>>
>>> On Tue, Jun 14, 2011 at 3:08 PM, de1976 wrote:
>>>
 Hello everyone. In looking through the API documentation, I've noticed
 that there is a "not-any?" function available, but there is no
 corresponding inverse "any?" function that I can find. There are,
 however, "every?" and "not-every?" functions available. The closest I
 could find was "some", but wouldn't it make sense to have an "any?"
 function for more obvious consistency? 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
>>>
>>
>>  --
>> 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: No any? function

2011-06-14 Thread Ambrose Bonnaire-Sergeant
Inspired by "seq"/"empty?" docstrings.

not-any?

Returns false if (pred x) is logical true for any x in coll,
else true - same as (not (some pred coll)).


some

Returns the first logical true value of (pred x) for any x in coll,
else nil. One common idiom is to use a set as pred, for example
this will return :fred if :fred is in the sequence, otherwise nil:
(some #{:fred} coll)
Please use the idiom (not-any? pred coll) rather than (not (some pred coll))

Thoughts?

Ambrose

On Wed, Jun 15, 2011 at 2:31 AM, Kevin Baribeau wrote:

> I actually had the same thought as the OP when reading through docs not too
> long ago.
>
> +1 for adding a pointer to "some" in the docstring of "not-any?"
>
> -kb
>
> On Tue, Jun 14, 2011 at 11:29 AM, Ambrose Bonnaire-Sergeant <
> abonnaireserge...@gmail.com> wrote:
>
>> Hi David,
>>
>> any? would be redundant and less general than some, if I am not mistaken.
>> Compare the docstrings for the hypothetical "any?".
>>
>> (some p coll)
>> Returns the *first logical true value* of (pred x) for any x in coll,
>>   else *nil*.
>>
>> (any? p coll)
>> Returns *true* if (pred x) is logical true for any x in coll,
>>  else *false*.
>>
>>
>> Since *nil* and *false* are both falsy, "some" can be used as a predicate
>> that is truthy
>> when it finds truthy result, otherwise falsy. This is exactly the behavior
>> expected from
>> an any? function.
>>
>> "some" is a poster boy for Clojure's well thought out truthyness system,
>> this is a great example
>> of the types of general functions it allows.
>>
>> Perhaps a pointer to "some" should be added in the docstring of
>> "not-any?". Although
>> a quick look at the source makes it crystal clear. I wasn't aware of
>> "not-any?"s existence,
>> maybe noting it in "some"s docstring could be beneficial also.
>>
>> Thanks,
>> Ambrose
>>
>> On Tue, Jun 14, 2011 at 3:08 PM, de1976 wrote:
>>
>>> Hello everyone. In looking through the API documentation, I've noticed
>>> that there is a "not-any?" function available, but there is no
>>> corresponding inverse "any?" function that I can find. There are,
>>> however, "every?" and "not-every?" functions available. The closest I
>>> could find was "some", but wouldn't it make sense to have an "any?"
>>> function for more obvious consistency? 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
>>
>
>  --
> 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: No any? function

2011-06-14 Thread Kevin Baribeau
I actually had the same thought as the OP when reading through docs not too
long ago.

+1 for adding a pointer to "some" in the docstring of "not-any?"

-kb

On Tue, Jun 14, 2011 at 11:29 AM, Ambrose Bonnaire-Sergeant <
abonnaireserge...@gmail.com> wrote:

> Hi David,
>
> any? would be redundant and less general than some, if I am not mistaken.
> Compare the docstrings for the hypothetical "any?".
>
> (some p coll)
> Returns the *first logical true value* of (pred x) for any x in coll,
>   else *nil*.
>
> (any? p coll)
> Returns *true* if (pred x) is logical true for any x in coll,
>  else *false*.
>
>
> Since *nil* and *false* are both falsy, "some" can be used as a predicate
> that is truthy
> when it finds truthy result, otherwise falsy. This is exactly the behavior
> expected from
> an any? function.
>
> "some" is a poster boy for Clojure's well thought out truthyness system,
> this is a great example
> of the types of general functions it allows.
>
> Perhaps a pointer to "some" should be added in the docstring of "not-any?".
> Although
> a quick look at the source makes it crystal clear. I wasn't aware of
> "not-any?"s existence,
> maybe noting it in "some"s docstring could be beneficial also.
>
> Thanks,
> Ambrose
>
> On Tue, Jun 14, 2011 at 3:08 PM, de1976 wrote:
>
>> Hello everyone. In looking through the API documentation, I've noticed
>> that there is a "not-any?" function available, but there is no
>> corresponding inverse "any?" function that I can find. There are,
>> however, "every?" and "not-every?" functions available. The closest I
>> could find was "some", but wouldn't it make sense to have an "any?"
>> function for more obvious consistency? 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
>

-- 
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: Simple Empty Vector Question

2011-06-14 Thread Ambrose Bonnaire-Sergeant
Yes that is correct. These forms are equivalent:

(defn login-page [] ...)

(def login-page (fn []  ))


Thanks,
Ambrose

On Wed, Jun 15, 2011 at 1:51 AM, octopusgrabbus wrote:

> In the following code (from Brian Carper's cow-blog)
>
> (defn login-page
>  "Page to let an admin log in."
>  []
>  {:title "Login"
>   :body [:div [:h3 "Log in"]
>  (form-to [:post "/login"]
>   (form-row "Username" "username" text-field)
>   (form-row "Password" "password" password-field)
>   (submit-row "Log in"))]})
>
> on the third line there are empty vector brackets. I believe this is
> defining the function as having now parameters. Is that correct?
>
> Thank you.
>
> --
> 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

Simple Empty Vector Question

2011-06-14 Thread octopusgrabbus
In the following code (from Brian Carper's cow-blog)

(defn login-page
  "Page to let an admin log in."
  []
  {:title "Login"
   :body [:div [:h3 "Log in"]
  (form-to [:post "/login"]
   (form-row "Username" "username" text-field)
   (form-row "Password" "password" password-field)
   (submit-row "Log in"))]})

on the third line there are empty vector brackets. I believe this is
defining the function as having now parameters. Is that correct?

Thank you.

-- 
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


Early Registration has opened for Clojure Conj 2011!

2011-06-14 Thread Chris Redinger
http://clojure-conj.org

Ticket, venue and initial speaker information has been posted. Sign up
today!

-- 
Christopher Redinger
Clojure/core
http://clojure.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: No any? function

2011-06-14 Thread Ambrose Bonnaire-Sergeant
Hi David,

any? would be redundant and less general than some, if I am not mistaken.
Compare the docstrings for the hypothetical "any?".

(some p coll)
Returns the *first logical true value* of (pred x) for any x in coll,
  else *nil*.

(any? p coll)
Returns *true* if (pred x) is logical true for any x in coll,
 else *false*.


Since *nil* and *false* are both falsy, "some" can be used as a predicate
that is truthy
when it finds truthy result, otherwise falsy. This is exactly the behavior
expected from
an any? function.

"some" is a poster boy for Clojure's well thought out truthyness system,
this is a great example
of the types of general functions it allows.

Perhaps a pointer to "some" should be added in the docstring of "not-any?".
Although
a quick look at the source makes it crystal clear. I wasn't aware of
"not-any?"s existence,
maybe noting it in "some"s docstring could be beneficial also.

Thanks,
Ambrose

On Tue, Jun 14, 2011 at 3:08 PM, de1976  wrote:

> Hello everyone. In looking through the API documentation, I've noticed
> that there is a "not-any?" function available, but there is no
> corresponding inverse "any?" function that I can find. There are,
> however, "every?" and "not-every?" functions available. The closest I
> could find was "some", but wouldn't it make sense to have an "any?"
> function for more obvious consistency? 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

RE: Vim Nailgun setup - access to REPL from outside Vim

2011-06-14 Thread Bhinderwala, Shoeb
Thanks Meikel. This did exactly what I wanted. Thanks for your efforts.

 



From: clojure@googlegroups.com [mailto:clojure@googlegroups.com] On
Behalf Of Meikel Brandmeyer
Sent: Tuesday, June 14, 2011 7:25 AM
To: clojure@googlegroups.com
Subject: Aw: Vim Nailgun setup - access to REPL from outside Vim

 

Hi,

do it the other way around. First start the repl. Then do a "(require
'vimclojure.nails) (vimclojure.nails/start-server-thread)". This will
setup the vim backend in the background while you can still work with
the repl.

Hope that helps.

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

-- 
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: Svar: transients are not designed to be bashed in-place

2011-06-14 Thread David Nolen
On Tue, Jun 14, 2011 at 1:56 AM, alsor  wrote:

> Just out of curiosity, are these some implementation's peculiarities or
> it's intentional design?


Intentional design.

David

-- 
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: Svar: Ideas from Fortress

2011-06-14 Thread Denis Labaye
>From my emacs start up file:

;; prevent slime to crash when encountering non ascii char
(set-language-environment "UTF-8")
(setq slime-net-coding-system 'utf-8-unix)
Le 14 juin 2011 06:16, "jlk"  a écrit :
> Hello
>
> Is there a trick to making this work in emacs/slime?
>
> If I enter pi in the *slime-repl clojure* buffer:
> cond: Coding system iso-latin-1-unix not suitable for "43(:emacs-
> rex (swank:listener-eval \"π\") \"jlk.math\" :repl-thread 19)
> so the encoding type is not UTF, but I can't set it using C-x Ret f
>
> Pi character works fine in the *infererior-lisp* buffer
>
> - Lachlan
>
>
> On Jun 11, 3:19 am, Stuart Sierra  wrote:
>> Symbols already permit Unicode characters. The Clojure reader assumes
>> UTF-8.  This may or may not render in G. Groups, though:
>>
>> user=> (def π (Math/PI))
>> #'user/π
>> user=> π
>> 3.141592653589793
>>
>> Of course, there's no actual layout, but you could write code that reads
a
>> mathematical expression in Clojure and generates TeX or something.
>>
>> -Stuart Sierra
>> clojure.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

-- 
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: Aw: Re: Aw: Re: transients are not designed to be bashed in-place

2011-06-14 Thread alsor
Yes, you're right - if I'm going to use transients, then I have to be sure 
that .search is single-threaded. Because I can't have both - transient's 
mutable properties and STM's properties of atom.

So, in my case I can use combination of atom and transients - because I know 
exact Searcher's implementation that I'm using, but in more general case I 
should not use transients at all - because they're leaking into third-party 
API call. 

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

No any? function

2011-06-14 Thread de1976
Hello everyone. In looking through the API documentation, I've noticed
that there is a "not-any?" function available, but there is no
corresponding inverse "any?" function that I can find. There are,
however, "every?" and "not-every?" functions available. The closest I
could find was "some", but wouldn't it make sense to have an "any?"
function for more obvious consistency? 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: Aw: Re: transients are not designed to be bashed in-place

2011-06-14 Thread alsor
Oh no, now the swap! might be a problem... from its doc: "Note that f may be 
called multiple times, and thus should be free of side effects", and I think 
it's no more side-effect free when we are using transients. 

So close! :-)

-- 
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: Aw: Re: transients are not designed to be bashed in-place

2011-06-14 Thread alsor
Wow, that's really good idea! Returned value of conj! is not ignored, and 
overall function should not produce unnecessary garbage on the heap. 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: Svar: transients are not designed to be bashed in-place

2011-06-14 Thread alsor
Just out of curiosity, are these some implementation's peculiarities or it's 
intentional design?

-- 
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: transients are not designed to be bashed in-place

2011-06-14 Thread alsor
The thing is, this .search method will invoke MyCustomCollector.collect 
method many times, for each matching document.

-- 
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: transients are not designed to be bashed in-place

2011-06-14 Thread alsor
Thanks for the interesting point about possible parallel implementation of 
search method. 

I think I will stay with atom implementation, because in this particular 
case I don't need to squeeze out maximum performance from this function.

But I wonder, what if in some similar case the performance will be very 
critical - then the only choice will be to implement Collector in Java using 
one of the Java's mutable collection and then convert it into Clojure's 
persistent collection? Because I really don't want to produce unnecessary 
objects on the heap while collecting all results. 

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: SQL queries on csv-files

2011-06-14 Thread Mark
Although it may be overkill for you, take a look at Teiid:  http://teiid.org


On Jun 14, 5:30 am, finbeu  wrote:
> Hello,
>
> I have a couple of csv files that are actually dumped data from SQL
> tables. These tables have proper relationships with key, foreign keys
> so they can be easily joined using SQL.
>
> I would like to load them into memory and then appy SQL queries on
> that data. So in fact, I'm looking for a clojure in-memory SQL
> database that allows me to slurp the csv files, treat them as tables
> and run sql queries on them.
>
> I already looked into clojure.set and this would work. But is there
> another library to look into? Maybe a clojure SQL set of macros that
> allow to issue "real" SQL queries? I don't want to install sqlite and
> jdbc-drivers and stuff like this. Just load csv file into memory and
> run SQL queries within clojure.
>
> Thx.
>
> Finn

-- 
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


SQL queries on csv-files

2011-06-14 Thread finbeu
Hello,

I have a couple of csv files that are actually dumped data from SQL
tables. These tables have proper relationships with key, foreign keys
so they can be easily joined using SQL.

I would like to load them into memory and then appy SQL queries on
that data. So in fact, I'm looking for a clojure in-memory SQL
database that allows me to slurp the csv files, treat them as tables
and run sql queries on them.

I already looked into clojure.set and this would work. But is there
another library to look into? Maybe a clojure SQL set of macros that
allow to issue "real" SQL queries? I don't want to install sqlite and
jdbc-drivers and stuff like this. Just load csv file into memory and
run SQL queries within clojure.

Thx.

Finn

-- 
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: lein and emacs

2011-06-14 Thread Matjaz Gregoric
If you need extra libraries in your classpath, you can give lein-oneoff
plugin a try:
https://github.com/mtyaka/lein-oneoff

Using lein-oneoff, you should first define your dependencies in a clojure
file (mydeps.clj) and then issuing the following command:
lein oneoff --swank mydeps.clj

This will start a swank server with a properly adjusted classpath.

You still need to create the mydeps.clj file, but you don't need to create a
brand new leiningen project.

Regards,
Matjaz


On Tue, Jun 14, 2011 at 1:36 PM, Rasmus Svensson wrote:

> 2011/6/14 Vincent :
> >
> > Dear all ,
> > I am using emacs with lein
> > I want to try out repl in emacs , but without creating a new project
> using
> > lien
> > Presently , following steps i have to do to start repl
> > 1. lein new project1   ( dummy project    as i have only run repl )
> > 2. cd project1
> > 3. modifying project.clj to set dependencies and dev depend.
> > 4. run lein deps
> > 5. run lein swank
> > If project already there , then   step 2  , step 5
> > 6. in emacs ,  M-x slime-connect .v
> > Thanks in advance
> > Vincent
>
> If you install swank-clojure as a leiningen plugin, it installs a
> shell script for this in ~/.lein/bin/swank-clojure:
>
> 0. lein plugin install swank-clojure 1.3.1 (if you haven't done this)
> 1. ~/.bin/bin/swank-clojure (or
> %USERPROFILE%/.lein/bin/swank-clojure.bat on Windows)
> 2. M-x slime-connect
>
> This will give you a repl with _some_ version of Clojure and no
> contrib or any extra libraries. (If you need to control the version
> and libraries used, you should be using a project.)
>
> // raek
>
> --
> 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: lein and emacs

2011-06-14 Thread Rasmus Svensson
2011/6/14 Vincent :
>
> Dear all ,
> I am using emacs with lein
> I want to try out repl in emacs , but without creating a new project using
> lien
> Presently , following steps i have to do to start repl
> 1. lein new project1   ( dummy project    as i have only run repl )
> 2. cd project1
> 3. modifying project.clj to set dependencies and dev depend.
> 4. run lein deps
> 5. run lein swank
> If project already there , then   step 2  , step 5
> 6. in emacs ,  M-x slime-connect .v
> Thanks in advance
> Vincent

If you install swank-clojure as a leiningen plugin, it installs a
shell script for this in ~/.lein/bin/swank-clojure:

0. lein plugin install swank-clojure 1.3.1 (if you haven't done this)
1. ~/.bin/bin/swank-clojure (or
%USERPROFILE%/.lein/bin/swank-clojure.bat on Windows)
2. M-x slime-connect

This will give you a repl with _some_ version of Clojure and no
contrib or any extra libraries. (If you need to control the version
and libraries used, you should be using a project.)

// raek

-- 
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


Aw: Vim Nailgun setup - access to REPL from outside Vim

2011-06-14 Thread Meikel Brandmeyer
Hi,

do it the other way around. First start the repl. Then do a "(require 
'vimclojure.nails) (vimclojure.nails/start-server-thread)". This will setup 
the vim backend in the background while you can still work with the repl.

Hope that helps.

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

Vim Nailgun setup - access to REPL from outside Vim

2011-06-14 Thread Shoeb Bhinderwala
I setup Vim to use nailgun server. I start the nailgun server using
"lein vimclojure" plugin and use the VimClojure vim plugin to connect
to it. Everything works great and I can start a REPL inside Vim using
the command :ClojureRepl. All of this is on Windows 7.

However, I want to start a REPL on the same nailgun server instance
from outside of Vim - from my command prompt. So that I can send my
expressions to the server from the Vim editor but then switch to my
command prompt REPL (in another window) to test it out. Is there a
command/technique to do this?

Thanks
Shoeb

-- 
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: lein and emacs

2011-06-14 Thread Tassilo Horn
Vincent  writes:

Hi!

> I am using emacs with lein 

Depending on you clojure-mode version (I think you need 1.9.1), it's
possible that

  M-x clojure-jack-in RET

does everything needed to fire up a SLIME REPL in emacs.  Have a look at
the thread "Radically simplified Emacs and SLIME setup" starting with
the message

  

Bye,
Tassilo

-- 
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


lein and emacs

2011-06-14 Thread Vincent

Dear all ,

I am using emacs with lein 
I want to try out repl in emacs , but without creating a new project using 
lien 
 Presently , following steps i have to do to start repl

1. lein new project1   ( dummy project    as i have only run repl )
2. cd project1
3. modifying project.clj to set dependencies and dev depend.
4. run lein deps
5. run lein swank

If project already there , then   step 2  , step 5

6. in emacs ,  M-x slime-connect .v 
Thanks in advance
Vincent 

-- 
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: rand-nth throwing an exception

2011-06-14 Thread Jarek Siembida
I don't think either is worse or better, the lack of consistency
is imho worse than either of the approaches. One has to
remember that in the corner case function A behaves this
way but function B behaves the other way.

jarek

-- 
In theory, there is no difference between theory and practice.
But in practice, there is.

-- 
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: Wisdom sought for functional iterative processing

2011-06-14 Thread Alex Osborne
Matthew Phillips  writes:

> The only way I can think of to write it in Clojure is:
>
> (reduce
>   (fn [items op]
> (let [items1 (if (:delete op) (drop-index (:delete op) items)
> items)]
>   (if (:insert op) (cons (:insert op) items1) items1)))
>   items ops)
>
> i.e. I'm using a cascade of conditional let's. This isn't _too_ bad in
> this case, but you can image how unreadable this could get.


To avoid a "cascade of lets" I've occasionally defined a function called
conj-if (or disj-if or assoc-if...). Like so:

(defn conj-if [coll test x]
  (if test (conj coll x) coll))

(fn [items op]
  (-> (conj-if (foo? op) "one")
  (conj-if (bar? op) "two")))
  (conj-if (baz? op) "three")))

That could be generalized, but I've so far never gotten into a situation
where I've felt the need to.

(defn call-if [x test f & [args]]; needs a better name
  (if test (apply f x args) x))

(fn [items op]
  (-> (call-if (foo? op) assoc "foo" 1)
  (call-if (bar? op) dissoc "bar")
  (call-if (baz? op) empty)))

On the other hand the cascading lets are really not that bad especially
if you pull any complex predicate or value-manipulation logic out into
separate functions:

(fn [items op]
  (let [items (if (foo? op) (assoc items "foo" 1) items)
items (if (bar? op) (dissoc items "bar")  items)
items (if (baz? op) (empty items) items)]
items))

-- 
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: Wisdom sought for functional iterative processing

2011-06-14 Thread Stuart Campbell
On 14 June 2011 12:37, Matthew Phillips  wrote:

> The only way I can think of to write it in Clojure is:
>
> (reduce
>  (fn [items op]
>(let [items1 (if (:delete op) (drop-index (:delete op) items)
> items)]
>  (if (:insert op) (cons (:insert op) items1) items1)))
>  items ops)
>
> i.e. I'm using a cascade of conditional let's. This isn't _too_ bad in
> this case, but you can image how unreadable this could get.
>

How about something like this (borrowing from Mark's loop/recur suggestion
above):

(defn maybe-delete [items op]
  (if-let [index (:delete op)]
(drop-index index items)
items))

(defn maybe-insert [items op]
  (if-let [new-item (:insert op)]
(cons new-item items)
items))

(loop [items items ops ops]
  (if-not ops
items
(let [op (first op)]
  (recur (-> items
 (maybe-delete op)
 (maybe-insert op))
 (next ops)

Looks more verbose on the surface, but I'm sure you could abstract away some
common bits of maybe-delete and maybe-insert using a macro.

Regards,
Stuart

-- 
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

Aw: Re: Aw: Re: transients are not designed to be bashed in-place

2011-06-14 Thread Meikel Brandmeyer
Hi again,

ok. This is not entirely correct. It depends on how your searcher works. If 
it works on several threads in parallel, there would be an issue, but the 
transient would barf in that case anyway. So you would get an exception and 
hence be safe.

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