Re: ANN: Korma - a SQL DSL for Clojure

2011-11-02 Thread Chris Granger
Color is always a touchy and very subjective realm. :)

In terms of "why not ClojureQL?" I'll quote my response from HN:

The issue I had with ClojureQL is that it seems like the wrong abstraction
to me. Myself and others I've talked to have found ourselves fighting with
how it tries to model data and more specifically the kind of queries it
generates. For example, it is very quick to use rather inefficient
sub-selects.

Cheers,
Chris.


On Wed, Nov 2, 2011 at 5:45 PM, Carin Meier  wrote:

> I really like the color pallette :)
>
> --
> 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: Any reason interleave needs 2 or more collections?

2011-11-02 Thread Alex Baranosky
What a coincidence. My instinct would be to make (interleave) return an
empty seq, instead of nil. I wonder the trade-offs between the two?

On Wed, Nov 2, 2011 at 10:02 PM, Alan Malloy  wrote:

>
> http://groups.google.com/group/clojure-dev/browse_thread/thread/b81c6c8621629960/b73ed6ba28b60781
>
>
> http://www.google.com/url?sa=D&q=http://dev.clojure.org/jira/browse/CLJ-863&usg=AFQjCNGcl4S8hvppsmfP8mtjo1W2y5wgfA
>
> On Nov 2, 6:28 pm, Alex Baranosky 
> wrote:
> > Something interesting I've noticed:
> >
> > I've recently realized I could simplify some application code of mine by
> > using interleave.  I immediately noticed that in the spot I was using it
> I
> > would never be sure to have 2+ streams (from
> > here<
> https://github.com/AlexBaranosky/EmailClojMatic/blob/master/src/remin...>
> > ):
> >
> > (defmethod parse-reminder-dates :day-of-month [s]
> >(let [[ordinals-part] (re-captures day-of-month-identifier-regex s)
> >  ordinals (map ordinal-to-int (re-match-seq ordinal-regex
> > ordinals-part))]
> >  (apply interleave++ (map day-of-month-stream ordinals
> >
> > For my purposes, in an application that might generate 0+ streams, it
> made
> > sense to create a variation of interleave, I dub interleave++:
> >
> > (defn interleave++ [& colls]
> >"like interleave from core, but does something sensible with 0 or 1
> > collection"
> >(cond (empty? colls)
> >  []
> >
> >  (= 1 (count colls))
> >  (first colls)
> >
> >  :else
> >  (apply interleave colls)))
> >
> > Is there a strategic reason interleave wasn't made to be a bit more
> > flexible, so as to be able to ignore checking for edge cases in the code
> > that uses interleave?
> >
> > Best,
> > Alex
>
> --
> 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: Any reason interleave needs 2 or more collections?

2011-11-02 Thread Alan Malloy
That's what I get for copy/pasting a link from Google Groups. The real
URL for the JIRA ticket is http://dev.clojure.org/jira/browse/CLJ-863
if you'd rather avoid the pointless redirect.

On Nov 2, 7:02 pm, Alan Malloy  wrote:
> http://groups.google.com/group/clojure-dev/browse_thread/thread/b81c6...
>
> http://www.google.com/url?sa=D&q=http://dev.clojure.org/jira/browse/C...
>
> On Nov 2, 6:28 pm, Alex Baranosky 
> wrote:
>
>
>
>
>
>
>
> > Something interesting I've noticed:
>
> > I've recently realized I could simplify some application code of mine by
> > using interleave.  I immediately noticed that in the spot I was using it I
> > would never be sure to have 2+ streams (from
> > here
> > ):
>
> > (defmethod parse-reminder-dates :day-of-month [s]
> >    (let [[ordinals-part] (re-captures day-of-month-identifier-regex s)
> >          ordinals (map ordinal-to-int (re-match-seq ordinal-regex
> > ordinals-part))]
> >      (apply interleave++ (map day-of-month-stream ordinals
>
> > For my purposes, in an application that might generate 0+ streams, it made
> > sense to create a variation of interleave, I dub interleave++:
>
> > (defn interleave++ [& colls]
> >    "like interleave from core, but does something sensible with 0 or 1
> > collection"
> >    (cond (empty? colls)
> >              []
>
> >              (= 1 (count colls))
> >              (first colls)
>
> >              :else
> >              (apply interleave colls)))
>
> > Is there a strategic reason interleave wasn't made to be a bit more
> > flexible, so as to be able to ignore checking for edge cases in the code
> > that uses interleave?
>
> > Best,
> > Alex

-- 
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: Any reason interleave needs 2 or more collections?

2011-11-02 Thread Alan Malloy
http://groups.google.com/group/clojure-dev/browse_thread/thread/b81c6c8621629960/b73ed6ba28b60781

http://www.google.com/url?sa=D&q=http://dev.clojure.org/jira/browse/CLJ-863&usg=AFQjCNGcl4S8hvppsmfP8mtjo1W2y5wgfA

On Nov 2, 6:28 pm, Alex Baranosky 
wrote:
> Something interesting I've noticed:
>
> I've recently realized I could simplify some application code of mine by
> using interleave.  I immediately noticed that in the spot I was using it I
> would never be sure to have 2+ streams (from
> here
> ):
>
> (defmethod parse-reminder-dates :day-of-month [s]
>    (let [[ordinals-part] (re-captures day-of-month-identifier-regex s)
>          ordinals (map ordinal-to-int (re-match-seq ordinal-regex
> ordinals-part))]
>      (apply interleave++ (map day-of-month-stream ordinals
>
> For my purposes, in an application that might generate 0+ streams, it made
> sense to create a variation of interleave, I dub interleave++:
>
> (defn interleave++ [& colls]
>    "like interleave from core, but does something sensible with 0 or 1
> collection"
>    (cond (empty? colls)
>              []
>
>              (= 1 (count colls))
>              (first colls)
>
>              :else
>              (apply interleave colls)))
>
> Is there a strategic reason interleave wasn't made to be a bit more
> flexible, so as to be able to ignore checking for edge cases in the code
> that uses interleave?
>
> Best,
> Alex

-- 
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: Any reason interleave needs 2 or more collections?

2011-11-02 Thread Sean Corfield
I seem to recall seeing a ticket opened in JIRA for this recently with
a patch so maybe it'll get incorporated.

On Wed, Nov 2, 2011 at 6:28 PM, Alex Baranosky
 wrote:
> Something interesting I've noticed:
>
> I've recently realized I could simplify some application code of mine by
> using interleave.  I immediately noticed that in the spot I was using it I
> would never be sure to have 2+ streams (from here):
>
> (defmethod parse-reminder-dates :day-of-month [s]
>    (let [[ordinals-part] (re-captures day-of-month-identifier-regex s)
>  ordinals (map ordinal-to-int (re-match-seq ordinal-regex
> ordinals-part))]
>  (apply interleave++ (map day-of-month-stream ordinals
> For my purposes, in an application that might generate 0+ streams, it made
> sense to create a variation of interleave, I dub interleave++:
>
> (defn interleave++ [& colls]
>    "like interleave from core, but does something sensible with 0 or 1
> collection"
>    (cond (empty? colls)
>  []
>  (= 1 (count colls))
>  (first colls)
>  :else
>  (apply interleave colls)))
>
> Is there a strategic reason interleave wasn't made to be a bit more
> flexible, so as to be able to ignore checking for edge cases in the code
> that uses interleave?

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


Any reason interleave needs 2 or more collections?

2011-11-02 Thread Alex Baranosky
Something interesting I've noticed:

I've recently realized I could simplify some application code of mine by
using interleave.  I immediately noticed that in the spot I was using it I
would never be sure to have 2+ streams (from
here
):

(defmethod parse-reminder-dates :day-of-month [s]
   (let [[ordinals-part] (re-captures day-of-month-identifier-regex s)
 ordinals (map ordinal-to-int (re-match-seq ordinal-regex
ordinals-part))]
 (apply interleave++ (map day-of-month-stream ordinals

For my purposes, in an application that might generate 0+ streams, it made
sense to create a variation of interleave, I dub interleave++:

(defn interleave++ [& colls]
   "like interleave from core, but does something sensible with 0 or 1
collection"
   (cond (empty? colls)
 []

 (= 1 (count colls))
 (first colls)

 :else
 (apply interleave colls)))

Is there a strategic reason interleave wasn't made to be a bit more
flexible, so as to be able to ignore checking for edge cases in the code
that uses interleave?

Best,
Alex

-- 
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: Homoiconicity in clojure (macro power)

2011-11-02 Thread Lee Spector

On Oct 31, 2011, at 5:40 AM, vikbehal wrote:

> I am from java Background. We say Homoiconicity in Clojure (Lisp).
> Code is data and data is code. I read various blogs on it, still not
> clear, Can you give me some example?

FWIW I think that homoiconicity can be useful in a variety of circumstances 
even when macros aren't involved.

I work with genetic programming, in which code is generated randomly, tested, 
mutated, recombined, etc. Doing this in a homoiconic language is particularly 
elegant. A very simple example that I wrote in Clojure for a class that I'm 
teaching is at: https://gist.github.com/1297325 (Many of you will notice that I 
could have written "inject" and "extract" more simply with zippers or 
clojure.walk; I avoided them here, and did some other things in the way that I 
did, for pedagogical reasons.)

 -Lee

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: ANN: Korma - a SQL DSL for Clojure

2011-11-02 Thread Carin Meier
I really like the color pallette :)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: ANN: Clojure/West - a new Clojure conference March 16-17th in San Jose

2011-11-02 Thread Alex Baranosky
Oh my, that's very exciting.
On Nov 2, 2011 12:39 PM, "Devin Walters"  wrote:

> Alex,
>
> This is great to hear. Thanks so much for all of your contributions to
> this community. I watched the Sussman talk last night on InfoQ and was
> reminded of how fantastic StrangeLoop 2011 was. I'm happy to hear you're
> heading this up.
>
> Hope to see all of you there.
>
>
> On Wednesday, November 2, 2011 at 10:27 AM, Baishampayan Ghose wrote:
>
> > > It is with great pleasure that I am announcing a new west coast
> > > Clojure conference: Clojure/West (more: http://clojurewest.org,
> > > http://twitter.com/clojurewest). The announcement is here:
> > > http://clojurewest.org/news/2011/11/2/clojurewest-is-launched.html.
> >
> >
> >
> > Moar Clojure, woohoo!
> >
> > Regards,
> > BG
> >
> > --
> > Baishampayan Ghose
> > b.ghose at gmail.com (http://gmail.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 (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

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: ANN: Korma - a SQL DSL for Clojure

2011-11-02 Thread Daniel Pittman
On Wed, Nov 2, 2011 at 12:49, Chris Granger  wrote:

> I'm officially releasing Korma 0.2.0 today with a wonderful new
> project site: http://sqlkorma.com ;)

That looks pretty awesome.  I do have one question: arrays.
Specifically, do you have any plans to support SQL ARRAY columns as
part of this work, together with their query operations (eg:
PostgreSQL style any/all extensions).

Daniel
-- 
♲ Made with 100 percent post-consumer electrons

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: ANN: Korma - a SQL DSL for Clojure

2011-11-02 Thread Timothy Baldridge
The site layout is great, and it looks like a awesome library. But all
that is dwarfed by the color selection...let's put this nicely...it's
physically painful to look at the Korma site with the current color
scheme. Besides that, it looks great.

Timothy

On Wed, Nov 2, 2011 at 3:28 PM, Craig  wrote:
>
> Hi Chris,
>
> Nice website :-)
>
> The HN thread mentions ClojureQL. Does it have limitations
> that made it unsuitable for you? Or were you keen to roll your own?
>
> --
> 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



-- 
“One of the main causes of the fall of the Roman Empire was
that–lacking zero–they had no way to indicate successful termination
of their C programs.”
(Robert Firth)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: ANN: Korma - a SQL DSL for Clojure

2011-11-02 Thread Craig

Hi Chris,

Nice website :-)

The HN thread mentions ClojureQL. Does it have limitations
that made it unsuitable for you? Or were you keen to roll your own?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


ANN clojure.java.jdbc 0.1.1

2011-11-02 Thread Sean Corfield
Should hit Maven Central "soon".

Changes in 0.1.1:

* Fix JDBC-21 by adding support for db-spec as URI (Phil Hagelberg).
* Fix JDBC-22 by deducing driver class name from subprotocol (Phil Hagelberg).
* Add Postgres dependency so tests can be automated (Phil Hagelberg).
* Add ability to specify test databases via TEST_DBS environment
variable (Phil Hagelberg).
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.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


ANN: Korma - a SQL DSL for Clojure

2011-11-02 Thread Chris Granger
Hey Folks,

I'm officially releasing Korma 0.2.0 today with a wonderful new
project site: http://sqlkorma.com ;)

HackerNews thread here: http://news.ycombinator.com/item?id=3188609

Cheers,
Chris.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: ANN: metrics-clojure 0.1.0

2011-11-02 Thread Devin Walters
Fantastic. I took a look at doing this after Coda presented it. Looking forward 
to using it.

Thank you. 

On Tuesday, November 1, 2011 at 11:32 AM, Steve Losh wrote: 
> Last night I released an initial version of metrics-clojure, which is a thin
> Clojure wrapper around Coda Hale's awesome metrics[1] library:
> 
> http://github.com/sjl/metrics-clojure
> http://bitbucket.org/sjl/metrics-clojure
> 
> If you haven't seen Coda's talk about metrics it's worth the watch:
> 
> http://pivotallabs.com/talks/139-metrics-metrics-everywhere
> 
> metrics-clojure makes it easier to work with metrics in Clojure. It lets you 
> do
> stuff like this:
> 
> (use '[metrics.counters :only (counter inc! dec!)])
> 
> (def users-connected (counter "users-connected"))
> 
> (inc! users-connected)
> (dec! users-connected)
> 
> and
> 
> (use '[metrics.histograms :only (histogram update!)])
> 
> (def search-results-returned (histogram "search-results-returned"))
> 
> (update! search-results-returned 10)
> (update! search-results-returned 245)
> 
> There's still a bunch of stuff I need to do, like adding data accessing and
> wrapping/adding more result reporting mechanisms, but the core is there.
> 
> I'd appreciate advice on the "API", since I'm still fairly new to Clojure. 
> It's
> not a "1.0.0" release so I wouldn't feel bad about changing it now.
> 
> [1]: https://github.com/codahale/metrics/
> 
> -- 
> Steve Losh
> 
> -- 
> 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: ANN: Clojure/West - a new Clojure conference March 16-17th in San Jose

2011-11-02 Thread Devin Walters
Alex,

This is great to hear. Thanks so much for all of your contributions to this 
community. I watched the Sussman talk last night on InfoQ and was reminded of 
how fantastic StrangeLoop 2011 was. I'm happy to hear you're heading this up.

Hope to see all of you there. 


On Wednesday, November 2, 2011 at 10:27 AM, Baishampayan Ghose wrote:

> > It is with great pleasure that I am announcing a new west coast
> > Clojure conference: Clojure/West (more: http://clojurewest.org,
> > http://twitter.com/clojurewest). The announcement is here:
> > http://clojurewest.org/news/2011/11/2/clojurewest-is-launched.html.
> 
> 
> 
> Moar Clojure, woohoo!
> 
> Regards,
> BG
> 
> -- 
> Baishampayan Ghose
> b.ghose at gmail.com (http://gmail.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 
> (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: Datestreams

2011-11-02 Thread Alex Baranosky
I went with interleave because it meant  I could easily recompose the
singular day streams I already have... as well as other similar streams for
generating days of the month and a couple others. I have no concern about
the performance.
On Nov 2, 2011 9:50 AM, "Benny Tsai"  wrote:

> Quite right.  Thank you for the reminder.
>
> On Wednesday, November 2, 2011 2:51:06 AM UTC-6, Alan Malloy wrote:
>>
>> The call to (set day-nums) should really be pulled out of the inner
>> function to avoid rebuilding the set over and over:
>>
>> (defn day-of-week-stream [& day-nums]
>>   (let [day-set (set day-nums)]
>> (filter #(day-set (.. % dayOfWeek get)) (today+all-future-
>> dates
>>
>> On Nov 1, 10:57 pm, Baishampayan Ghose  wrote:
>> > On Wed, Nov 2, 2011 at 11:01 AM, Benny Tsai 
>> wrote:
>> > > Untested, since I don't have JodaTime installed, but something like
>> this
>> > > maybe?
>> >
>> > > (defn day-of-week-stream [& day-nums]
>> > >   (filter #((set day-nums) (.. % dayOfWeek get))
>> (today+all-future-dates)))
>> >
>> > This one is a good solution. No need to interleave two streams when
>> > you can generate one directly.
>> >
>> > Regards,
>> > BG
>> >
>> > --
>> > Baishampayan Ghose
>> > b.ghose at gmail.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: ANN: Clojure/West - a new Clojure conference March 16-17th in San Jose

2011-11-02 Thread Baishampayan Ghose
> It is with great pleasure that I am announcing a new west coast
> Clojure conference: Clojure/West (more: http://clojurewest.org,
> http://twitter.com/clojurewest).  The announcement is here:
> http://clojurewest.org/news/2011/11/2/clojurewest-is-launched.html.

Moar Clojure, woohoo!

Regards,
BG

-- 
Baishampayan Ghose
b.ghose at gmail.com

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


ANN: Clojure/West - a new Clojure conference March 16-17th in San Jose

2011-11-02 Thread Alex Miller
It is with great pleasure that I am announcing a new west coast
Clojure conference: Clojure/West (more: http://clojurewest.org,
http://twitter.com/clojurewest).  The announcement is here:
http://clojurewest.org/news/2011/11/2/clojurewest-is-launched.html.

The first Clojure/West will occur March 16-17th in downtown San Jose,
CA.  Future years may occur in San Francisco or other west coast
cities with robust Clojure communities (Seattle, Portland, San Diego,
and LA come to mind).  This year I put a premium on finding the best
combination of an affordable hotel rate ($119/night) and a convenient
venue for airport, eating, etc which ultimately lead me to San Jose.

I'm really excited to put together my experience in running Strange
Loop (which has always had an unabashed Clojure focus :) and my own
experience as a full-time Clojure developer at Revelytix to creating a
new forum for Clojure developers.  The Conj is great and I have been
in frequent contact with the Clojure/core team to make Clojure/West an
event that complements the Conj rather than competes with it.  I think
the community is large enough that we can have two great events
(hopefully more!) each year.

Please join the Clojure/West mailing list for future announcements
(Call for Presentations, registration, sponsorship, etc): 
http://eepurl.com/gP51T.

Alex Miller

-- 
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: Homoiconicity in clojure (macro power)

2011-11-02 Thread Jeff Heon
This is the explanation that really made it click for me:

The nature of Lisp
http://www.defmacro.org/ramblings/lisp.html

-- 
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: Please try the alphas and betas!

2011-11-02 Thread Chas Emerick
> Is there a way to peg a particular snapshot?  If we find that
> something breaks, we'd want to roll back to a previous version until
> the problem is fixed.  It looks like the maven metadata only has the
> latest snapshot recorded (I may be wrong... I'm certainly not a Maven
> guru).
> 
> -John

Yes; this is called "locking" snapshots in the Maven world, and there are 
commands there that can lock any snapshot dependencies to the current snapshot.

If you are using Leiningen, there are no corollary commands, but you can use 
the same concrete snapshot version numbers.  e.g. looking at Clojure 1.4.0 
snapshots here:

https://oss.sonatype.org/content/repositories/snapshots/org/clojure/clojure/1.4.0-master-SNAPSHOT/

You can use a version number like "1.4.0-master-20111025.230825-6" to fix 
against that particular snapshot instead of continually updating to HEAD.

That said, if alphas are going to be emitted at a steady pace, then updating to 
them as desired may suit your use case better (i.e. it's easier to know to 
revert to -alpha8 [or whatever] than it is to revert to 
1.4.0-master-20111025.230825-6).

The maven snapshot metadata is only maintained for the latest snapshot so 
version numbers that include SNAPSHOT can resolve to a particular concrete 
artifact. Explicitly using a concrete snapshot version (like 
"1.4.0-master-20111025.230825-6") resolves directly to the artifact in 
question, so the metadata isn't relevant.

- Chas

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

2011-11-02 Thread Benny Tsai
Quite right.  Thank you for the reminder.

On Wednesday, November 2, 2011 2:51:06 AM UTC-6, Alan Malloy wrote:
>
> The call to (set day-nums) should really be pulled out of the inner 
> function to avoid rebuilding the set over and over: 
>
> (defn day-of-week-stream [& day-nums] 
>   (let [day-set (set day-nums)] 
> (filter #(day-set (.. % dayOfWeek get)) (today+all-future- 
> dates 
>
> On Nov 1, 10:57 pm, Baishampayan Ghose  wrote: 
> > On Wed, Nov 2, 2011 at 11:01 AM, Benny Tsai  wrote: 
> > > Untested, since I don't have JodaTime installed, but something like 
> this 
> > > maybe? 
> > 
> > > (defn day-of-week-stream [& day-nums] 
> > >   (filter #((set day-nums) (.. % dayOfWeek get)) 
> (today+all-future-dates))) 
> > 
> > This one is a good solution. No need to interleave two streams when 
> > you can generate one directly. 
> > 
> > Regards, 
> > BG 
> > 
> > -- 
> > Baishampayan Ghose 
> > b.ghose at gmail.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: Please try the alphas and betas!

2011-11-02 Thread Hubert Iwaniuk

http://bit.ly/clojure-releases

Stuart Halloway wrote:

I'd like to second what Bill said...I don't really have the time to
setup a clojure build process to test out the 1.4 Alphas/Betas, but if
there was a way for me to get to it via lein...I would just target 1.4
for all my day-to-day development.

This should work:

  :repositories [["sonatype-snapshots"
"https://oss.sonatype.org/content/repositories/snapshots/";]]
  :dependencies [[org.clojure/clojure "1.4.0-master-SNAPSHOT"] ...]

Is there a way to peg a particular snapshot?  If we find that
something breaks, we'd want to roll back to a previous version until
the problem is fixed.  It looks like the maven metadata only has the
latest snapshot recorded (I may be wrong... I'm certainly not a Maven
guru).

-John


This is the reason the we release such a large number of alphas and betas, so 
we have something more reliable than snapshots to peg to.  The following search 
on maven central will show you all the Clojure releases:

http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22clojure%22

Does anybody know a better link that automatically shows this same info? If 
not, I will add this link in the wiki.

Stu




--
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: Dynamic test creation?

2011-11-02 Thread Nate Young
On 11/01/2011 03:05 PM, AndyK wrote:
> How would (run-tests 'my-namespace) know to run all those dynamic
> tests? I thought that it parsed the namespace for 'my-namespace when
> you call it. Or is it that the call to defcsvtests sets off a chain of
> macro resolutions before run-tests can even do its thing (so that it

Right. Its that the macro-expansion phase actually reads from the csv
file in order to create a number of deftest forms, and each one then
gets evaluated, so after you've evaluated (defcsvtests), then
(run-tests) will be able to find a number of tests to run.

-- 
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: Please try the alphas and betas!

2011-11-02 Thread Stuart Halloway
>>> I'd like to second what Bill said...I don't really have the time to
>>> setup a clojure build process to test out the 1.4 Alphas/Betas, but if
>>> there was a way for me to get to it via lein...I would just target 1.4
>>> for all my day-to-day development.
>> 
>> This should work:
>> 
>>  :repositories [["sonatype-snapshots"
>> "https://oss.sonatype.org/content/repositories/snapshots/";]]
>>  :dependencies [[org.clojure/clojure "1.4.0-master-SNAPSHOT"] ...]
> 
> Is there a way to peg a particular snapshot?  If we find that
> something breaks, we'd want to roll back to a previous version until
> the problem is fixed.  It looks like the maven metadata only has the
> latest snapshot recorded (I may be wrong... I'm certainly not a Maven
> guru).
> 
> -John

This is the reason the we release such a large number of alphas and betas, so 
we have something more reliable than snapshots to peg to.  The following search 
on maven central will show you all the Clojure releases:

http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22clojure%22

Does anybody know a better link that automatically shows this same info? If 
not, I will add this link in the wiki.

Stu


-- 
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: Lazy behavior

2011-11-02 Thread David Powell
> What would be the best (idiomatic and efficiant) solution then?
> - wrap my file under a lazy sequence, call take & drop recursively
> with recur
> - just call readLine method directly when I need more lines and
> process them.
>

Hi,

Have a look at the functions:

line-seq
and
clojure.java.io/reader

I think you want something like:

(line-seq (reader "c:/test.txt"))

This returns you a lazy sequence of the lines in the file, which will only
read the file once, caching the lines that have been read in the seq.  The
sequence is immutable, though it will only read the lines from the
underlying file as required.

If you are interested in how this works, try (source line-seq) to see the
code.

-- 
Dave

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: ANN: core.logic 0.6.5 release

2011-11-02 Thread David Nolen
They are still there just renamed so as not to conflict with clojure.core:
-reify, -inc

On Wednesday, November 2, 2011, Ambrose Bonnaire-Sergeant <
abonnaireserge...@gmail.com> wrote:
> What happened to reify and inc?
>
> Ambrose
>
> On Wed, Nov 2, 2011 at 12:10 PM, David Nolen 
wrote:
>>
>> Just cut a new release that hopefully makes playing with core.logic a
lot less tedious.
>> From 0.6.4 to 0.6.5
>> 
>> Enhancements
>> ---
>> * Consolidate all the useful name spaces into clojure.core.logic
>> * We now only overload ==, no more need to exclude reify or inc
>> You can use core.logic in your own projects with:
>> (ns foo.bar
>>   (:refer-clojure :exclude [==])
>>   (:use clojure.core.logic))
>>
>> --
>> 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: primitive type hints do not work when destructuring

2011-11-02 Thread bsmith.occs
On Nov 2, 11:40 am, Sergey Didenko  wrote:
> Seems like a bug:
>
> The following compiles:
>
> (let [[^Double x ^Double y] [0.1 0.2]] (+ x y))
>
> This does not:
>
> (let [[^double x ^double y] [0.1 0.2]] (+ x y))
>
> "Unable to resolve classname: double"

This is CLJ-852. Applying the patch posted there on top of current
master fixes the problem:

$ curl 
http://dev.clojure.org/jira/secure/attachment/10398/CLJ-852-test.patch
| git am -
...
$ curl 
http://dev.clojure.org/jira/secure/attachment/10401/CLJ-852-rfc-fix.patch
| git am -
...
$ mvn packge
...
$ java -jar target/clojure-1.4.0-master-SNAPSHOT.jar
Clojure 1.4.0-master-SNAPSHOT
(let [[^double x ^double y] [0.1 0.2]] (+ x y))
0.30004

// Ben

-- 
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: primitive type hints do not work when destructuring

2011-11-02 Thread Sergey Didenko
tested under Clojure 1.3

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


primitive type hints do not work when destructuring

2011-11-02 Thread Sergey Didenko
Seems like a bug:

The following compiles:

(let [[^Double x ^Double y] [0.1 0.2]] (+ x y))

This does not:

(let [[^double x ^double y] [0.1 0.2]] (+ x y))

"Unable to resolve classname: double"

-- 
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: -> vs ->> and names vs anonymous function

2011-11-02 Thread Brian Mosley
On Wed, Nov 2, 2011 at 6:12 AM, Dennis Haupt  wrote:
> so -> and ->> behave the same as long as my functions only take one
> parameter?

They do if you avoid inline function definitions.

-- 
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: -> vs ->> and names vs anonymous function

2011-11-02 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

so -> and ->> behave the same as long as my functions only take one
parameter?

Am 02.11.2011 10:58, schrieb Matt Hoyt:
> First question answer:
> 
> The code isn't the same.  The ~x is the first argument for -> and
> is the last argument for ->>.  So if you do a long chain of
> expression the first argument is passed into the return value into
> the next function with -> and ->> pass that value as the last
> parameter.
> 
> Second question:
> 
> I think what you mean is (->> "hi" println) .   If you wanted to
> give the function multiple arguments you could do this:
> 
> (-> "hello" (println "world!")) and the other form it would be
> (->> "world!" (println "Hello"))
> 
> Matt Hoyt 
> 
>
> 
*From:* Dennis Haupt 
> *To:* clojure@googlegroups.com *Sent:* Wednesday, November 2, 2011
> 4:37 AM *Subject:* -> vs ->> and names vs anonymous function
> 
> hi there,
> 
> i stumbled over two odd things 1) -> and ->> have the same source
> code. why is that? 2) why can't i use "(-> "hi" #(println %))"
> directly? why do i have to put my function into a symbol first? is
> there a way to avoid this?
> 
> (let [dummy #(println %)] (->> "hi" dummy))
> 
> 
> 
> -- 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


- -- 

-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.14 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOsRekAAoJENRtux+h35aGrs4QAL1SWvdtktKl0rbTOXkdA9we
rSJ1USxf+JAP7ckz6G2+U7P5q5SdyfsTMAjPU/tsSQDQeNx/8r15WhUZn2IXw8X0
9Gq8mSD7cF07u3Gsi51abVhxig1Gp8Npsk9f52mkfnw7UjTUbVrXEh01fC8L3KPL
afI+HVLW2MIAgBKeTJF6W8w9xeDAJkrM+e2oQnpvMzOWBequ7UKihrPQ6//BMct3
dkqMLD/D4Hdhps9RQy9lXs9acHmdl2MSX2t2RDMzA9iqINBV6DJ6k2wTT2ZZ9R+d
pxki6th8o3B6nEH1ti1ZDx3Sj+sx3L+FBLI1vriUOsFiq0GBzFj8SGYHz2impff9
90aVBA7lrSkHbiKugEEx2HMvgET6yG4pzvStApF8cb6hnGFf21V9kwEvV/F067Rd
RafNSNu6DSHZyKV9oFeM0EnfsGYwo5Zg6EuxfZvYxCA2YFdWCWo6bqleqRjK2VF+
MblKmbhp215CYx82rgXDUpp5GTQZM8PWBO7aQWPbkiRT4BetQlKoB/scYSPzT9et
PNaVHzZhQkdhSKRXFD+pNjFBgu3ATouoQDbQZWu3fl+HEZIQGFH8/+GYgEvxfXa8
Np4Ih2BD/NAoW6Pzj2Gsyd6FwGK4o21H9yykt9AC3HAoLOHJsa9AFH3e7QlwesJo
uDmEpTYJ2KiFeGjsvIzL
=G6Eu
-END PGP SIGNATURE-

-- 
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: -> vs ->> and names vs anonymous function

2011-11-02 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

thx
*note: use macroexpand next time*

Am 02.11.2011 10:58, schrieb Jonas:
> 
> 
> On Wednesday, November 2, 2011 11:37:32 AM UTC+2, HamsterofDeath
> wrote:
> 
> hi there,
> 
> i stumbled over two odd things 1) -> and ->> have the same source
> code. why is that?
> 
> Similar, but not the same [1]: (~(firstform)~x~@(nextform)) vs.
> (~(firstform)~@(nextform)~x)
> 
> 
> 2) why can't i use "(-> "hi" #(println %))" directly? why do i have
> to put my function into a symbol first? is there a way to avoid
> this?
> 
> #(println %) expands to (fn [%] (println %)) so (-> "hi" #(println
> %)) expands to (fn "hi" [%] (println %)).
> 
> Note also that (-> "hi" println) would work since it's transformed
> into (println "hi"). Also, the form (-> "hi" (#(println %))) should
> also work fine.
> 
> /jonas
> 
> [1]
> https://github.com/clojure/clojure/blob/f5f827ac9fbb87e770d25007472504403ed3d7a6/src/clj/clojure/core.clj#L1528
>
> 
> 
> -- 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


- -- 

-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.14 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOsRfHAAoJENRtux+h35aGaUwQAI5Uj2j1NYaNn6UotXvkJq9f
JlK34bLhcNu0moWb1lK7m+OQI98OmXtpdjSU1Flc14MECphQ3mst2HkP5fkh1JxE
P1RDUcLwD/pPTy1opZ7JAIi8YygBD8hSGxMYIwMLDv+YZdo6aZoDHSIFlJBcrFla
EFlDZRg7pgRcRUdCL35VUALr4AGuQ7eqtbsfaB2PXyfC6b8qW2JvICukokZofqyQ
ceO37GCc7CjpcMviAEABa+ByDSEwouiawDYkiDDdNTs9ZmsRX6PQUB9w75NQ5C5h
5mTIR/5KsMDqcGO2pNWGUOdA/d5Oj30EkUPd4pwNHwT4mgWjZbZk1aLX/CrfbRyT
KPwenuXrelFsWC7uk0xBwLJwc8Z/85CXsVYATBWItS+05yD+i41GYD4ejnpjBgUw
BiMms+T/A8vorbAjelgVs6Y53PJxndT+7wVL0Osj7HNaj/CItgMoos/yce/rOeig
jGvHo943A8OAxzAtf3LsLvHBf8xUO6eupSCVDJl891jRMdUEfLezRL2aisjXtWj5
ZXkb1rEGJHS11xm5fNBQF35JmFmNwD78zepJKqVgQjaMDVb79sSIQfmI9308F7Iy
TEanIVTCn1ZnoxZiTTy5fbFXuufMvWzrEywVdJ0os9Os8hufGBAatFikArl5OuOD
KKKLbIeI8QvLJuOAwZwE
=nyKh
-END PGP SIGNATURE-

-- 
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: -> vs ->> and names vs anonymous function

2011-11-02 Thread Stefan Kamphausen
Hi,

while all the other answers already offered explanations and solutions I 
feel like I should add, that macros like -> and ->> work on the 
source-code.  So using -> does not mean 'pass the first thing as an 
argument to the function call in the second thing', it means 'take the 
first thing and rearrange my source-code so that the second thing becomes a 
list with the first thing in the second position'.  And all this is done 
before compiling.

Hope that helps.

Kind regards,
Stefan

-- 
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: -> vs ->> and names vs anonymous function

2011-11-02 Thread Brian Mosley
On Wed, Nov 2, 2011 at 5:37 AM, Dennis Haupt  wrote:
> i stumbled over two odd things
> 1) -> and ->> have the same source code. why is that?

-> and ->> are macros that have similar purposes. "->" inserts the previous form
as the first argument to the function, "->>" inserts it as the last.


> 2) why can't i use "(-> "hi" #(println %))" directly? why do i have to
> put my function into a symbol first? is there a way to avoid this?

This is one is a bit more involved.  The #(func ...) form is a reader
macro so it gets
translated before macro expansion occurs:

user> (read-string
"(-> \"hi\" #(println %))")
(-> "hi" (fn* [p1__2134#] (println p1__2134#)))

The result is that your initial string is inserted into a lambda
expression in the wrong place (where the parameter list should be).
When clojure tries to compile the resulting form after macro
expansion, you get an error:

user> (macroexpand '(-> "hi" (fn* [p1__2134#] (println p1__2134#
(fn* "hi" [p1__2134#] (println p1__2134#))
 

The easiest fix if you need to use inline function definitions is to
wrap them in parens:

(-> "hi" (#(println %)))

Although, in this case it's not necessary, it would have been easier to do

(-> "hi" println)

-- 
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: -> vs ->> and names vs anonymous function

2011-11-02 Thread Matt Hoyt
First question answer:

The code isn't the same.  The ~x is the first argument for -> and is the last 
argument for ->>.  So if you do a long chain of expression the first argument 
is passed into the return value into the next function with -> and ->> pass 
that value as the last parameter.

Second question:

I think what you mean is (->> "hi" println) .   If you wanted to give the 
function multiple arguments you could do this:

(-> "hello" (println "world!")) and the other form it would be (->> "world!" 
(println "Hello"))
 
Matt Hoyt



From: Dennis Haupt 
To: clojure@googlegroups.com
Sent: Wednesday, November 2, 2011 4:37 AM
Subject: -> vs ->> and names vs anonymous function

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

hi there,

i stumbled over two odd things
1) -> and ->> have the same source code. why is that?
2) why can't i use "(-> "hi" #(println %))" directly? why do i have to
put my function into a symbol first? is there a way to avoid this?

(let [dummy #(println %)]
(->> "hi" dummy))


- -- 

-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.14 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOsQ9cAAoJENRtux+h35aGle8P/ih+1jVTdmrVUmF1o/QM7N06
s+bWnhkvt9qIcs+jB8dNUSIRLaDkdqQBsO6Aj7SvlGhhgjNjKyKrBBkHwAgriCXj
H95Dk4UPAvkILYe1ztLJNkYde0TbEMiOtSHRza7PWdtMChFYRhdwW5RVQxzWQd1j
VZbp681mfPh2k8NXEo1ywG0XRxpC4/gNdV9I3spfLBO/gvLgPDFHutLKzojZtTr9
Ba8HHXxseF3e9Yp/v+j2NqA05RCWgRMqjtNW0WIXOydgmsyYw/xhUQn+mHtNgd9V
43MP6Z9lbU+ZEJNnlnqP7FQ9M07g96z9iLOkPUKV3zMqwgpu3mTmWcJdN5TtPI1B
Uzt5N6Ds/9Sx4yV3MUEK4ROcN6y94zOgUYMMrE1wdR5PvSTUehPXVWp+WfoOkpxV
HO8Li4bTFIffNx8agHAv8N6U4kO513yUqNcM0HsTMwtOZ98unhWp4xcaypszQs0I
7DBoGdR6RV/bFJV2jp5vc4lGNxEpf1+RzMluh3Z9GPKjatVno2yI4MlEblhl/zXf
SHJyOplR3Csr+ojN7v5IZZrVP+EzC41eHdpAXig4pYpVi3p3P8oAfKke7sY5yHAu
kBVG+Q+gmLH4x7vkZZIu9T7JBEX/lMaGx4/pIW95inkjJKfF9rZMNc8BqN8ezqzv
z6SKrE2KpF5YTEr8CscC
=jkOp
-END PGP SIGNATURE-

-- 
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: Lazy behavior

2011-11-02 Thread Nicolas
Hi,

I'am not really sure on your explanation here.

For me if the processor, JVM or clojure compiler cannot prove it
doesn't change the semantics, the optimization will not be applyed.
readLine behing a java method call, it can perform any operations and
thus clojure compiler will not change the execution order (or number
of calls to it).

I agree that some clojure functions explicitely expect that no side
effect will be performed to perform futher optimizations, but then it
is stated in the documentation.


On Nov 1, 11:33 am, Ingo  wrote:
> The problem with the direct call of the readLine() method is that it might
> not work some day like it appears to work today. Specifically, the meaning
> of your program depends on:
>
>    - evaluation order the compiler chooses
>    - the fact that the compiler obviously does not do common subexpression
>    elimination in this case, maybe because it sees that readLine() is not
>    pure, but who knows.

-- 
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: -> vs ->> and names vs anonymous function

2011-11-02 Thread Baishampayan Ghose
> i stumbled over two odd things
> 1) -> and ->> have the same source code. why is that?

The source code is _not_ the same for the two macros you mentioned. I
will leave it to you to spot the differences ;-)

> 2) why can't i use "(-> "hi" #(println %))" directly? why do i have to
> put my function into a symbol first? is there a way to avoid this?
>
> (let [dummy #(println %)]
> (->> "hi" dummy))

You don't need to "put the function into a symbol", all you need is an
extra set of parentheses -

(->> "hi" (#(println %)))
;=> hi
;=> nil

In your case, the reader macro # is converting your form into a
function object _before_ macro-expansion time. The ->> macro sees that
it's not a seq and adds a set of parens around it automatically but
the semantics of the form is getting altered to something like this -

(fn [x] (println x) "hi")

And thus, it's not working as you expect it to.

Regards,
BG

-- 
Baishampayan Ghose
b.ghose at gmail.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: -> vs ->> and names vs anonymous function

2011-11-02 Thread Jonas


On Wednesday, November 2, 2011 11:37:32 AM UTC+2, HamsterofDeath wrote:
>
> hi there,
>
> i stumbled over two odd things
> 1) -> and ->> have the same source code. why is that?
>
Similar, but not the same [1]:
(~(first form) ~x ~@(next form)) vs. (~(first form) ~@(next form) ~x)
 

> 2) why can't i use "(-> "hi" #(println %))" directly? why do i have to
> put my function into a symbol first? is there a way to avoid this?
>
#(println %) expands to (fn [%] (println %)) so (-> "hi" #(println %)) 
expands to (fn "hi" [%] (println %)). 

Note also that (-> "hi" println) would work since it's transformed into 
(println "hi"). Also, the form (-> "hi" (#(println %))) should also work 
fine.

/jonas

[1] 
https://github.com/clojure/clojure/blob/f5f827ac9fbb87e770d25007472504403ed3d7a6/src/clj/clojure/core.clj#L1528
 

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

-> vs ->> and names vs anonymous function

2011-11-02 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

hi there,

i stumbled over two odd things
1) -> and ->> have the same source code. why is that?
2) why can't i use "(-> "hi" #(println %))" directly? why do i have to
put my function into a symbol first? is there a way to avoid this?

(let [dummy #(println %)]
(->> "hi" dummy))


- -- 

-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.14 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOsQ9cAAoJENRtux+h35aGle8P/ih+1jVTdmrVUmF1o/QM7N06
s+bWnhkvt9qIcs+jB8dNUSIRLaDkdqQBsO6Aj7SvlGhhgjNjKyKrBBkHwAgriCXj
H95Dk4UPAvkILYe1ztLJNkYde0TbEMiOtSHRza7PWdtMChFYRhdwW5RVQxzWQd1j
VZbp681mfPh2k8NXEo1ywG0XRxpC4/gNdV9I3spfLBO/gvLgPDFHutLKzojZtTr9
Ba8HHXxseF3e9Yp/v+j2NqA05RCWgRMqjtNW0WIXOydgmsyYw/xhUQn+mHtNgd9V
43MP6Z9lbU+ZEJNnlnqP7FQ9M07g96z9iLOkPUKV3zMqwgpu3mTmWcJdN5TtPI1B
Uzt5N6Ds/9Sx4yV3MUEK4ROcN6y94zOgUYMMrE1wdR5PvSTUehPXVWp+WfoOkpxV
HO8Li4bTFIffNx8agHAv8N6U4kO513yUqNcM0HsTMwtOZ98unhWp4xcaypszQs0I
7DBoGdR6RV/bFJV2jp5vc4lGNxEpf1+RzMluh3Z9GPKjatVno2yI4MlEblhl/zXf
SHJyOplR3Csr+ojN7v5IZZrVP+EzC41eHdpAXig4pYpVi3p3P8oAfKke7sY5yHAu
kBVG+Q+gmLH4x7vkZZIu9T7JBEX/lMaGx4/pIW95inkjJKfF9rZMNc8BqN8ezqzv
z6SKrE2KpF5YTEr8CscC
=jkOp
-END PGP SIGNATURE-

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

2011-11-02 Thread Alan Malloy
The call to (set day-nums) should really be pulled out of the inner
function to avoid rebuilding the set over and over:

(defn day-of-week-stream [& day-nums]
  (let [day-set (set day-nums)]
(filter #(day-set (.. % dayOfWeek get)) (today+all-future-
dates

On Nov 1, 10:57 pm, Baishampayan Ghose  wrote:
> On Wed, Nov 2, 2011 at 11:01 AM, Benny Tsai  wrote:
> > Untested, since I don't have JodaTime installed, but something like this
> > maybe?
>
> > (defn day-of-week-stream [& day-nums]
> >   (filter #((set day-nums) (.. % dayOfWeek get)) (today+all-future-dates)))
>
> This one is a good solution. No need to interleave two streams when
> you can generate one directly.
>
> Regards,
> BG
>
> --
> Baishampayan Ghose
> b.ghose at gmail.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: ANN: metrics-clojure 0.1.0

2011-11-02 Thread Matthew Gilliard
Ah - we'll certainly be using this soon - thanks!

 mg

On Tue, Nov 1, 2011 at 4:32 PM, Steve Losh  wrote:
> Last night I released an initial version of metrics-clojure, which is a thin
> Clojure wrapper around Coda Hale's awesome metrics[1] library:
>
> http://github.com/sjl/metrics-clojure
> http://bitbucket.org/sjl/metrics-clojure
>
> If you haven't seen Coda's talk about metrics it's worth the watch:
>
> http://pivotallabs.com/talks/139-metrics-metrics-everywhere
>
> metrics-clojure makes it easier to work with metrics in Clojure.  It lets you 
> do
> stuff like this:
>
>    (use '[metrics.counters :only (counter inc! dec!)])
>
>    (def users-connected (counter "users-connected"))
>
>    (inc! users-connected)
>    (dec! users-connected)
>
> and
>
>    (use '[metrics.histograms :only (histogram update!)])
>
>    (def search-results-returned (histogram "search-results-returned"))
>
>    (update! search-results-returned 10)
>    (update! search-results-returned 245)
>
> There's still a bunch of stuff I need to do, like adding data accessing and
> wrapping/adding more result reporting mechanisms, but the core is there.
>
> I'd appreciate advice on the "API", since I'm still fairly new to Clojure.  
> It's
> not a "1.0.0" release so I wouldn't feel bad about changing it now.
>
> [1]: https://github.com/codahale/metrics/
>
> --
> Steve Losh
>
> --
> 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: Thoughts on a polyglot app server?

2011-11-02 Thread Meikel Brandmeyer
Maybe this? http://immutant.org/news/2011/11/01/announcing/

Am 01.11.2011 um 21:48 schrieb Jason Toy:

> Any more plans or ideas on this?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Please try the alphas and betas!

2011-11-02 Thread John Szakmeister
On Mon, Oct 31, 2011 at 4:25 PM, Sean Corfield  wrote:
> On Mon, Oct 31, 2011 at 8:06 AM, Timothy Baldridge  
> wrote:
>> I'd like to second what Bill said...I don't really have the time to
>> setup a clojure build process to test out the 1.4 Alphas/Betas, but if
>> there was a way for me to get to it via lein...I would just target 1.4
>> for all my day-to-day development.
>
> This should work:
>
>  :repositories [["sonatype-snapshots"
> "https://oss.sonatype.org/content/repositories/snapshots/";]]
>  :dependencies [[org.clojure/clojure "1.4.0-master-SNAPSHOT"] ...]

Is there a way to peg a particular snapshot?  If we find that
something breaks, we'd want to roll back to a previous version until
the problem is fixed.  It looks like the maven metadata only has the
latest snapshot recorded (I may be wrong... I'm certainly not a Maven
guru).

-John

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