Re: Git with Google Code

2009-04-28 Thread Dan
On Tue, Apr 28, 2009 at 4:36 PM, Rayne  wrote:

>
> Git still sucks on windows :\
>

On which grounds?

Or as wikipedia would put it [citation needed]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: more vimclojure

2009-04-28 Thread Adrian Cuthbertson

Likewise a real fan!

In the absence of an issue tracker at this time, could I mention the
following relating to indenting;

(defn xxx
  "Some stuff...

(defmacro xxx
  "Some stuff...

(defroutes xxx
 "Some stuf...

That is, the indenting starts under the argument for "non-recognised"
fn names - which tends to mess up auto alignment (=).

Is there an easy way around this or if not could it be changed in vimclojure?

Thanks Meikel, great work!

Adrian.


On Wed, Apr 29, 2009 at 4:42 AM, Johan Berntsson  wrote:
>
> On Apr 29, 11:21 am, tmountain  wrote:
>> I just wanted to chime in and say I'm also a fan of vimclojure. I find
>> it to be one of the more enjoyable dev environments I've worked in and
>> the ability to send arbitrary expressions to the REPL is really
>> convenient. I have found a few issues with it though, and I'm
>> wondering what the appropriate chanel to report them is?
>
> I've been emailing directly to Meikel, but perhaps a issue tracker of
> some kind would be good? It is of course up to Meikel, and VimClojure
> is already good enough for me to use for all my Clojure hacking
> (including some paid work).
>
> /Johan
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: more vimclojure

2009-04-28 Thread Johan Berntsson

On Apr 29, 11:21 am, tmountain  wrote:
> I just wanted to chime in and say I'm also a fan of vimclojure. I find
> it to be one of the more enjoyable dev environments I've worked in and
> the ability to send arbitrary expressions to the REPL is really
> convenient. I have found a few issues with it though, and I'm
> wondering what the appropriate chanel to report them is?

I've been emailing directly to Meikel, but perhaps a issue tracker of
some kind would be good? It is of course up to Meikel, and VimClojure
is already good enough for me to use for all my Clojure hacking
(including some paid work).

/Johan

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: more vimclojure

2009-04-28 Thread tmountain

I just wanted to chime in and say I'm also a fan of vimclojure. I find
it to be one of the more enjoyable dev environments I've worked in and
the ability to send arbitrary expressions to the REPL is really
convenient. I have found a few issues with it though, and I'm
wondering what the appropriate chanel to report them is?

Travis

On Apr 28, 3:55 pm, jim  wrote:
> Meikel,
>
> I've been poking at vimclojure and I like it. I'm looking forward to
> get good at using it. So far, I've changed it so that the preview
> window and new REPL's open to the right of the current window.
>
> One question, is it possible to restart a REPL so that any definitions
> loaded previously are gone and you have a brand new environment to
> work in?
>
> Thanks,
> Jim
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: Post 1.0 features

2009-04-28 Thread Rich Hickey



On Apr 28, 5:40 pm, Phil Hagelberg  wrote:
> Marko Kocić  writes:
> > Since Clojure seems like feature complete for 1.0 release, I am
> > starting to be curious what are the features planned for after 1.0
> > release?
>
> You can check the issues list:
>
>  http://code.google.com/p/clojure/issues/list
>
> These are mostly bug fixes rather than new features though.
>
> I posted a fix for #13 that validates symbols and keywords have names
> that are recognizable by the reader, but I suspect the possibility of
> breakage is too great for it to make it into 1.0:
>
>  http://code.google.com/p/clojure/issues/detail?id=13
>
> The one I'm really looking forward to is the ability to add metadata to
> fn values:
>
>  http://code.google.com/p/clojure/issues/detail?id=90
>

I've moved some of my notes on future features here:

http://clojure.org/todo

Rich

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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, converting a sequence with repetitions to a multi-map

2009-04-28 Thread Jason Wolfe

(defn seq-to-multimap
  "takes a sequence s of possibly repeating elements
   and converts it to a map, where keys are obtained by applying key-
fn
   to elements of s and values are sequence of all elements of s with
   the particular key"
  [s key-fn]
  (apply merge-with concat
 (map (fn [x] {(key-fn x) [x]}) s)))

Here's a more concise, but probably significantly slower version 

-Jason
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: PeepCode screencast

2009-04-28 Thread Rick Moynihan

After reading the comments above, I managed to convince my boss (a
former lisp hacker) to shell out for the peepcode screencasts for
me...

Overall I'd also say that I agree with the majority of comments found here.

The quality of the screencasts is excellent, and the material is well
presented; however the comments of others certainly hold true.  Put
briefly the screencast hasn't really chosen it's audience.

If like me, you have been tinkering with clojure for a few months and
are beginning to get more serious with it then you'll likely find the
screencast a worthwhile purchase.  The code example (a basic socket
based Multi User Dungeon) is excellent and provides a good
demonstration of clojure's concurrency primitives.  The code appears
idiomatic with coverage of namespaces and code layout in a moderately
sized example being invaluable too.

I just wish the discussion of "why clojure", multi-core, basic syntax,
map/reduce etc... had been left out for a more introductory
screencast.  I felt that for a beginner, unfamiliar with lisp or
functional programming these sections went far too quickly, whilst for
the more initiated they left less time for the 'good stuff'.

Anyway, I learned a few things from the screencast; and though I'm
confident I would have picked them up anyway this screencast feels
like a good way to cement your existing knowledge and perhaps pick up
a few tricks on the way.

It's good to see clojure getting this kind of coverage.  Keep it coming! :-)

R.


2009/4/27 Andrew Wagner :
> I can agree with that, for the most part. But if you've been doing clojure
> for a while, why cover basic syntax, basic map/reduce stuff, etc.? The time
> could have been spent more usefully. It just failed to pick an audience and
> stick with it, that's all.
>
> On Mon, Apr 27, 2009 at 2:45 PM, Paul Barry  wrote:
>>
>> Yeah, I agree that it was pretty good.  I like that you have a non-trivial
>> working application at the end of it.  My one criticism is that it's too
>> hard to try to follow along and write the code as you go because there are
>> too many changes from each step to step that aren't discussed in the
>> screencast, you just have to look at the code.
>>
>> Also, it does glaze over too many topics to be useful for a beginner, so
>> I'm not sure that explaining some basic concepts as they come up but not
>> others does anyone any good.  Stu's book is much better for a beginner, but
>> if you have been doing Clojure for a little while, this is a great
>> screencast.
>>
>> On Mon, Apr 27, 2009 at 6:51 AM, Jennifer Morgan
>>  wrote:
>>>
>>> I though the screen cast was really very good,especially as it gives a
>>> good overview of how to break up your code and about packaging. It
>>> does go a bit quick, but I found that by re-watching + reading the
>>> code at the same time very helpful. It a useful demo to see the power
>>> and conciseness of clojure ;-)
>>>
>>>
>>> On 26/04/2009, Andrew Wagner  wrote:
>>> > Just to provide a review - I must say, I really wanted to like this
>>> > screencast, and failed, unfortunately. It tries to cover everything
>>> > from
>>> > "what is functional programming?" (tracing through passing functional
>>> > arguments, and basic map/reduce stuff, for example) to the intricacies
>>> > of
>>> > STM use and clojure syntax/semantics. While all of these are worthwhile
>>> > talks, trying to cover all of them in an hour means flying through them
>>> > and
>>> > really barely getting into any of them.
>>> >
>>> > On Fri, Apr 24, 2009 at 1:03 PM, Phil Hagelberg 
>>> > wrote:
>>> >
>>> >>
>>> >> I'm proud to announce that the "Functional Programming with Clojure"
>>> >> PeepCode screencast has just been published:
>>> >>
>>> >> http://peepcode.com/products/functional-programming-with-clojure
>>> >>
>>> >> It's a professionally-produced 65-minute video that introduces all the
>>> >> foundational concepts of Clojure by stepping through the creation of a
>>> >> multiplayer text adventure game. If you've been looking for a quick
>>> >> way to get up to speed on Clojure, this is your ticket.
>>> >>
>>> >> The screencast is sold for $9, and there's a preview available:
>>> >>
>>> >> http://peepcode.com/system/uploads/2009/peepcode-clojure-preview.mov
>>> >>
>>> >> Hope you like it!
>>> >>
>>> >> -Phil Hagelberg
>>> >>
>>> >> http://technomancy.us
>>> >>
>>> >> >
>>> >>
>>> >
>>> > >
>>> >
>>>
>>>
>>
>>
>>
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



please update the svn repo in sourceforge

2009-04-28 Thread Jordi Burguet-Castell

Hi,

I got bitten by some problems because I was pulling from the
sourceforge svn. It made me stop looking into clojure for a while, but
just today I randomly found a post that made me realize that I wasn't
pulling from the right place.

As Phil said a couple of months ago:
"""
It would probably be a good idea to make it so the last commit in the
SF
repo is simply a README saying "don't use this anymore; use the
current
repository at [...]" and remove all the code in it just to avoid these
problems in the future.
"""

I definitely second that idea.

Cheers,
jordi

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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, converting a sequence with repetitions to a multi-map

2009-04-28 Thread Meikel Brandmeyer

Hi,

Am 28.04.2009 um 23:28 schrieb Boris Mizhen:


BTW, I hope I'm not abusing this mailing list by asking questions like
this?


This list and the #clojure channel are the right place to ask
such questions. That said, there is the search facility of google
groups and the log of the channel at http://clojure-log.n01se.net
So searching a bit to eliminate FAQs before asking a question
is a good idea, but not required. :)


Sincerely
Meikel



smime.p7s
Description: S/MIME cryptographic signature


Re: Post 1.0 features

2009-04-28 Thread Phil Hagelberg

Marko Kocić  writes:

> Since Clojure seems like feature complete for 1.0 release, I am
> starting to be curious what are the features planned for after 1.0
> release?

You can check the issues list:

  http://code.google.com/p/clojure/issues/list

These are mostly bug fixes rather than new features though.

I posted a fix for #13 that validates symbols and keywords have names
that are recognizable by the reader, but I suspect the possibility of
breakage is too great for it to make it into 1.0:

  http://code.google.com/p/clojure/issues/detail?id=13

The one I'm really looking forward to is the ability to add metadata to
fn values:

  http://code.google.com/p/clojure/issues/detail?id=90

-Phil

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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, converting a sequence with repetitions to a multi-map

2009-04-28 Thread Christophe Grand

Hi Boris,

Boris Mizhen a écrit :
> I am starting to learn clojure. I would appreciate comments on the
> utility function below.
> Coding style, idiomatic Clojure, comment style, efficiency, naming
> conventions, indentations (used slime) ... anything I should
> improve :)
>
> (defn seq-to-multimap [s key-fn]
>   "takes a sequence s of possibly repeating elements
>and converts it to a map, where keys are obtained by applying key-
> fn
>to elements of s and values are sequence of all elements of s with
> the
>particular key"
>   (reduce
>(fn [amap item]
>  (let [key (key-fn item)]
>(assoc amap key
> (if-let [it (amap key)]
>   (conj it item)
>   (list item)
>{} s))
>   

First, you misplaced the docstring: it comes before the args vector.
Using a default return value, you can rewrite the (if-let...) as (conj 
(amap key ()) item).

> user> (seq-to-multimap [1 :key :key 2 3 3 nil] #(identity %1))
> {nil (nil), 3 (3 3), 2 (2), :key (:key :key), 1 (1)}
>   

Here you don't need to write #(identity %1), "identity" suffices.

> Would it be better to have this function to create a list of lists
> using an equality op instead?
>   

I think it's a better choice to have it return a map because, to compute 
the result, you need to efficiently index by key.

-- 
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.blogspot.com/ (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
To unsubscribe from 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, converting a sequence with repetitions to a multi-map

2009-04-28 Thread Boris Mizhen

Thanks Stuart,
preserving order is a nice touch :)

I also did not realize that conj preserves sequence type ...

BTW, I hope I'm not abusing this mailing list by asking questions like
this?

Boris

On Apr 28, 5:15 pm, Stuart Sierra  wrote:
> Hi Boris, welcome to Clojure!
>
> This function looks reasonable to me.  In your example, you don't need
> to write "#(identity %)" -- just "identity" is enough.  If you want to
> preserve the order of objects in the sequence, you can use a vector
> instead of a list.
>
> I would use "contains?" in the conditional test.  It took me a while
> to realize that the values in amap will never be false/nil, so you
> don't have to worry about (amap key) being logical false.  But in
> other uses of maps, that can be a concern.
>
> So here's my version:
>
> (defn seq-to-multimap [s key-fn]
>   (reduce
>    (fn [amap item]
>      (let [key (key-fn item)]
>        (assoc amap key
>               (if (contains? amap key)
>                 (conj (amap key) item)
>                 [item]
>    {} s))
>
> As to whether this should return a map or a list of lists, that all
> depends on what you want to use it for.  Here's a nice demonstration:
>
> user> (seq-to-multimap (range 1 15) #(mod % 5))
> {0 [5 10], 4 [4 9 14], 3 [3 8 13], 2 [2 7 12], 1 [1 6 11]}
>
> -SS
>
> On Apr 28, 4:19 pm, Boris Mizhen  wrote:
>
> > Hello all,
>
> > I am starting to learn clojure. I would appreciate comments on the
> > utility function below.
> > Coding style, idiomatic Clojure, comment style, efficiency, naming
> > conventions, indentations (used slime) ... anything I should
> > improve :)
>
> > (defn seq-to-multimap [s key-fn]
> >   "takes a sequence s of possibly repeating elements
> >    and converts it to a map, where keys are obtained by applying key-
> > fn
> >    to elements of s and values are sequence of all elements of s with
> > the
> >    particular key"
> >   (reduce
> >    (fn [amap item]
> >      (let [key (key-fn item)]
> >        (assoc amap key
> >               (if-let [it (amap key)]
> >                 (conj it item)
> >                 (list item)
> >    {} s))
>
> > user> (seq-to-multimap [1 :key :key 2 3 3 nil] #(identity %1))
> > {nil (nil), 3 (3 3), 2 (2), :key (:key :key), 1 (1)}
>
> > Would it be better to have this function to create a list of lists
> > using an equality op instead?
>
> > Thank you!
> > Boris
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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, converting a sequence with repetitions to a multi-map

2009-04-28 Thread Stuart Sierra

Hi Boris, welcome to Clojure!

This function looks reasonable to me.  In your example, you don't need
to write "#(identity %)" -- just "identity" is enough.  If you want to
preserve the order of objects in the sequence, you can use a vector
instead of a list.

I would use "contains?" in the conditional test.  It took me a while
to realize that the values in amap will never be false/nil, so you
don't have to worry about (amap key) being logical false.  But in
other uses of maps, that can be a concern.

So here's my version:

(defn seq-to-multimap [s key-fn]
  (reduce
   (fn [amap item]
 (let [key (key-fn item)]
   (assoc amap key
  (if (contains? amap key)
(conj (amap key) item)
[item]
   {} s))

As to whether this should return a map or a list of lists, that all
depends on what you want to use it for.  Here's a nice demonstration:

user> (seq-to-multimap (range 1 15) #(mod % 5))
{0 [5 10], 4 [4 9 14], 3 [3 8 13], 2 [2 7 12], 1 [1 6 11]}


-SS


On Apr 28, 4:19 pm, Boris Mizhen  wrote:
> Hello all,
>
> I am starting to learn clojure. I would appreciate comments on the
> utility function below.
> Coding style, idiomatic Clojure, comment style, efficiency, naming
> conventions, indentations (used slime) ... anything I should
> improve :)
>
> (defn seq-to-multimap [s key-fn]
>   "takes a sequence s of possibly repeating elements
>    and converts it to a map, where keys are obtained by applying key-
> fn
>    to elements of s and values are sequence of all elements of s with
> the
>    particular key"
>   (reduce
>    (fn [amap item]
>      (let [key (key-fn item)]
>        (assoc amap key
>               (if-let [it (amap key)]
>                 (conj it item)
>                 (list item)
>    {} s))
>
> user> (seq-to-multimap [1 :key :key 2 3 3 nil] #(identity %1))
> {nil (nil), 3 (3 3), 2 (2), :key (:key :key), 1 (1)}
>
> Would it be better to have this function to create a list of lists
> using an equality op instead?
>
> Thank you!
> Boris
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: Should line-seq close the reader?

2009-04-28 Thread Bradbev

On Apr 28, 10:45 am, Meikel Brandmeyer  wrote:
> Hi,
>
> Am 28.04.2009 um 19:01 schrieb Bradbev:
>
> > Is it a good idea for line-seq to close its BufferedReader when there
> > is no more data?  Or at least provide an optional parameter that
> > allows/disallows close?
>
> The cleanest solution with respect to lazy sequences is
> realisation.
>
> (with-open [rdr (...)]
>    (doall (line-seq rdr)))

Not very lazy though is it? :)

>
> Closing the reader when reaching the end of the seq
> doesn't help, since maybe you never reach the end of
> the seq? So passing the seq outside of your responsibility
> means realising it and closing the reader, eg. via the
> code above.
Wouldn't the finalizer for the BufferedReader call close in that
case?  Not really ideal though I guess.

>
> If the seq doesn't leave your area of responsibility you
> can consume the seq and close the reader explicitely.
>
> At least this is my understanding of the current situation.
>
> (Note: this also applies to db connections and such...)
>
> Sincerely
> Meikel
>
>  smime.p7s
> 5KViewDownload
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: more vimclojure

2009-04-28 Thread jim

The position setting sounds good.

As far as the new REPL goes, in much of my code, I set the namespace
and I would like to have all those blown away as well. Would it be
possible to add a command to the nailgun server that would cause it to
shutdown and automatically restart? Alternatively, I got Java Service
Wrapper, http://wrapper.tanukisoftware.org/doc/english/download.jsp,
working with a network app of mine. Supposedly, it starts a JVM and
restarts it if it crashes. If something like that was used, just
killing the server would cause it to be restarted.

Jim

On Apr 28, 3:06 pm, Meikel Brandmeyer  wrote:
> Hi,
>
> Am 28.04.2009 um 21:55 schrieb jim:
>
> > I've been poking at vimclojure and I like it. I'm looking forward to
> > get good at using it. So far, I've changed it so that the preview
> > window and new REPL's open to the right of the current window.
>
> The next version will have a vimclojure#SplitPos so that one
> can choose the position (left, right, top or bottom).
>
> > One question, is it possible to restart a REPL so that any definitions
> > loaded previously are gone and you have a brand new environment to
> > work in?
>
> Not yet. You have to restart the server. The problem is, that the
> connection to the Repl is not continuous but re-established every
> time a command is sent. So I have to distinguish the connections.
> Hmm.. Maybe I will install one namespace per Repl. So closing
> the Repl with ,close will nuke the namespace.. Hmm...
>
> Anyway noted down for the feature list.
>
> Thanks for the feedback.
>
> Sincerely
> Meikel
>
>  smime.p7s
> 5KViewDownload
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: Git with Google Code

2009-04-28 Thread Rayne

Git still sucks on windows :\

On Apr 28, 11:04 am, Stuart Sierra 
wrote:
> FYI, for those interested in using Git for Clojure sources, here's
> Google's advice on how to use Git with Google Code:
>
> http://google-opensource.blogspot.com/2008/05/develop-with-git-on-goo...
>
> -SS
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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, converting a sequence with repetitions to a multi-map

2009-04-28 Thread Boris Mizhen

Hello all,

I am starting to learn clojure. I would appreciate comments on the
utility function below.
Coding style, idiomatic Clojure, comment style, efficiency, naming
conventions, indentations (used slime) ... anything I should
improve :)

(defn seq-to-multimap [s key-fn]
  "takes a sequence s of possibly repeating elements
   and converts it to a map, where keys are obtained by applying key-
fn
   to elements of s and values are sequence of all elements of s with
the
   particular key"
  (reduce
   (fn [amap item]
 (let [key (key-fn item)]
   (assoc amap key
  (if-let [it (amap key)]
(conj it item)
(list item)
   {} s))

user> (seq-to-multimap [1 :key :key 2 3 3 nil] #(identity %1))
{nil (nil), 3 (3 3), 2 (2), :key (:key :key), 1 (1)}

Would it be better to have this function to create a list of lists
using an equality op instead?

Thank you!
Boris
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: Should line-seq close the reader?

2009-04-28 Thread Bradbev

On Apr 28, 12:53 pm, Stuart Sierra 
wrote:
> clojure.contrib-duck-streams has a similar function, read-lines, that
> does close the Reader after all the lines have been read (and the
> sequence consumed).  It's not entirely safe, because if an exception
> or something prevents you from reading all the lines, the Reader
> remains open.
>
> -Stuart Sierra
I should have known contrib would have had something.  I need to read
the contrib sources more.  Thanks!

Brad

>
> On Apr 28, 1:01 pm, Bradbev  wrote:
>
> > Hello,
> > I want to use line-seq, and have it close the input reader.
> > My first attempt was
> > (with-open [stream (BufferedReader.)]
> > (line-seq stream))
> > Which crashes immediately because you can't read lines from a closed
> > seq.  So, the only way to explicitly close the reader associated with
> > line-seq is to keep another ref to it.
>
> > Is it a good idea for line-seq to close its BufferedReader when there
> > is no more data?  Or at least provide an optional parameter that
> > allows/disallows close?
>
> > Cheers,
> > Brad
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: more vimclojure

2009-04-28 Thread Meikel Brandmeyer

Hi,

Am 28.04.2009 um 21:55 schrieb jim:


I've been poking at vimclojure and I like it. I'm looking forward to
get good at using it. So far, I've changed it so that the preview
window and new REPL's open to the right of the current window.


The next version will have a vimclojure#SplitPos so that one
can choose the position (left, right, top or bottom).


One question, is it possible to restart a REPL so that any definitions
loaded previously are gone and you have a brand new environment to
work in?


Not yet. You have to restart the server. The problem is, that the
connection to the Repl is not continuous but re-established every
time a command is sent. So I have to distinguish the connections.
Hmm.. Maybe I will install one namespace per Repl. So closing
the Repl with ,close will nuke the namespace.. Hmm...

Anyway noted down for the feature list.

Thanks for the feedback.

Sincerely
Meikel



smime.p7s
Description: S/MIME cryptographic signature


more vimclojure

2009-04-28 Thread jim

Meikel,

I've been poking at vimclojure and I like it. I'm looking forward to
get good at using it. So far, I've changed it so that the preview
window and new REPL's open to the right of the current window.

One question, is it possible to restart a REPL so that any definitions
loaded previously are gone and you have a brand new environment to
work in?

Thanks,
Jim
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: Should line-seq close the reader?

2009-04-28 Thread Stuart Sierra

clojure.contrib-duck-streams has a similar function, read-lines, that
does close the Reader after all the lines have been read (and the
sequence consumed).  It's not entirely safe, because if an exception
or something prevents you from reading all the lines, the Reader
remains open.

-Stuart Sierra


On Apr 28, 1:01 pm, Bradbev  wrote:
> Hello,
> I want to use line-seq, and have it close the input reader.
> My first attempt was
> (with-open [stream (BufferedReader.)]
> (line-seq stream))
> Which crashes immediately because you can't read lines from a closed
> seq.  So, the only way to explicitly close the reader associated with
> line-seq is to keep another ref to it.
>
> Is it a good idea for line-seq to close its BufferedReader when there
> is no more data?  Or at least provide an optional parameter that
> allows/disallows close?
>
> Cheers,
> Brad
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: Getting slime-edit-definition to work with Clojure

2009-04-28 Thread Baishampayan Ghose

Phil,

> I suspect the problem might have to do with the fact that you're
> configuring slime for both SBCL and Clojure. I know it's possible to
> get this working, but it's a lot more complicated that way. I'd
> suggest having one file for clojure slime config and one for sbcl, and
> only load one of them per Emacs instance.
> 
> I'm sure someone who's more familiar with SLIME and Common Lisp could
> figure out a solution, but this seems like simplest solution.

My eyes lit up for a second! I removed all SBCL support from SLIME and
it still doesn't work :(

Can you kindly share your working dotfiles and enlighten me?

My current .emacs has this:
;;;

(require 'slime)
(slime-setup '(slime-fancy slime-banner slime-mdot-fu))

(defvar slime-net-coding-system
  (find-if 'slime-find-coding-system
   '(utf-8-unix iso-latin-1-unix iso-8859-1-unix binary)))

;;; Clojure specific
(defvar clj-root (concat (expand-file-name "~") "/clojure/"))
(setq load-path (append
 (list (concat clj-root "clojure-mode")
   (concat clj-root "swank-clojure"))
 load-path))

(setq swank-clojure-binary "clojure")

(require 'swank-clojure-autoload)

(add-to-list 'slime-lisp-implementations
 '(clojure ("/home/ghoseb/bin/clojure") :init
swank-clojure-init))

(require 'clojure-mode)
(eval-after-load 'clojure-mode '(clojure-slime-config))

(autoload 'clojure-mode "clojure-mode" "A major mode for Clojure" t)
(add-to-list 'auto-mode-alist '("\\.clj$" . clojure-mode))

(defun lisp-enable-paredit-hook ()
  (paredit-mode 1))

(add-hook 'clojure-mode-hook 'lisp-enable-paredit-hook)

(defun clj ()
  "Starts Clojure in Slime"
  (interactive)
  (slime 'clojure))
;;;

Regards,
BG

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



Re: vimclojure help

2009-04-28 Thread Meikel Brandmeyer

Hi,

Am 28.04.2009 um 20:24 schrieb jim:


Success!


\o/ Good to hear. Will fix the launcher script.


After changing ng-server to be correct, I set up CLOJURE_EXT and
CLASSPATH, then called it. Calling ng from the command line showed
that it still couldn't find clojure-contrib.jar, so I added that to
CLASSPATH. Then calling ng from the command line gave me 'usr'.

Gvim was still failing when I started a REPL from command mode. It was
giving an error that it couldn't find /home/jim/vimclojure-2.0.1/ng.
Instead of figuring out why, I just created the directory and put ng
into it. After that, things worked.


Probably some typo in your configuration:

let vimclojure#NailgunClient = "/home/jim/vimclojure-2.0.1/ng"

vs.

let vimclojure#NailgunClient = "/home/jim/vimclojure-2.1.0/ng"

Sincerely
Meikel



smime.p7s
Description: S/MIME cryptographic signature


Re: vimclojure help

2009-04-28 Thread jim

Success!

After changing ng-server to be correct, I set up CLOJURE_EXT and
CLASSPATH, then called it. Calling ng from the command line showed
that it still couldn't find clojure-contrib.jar, so I added that to
CLASSPATH. Then calling ng from the command line gave me 'usr'.

Gvim was still failing when I started a REPL from command mode. It was
giving an error that it couldn't find /home/jim/vimclojure-2.0.1/ng.
Instead of figuring out why, I just created the directory and put ng
into it. After that, things worked.

Jim

On Apr 28, 10:52 am, Meikel Brandmeyer  wrote:
> Hi,
>
> Am 28.04.2009 um 01:56 schrieb jim:
>
> > java.lang.NoClassDefFoundError: clojure/lang/APersistentMap (wrong
> > name: clojure/proxy/clojure/lang/APersistentMap)
>
> This is a sign, that the clojure.jar is missing from the classpath.
> Please change the -depth to -maxdepth (keeping the one) as
> was noted by Micheal in the other message. Please let me
> know if this fixes the problem for you.
>
> Hmmm... No one complained about this up to know.. However
> I will fix the launcher script (it's a mess anyway) and provide
> a fix in the next bugfix release.
>
> Sincerely
> Meikel
>
>  smime.p7s
> 5KViewDownload
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: Should line-seq close the reader?

2009-04-28 Thread Meikel Brandmeyer

Hi,

Am 28.04.2009 um 19:01 schrieb Bradbev:


Is it a good idea for line-seq to close its BufferedReader when there
is no more data?  Or at least provide an optional parameter that
allows/disallows close?


The cleanest solution with respect to lazy sequences is
realisation.

(with-open [rdr (...)]
  (doall (line-seq rdr)))

Closing the reader when reaching the end of the seq
doesn't help, since maybe you never reach the end of
the seq? So passing the seq outside of your responsibility
means realising it and closing the reader, eg. via the
code above.

If the seq doesn't leave your area of responsibility you
can consume the seq and close the reader explicitely.

At least this is my understanding of the current situation.

(Note: this also applies to db connections and such...)

Sincerely
Meikel



smime.p7s
Description: S/MIME cryptographic signature


Re: Getting slime-edit-definition to work with Clojure

2009-04-28 Thread Phil Hagelberg

On Tue, Apr 28, 2009 at 2:33 AM, Baishampayan Ghose
 wrote:
>>> It works for me. Are you trying to look up a built-in clojure function
>>> or one from your own application? How did you install SLIME and
>>> swank-clojure etc?
>
> Any ideas with the problem? I provided all the info in the earlier mail.
> This issue is really biting me :)

I suspect the problem might have to do with the fact that you're
configuring slime for both SBCL and Clojure. I know it's possible to
get this working, but it's a lot more complicated that way. I'd
suggest having one file for clojure slime config and one for sbcl, and
only load one of them per Emacs instance.

I'm sure someone who's more familiar with SLIME and Common Lisp could
figure out a solution, but this seems like simplest solution.

-Phil

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: The Path to 1.0

2009-04-28 Thread Meikel Brandmeyer

Dear Clojurians,

Am 28.04.2009 um 15:26 schrieb Rich Hickey:


Feedback welcome,


I updated my Clojure+Ivy patch to use the new
version information. Using the publish target is
only possible on none-interim releases and
publishes the given version.

publish-local will use SVNAnt to extract the
current svn revision from the repository and
publish a version named after the revision.
Currently rev. 1359 is available in the
kotka.de repo. For contrib is 724 available
with the different modules as configurations.

The patch is non-intrusive and adds build+ivy.xml
as well as the ivy.xml.

It's only a first stab and not perfect. Feedback
welcome. Especially for unifying the version
handling with the current maven implementation.
I don't know maven and use Ivy for a few weeks
now. So someone more experienced might want
to comment?

Sincerely
Meikel



clojure-ivy2.diff
Description: Binary data





contrib-ivy2.diff
Description: Binary data




smime.p7s
Description: S/MIME cryptographic signature


Should line-seq close the reader?

2009-04-28 Thread Bradbev

Hello,
I want to use line-seq, and have it close the input reader.
My first attempt was
(with-open [stream (BufferedReader.)]
(line-seq stream))
Which crashes immediately because you can't read lines from a closed
seq.  So, the only way to explicitly close the reader associated with
line-seq is to keep another ref to it.

Is it a good idea for line-seq to close its BufferedReader when there
is no more data?  Or at least provide an optional parameter that
allows/disallows close?

Cheers,
Brad
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Git with Google Code

2009-04-28 Thread Stuart Sierra

FYI, for those interested in using Git for Clojure sources, here's
Google's advice on how to use Git with Google Code:

http://google-opensource.blogspot.com/2008/05/develop-with-git-on-google-code-project.html

-SS
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: Question about modifying sexps via macros

2009-04-28 Thread Meikel Brandmeyer

Hi,

Am 28.04.2009 um 09:26 schrieb ianp:


   (defmacro create-form [#^Container container #^Map components &
body]
 (let [layout (GroupLayout. container)]
  (.setLayout container layout)
  ...))


Please note, that these annotations are wrong. Since
create-form is a macro, container and components refer
to Symbols or some other Clojure structure (depending
on how you pass the later container and map).

So, when you invoke your macro like this:
  (create-form c m stuff ...)
container is the Symbol c and components the Symbol m.

In particular the (GroupLayout. container) and the
(.setLayout container layout) make only sense at runtime
So there use here is probably a mistake.

Sincerely
Meikel



smime.p7s
Description: S/MIME cryptographic signature


Re: vimclojure help

2009-04-28 Thread Meikel Brandmeyer

Hi,

Am 28.04.2009 um 01:56 schrieb jim:


java.lang.NoClassDefFoundError: clojure/lang/APersistentMap (wrong
name: clojure/proxy/clojure/lang/APersistentMap)


This is a sign, that the clojure.jar is missing from the classpath.
Please change the -depth to -maxdepth (keeping the one) as
was noted by Micheal in the other message. Please let me
know if this fixes the problem for you.

Hmmm... No one complained about this up to know.. However
I will fix the launcher script (it's a mess anyway) and provide
a fix in the next bugfix release.

Sincerely
Meikel



smime.p7s
Description: S/MIME cryptographic signature


Re: areduce flaw

2009-04-28 Thread Boris Mizhen

Thanks Rich,

> What's correct is what is documented here: http://clojure.org/java_interop
RTFM is still very relevant :)

Boris

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: The Path to 1.0

2009-04-28 Thread Laurent PETIT
Now that the files are versioned, should ant clean do
 * 1. a "brute force" equivalent of rm clojure*.jar in %CLOJURE_INSTALL%
 * 2. or just try to delete clojure jars with names equal to the
current values in version.properties

I prefer 1., since with 2. if version numbers have changed in
version.properties, ant clean will not delete jars with old names and
it could be very confusing.

Rich, please find attached the patch (one line) for 1., if you agree
with Michael and with 1. option.

HTH,

-- 
Laurent

2009/4/28 Michael Wood :
>
> 2009/4/28 Laurent PETIT :
>>
>> 2009/4/28 Marko Kocić :
>>>
>>> Shouldn't "ant clean" remove all generated files, including jars from
>>> the source tree?
>>
>> I also asked this to myself, but it was the previous behaviour and I
>> didn't want to do more than one thing in the patch.
>
> "ant clean" in the clojure-contrib build tree removes the jars.  I
> think it makes sense to do the same for clojure.
>
> --
> Michael Wood 
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---

Index: build.xml
===
--- build.xml	(révision 1359)
+++ build.xml	(copie de travail)
@@ -144,6 +144,11 @@
   
 
+
+  
+
+  
+
 
   
 


Re: The Path to 1.0

2009-04-28 Thread Rich Hickey



On Apr 28, 9:41 am, Laurent PETIT  wrote:
> Hi,
>
> 2009/4/28 Rich Hickey :
>
>
>
> > On Apr 27, 5:01 pm, Laurent PETIT  wrote:
> >> New patch with corrections posted to google code,
>
> > That patch has been applied. I recommend everyone who is able to
> > please try out the latest version from SVN - this will become a
> > release candidate. The patch generates jar files with version numbers
> > in the names. It was suggested on IRC that perhaps it should also copy
> > the jar to their traditional (non-versioned) names, for greater
> > compatibility.
>
> Why not ? The patch is really simple (3 lines), find it in attachment
> and if you nevertheless want an issue in google code, I'll do it).
>

Patch applied (svn 1359) - thanks!

Rich

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: The Path to 1.0

2009-04-28 Thread Michael Wood

2009/4/28 Laurent PETIT :
>
> 2009/4/28 Marko Kocić :
>>
>> Shouldn't "ant clean" remove all generated files, including jars from
>> the source tree?
>
> I also asked this to myself, but it was the previous behaviour and I
> didn't want to do more than one thing in the patch.

"ant clean" in the clojure-contrib build tree removes the jars.  I
think it makes sense to do the same for clojure.

-- 
Michael Wood 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: Getting slime-edit-definition to work with Clojure

2009-04-28 Thread Baishampayan Ghose

Shawn,

> In case of a function that I wrote somewhere in a file and loaded in
> SLIME, I get an exception - java.lang.StringIndexOutOfBoundsException:
> String index out of range: -1 (NO_SOURCE_FILE:0) (in *Messages* I get
> funcall: Synchronous Lisp Evaluation aborted)
> 
> 
> I don't know what your clojure binary looks like, but is the code for
> these functions on your Java classpath?

Yes they are in the classpath. I can 'use' clojure.contrib fine. But
when I do a M-. on any of the functions, I get an error on the mini-buffer.

Regards,
BG

-- 
Baishampayan Ghose 
oCricket.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
To unsubscribe from 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: The Path to 1.0

2009-04-28 Thread Laurent PETIT

2009/4/28 Marko Kocić :
>
> Shouldn't "ant clean" remove all generated files, including jars from
> the source tree?

I also asked this to myself, but it was the previous behaviour and I
didn't want to do more than one thing in the patch.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: The Path to 1.0

2009-04-28 Thread Marko Kocić

Shouldn't "ant clean" remove all generated files, including jars from
the source tree?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: The Path to 1.0

2009-04-28 Thread Konrad Hinsen

On Apr 28, 2009, at 15:26, Rich Hickey wrote:

> That patch has been applied. I recommend everyone who is able to
> please try out the latest version from SVN - this will become a
> release candidate.

After modifying my build scripts to take into account the new name of  
the jar file, all the builds and tests on all my code work fine.

Konrad.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: The Path to 1.0

2009-04-28 Thread Laurent PETIT
Hi,

2009/4/28 Rich Hickey :
>
>
>
> On Apr 27, 5:01 pm, Laurent PETIT  wrote:
>> New patch with corrections posted to google code,
>>
>
> That patch has been applied. I recommend everyone who is able to
> please try out the latest version from SVN - this will become a
> release candidate. The patch generates jar files with version numbers
> in the names. It was suggested on IRC that perhaps it should also copy
> the jar to their traditional (non-versioned) names, for greater
> compatibility.

Why not ? The patch is really simple (3 lines), find it in attachment
and if you nevertheless want an issue in google code, I'll do it).

-- 
Laurent

> Maven users please make sure that side of the build
> works for 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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---

Index: build.xml
===
--- build.xml	(révision 1358)
+++ build.xml	(copie de travail)
@@ -46,6 +46,9 @@
 
   
 	
+  
+  
+  
   
   
   
@@ -104,6 +107,7 @@
 
   
 
+
   
 
   
   
 
+
   
 
   
 
+
   
 
   


Re: The Path to 1.0

2009-04-28 Thread Rich Hickey



On Apr 27, 5:01 pm, Laurent PETIT  wrote:
> New patch with corrections posted to google code,
>

That patch has been applied. I recommend everyone who is able to
please try out the latest version from SVN - this will become a
release candidate. The patch generates jar files with version numbers
in the names. It was suggested on IRC that perhaps it should also copy
the jar to their traditional (non-versioned) names, for greater
compatibility. Maven users please make sure that side of the build
works for you.

Feedback welcome,

Rich



> 2009/4/27 Laurent PETIT :
>
> > I've created issue 110 with the patch attached in clojure's google code 
> > project.
>
> > Hi Rich, Howard,
>
> > I'll answer to both at the same time, trying to reconcile things a bit.
>
> > Howard, my first patch was already along the lines of what you
> > described below, I think (concerning the fact to use ant to generate
> > with filters from templates).
>
> > Then Rich asked if it was possible to not have to generate files. I
> > understand this question a little less broadly than "not generate
> > files at all cost", but "not generate files in the source code". So
> > that if the generation step is not followed by some tool for some
> > reason, things don't break - at compile time or run time -.
>
> > That's why I came up with this new version:
>
> >  * a src/clj/clojure/version.properties file
> >  * this version.properties file is the reference for version numbers.
> > It is on the classpath so it can be seen by clojure at runtime. It is
> > in a subdirectory of clojure-the-project so any tool can refer to it
> > relatively to the installation of clojure.
>
> >  * I've added the needed code to clojure to load clojure version
> > number at startup time
>
> > I've also added function (clojure.core/clojure-version) that will
> > return a string representing the version from the structured
> > *clojure-version* map. The algorithm here is simple:
> > .[.][-][-SNAPSHOT]
>
> >  * I've changed the ant build.xml so that it creates fully qualified
> > names with version attributes for the generated jars.
> >  * Note on the :interim attribute: to protect the person who makes
> > releases from itself, instead of considering :interim to be true if
> > there is the "true" string in the properties file, I've made the
> > opposite choice: interim is true for any value other than "false". So
> > if there is a typo in version.properties (e.g. tru instead of true),
> > then the release will be marked as interim, and that will not be a big
> > deal. In the other case, it would be a big deal if an official release
> > was made accidentally instead of an interim.
>
> > * finally, pom.xml file is now generated from ant as part of the
> > classic init step.
>
> > Note: I strongly suggest that the clojure.version.interim property
> > remains true in svn, so that it's not possible to inadvertently
> > release a version "too early".
>
> > HTH,
>
> > Feel free to use or not,
>
> > --
> > Laurent
>
> > 2009/4/24 Howard Lewis Ship :
>
> >> Another option is for the version number to be in build.xml, and for
> >> it to generate a runtime file (so that Clojure can know its own
> >> version number) and set the version number inside a generated pom.xml.
> >>  You can use Ant resource copying with filters to accomplish both
> >> these goals.
>
> >> On Thu, Apr 23, 2009 at 8:24 AM, Laurent PETIT  
> >> wrote:
>
> >>> 2009/4/23 Rich Hickey :
>
>  On Apr 22, 12:41 pm, Laurent PETIT  wrote:
> > 2009/4/22 Rich Hickey :
>
> > > [...]
> > > {:major 1, :minor 0, :incremental 0, :qualifier :rc1 :interim true}
>
> > > for interim versions and
>
> > > {:major 1, :minor 0, :incremental 0}
>
> > > for releases. :interim tracks the SNAPSHOT segment of the version
> > > string.
> > > [...]
> > > I don't mind the build producing clojure-1.0.0.jar etc, but it doesn't
> > > now. The master build is Ant. Where is the best place to put the
> > > version info so it can be leveraged by Ant, Maven and the clojure core
> > > runtime in order to produce *clojure-version* ?
>
> > Here a patch that allows to initialize from ant and from a file
> > version.properties the values in *clojure-version*.
>
> > The patch only addresses the problematic of having a single place for
> > version attributes.
> > Having the ant build also use these properties for creating correctly
> > numbered jars is not part of the patch.
>
> > Note that I had to create a new file, src/clj/clojure/core_version.clj
> > , which is created by ant as a combination of template file
> > core_version-template.clj and the properties from version.properties.
>
> > You'll see that if you don't like the names of the keys in
> > version.properties, build.xml is the single place where to change them
> > (apart from version.properties, of course).
> > Also, if you don't like the name version.properties (e.g. if it should
> >

Re: Getting slime-edit-definition to work with Clojure

2009-04-28 Thread Shawn Hoover
On Mon, Apr 27, 2009 at 3:08 AM, Baishampayan Ghose wrote:

>
> Phil,
> > It works for me. Are you trying to look up a built-in clojure function
> > or one from your own application? How did you install SLIME and
> > swank-clojure etc?
>
> It doesn't work for either. When I try looking up a clojure-contrib
> function, I get let*: Search failed: "  clojure/contrib/str_utils.clj$"
>
> In case of a function that I wrote somewhere in a file and loaded in
> SLIME, I get an exception - java.lang.StringIndexOutOfBoundsException:
> String index out of range: -1 (NO_SOURCE_FILE:0) (in *Messages* I get
> funcall: Synchronous Lisp Evaluation aborted)
>

I don't know what your clojure binary looks like, but is the code for these
functions on your Java classpath?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: cannot use swig native shared libraries

2009-04-28 Thread Antonio, Fabio Di Narzo

2009/4/28 Rich Hickey :
>
>
>
> On Apr 22, 9:41 am, "Antonio, Fabio Di Narzo"
>  wrote:
>> Hi all.
>> I'm having problems with using swig-generated wrappers with Clojure.
>> I'm running ubuntu-8.04-i386, gcc-4.2.4, swig-1.3.33, openjdk-1.6.0,
>> latest clojure release.
>>
>> I've cut down a minimal reproducible example.
>> The swig file:
>> ---file:swig_test.i---
>> %module swig_test
>> %{
>> int swig_test_whatever() {
>>   return 3;}
>>
>> %}
>> int swig_test_whatever();
>> ---cut---
>>
>> Compile with:
>> ---cut---
>> mkdir swig_test
>> swig -java -package swig_test -outdir swig_test swig_test.i
>> javac swig_test/*.java
>> export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
>> export JNI_CFLAGS="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/
>> linux"
>> gcc -shared ${JNI_CFLAGS} swig_test_wrap.c -o libswig_test.so
>> ---cut---
>>
>> The swig-generated java itfc file is:
>> ---file:swig_test/swig_test.java---
>> package swig_test;
>> public class swig_test {
>>   public static int swig_test_whatever() {
>>     return swig_testJNI.swig_test_whatever();
>>   }}
>>
>> ---cut---
>>
>> The clojure code:
>> ---cut---
>> (import '(swig_test swig_test))
>>
>> (System/load
>>  (.concat (System/getProperty "user.dir") "/libswig_test.so"))
>> (swig_test/swig_test_whatever)
>> ---cut---
>> I get:
>> java.lang.UnsatisfiedLinkError:
>> swig_test.swig_testJNI.swig_test_whatever()I (NO_SOURCE_FILE:0)
>>
>> I can use "manually written" JNI wrappers with clojure and, vice-
>> versa, swig-generated wrappers with plain java code. What I'm missing
>> here? Anybody can help?
>>
>
> Did you try System/load before import?

Tried just now. Same error.

>
> Rich
>
> >
>



-- 
Antonio, Fabio Di Narzo
Ph.D. student at
Department of Statistical Sciences
University of Bologna, Italy

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: areduce flaw

2009-04-28 Thread Rich Hickey



On Apr 27, 4:26 pm, Boris Mizhen  wrote:
> Hello all,
> It seems to me that areduce can not be used with an anonymous array.
> Consider:
>
> (areduce (.. System getProperties values toArray) i r 0
> (some_expression))
>
> It seems to me that there is no way to get i'th element of the array
> in (some_expression) other than let'-ing it first.
> It would be nice to be able to pass the name for the current element
> or define a local macro that expands to
> (aref #a i) - here #a is a gensym for the array itself ...
>
> Thought?
>

Yes, areduce would be nicer if it looked like a binding set:

(areduce [aname anarray, ret init] expr)
(areduce [aname anarray, ret init, start-idx  start-n] expr)
(areduce [aname anarray, ret init, start-idx  start-n, end-idx end-n]
expr)

Treating amap similarly is slightly different since you don't supply
an initial value for ret.

You can put up an issue for this if you like.

Rich

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: areduce flaw

2009-04-28 Thread Rich Hickey



On Apr 27, 10:04 pm, Boris Mizhen  wrote:
> Thanks to all who replied.
>
> To summarize what I learned  - Clojure has a special form (. ) to
> *call* java functions, but does not have concept of a *value*
> corresponding to a java function.
> This makes Java functions a second class citizen :)
>

Java was born a second-class citizen, Clojure doesn't make it so. In
particular, Java doesn't have proper functions, it has methods. They
are not first class values in Java, and Clojure can't fix that. You
can't pass Java methods by value and you can't apply them. While it
would be possible to automatically generate wrapper fns for Java
methods that would let you *pretend* they were functions, Clojure
currently doesn't do that, since doing so would often mean silently
generating code that uses reflection, and by the time you add
sufficient syntax to allow type hints, there's little benefit over #
().

> In addition special forms are expanded in the first position of the
> list, but not on other positions, thus in (foo Math/abs)  Math/abs is
> no longer a syntax for a static method, but a lookup of a var 'abs' in
> a namespace Math.

>
> Correct?
>

What's correct is what is documented here:

http://clojure.org/java_interop

Rich


> On Apr 27, 7:28 pm, Timothy Pratley  wrote:
>
> > > How can I pass a static java function to another function?
>
> > There is also memfn:
> > (memfn name & args)
> > Macro
> > Expands into code that creates a fn that expects to be passed an
> > object and any args and calls the named instance method on the object
> > passing the args. Use when you want to treat a Java method as a first-
> > class fn.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: cannot use swig native shared libraries

2009-04-28 Thread Rich Hickey



On Apr 22, 9:41 am, "Antonio, Fabio Di Narzo"
 wrote:
> Hi all.
> I'm having problems with using swig-generated wrappers with Clojure.
> I'm running ubuntu-8.04-i386, gcc-4.2.4, swig-1.3.33, openjdk-1.6.0,
> latest clojure release.
>
> I've cut down a minimal reproducible example.
> The swig file:
> ---file:swig_test.i---
> %module swig_test
> %{
> int swig_test_whatever() {
>   return 3;}
>
> %}
> int swig_test_whatever();
> ---cut---
>
> Compile with:
> ---cut---
> mkdir swig_test
> swig -java -package swig_test -outdir swig_test swig_test.i
> javac swig_test/*.java
> export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
> export JNI_CFLAGS="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/
> linux"
> gcc -shared ${JNI_CFLAGS} swig_test_wrap.c -o libswig_test.so
> ---cut---
>
> The swig-generated java itfc file is:
> ---file:swig_test/swig_test.java---
> package swig_test;
> public class swig_test {
>   public static int swig_test_whatever() {
> return swig_testJNI.swig_test_whatever();
>   }}
>
> ---cut---
>
> The clojure code:
> ---cut---
> (import '(swig_test swig_test))
>
> (System/load
>  (.concat (System/getProperty "user.dir") "/libswig_test.so"))
> (swig_test/swig_test_whatever)
> ---cut---
> I get:
> java.lang.UnsatisfiedLinkError:
> swig_test.swig_testJNI.swig_test_whatever()I (NO_SOURCE_FILE:0)
>
> I can use "manually written" JNI wrappers with clojure and, vice-
> versa, swig-generated wrappers with plain java code. What I'm missing
> here? Anybody can help?
>

Did you try System/load before import?

Rich

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: Getting slime-edit-definition to work with Clojure

2009-04-28 Thread Baishampayan Ghose

>> It works for me. Are you trying to look up a built-in clojure function
>> or one from your own application? How did you install SLIME and
>> swank-clojure etc?

Any ideas with the problem? I provided all the info in the earlier mail.
This issue is really biting me :)

Regards,
BG

-- 
Baishampayan Ghose 
oCricket.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
To unsubscribe from 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: Question about modifying sexps via macros

2009-04-28 Thread Christophe Grand

Michael Wood a écrit :
> On Tue, Apr 28, 2009 at 9:39 AM, Christophe Grand  
> wrote:
> [...]
>   
>> `~sbody is equivalent to body
>> 
> [...]
>
> I think you mean it is equivalent to sbody.
>   

indeed, it's a typo

-- 
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.blogspot.com/ (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
To unsubscribe from 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: Question about modifying sexps via macros

2009-04-28 Thread Michael Wood

On Tue, Apr 28, 2009 at 9:39 AM, Christophe Grand  wrote:
[...]
> `~sbody is equivalent to body
[...]

I think you mean it is equivalent to sbody.

-- 
Michael Wood 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: vimclojure help

2009-04-28 Thread Michael Wood

On Tue, Apr 28, 2009 at 1:56 AM, jim  wrote:
[...]
> Finally discovered what I think is a bug in the ng-server script. The
> find command has a '1' between the "-depth" and "-print0". Removing
[...]

I believe the find command on OS X (and probably on *BSD) treats
"-depth n" like the GNU find "-mindepth n -maxdepth n".

Both GNU and BSD find treat "-depth" (without a numeric argument) as
meaning "depth first search".

BSD find also understands -mindepth and -maxdepth, so for portability,
rather use those, although in this case I think "-maxdepth 1" should
be sufficient.  :)

-- 
Michael Wood 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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: Question about modifying sexps via macros

2009-04-28 Thread Christophe Grand

ianp a écrit :
> I'm trying to create a macro that will splice in some additional
> elements to a structure. If I have an input struture like so:
>
> (p (s (c foo bar)) (s (c baz qux)))
>
> I'd like to be able to do (splice grp layout (rest my-data)) and have
> it return:
>
> ((s grp layout (c foo bar)) (s grp layout (c baz qux)))
>
> Here's the closest I came:
>
> (defmacro splice [a b & body]
>   (let [sbody (map (fn [f] (list* (first f) a b (rest f))) body)]
>   `~sbody))
>   

`~sbody is equivalent to body

> but it's just returning an empty list, anyone see what I;m doing
> wrong?
>   

splice works well:
=> (macroexpand-1 '(splice grp layout (s (c foo bar)) (s (c baz qux
((s grp layout (c foo bar)) (s grp layout (c baz qux)))

How did you test splice?

hth

Christophe

-- 
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.blogspot.com/ (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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Question about modifying sexps via macros

2009-04-28 Thread ianp

I'm trying to create a macro that will splice in some additional
elements to a structure. If I have an input struture like so:

(p (s (c foo bar)) (s (c baz qux)))

I'd like to be able to do (splice grp layout (rest my-data)) and have
it return:

((s grp layout (c foo bar)) (s grp layout (c baz qux)))

Here's the closest I came:

(defmacro splice [a b & body]
  (let [sbody (map (fn [f] (list* (first f) a b (rest f))) body)]
  `~sbody))

but it's just returning an empty list, anyone see what I;m doing
wrong?

In context: I'm trying to create a nice wrapper around GroupLayout,
I'd ike to be able to set up (in Java or Clojure) a Map and then use something like

(defmacro create-form [#^Container container #^Map components &
body]
  (let [layout (GroupLayout. container)]
   (.setLayout container layout)
   ...))

to turn a form this this

(create-form container component-map
  (horizontal (p (s (c "foo" "bar")) (s (c "baz" "qux"
  (vertical (s (p "foo" "baz") (p "bar" "qux"

with p creating a parallel group, s creating a sequential group, and c
containing a list of component names to add (looked up from component-
map).

Any thought on this idea would also be appreciated.

Cheers,
Ian.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from 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 you "boot-strap" clojure from java?

2009-04-28 Thread ianp

>    http://ianp.org/2009/04/embedding-clojure-in-an-existi
>
> Also, since writing thse notes down I've worked out getting my app
> data into Clojure; that, combined with Christophe's notes about and
> I'm pretty much set to go for most of what I want to do.

Notes and code snippets here

http://ianp.org/2009/04/embedding-clojure-part-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
To unsubscribe from 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: cannot use swig native shared libraries

2009-04-28 Thread Antonio, Fabio Di Narzo

2009/4/28 jim :
>
> Hey Antonio,
>
> I'm getting a similar error. I wanted to call setuid from Clojure, so
> I followed this link's example:
> http://www2.sys-con.com/itsg/virtualcd/Java/archives/0510/Silverman/index.html
>
> to build a java class and a shared library. I added the class to my
> classpath and was able to import my UID class. But when I tried to
> call the UID.setuid method, it gave me that UnsatisfiedLinkError. Did
> you find a solution to your problem?

Unfortunately, no.
a.

>
> Jim
>
> On Apr 22, 8:41 am, "Antonio, Fabio Di Narzo"
>  wrote:
>> Hi all.
>> I'm having problems with using swig-generated wrappers with Clojure.
>> I'm running ubuntu-8.04-i386, gcc-4.2.4, swig-1.3.33, openjdk-1.6.0,
>> latest clojure release.
>>
>> I've cut down a minimal reproducible example.
>> The swig file:
>> ---file:swig_test.i---
>> %module swig_test
>> %{
>> int swig_test_whatever() {
>>   return 3;}
>>
>> %}
>> int swig_test_whatever();
>> ---cut---
>>
>> Compile with:
>> ---cut---
>> mkdir swig_test
>> swig -java -package swig_test -outdir swig_test swig_test.i
>> javac swig_test/*.java
>> export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
>> export JNI_CFLAGS="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/
>> linux"
>> gcc -shared ${JNI_CFLAGS} swig_test_wrap.c -o libswig_test.so
>> ---cut---
>>
>> The swig-generated java itfc file is:
>> ---file:swig_test/swig_test.java---
>> package swig_test;
>> public class swig_test {
>>   public static int swig_test_whatever() {
>>     return swig_testJNI.swig_test_whatever();
>>   }}
>>
>> ---cut---
>>
>> The clojure code:
>> ---cut---
>> (import '(swig_test swig_test))
>>
>> (System/load
>>  (.concat (System/getProperty "user.dir") "/libswig_test.so"))
>> (swig_test/swig_test_whatever)
>> ---cut---
>> I get:
>> java.lang.UnsatisfiedLinkError:
>> swig_test.swig_testJNI.swig_test_whatever()I (NO_SOURCE_FILE:0)
>>
>> I can use "manually written"JNIwrappers with clojure and, vice-
>> versa, swig-generated wrappers with plain java code. What I'm missing
>> here? Anybody can help?
>>
>> Bests,
>> Antonio, Fabio Di Narzo.
> >
>



-- 
Antonio, Fabio Di Narzo
Ph.D. student at
Department of Statistical Sciences
University of Bologna, Italy

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---