Re: how do I use data.priority-map

2011-09-29 Thread Sunil S Nandihalli
thanks sean for your reply about how to use priority-map in my project...
However, I am curious as to how to find out as to what is the latest version
for a given library.. for example data.finger-tree that is available..


Sunil.

On Thu, Sep 29, 2011 at 5:46 AM, Sean Corfield wrote:

> No builds have yet been released to Maven.
>
> You can, however, use the snapshot from Sonatype. Add the following to
> project.clj:
>
>  :repositories {"sonatype-oss-public"
> "https://oss.sonatype.org/content/groups/public/"}
>
> That causes Leiningen to search the Sonatype repository.
>
> Then add this dependency:
>
>  [org.clojure/data.priority-map "0.0.1-SNAPSHOT"]
>
> That should get you going.
>
> Sean
>
> On Wed, Sep 28, 2011 at 3:21 PM, Sunil S Nandihalli
>  wrote:
> > after I posted the question .. I found this discussion . So, I guess it
> is
> > not ready for prime-time yet .. (may be I am wrong)
>
> --
> 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: how do I use data.priority-map

2011-09-29 Thread Sunil S Nandihalli
answering my own question ...

aah .. I can just go to the sonatype repository and findout .. thanks

Sunil.

On Thu, Sep 29, 2011 at 5:46 AM, Sean Corfield wrote:

> No builds have yet been released to Maven.
>
> You can, however, use the snapshot from Sonatype. Add the following to
> project.clj:
>
>  :repositories {"sonatype-oss-public"
> "https://oss.sonatype.org/content/groups/public/"}
>
> That causes Leiningen to search the Sonatype repository.
>
> Then add this dependency:
>
>  [org.clojure/data.priority-map "0.0.1-SNAPSHOT"]
>
> That should get you going.
>
> Sean
>
> On Wed, Sep 28, 2011 at 3:21 PM, Sunil S Nandihalli
>  wrote:
> > after I posted the question .. I found this discussion . So, I guess it
> is
> > not ready for prime-time yet .. (may be I am wrong)
>
> --
> 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: how do I use data.priority-map

2011-09-29 Thread Sean Corfield
On Thu, Sep 29, 2011 at 12:11 AM, Sunil S Nandihalli
 wrote:
> answering my own question ...
> aah .. I can just go to the sonatype repository and findout .. thanks

If something isn't listed on Maven Central here
http://search.maven.org/#search%7Cga%7C1%7Corg.clojure then you'll
have to dig around in Sonatype.

data.finger-tree 0.0.1 is on Maven Central tho'...

I'll shake the tree to encourage releases to Maven for the rest of the
contrib libraries. I could/should make a release of
data.priority-map... I helped Mark get his three contrib libraries
migrated and setup and the only reason I haven't made Maven releases
is because math.numeric-tower currently only runs on Clojure 1.3.0 due
to a reference to BigInt.
-- 
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: how do I use data.priority-map

2011-09-29 Thread Sean Corfield
On Thu, Sep 29, 2011 at 2:39 AM, Sean Corfield  wrote:
> I'll shake the tree to encourage releases to Maven for the rest of the
> contrib libraries. I could/should make a release of
> data.priority-map... I helped Mark get his three contrib libraries
> migrated and setup and the only reason I haven't made Maven releases
> is because math.numeric-tower currently only runs on Clojure 1.3.0 due
> to a reference to BigInt.

I just cut 0.0.1 releases of data.priority-map and math.combinatorics
so those should appear on Maven Central "soon" (within 24 hours,
possibly sooner). I'll do math.numeric-tower once it passes Clojure
1.2.x tests.
-- 
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


pattern matching in clojure

2011-09-29 Thread Michael Jaaka
Hi!

Is there any way to define function with pattern matching in function
signature as it is in haskell?

Bye!

-- 
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: pattern matching in clojure

2011-09-29 Thread Ambrose Bonnaire-Sergeant
Hi,

core.match might be what you're looking for.

(defn append [a b]
  (match [a b]
 [[] _] b
 [[x & as] _] (append as (cons x b)))

(defn or [b1 b2]
  (match [b1 b2]
 [true _] true
 [_ true] true
 :else false))


https://github.com/clojure/core.match

Thanks,
Ambrose

On Thu, Sep 29, 2011 at 6:03 PM, Michael Jaaka  wrote:

> Hi!
>
> Is there any way to define function with pattern matching in function
> signature as it is in haskell?
>
> Bye!
>
> --
> 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

producing Blub code and vv.

2011-09-29 Thread Hank
Hi,

I'd like to check the interest in the community for a comprehensive
Clojure library/framework/whathaveyou that helps produce Java/Python/
Ruby/... a.k.a. "Blub" (http://www.paulgraham.com/avg.html) code, i.e.
instead of writing a Clojure program that e.g. produces web pages,
writing a Clojure program that produces a Blub program that produces
web pages. A Blub program in idiomatic, maintainable, efficient Blub
code that is.

This is obviously to enable cooperation on shared domain
knowledge/"business logic" across communities with mixed Clojure/Blub
language preferences that I expect will continue to exist for decades.
Full cooperation would then also require the framework to produce
Clojure code that embodies functionality embodied in Blub code. I'd
expect that bit to be harder to realize but also more valuable, as it
would allow drawing not only on the body of work done in Blub for
reasons of preference but also on legacy code from the dark ages when
there was no Clojure.

I'm asking this especially in light of the upcoming Clojure Conj where
there would be an opportunity to discuss this complex subject in a
"high bandwidth" :) kind of way.

Searching this group I haven't found much along those lines other than
isolated problems being tackled -- the question here rather being:
What's the furthest the the envelope can be pushed in terms of co-
opting the Blub world?

Hank

-- 
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: pattern matching in clojure

2011-09-29 Thread Christian Pohlmann
Additionally to core.match there is also matchure [1] which comes with
a defn-match that can be used like this:

(defn-match choose
  ([_ 0] 1)
  ([0 _] 0)
  ([?n ?k] (+ (choose (dec n) (dec k)) (choose (dec n) k

This makes defining functions fairly close to what you're used from Haskell.

[1] https://github.com/dcolthorp/matchure

Christian


On Thu, Sep 29, 2011 at 12:03 PM, Michael Jaaka
 wrote:
> Hi!
>
> Is there any way to define function with pattern matching in function
> signature as it is in haskell?
>
> Bye!
>
> --
> 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: Shameless self promotion - JavaOne

2011-09-29 Thread Boris Mühmer
That would be great!


Thanks in advance,
boris


2011/9/29 Dennis :
> I am not sure to what extent there will be recording.  However, I can
> send you my slides after the presentation.
>
> -- Dennis
>
> On Wed, Sep 28, 2011 at 12:47 AM, Boris Mühmer
>  wrote:
>> Will there be any slides or maybe even a recording of this session?
>>
>> I would be very interested in this talk, but I can't go there...
>>
>>
>> Regards,
>> Boris
>>
>>
>> 2011/9/27 Dennis :
>>> Hey guys,
>>>
>>> I will be giving a talk at JavaOne (it is Clojure related).  Here is
>>> the information.
>>>
>>> Title:          Monitoring a Large-Scale Infrastructure with Clojure
>>> Time             Tuesday, 07:30 PM, Parc 55 - Embarcadero
>>> Length          45 Minutes
>>> Abstract:               Monitoring a large infrastructure brings unique 
>>> challenges
>>> that require blending development and operations concepts. This
>>> session discusses how Dell Inc. used Clojure to develop a
>>> data-flow-based monitoring system that stores, evaluates, and acts on
>>> hundreds of thousands of metrics.
>>>
>>> It covers
>>> • Real-world applications of Clojure's parallel programming constructs
>>> to take advantage of multiple cores available in today's systems
>>> • Using Clojure's homoiconic nature to create DSLs
>>> • Taking advantage of Clojure running on the JVM to use the Java ecosystem
>>> • How DevOps takes advantage of the JVM dynamic languages to develop
>>> new monitoring tools
>>> Track           Emerging Languages, Tools, and Techniques
>>> Optional Track          The Java Frontier
>>>
>>> -- Dennis
>>>
>>> --
>>> 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: pattern matching in clojure

2011-09-29 Thread David Nolen
And if you'd actually like a little bit of sugar so that it's really at the
level of the function definition - patch welcome! :)

David

On Thu, Sep 29, 2011 at 6:46 AM, Ambrose Bonnaire-Sergeant <
abonnaireserge...@gmail.com> wrote:

> Hi,
>
> core.match might be what you're looking for.
>
> (defn append [a b]
>   (match [a b]
>  [[] _] b
>  [[x & as] _] (append as (cons x b)))
>
> (defn or [b1 b2]
>   (match [b1 b2]
>  [true _] true
>  [_ true] true
>  :else false))
>
>
> https://github.com/clojure/core.match
>
> Thanks,
> Ambrose
>
> On Thu, Sep 29, 2011 at 6:03 PM, Michael Jaaka <
> michael.ja...@googlemail.com> wrote:
>
>> Hi!
>>
>> Is there any way to define function with pattern matching in function
>> signature as it is in haskell?
>>
>> Bye!
>>
>> --
>> 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: pattern matching in clojure

2011-09-29 Thread David Nolen
matchure does some funny things to deal with code size, including generating
internals fns which will break recur. core.match avoided this problem until
quite recently. We've now added backtracking to control code size for
certain kinds of pattern matches. However this also conflicts w/ recur,
you've reminded me that we need to use the old compilation strategy in the
presence of recur :)

David

On Thu, Sep 29, 2011 at 7:08 AM, Christian Pohlmann <
chr.pohlm...@googlemail.com> wrote:

> Additionally to core.match there is also matchure [1] which comes with
> a defn-match that can be used like this:
>
> (defn-match choose
>  ([_ 0] 1)
>  ([0 _] 0)
>  ([?n ?k] (+ (choose (dec n) (dec k)) (choose (dec n) k
>
> This makes defining functions fairly close to what you're used from
> Haskell.
>
> [1] https://github.com/dcolthorp/matchure
>
> Christian
>
>
> On Thu, Sep 29, 2011 at 12:03 PM, Michael Jaaka
>  wrote:
> > Hi!
> >
> > Is there any way to define function with pattern matching in function
> > signature as it is in haskell?
> >
> > Bye!
> >
> > --
> > 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

Learning clojure - comments on my function?

2011-09-29 Thread Peter Hull
Hi All,
I am just learning clojure and I've written a function to split a list (see 
docstring for details). I was wondering if any of you experienced hands 
could take a look at it and comment. I've never used lisp or a functional 
language before so I was wondering if I was doing it right or if there is a 
better way. Anyway here is the function:

(defn split-zero 
  "Split a collection at its zero values into a list of lists.
   Multiple zeros are treated as one.
   The order of elements in each inner list is maintained but
   the order of inner lists in the result may be changed.
   e.g. (split-zero '(1 2 3 0 4 5 6 0 7 8 9))
   -> ((7 8 9) (4 5 6) (1 2 3))"
  [ls] ((fn [ls wip ans] 
(if (empty? ls)
  (if (empty? wip) ans (conj ans (list* wip)))
  (if (zero? (first ls))
(if (empty? wip)
  (recur (next ls) [] ans)
  (recur (next ls) [] (conj ans (list* wip
(recur (next ls) (conj wip (first ls)) ans ls [] nil))

Thanks,
Peter

-- 
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: producing Blub code and vv.

2011-09-29 Thread David Nolen
ClojureScript?

David

On Thu, Sep 29, 2011 at 6:39 AM, Hank  wrote:

> Hi,
>
> I'd like to check the interest in the community for a comprehensive
> Clojure library/framework/whathaveyou that helps produce Java/Python/
> Ruby/... a.k.a. "Blub" (http://www.paulgraham.com/avg.html) code, i.e.
> instead of writing a Clojure program that e.g. produces web pages,
> writing a Clojure program that produces a Blub program that produces
> web pages. A Blub program in idiomatic, maintainable, efficient Blub
> code that is.
>
> This is obviously to enable cooperation on shared domain
> knowledge/"business logic" across communities with mixed Clojure/Blub
> language preferences that I expect will continue to exist for decades.
> Full cooperation would then also require the framework to produce
> Clojure code that embodies functionality embodied in Blub code. I'd
> expect that bit to be harder to realize but also more valuable, as it
> would allow drawing not only on the body of work done in Blub for
> reasons of preference but also on legacy code from the dark ages when
> there was no Clojure.
>
> I'm asking this especially in light of the upcoming Clojure Conj where
> there would be an opportunity to discuss this complex subject in a
> "high bandwidth" :) kind of way.
>
> Searching this group I haven't found much along those lines other than
> isolated problems being tackled -- the question here rather being:
> What's the furthest the the envelope can be pushed in terms of co-
> opting the Blub world?
>
> Hank
>
> --
> 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: Learning clojure - comments on my function?

2011-09-29 Thread Jonathan Fischer Friberg
First of all, you should switch from

((fn [ls wip ans] ...) ls [] nil)

to

(loop [ls ls wip [] ans nil] ...)

Read about it here:
http://clojure.org/special_forms

Using higher-order functions, you could do:

(defn split-zero [coll]
  (if (seq coll)
(let [divided (partition-by zero? coll)]
  (take-nth 2 (if (zero? (ffirst divided)) (rest divided) divided)

Step by step:
(partition-by zero? coll)
'(1 2 3 0 4 5 6 0 7 8 9) -> '((1 2 3) (0) (4 5 6) (0) (7 8 9))

(if (zero? (ffirst divided)) (rest divided) divided)
If the first partition consists of zeroes, skip it.

(take-nth 2 ...)
'(3 1 7 3 0) -> '(3 7 0)

On Thu, Sep 29, 2011 at 1:35 PM, Peter Hull  wrote:

> Hi All,
> I am just learning clojure and I've written a function to split a list (see
> docstring for details). I was wondering if any of you experienced hands
> could take a look at it and comment. I've never used lisp or a functional
> language before so I was wondering if I was doing it right or if there is a
> better way. Anyway here is the function:
>
> (defn split-zero
>   "Split a collection at its zero values into a list of lists.
>Multiple zeros are treated as one.
>The order of elements in each inner list is maintained but
>the order of inner lists in the result may be changed.
>e.g. (split-zero '(1 2 3 0 4 5 6 0 7 8 9))
>-> ((7 8 9) (4 5 6) (1 2 3))"
>   [ls] ((fn [ls wip ans]
> (if (empty? ls)
>   (if (empty? wip) ans (conj ans (list* wip)))
>   (if (zero? (first ls))
> (if (empty? wip)
>   (recur (next ls) [] ans)
>   (recur (next ls) [] (conj ans (list* wip
> (recur (next ls) (conj wip (first ls)) ans ls [] nil))
>
> Thanks,
> Peter
>
>  --
> 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: Learning clojure - comments on my function?

2011-09-29 Thread Islon Scherer
You probably want something like

(defn split-zero [ls]
(filter #(not= (first %) 0) (partition-by zero? ls)))

-- 
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: pattern matching in clojure

2011-09-29 Thread Baishampayan Ghose
On Thu, Sep 29, 2011 at 4:16 PM, Ambrose Bonnaire-Sergeant
 wrote:
> (defn append [a b]
>   (match [a b]
>      [[] _] b
>      [[x & as] _] (append as (cons x b)))
> (defn or [b1 b2]
>   (match [b1 b2]
>              [true _] true
>              [_ true] true
>              :else false))

Does the above code work?

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: pattern matching in clojure

2011-09-29 Thread Ambrose Bonnaire-Sergeant
append is missing a closing paren.

It should work.

Ambrose

On Thu, Sep 29, 2011 at 8:21 PM, Baishampayan Ghose wrote:

> On Thu, Sep 29, 2011 at 4:16 PM, Ambrose Bonnaire-Sergeant
>  wrote:
> > (defn append [a b]
> >   (match [a b]
> >  [[] _] b
> >  [[x & as] _] (append as (cons x b)))
> > (defn or [b1 b2]
> >   (match [b1 b2]
> >  [true _] true
> >  [_ true] true
> >  :else false))
>
> Does the above code work?
>
> 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: pattern matching in clojure

2011-09-29 Thread Baishampayan Ghose
On Thu, Sep 29, 2011 at 5:57 PM, Ambrose Bonnaire-Sergeant
 wrote:
> append is missing a closing paren.
> It should work.

Where does `match` come from? I couldn't find it anywhere.

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: pattern matching in clojure

2011-09-29 Thread Ambrose Bonnaire-Sergeant
It's part of core.match.

clojure.core.match.core/match

https://github.com/clojure/core.match

Thanks,
Ambrose

On Thu, Sep 29, 2011 at 8:28 PM, Baishampayan Ghose wrote:

> On Thu, Sep 29, 2011 at 5:57 PM, Ambrose Bonnaire-Sergeant
>  wrote:
> > append is missing a closing paren.
> > It should work.
>
> Where does `match` come from? I couldn't find it anywhere.
>
> 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: pattern matching in clojure

2011-09-29 Thread Baishampayan Ghose
On Thu, Sep 29, 2011 at 6:00 PM, Ambrose Bonnaire-Sergeant
 wrote:
> It's part of core.match.
> clojure.core.match.core/match
> https://github.com/clojure/core.match

Sorry Ambrose, I was so stupid, I was looking at core.logic :-)

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: pattern matching in clojure

2011-09-29 Thread Ambrose Bonnaire-Sergeant
In this exchange I've written core.logic when I meant core.match about 4
times xD

Ambrose

On Thu, Sep 29, 2011 at 8:33 PM, Baishampayan Ghose wrote:

> On Thu, Sep 29, 2011 at 6:00 PM, Ambrose Bonnaire-Sergeant
>  wrote:
> > It's part of core.match.
> > clojure.core.match.core/match
> > https://github.com/clojure/core.match
>
> Sorry Ambrose, I was so stupid, I was looking at core.logic :-)
>
> 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: pattern matching in clojure

2011-09-29 Thread David Nolen
In core.logic you do have matche, which is conceptually similar.

David

On Thu, Sep 29, 2011 at 8:33 AM, Baishampayan Ghose wrote:

> On Thu, Sep 29, 2011 at 6:00 PM, Ambrose Bonnaire-Sergeant
>  wrote:
> > It's part of core.match.
> > clojure.core.match.core/match
> > https://github.com/clojure/core.match
>
> Sorry Ambrose, I was so stupid, I was looking at core.logic :-)
>
> 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: pattern matching in clojure

2011-09-29 Thread Baishampayan Ghose
On Thu, Sep 29, 2011 at 6:06 PM, David Nolen  wrote:
> In core.logic you do have matche, which is conceptually similar.

Right, I knew about `matche` and that added to all the confusion.

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: Learning clojure - comments on my function?

2011-09-29 Thread Peter Hull
Thank you, both!

I guessed there would be a neater solution (I wasn't aware of
partition-by)

Pete

-- 
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: producing Blub code and vv.

2011-09-29 Thread Hank
Mauve has more RAM? :)

On Sep 29, 9:46 pm, David Nolen  wrote:
> ClojureScript?
>
> 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: Are futures garbage-collected?

2011-09-29 Thread Jan Rychter
Thanks to everyone for the helpful replies. I've been using futures in this 
manner for a long time now and they work fine, but I wanted to make sure 
this is the specified behavior.

--J.

-- 
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: Shameless self promotion - JavaOne

2011-09-29 Thread Chas Emerick
Looks good, Dennis.

Similarly, I'll be giving a talk at Java One on Clojure; I'll do my
best to warm up the crowd for you. :-)

Session ID: 25060
Session Title: Real-Time Hot Code Deployment with Clojure
Venue / Room: Parc 55 - Embarcadero
Date and Time: 10/4/11, 13:30 - 14:30
AbstractFew things help boost developer productivity more than
speeding the delivery of code into running environments. Dynamic
languages help by shortening development lifecycles and simplifying
application models, and tools provide similar benefits for static
languages such as Java and Scala, but these options are fundamentally
partial workarounds. This session details how Clojure—a dynamic,
compiled JVM language—facilitates hot code deployment that completely
eliminates turnaround time for developing locally, updating remote
production servers, and even modifying code running on mobile devices.
The presentation uses an open source, IDE-agnostic tool chain to
demonstrate these capabilities and how they accelerate common
development practices.

Perhaps old hat for many here, but hopefully will be a good
introduction to a compelling advantage Clojure offers.

Cheers,

- Chas

On Sep 27, 11:50 am, Dennis  wrote:
> Hey guys,
>
> I will be giving a talk at JavaOne (it is Clojure related).  Here is
> the information.
>
> Title:          Monitoring a Large-Scale Infrastructure with Clojure
> Time             Tuesday, 07:30 PM, Parc 55 - Embarcadero
> Length          45 Minutes
> Abstract:               Monitoring a large infrastructure brings unique 
> challenges
> that require blending development and operations concepts. This
> session discusses how Dell Inc. used Clojure to develop a
> data-flow-based monitoring system that stores, evaluates, and acts on
> hundreds of thousands of metrics.
>
> It covers
> • Real-world applications of Clojure's parallel programming constructs
> to take advantage of multiple cores available in today's systems
> • Using Clojure's homoiconic nature to create DSLs
> • Taking advantage of Clojure running on the JVM to use the Java ecosystem
> • How DevOps takes advantage of the JVM dynamic languages to develop
> new monitoring tools
> Track           Emerging Languages, Tools, and Techniques
> Optional Track          The Java Frontier
>
> -- Dennis

-- 
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: break-on-gaps - just curious if there is a more idiomatic way to do this

2011-09-29 Thread qhfgva
Thanks.  That's helps me think about when/how to use lazy-seq

On Sep 28, 2:00 pm, Nathan Sorenson  wrote:
> If you were feeling so inclined, you could structure this as a lazy sequence
> (like 'partition' does)
>
> (defn lazy-break
>   [coll]
>   (letfn [(break-paired [pairs]
>             (lazy-seq
>              (when-let [s (seq pairs)]
>                (let [p (doall (take-while (fn [[a b]] (= (inc a) b)) pairs))
>                      cutpoint (count p)]
>                  (cons (concat p [(nth pairs cutpoint)])
>                        (break-paired (drop (inc cutpoint) pairs)))]
>     (map #(map first %) (break-paired (map vector coll (rest coll))
>
> user> (take 2 (lazy-break (concat (range 4) (range 3) (range
> ((0 1 2 3) (0 1 2))

-- 
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: break-on-gaps - just curious if there is a more idiomatic way to do this

2011-09-29 Thread qhfgva
Nice.  Also this makes me think that my clojure intuitions are getting
better.

On Sep 28, 3:07 pm, Alan Malloy  wrote:
> I wrote a generalized version of this called partition-between, which
> you can see 
> athttps://github.com/flatland/useful/blob/develop/src/useful/seq.clj#L181
> if you're interested. Using that as a primitive, your break-on-gaps
> function is simple:
>
> user> (partition-between (fn [[a b]] (not= a (dec b))) [1 2 3 5 6 7 8
> 10 20 21])
> ([1 2 3] [5 6 7 8] [10] [20 21])
>
> On Sep 28, 11:39 am,qhfgva wrote:
>
>
>
>
>
>
>
> > I've been working on problems from "Programming Challenges" (Skiena)
> > to learn clojure.  As part of a problem I developed the following
> > routine.  I sort of scare myself how natural thinking in reduce is
> > getting, but I was wondering if there is a more clever/idiomatic way
> > to solve this problem.
>
> > (defn break-on-gaps [minutes]
> >   (reduce (fn [acc x]
> >             (if (empty? acc)
> >               [[x]]
> >               (if (= (inc (last (last acc))) x)
> >                 (conj (vec (butlast acc))
> >                       (conj (last acc) x))
> >                 (conj acc [x]
> >           []
> >           minutes))
>
> > user=> (break-on-gaps [1 2 3 5 6 7 8 10 20 21])
> > [[1 2 3] [5 6 7 8] [10] [20 21]]

-- 
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 to Generate Java Source?

2011-09-29 Thread Dennis Crenshaw
I'm in a bit of a bind-- I've written some really nice Clojure code for
dealing with Genomic sequences that works as well or better than the
reference implementation we currently use where I work. However, the the
hierarchy has recently changed and my new boss is requiring me to have all
code in Java (eg. interop is not an option since he wants the source to be
pure Java.) Is there any way to prevent my head exploding from
hand-translating my Clojure code into Java?

I'm sure it's possible to generate Java source since we heard Rich's amusing
anecdote about using Clojure to write reams of Java boilerplate instead of
doing himself. Is there a precedent or even an existing library for
translation from Clojure into Java source though? I'd like to be able to use
the code I've got without a long, painful devolution. More importantly, I
want to be able to continue developing in Clojure and just compile it to
Java source and check that in.

Thanks,
Dennis

-- 
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 to Generate Java Source?

2011-09-29 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

compile to java class, decompile to java source. works in theory,
until someone actually looks at the source ;)

btw, your new boss is ... not the type of boss that would keep me from
looking for a new job.

Am 29.09.2011 20:09, schrieb Dennis Crenshaw:
> I'm in a bit of a bind-- I've written some really nice Clojure code
> for dealing with Genomic sequences that works as well or better
> than the reference implementation we currently use where I work.
> However, the the hierarchy has recently changed and my new boss is
> requiring me to have all code in Java (eg. interop is not an option
> since he wants the source to be pure Java.) Is there any way to
> prevent my head exploding from hand-translating my Clojure code
> into Java?
> 
> I'm sure it's possible to generate Java source since we heard
> Rich's amusing anecdote about using Clojure to write reams of Java
> boilerplate instead of doing himself. Is there a precedent or even
> an existing library for translation from Clojure into Java source
> though? I'd like to be able to use the code I've got without a
> long, painful devolution. More importantly, I want to be able to
> continue developing in Clojure and just compile it to Java source
> and check that in.
> 
> Thanks, Dennis
> 
> -- 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/

iQIcBAEBAgAGBQJOhLd6AAoJENRtux+h35aGCe4QANMbLKUwasgC5Ue5O+Ad5ozt
Pl0zWDbS29iPYP7NtafPltBUxypZrkDWlT/8mbZW5bkCe2R5V/JyzVO34eIZsUCs
AhcC7TlIXTl8UQQJVC+zKwZ/S6URHApEKI097rxJVGqKEDqjXS7tytqKXYM4hrOp
H1Iu8SQyGdDgEOjL8VQHTGiPeovM6lzW1evK/iqvlUlgDmD5B11ectI9tSrITPn9
IAl+7RK7FcM7B5PESY+GKG4zbitEy4M1UKNQUq1XaCwx2qWERQMhvNrujjUCO9jX
m+na6X5u7Cl/xBxxl52n053e/zQjJK4rdLAgm6K1x1b/t7kofrf+3D9BLCYdr9GY
/1mYhOm1THXgNCYfZYMbDzEwKSy3molnCbPr7pryqj9IJjJ5fEPAfXmSZa7ESZSm
MeEPKnDEhfKSV+NvuQ9srZL0XrN/YDJ+IIckAc1hoAGKUmH4bf+kkhWkD2+cgft2
PO3DG+5kaXy0rc3lP1XAntTQQufIfTwOu69DFPVhOTKHRaWCn/SxDlW2/D3CytU5
MFc59ZKON6sz3L04/9ihnMonW1E/VYl2dvEL/v67s+hkDfc/la4fNpyDP0jnOa6b
didf/CLOoXDf96gkLe87R9WPdfdMgjrWvq+oz+T1JmUN7mCuwb0ha13JrnxBqLIJ
bBwNY9PsIP0B9nJWZCgs
=C3mv
-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: Shameless self promotion - JavaOne

2011-09-29 Thread Felix Filozov
Is the location of the meetup anywhere close to the conference?

On Wednesday, September 28, 2011, Sean Corfield 
wrote:
> The Bay Area Clojure User Group is scheduled to meet on Thursday
> October 6th. Any out of town Clojurians who would be around for that
> meetup and might be persuaded to come and talk about what they're
> doing with Clojure?
>
> http://www.meetup.com/The-Bay-Area-Clojure-User-Group/
>
> Sean
>
> On Tue, Sep 27, 2011 at 8:50 AM, Dennis  wrote:
>> I will be giving a talk at JavaOne (it is Clojure related).  Here is
>> the information.
>>
>> Title:  Monitoring a Large-Scale Infrastructure with Clojure
>> Time Tuesday, 07:30 PM, Parc 55 - Embarcadero
>> Length  45 Minutes
>> Abstract:   Monitoring a large infrastructure brings unique
challenges
>> that require blending development and operations concepts. This
>> session discusses how Dell Inc. used Clojure to develop a
>> data-flow-based monitoring system that stores, evaluates, and acts on
>> hundreds of thousands of metrics.
>>
>> It covers
>> • Real-world applications of Clojure's parallel programming constructs
>> to take advantage of multiple cores available in today's systems
>> • Using Clojure's homoiconic nature to create DSLs
>> • Taking advantage of Clojure running on the JVM to use the Java
ecosystem
>> • How DevOps takes advantage of the JVM dynamic languages to develop
>> new monitoring tools
>> Track   Emerging Languages, Tools, and Techniques
>> Optional Track  The Java Frontier
>
> --
> 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 to Generate Java Source?

2011-09-29 Thread Luc Prefontaine
Oups, you just have been dilberted in a non creative dimension :)

I would go for the bytecode decompilation option, most probably your new boss
will not even notice according to the Dilbert workplace rules.

He most probably pushes is desk away when his mouse hits the border of his 
mouse pad
hopping to correct the problem.

Luc


On Thu, 29 Sep 2011 20:22:50 +0200
Dennis Haupt  wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> compile to java class, decompile to java source. works in theory,
> until someone actually looks at the source ;)
> 
> btw, your new boss is ... not the type of boss that would keep me from
> looking for a new job.
> 
> Am 29.09.2011 20:09, schrieb Dennis Crenshaw:
> > I'm in a bit of a bind-- I've written some really nice Clojure code
> > for dealing with Genomic sequences that works as well or better
> > than the reference implementation we currently use where I work.
> > However, the the hierarchy has recently changed and my new boss is
> > requiring me to have all code in Java (eg. interop is not an option
> > since he wants the source to be pure Java.) Is there any way to
> > prevent my head exploding from hand-translating my Clojure code
> > into Java?
> > 
> > I'm sure it's possible to generate Java source since we heard
> > Rich's amusing anecdote about using Clojure to write reams of Java
> > boilerplate instead of doing himself. Is there a precedent or even
> > an existing library for translation from Clojure into Java source
> > though? I'd like to be able to use the code I've got without a
> > long, painful devolution. More importantly, I want to be able to
> > continue developing in Clojure and just compile it to Java source
> > and check that in.
> > 
> > Thanks, Dennis
> > 
> > -- 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/
> 
> iQIcBAEBAgAGBQJOhLd6AAoJENRtux+h35aGCe4QANMbLKUwasgC5Ue5O+Ad5ozt
> Pl0zWDbS29iPYP7NtafPltBUxypZrkDWlT/8mbZW5bkCe2R5V/JyzVO34eIZsUCs
> AhcC7TlIXTl8UQQJVC+zKwZ/S6URHApEKI097rxJVGqKEDqjXS7tytqKXYM4hrOp
> H1Iu8SQyGdDgEOjL8VQHTGiPeovM6lzW1evK/iqvlUlgDmD5B11ectI9tSrITPn9
> IAl+7RK7FcM7B5PESY+GKG4zbitEy4M1UKNQUq1XaCwx2qWERQMhvNrujjUCO9jX
> m+na6X5u7Cl/xBxxl52n053e/zQjJK4rdLAgm6K1x1b/t7kofrf+3D9BLCYdr9GY
> /1mYhOm1THXgNCYfZYMbDzEwKSy3molnCbPr7pryqj9IJjJ5fEPAfXmSZa7ESZSm
> MeEPKnDEhfKSV+NvuQ9srZL0XrN/YDJ+IIckAc1hoAGKUmH4bf+kkhWkD2+cgft2
> PO3DG+5kaXy0rc3lP1XAntTQQufIfTwOu69DFPVhOTKHRaWCn/SxDlW2/D3CytU5
> MFc59ZKON6sz3L04/9ihnMonW1E/VYl2dvEL/v67s+hkDfc/la4fNpyDP0jnOa6b
> didf/CLOoXDf96gkLe87R9WPdfdMgjrWvq+oz+T1JmUN7mCuwb0ha13JrnxBqLIJ
> bBwNY9PsIP0B9nJWZCgs
> =C3mv
> -END PGP SIGNATURE-
> 



-- 
Luc P.


The rabid Muppet

-- 
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: Shameless self promotion - JavaOne

2011-09-29 Thread Sean Corfield
On Thu, Sep 29, 2011 at 11:35 AM, Felix Filozov  wrote:
> Is the location of the meetup anywhere close to the conference?

The group alternates between San Francisco and Mountain View but we're
considering meeting every month in San Francisco and running the
Mountain View meetings less frequently in addition, going forward.
Because of Java One, we'll almost certainly meet up in San Francisco
this coming week.

Sean

> On Wednesday, September 28, 2011, Sean Corfield 
> wrote:
>> http://www.meetup.com/The-Bay-Area-Clojure-User-Group/

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


Clojure DSL for Storm

2011-09-29 Thread nathanmarz
I've fleshed out and documented the Clojure DSL for Storm. There were
quite a few people interested in this, and I figured the Clojure
community at large would want to know about it.

Here are the docs: https://github.com/nathanmarz/storm/wiki/Clojure-DSL

And here is an example that uses it:
https://github.com/nathanmarz/storm-starter/blob/master/src/clj/storm/starter/clj/word_count.clj

The DSL is quite nice. If you don't know what Storm is, the DSL won't
make a lot of sense, so you should read through the introductory
documentation to learn the concepts of Storm and the abstractions it
exposes.

-Nathan

-- 
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: producing Blub code and vv.

2011-09-29 Thread Nicolas
Clojure has native interoperability with JVM & CLR. This mean that you
can have part of your code written in Clojure, part in Java/Jython/
JRuby if your target the JVM or C# if you target CLR. Of course you'll
not be able to mess everything like first half of a method in Clojure,
second half in java but this is going to work.

Clojurescript might bring you interroperability with JS too.

The best blurb language then is going to be java because support for
it is part of the clojure design.

But adding a new arbitrar language to this equation is going to be
very costly. Also you don't only want interroperability you want to
have a translation to idiomatic blurb code and back to idiomatic
clojure. There is no offering for this right now and this would need
lot of time to do it properly. And from my understanding, I see no
other language that bring such support you ask for. This is not a
feature that clojure lack.

Maybe its me, but I do not see it as a a top priority for clojure
language. We already have support with JVM, CLR. If required to any
language through a network protocol. With Java/Clojure combination you
can do nearly everything and have library for nearly everything too.

Life is great !

On 29 sep, 12:39, Hank  wrote:
> Hi,
>
> I'd like to check the interest in the community for a comprehensive
> Clojure library/framework/whathaveyou that helps produce Java/Python/
> Ruby/... a.k.a. "Blub" (http://www.paulgraham.com/avg.html) code, i.e.
> instead of writing a Clojure program that e.g. produces web pages,
> writing a Clojure program that produces a Blub program that produces
> web pages. A Blub program in idiomatic, maintainable, efficient Blub
> code that is.
>
> This is obviously to enable cooperation on shared domain
> knowledge/"business logic" across communities with mixed Clojure/Blub
> language preferences that I expect will continue to exist for decades.
> Full cooperation would then also require the framework to produce
> Clojure code that embodies functionality embodied in Blub code. I'd
> expect that bit to be harder to realize but also more valuable, as it
> would allow drawing not only on the body of work done in Blub for
> reasons of preference but also on legacy code from the dark ages when
> there was no Clojure.
>
> I'm asking this especially in light of the upcoming Clojure Conj where
> there would be an opportunity to discuss this complex subject in a
> "high bandwidth" :) kind of way.
>
> Searching this group I haven't found much along those lines other than
> isolated problems being tackled -- the question here rather being:
> What's the furthest the the envelope can be pushed in terms of co-
> opting the Blub world?
>
> Hank

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


(flatten )

2011-09-29 Thread ChrisR
Hi there, possibly the flatten documentation is wrong as (flatten nil)
for me is returning
the empty list rather than nil. (1.3.0). Is there a better place to
post this?

  (clojure.core/flatten nil)
  => ()

from docstring:
  "Takes any nested combination of sequential things (lists, vectors,
etc.) and returns their contents as a single, flat sequence.
(flatten nil) returns nil."

-- 
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 to Generate Java Source?

2011-09-29 Thread Nicolas
Best would be to act as professionnal:
- try to convince your new boss of the benefits of using clojure from
a business point of view.
- if this fail, either go back to writing java or quit.

But do not try to abuse your boss and company by developping in
clojure behind the scene and deliver some crappy generated java. This
would be a legitimate reason to be fired.


On 29 sep, 20:09, Dennis Crenshaw  wrote:
> I'm in a bit of a bind-- I've written some really nice Clojure code for
> dealing with Genomic sequences that works as well or better than the
> reference implementation we currently use where I work. However, the the
> hierarchy has recently changed and my new boss is requiring me to have all
> code in Java (eg. interop is not an option since he wants the source to be
> pure Java.) Is there any way to prevent my head exploding from
> hand-translating my Clojure code into Java?
>
> I'm sure it's possible to generate Java source since we heard Rich's amusing
> anecdote about using Clojure to write reams of Java boilerplate instead of
> doing himself. Is there a precedent or even an existing library for
> translation from Clojure into Java source though? I'd like to be able to use
> the code I've got without a long, painful devolution. More importantly, I
> want to be able to continue developing in Clojure and just compile it to
> Java source and check that in.
>
> Thanks,
> Dennis

-- 
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 to Generate Java Source?

2011-09-29 Thread Hank
There isn't an easy solution right now but I think it's worth the
effort producing something there. You might want to join the
discussion over here: http://groups.google.com/group/clojure/t/5da63583815b6102

-- 
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: producing Blub code and vv.

2011-09-29 Thread David Nolen
Have you actually looked at the ClojureScript compiler? In what way is
its design unsuitable for what you're proposing?

David

On Sep 29, 9:11 am, Hank  wrote:
> Mauve has more RAM? :)
>
> On Sep 29, 9:46 pm, David Nolen  wrote:
>
>
>
>
>
>
>
> > ClojureScript?
>
> > 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: producing Blub code and vv.

2011-09-29 Thread Hank
On Sep 30, 8:35 am, Nicolas  wrote:
> Clojure has native interoperability with JVM & CLR.

Right, this is machine interop. What about people interop? How can a
Clojure programmer "interoperate" with a Ruby programmer? Can I chuck
some Clojure code into Google translate (http://google.com/translate)
and out comes Ruby code or vice versa? That would be nice.

> And from my understanding, I see no
> other language that bring such support you ask for. This is not a
> feature that clojure lack.

That's right, if your idea of a "lacking" feature is one that other
langauges have and therefore Clojure should have, too, this isn't the
case here. It is a feature that's "lacking" just because it would be
useful.

> Maybe its me, but I do not see it as a a top priority for clojure
> language.

That's why I posted this, to find out what the need is, how many
Clojure programmers live in inhomogeneous programming environments?
Someone just posted something like that a few hours later (http://
groups.google.com/group/clojure/browse_thread/thread/
18b13c222163dda0), though I was more thinking of the open source
communities out there and the vast amounts of code they produce, they
are easier to observe and interact with since stuff doesn't happen
behind closed doors like in the corporate world.

-- 
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: producing Blub code and vv.

2011-09-29 Thread Raoul Duke
Hank,

it ain't Clojure so this might be irrelevant to you, but some
interesting cross-platform languages are: (a) www.haxe.org which is
mature, and (b) Shen http://preview.tinyurl.com/6hnjpb2 which is still
young.

sincerely.

-- 
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: producing Blub code and vv.

2011-09-29 Thread David Nolen
On Thu, Sep 29, 2011 at 7:54 PM, Hank  wrote:

> On Sep 30, 8:35 am, Nicolas  wrote:
> > Clojure has native interoperability with JVM & CLR.
>
> Right, this is machine interop. What about people interop? How can a
> Clojure programmer "interoperate" with a Ruby programmer? Can I chuck
> some Clojure code into Google translate (http://google.com/translate)
> and out comes Ruby code or vice versa? That would be nice.
>

Embedding V8 is becoming popular in the Ruby community. You can write
ClojureScript and interoperate just fine.

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: aquamacs, slime and clojure on OS X

2011-09-29 Thread Jake Penton
Thanks for all the answers, everyone.

I did the original post and then immediately came down with some kind of 
nasty cold. So I just got back to it today, but have not had a chance to try 
the suggestions.

I'll probably discover that my setup difficulties had a lot to do with 
feeling crummy and being a bit fuzzy in the head. I'll find out shortly 
here.

Thanks again.

- J -

-- 
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: producing Blub code and vv.

2011-09-29 Thread Hank
No. Maintanable and idiomatic code weren't its goals, efficient maybe.
If it did in fact produce maintainable and idiomatic code that would
be an accidental byproduct. Does it?

The ClojureScript compiler was also, from what I understand, designed
to produce small programs, i.e. "one web page's worth" of JavaScript
code. I wouldn't assume that this easily scales up especially
maintainability wise.

On Sep 30, 9:45 am, David Nolen  wrote:
> Have you actually looked at the ClojureScript compiler? In what way is
> its design unsuitable for what you're proposing?
>
> David
>
> On Sep 29, 9:11 am, Hank  wrote:
>
>
>
>
>
>
>
> > Mauve has more RAM? :)
>
> > On Sep 29, 9:46 pm, David Nolen  wrote:
>
> > > ClojureScript?
>
> > > 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: producing Blub code and vv.

2011-09-29 Thread Hank
Just replying to my own post here:

Something like Linj (https://github.com/xach/linj /
http://www.doiserbia.nb.rs/img/doi/1820-0214/2008/1820-02140802019L.pdf)
and the corresponding Jnil go into the right direction.

-- 
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: producing Blub code and vv.

2011-09-29 Thread Hank
Thanks, but from what I can see, they enable machine interop, not
people interop. Instead of cross-platform, can you do cross-community?

On Sep 30, 10:00 am, Raoul Duke  wrote:
> Hank,
>
> it ain't Clojure so this might be irrelevant to you, but some
> interesting cross-platform languages are: (a)www.haxe.orgwhich is
> mature, and (b) Shenhttp://preview.tinyurl.com/6hnjpb2which is still
> young.
>
> sincerely.

-- 
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: producing Blub code and vv.

2011-09-29 Thread Sean Corfield
On Thu, Sep 29, 2011 at 3:39 AM, Hank  wrote:
> I'd like to check the interest in the community for a comprehensive
> Clojure library/framework/whathaveyou that helps produce Java/Python/
> Ruby/... a.k.a. "Blub" (http://www.paulgraham.com/avg.html) code, i.e.
> instead of writing a Clojure program that e.g. produces web pages,
> writing a Clojure program that produces a Blub program that produces
> web pages. A Blub program in idiomatic, maintainable, efficient Blub
> code that is.

I think the major obstacle is likely to be the difference in idioms.
Any substantial idiomatic piece of Clojure is going to be almost
impossible to automatically translate to _idiomatic_ code in another
high-level language that uses different idioms. You'd also probably
have to introduce a number of "coding conventions" to constrain your
Clojure code in order to avoid "holes" in the translation.

Some questions:
* How do you translate Clojure functions in namespaces spread across
multiple files into a Java class?
* Would it even be idiomatic Java to always have classes full of only
static methods?
* What about Clojure's vast library of functions (esp. higher-order)?
* What would something like
(map (juxt :id identity) (filter (comp not nil? :data)
some-lazy-data-stream))
  look like in Blub, if Blub doesn't have keywords, composition,
higher-order functions, lazy data structures?
* How would code that uses STM translate to a Blub without it?
* How idiomatic would Blub code be when Clojure uses immutable data by default?

I think it's a fascinating problem to try to solve for any given
target Blub but I'm not sure how practical it would be, i.e., how
readable the generated Blub code would be to an "average" Blub
programmer...?
-- 
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 to Generate Java Source?

2011-09-29 Thread Nick Brown
It may be easier to convince him by explaining how much time it is
going to cost to do conversion.  Abstract computer science terminology
isn't always that convincing to managers, but explaining how much time
will be wasted is.

On Sep 29, 6:56 pm, Nicolas  wrote:
> Best would be to act as professionnal:
> - try to convince your new boss of the benefits of using clojure from
> a business point of view.
> - if this fail, either go back to writing java or quit.
>
> But do not try to abuse your boss and company by developping in
> clojure behind the scene and deliver some crappy generated java. This
> would be a legitimate reason to be fired.
>
> On 29 sep, 20:09, Dennis Crenshaw  wrote:
>
>
>
>
>
>
>
> > I'm in a bit of a bind-- I've written some really nice Clojure code for
> > dealing with Genomic sequences that works as well or better than the
> > reference implementation we currently use where I work. However, the the
> > hierarchy has recently changed and my new boss is requiring me to have all
> > code in Java (eg. interop is not an option since he wants the source to be
> > pure Java.) Is there any way to prevent my head exploding from
> > hand-translating my Clojure code into Java?
>
> > I'm sure it's possible to generate Java source since we heard Rich's amusing
> > anecdote about using Clojure to write reams of Java boilerplate instead of
> > doing himself. Is there a precedent or even an existing library for
> > translation from Clojure into Java source though? I'd like to be able to use
> > the code I've got without a long, painful devolution. More importantly, I
> > want to be able to continue developing in Clojure and just compile it to
> > Java source and check that in.
>
> > Thanks,
> > Dennis

-- 
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: aquamacs, slime and clojure on OS X

2011-09-29 Thread Jake Penton
Ok, I followed the simple instructions, but ran into a minor problem.

It seems that the Aquamacs version of slime conflicts with the clojure 
setup, and should be disabled. This version of slime (as delivered by the 
Aquamacs folks) is installed in /Library/Application Support/Aquamacs 
Emacs/SLIME/. Since I am not going to be using slime with Common Lisp for a 
while, I just deleted the afore-mentioned directory. There is no doubt a 
more subtle way, but for now I don't care.

My guess is that the majority of people using Aquamacs and clojure may not 
have had slime set up as I had for use with Common Lisp, so the conflict may 
not have been evident.

I now get a toplevel when I navigate to a leiningen project and do M-x 
clojure-jack-in, so HAPPY HAPPY HAPPY!

Thanks.

- J -


-- 
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: producing Blub code and vv.

2011-09-29 Thread Hank
> I think the major obstacle is likely to be the difference in idioms.
> Any substantial idiomatic piece of Clojure is going to be almost
> impossible to automatically translate to _idiomatic_ code in another
> high-level language that uses different idioms.

That could very well turn out to be the case. In the spectrum between
"fully manual" and "fully automated" I can picture scenarios like:
- Mostly manual but with some automatic assistance from the IDE: E.g.
the way Eclipse assists you in coding Java, when you press Ctrl+Space.
It doesn't automatically write code for you but it can narrow down the
choice as to what to type next.
- Most automatic but with some manual assistance from the coder: E.g.
annotate the Clojure code with hints about the idioms to translate to
in the target language. Right now in Clojure we use annotations
like :exposes-methods that aren't strictly for the Clojure
functionality itself but for Java interop. So there could be
annotations like :use-design-pattern-x that dictate the choice of
idiom/design pattern in the compilation to the target language.

> You'd also probably
> have to introduce a number of "coding conventions" to constrain your
> Clojure code in order to avoid "holes" in the translation.

It's probably a question of how unwieldy the produced code is allowed
to get. If you express the goal of "maintainability" in terms of some
metric like lines of code or whatever then I can see hard limits being
reached. If you don't put a limit on that then I don't see any danger
of holes.

> Some questions:
> * How do you translate Clojure functions in namespaces spread across
> multiple files into a Java class?
> [...]

Those are very good questions and I'd have to think about it. Maybe
I'll start a wiki somewhere so we can start collecting "translation
recipes". Generally, if the answer isn't obvious from staring at the
Clojure code, it helps to think about the problems in terms of the
bigger picture, i.e. the business logic/domain knowledge, and then
translate to Blub in the head. E.g. "I want to cache generated web
pages on the disk, how would I do this in Java?"

> * How would code that uses STM translate to a Blub without it?

I like this one in particular. People have written concurrent code
before STM. I do it in my job every day. :) How did that work with
explicit locks again??

> * How idiomatic would Blub code be when Clojure uses immutable data by 
> default?

A good source for this is the O'Reilly book "Functional Programming in
Java". There you can see how idioms from one language can be applied
to another. I think Java code that uses a lot of immutable data, i.e.
"final" variables all around, would still be accepted by the Java
community. The produced code could even leave out the "final" keyword
in order to not cause too much clutter but still not modify the
variables. It violates the principle of least authority but I see that
in real-world code everywhere.

> I think it's a fascinating problem to try to solve for any given
> target Blub but I'm not sure how practical it would be, i.e., how
> readable the generated Blub code would be to an "average" Blub
> programmer...?

The problem may have to be solved first in order to judge the value of
the solution. My day-to-day experience and my guts tell me it's worth
it. :D

You weren't going to the Conj by any chance, were 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


Re: producing Blub code and vv.

2011-09-29 Thread Sean Corfield
On Thu, Sep 29, 2011 at 10:48 PM, Hank  wrote:
> A good source for this is the O'Reilly book "Functional Programming in
> Java". There you can see how idioms from one language can be applied
> to another.

Oh yes, I know about that book but the question is: how idiomatic is
that code in Java? You can write imperative, stateful code in Clojure
but it wouldn't be idiomatic.

> You weren't going to the Conj by any chance, were you?

Yup. Looking forward to it!
-- 
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: producing Blub code and vv.

2011-09-29 Thread Hank
Addendum: Just as an example, for this here ...

> Would it even be idiomatic Java to always have classes full of only
> static methods?

... the Java-ists have an idiom ("design pattern") called singleton.
They're not static methods but once-instance classes.

-- 
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: pattern matching in clojure

2011-09-29 Thread Kevin Downey
Last I checked matchjure generates fns which break recur (there is an issue
open for it). Trading recursion for matching seems like a bad deal, I
recommend using match instead.
On Sep 29, 2011 4:32 AM, "Christian Pohlmann" 
wrote:
> Additionally to core.match there is also matchure [1] which comes with
> a defn-match that can be used like this:
>
> (defn-match choose
> ([_ 0] 1)
> ([0 _] 0)
> ([?n ?k] (+ (choose (dec n) (dec k)) (choose (dec n) k
>
> This makes defining functions fairly close to what you're used from
Haskell.
>
> [1] https://github.com/dcolthorp/matchure
>
> Christian
>
>
> On Thu, Sep 29, 2011 at 12:03 PM, Michael Jaaka
>  wrote:
>> Hi!
>>
>> Is there any way to define function with pattern matching in function
>> signature as it is in haskell?
>>
>> Bye!
>>
>> --
>> 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: producing Blub code and vv.

2011-09-29 Thread Sean Corfield
On Thu, Sep 29, 2011 at 11:24 PM, Hank  wrote:
>> Would it even be idiomatic Java to always have classes full of only
>> static methods?
> ... the Java-ists have an idiom ("design pattern") called singleton.
> They're not static methods but once-instance classes.

Doesn't that kind of prove my point? :)

And, after all, isn't the Singleton design pattern only a workaround
for the fact that languages like Java don't have a built-in construct
for creating a memoized global variable? :)

See you at the Conj...
-- 
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: producing Blub code and vv.

2011-09-29 Thread Hank
On Sep 30, 2:58 pm, Sean Corfield  wrote:
> On Thu, Sep 29, 2011 at 11:24 PM, Hank  wrote:
> >> Would it even be idiomatic Java to always have classes full of only
> >> static methods?
> > ... the Java-ists have an idiom ("design pattern") called singleton.
> > They're not static methods but once-instance classes.
>
> Doesn't that kind of prove my point? :)

Uh not sure. Let's argue about it in person in November.

> And, after all, isn't the Singleton design pattern only a workaround
> for the fact that languages like Java don't have a built-in construct
> for creating a memoized global variable? :)

http://c2.com/cgi/wiki?AreDesignPatternsMissingLanguageFeatures

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