Re: ANN: Jark 0.3 (using the nrepl protocol)

2011-05-07 Thread isaac praveen
Chas,

Thanks for nREPL. It is a very useful tool.

-- 
isaac
http://icylisper.in

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


Re: ANN: Jark 0.3 (using the nrepl protocol)

2011-05-07 Thread Laurent PETIT
Yeah, nrepl support for CCW, which Chas personnally did, has been an
incredibly valuable addition.

I'm glad to see more tools adopting it for backend support !

2011/5/7 isaac praveen icylis...@gmail.com:
 Chas,

 Thanks for nREPL. It is a very useful tool.

 --
 isaac
 http://icylisper.in

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

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


Re: ANN: Jark 0.3 (using the nrepl protocol)

2011-05-07 Thread isaac praveen
On Sat, May 7, 2011 at 5:50 PM, Laurent PETIT laurent.pe...@gmail.com wrote:
 Yeah, nrepl support for CCW, which Chas personnally did, has been an
 incredibly valuable addition.

 I'm glad to see more tools adopting it for backend support !


I agree.

Also, the nrepl-server itself should be bundled with some basic
utilities. That is where jark is useful.

Jark is a tool that provides
a) a nrepl-server
b) a set of extensible utilities to manage classpaths, namespaces, JVM  both on
c) a command-line client that communicates via the nREPL protocol, has
minimum runtime dependencies and can run on most platforms.

It would be nice to have a jark/nREPL plus SLIME/Vim stack.

-- 
isaac
http://icylisper.in

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


Re: ANN: Jark 0.3 (using the nrepl protocol)

2011-05-07 Thread isaac praveen
 b) a set of extensible utilities to manage classpaths, namespaces, JVM  both 
 on
Oops. I meant :

A set of extensible utilities to manage classpaths, namespaces, JVM
etc , remotely.

-- 
isaac

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


Re: ANN: Jark 0.3 (using the nrepl protocol)

2011-05-07 Thread Chas Emerick

On May 7, 2011, at 10:01 AM, isaac praveen wrote:

 On Sat, May 7, 2011 at 5:50 PM, Laurent PETIT laurent.pe...@gmail.com wrote:
 Yeah, nrepl support for CCW, which Chas personnally did, has been an
 incredibly valuable addition.
 
 I'm glad to see more tools adopting it for backend support !
 
 
 I agree.

Indeed, this was exactly my intention when I set out to build nREPL.  So, we 
now have Eclipse/CCW, jark, and Enclojure (soon: 
http://groups.google.com/group/enclojure/msg/a742dd461c88109b) using nREPL; 
such common ground will certainly make it easier to support having diverse 
toolsets in teams of Clojure programmers, etc.

On May 6, 2011, at 7:37 PM, Ambrose Bonnaire-Sergeant wrote:

 We haven't started on a VimClojure nREPL fork yet.
 
 We should probably ask Meikel if he's already tackled it, there is a nrepl 
 tag on
 bitbucket but it's about 6 months old. 
 https://bitbucket.org/kotarak/vimclojure/overview

My recollection is that Meikel was a fair ways along in his nREPL 
implementation late last year.  Hopefully he can chime in as to what the 
current status is of things there.

 Also, the nrepl-server itself should be bundled with some basic
 utilities. That is where jark is useful.
 
 Jark is a tool that provides
 a) a nrepl-server
 b) a set of extensible utilities to manage classpaths, namespaces, JVM  both 
 on
 c) a command-line client that communicates via the nREPL protocol, has
 minimum runtime dependencies and can run on most platforms.
 
 It would be nice to have a jark/nREPL plus SLIME/Vim stack.

nREPL + jark + some baseline set of introspection utilities and such (started 
to be described here: 
http://dev.clojure.org/display/design/IDE+tooling+backend) is looking like a 
proper foundation for Clojure tooling, regardless of platform/editor/etc.

FWIW, I'd like to throw out the notion that perhaps some small part of jark 
might make sense to be rolled into the nREPL project itself (in particular, a 
command-line interface / client is needed -- there's one there, but it's far 
from ideal).  Further, if the jark leads are open to it, it may be worth 
discussing over on clojure-dev to see what the appetite is among the core folks 
for a Clojure Contrib project with jark's objectives/scope.

Cheers,

- Chas

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


What is the purpose of the Identity function?

2011-05-07 Thread Base
At the risk of sounding completely dense, I am having a hard time
understanding the purpose of the Identity function.  As far as I can
tell all it does is return what is passed to it.

Review code I see it used all the time, and cannot understand why it
is needed.

Any insight?

Thanks

Base

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: What is the purpose of the Identity function?

2011-05-07 Thread Alfredo
My two cents:
You can use it with the operator -, in order to pass something to
another function, or for propagating an input of some sort.

It sounds sensed?
Bye,
Alfredo

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: What is the purpose of the Identity function?

2011-05-07 Thread Ulises
I usually use identity as a predicate for functions such as filter,
drop-while, take-while, etc.

Consider this silly example: imagine you had an operation that fetches
stuff from a resource (DB, network, etc.) and that upon failing it
returns nil. Additionally, imagine that you're interested in running
this operation for several resources and keeping those values which
didn't fail. You can do so with identity:

user= (defn my-operation-that-might-fail [x]
  (if (= x foo) x nil))
#'user/my-operation-that-might-fail
user= (def some-values [bar foo baz])
#'user/some-values
user= (filter identity (map your-pred some-values))
(foo)
user=

and you have your single operation that didn't fail.

My 0.5cts.

U

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: What is the purpose of the Identity function?

2011-05-07 Thread Ambrose Bonnaire-Sergeant
I just grepped the clojure source code and an interesting use is in walk.clj

https://github.com/clojure/clojure/blob/master/src/clj/clojure/walk.clj#L62

`walk` has flexibility with higher order functions, but identity helps with
the simple
case of just returning the forms elegantly.

I thought it was cool :)

Ambrose

On Sat, May 7, 2011 at 11:51 PM, Base basselh...@gmail.com wrote:

 At the risk of sounding completely dense, I am having a hard time
 understanding the purpose of the Identity function.  As far as I can
 tell all it does is return what is passed to it.

 Review code I see it used all the time, and cannot understand why it
 is needed.

 Any insight?

 Thanks

 Base

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

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

Re: ANN: Jark 0.3 (using the nrepl protocol)

2011-05-07 Thread Meikel Brandmeyer
Hi,

Am 07.05.2011 um 16:48 schrieb Chas Emerick:

 We haven't started on a VimClojure nREPL fork yet.
 
 We should probably ask Meikel if he's already tackled it, there is a nrepl 
 tag on
 bitbucket but it's about 6 months old. 
 https://bitbucket.org/kotarak/vimclojure/overview
 
 My recollection is that Meikel was a fair ways along in his nREPL 
 implementation late last year.  Hopefully he can chime in as to what the 
 current status is of things there.

Ah. Sad story. I already worked in the nrepl backend for vimclojure—as Ambrose 
noted: there is a branch on bitbucket for that. However things stalled. The 
reason is the client. There I have these stupid vim limitations again:

* It must be fast.
* It must be self-contained.
* It must work on Windows. *bleh*

The first point kills a Java client. The JVM startup time is too slow. The 
second kills netcat, curl and friends. The client has to understand the 
protocol in order to know, when to stop the connection and terminate itself. 
Until the client terminates vim will be blocked. The third point kills all the 
“standard” scripting languages like Python, Ruby, Perl, you name it. I don't 
want to add a 30Mb dependency when a 30k client was sufficient with nailgun.

So what I need is: A client understanding the protocol and looking for the 
“done” message. It must be fast and small. So it will be likely written in 
something like C, OCaml or Haskell and compiled to native binary. It doesn't 
come with more dependencies than itself.

I might come up with a C or OCaml version for the Unices, but I have absolutely 
no clue about Windows programming. Something like OCaml would maybe even work 
verbatim on Windows, but I haven't got native compilation to work there.

And finally I'm missing time right now to do this by myself. (As always… *sigh*)

When I read about jark+nrepl+cli client, I thought “*dumdidum* someone will do 
it *dumdidum* someone will do it” ;) I appreciate any help and I'm willing to 
help out with support on answering questions and posing setting-hair-on-fire 
requirements.

Sincerely
Meikel

PS (general note): If you want to hack on VimClojure – especially with such 
difficult and essential issue as a different communication channel – I'd 
appreciate to be kept in the loop. I can save time by knowing caveats and 
obstacles. And – frankly – I'd like to know what modifications of VC are going 
on out there. Feel free to discuss such things on the VimClojure goggle group. 
Thank you.

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


Re: What is the purpose of the Identity function?

2011-05-07 Thread Meikel Brandmeyer
Hi,

you can also use it to do funny stuff with juxt.

(map (juxt identity f) some-seq)

Sincerely
Meikel

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


Re: ANN: Jark 0.3 (using the nrepl protocol)

2011-05-07 Thread Ambrose Bonnaire-Sergeant
Thanks for letting us know Meikel. These are similar issues that we have
encountered
with the jark client.

We are planning to rewrite it in Haskell (currently Python), I'm sure there
will be similarities between a potential
VimClojure client.

I have tried to tinker with VimClojure but sadly never got it building with
gradle+clojuresque.
I will have another go soon.

What version of gradle (and clojuresque) is VimClojure known to build with?

Thanks,
Ambrose

On Sun, May 8, 2011 at 12:20 AM, Meikel Brandmeyer m...@kotka.de wrote:

 Hi,

 Am 07.05.2011 um 16:48 schrieb Chas Emerick:

  We haven't started on a VimClojure nREPL fork yet.
 
  We should probably ask Meikel if he's already tackled it, there is a
 nrepl tag on
  bitbucket but it's about 6 months old.
 https://bitbucket.org/kotarak/vimclojure/overview
 
  My recollection is that Meikel was a fair ways along in his nREPL
 implementation late last year.  Hopefully he can chime in as to what the
 current status is of things there.

 Ah. Sad story. I already worked in the nrepl backend for vimclojure—as
 Ambrose noted: there is a branch on bitbucket for that. However things
 stalled. The reason is the client. There I have these stupid vim limitations
 again:

 * It must be fast.
 * It must be self-contained.
 * It must work on Windows. *bleh*

 The first point kills a Java client. The JVM startup time is too slow. The
 second kills netcat, curl and friends. The client has to understand the
 protocol in order to know, when to stop the connection and terminate itself.
 Until the client terminates vim will be blocked. The third point kills all
 the “standard” scripting languages like Python, Ruby, Perl, you name it. I
 don't want to add a 30Mb dependency when a 30k client was sufficient with
 nailgun.

 So what I need is: A client understanding the protocol and looking for the
 “done” message. It must be fast and small. So it will be likely written in
 something like C, OCaml or Haskell and compiled to native binary. It doesn't
 come with more dependencies than itself.

 I might come up with a C or OCaml version for the Unices, but I have
 absolutely no clue about Windows programming. Something like OCaml would
 maybe even work verbatim on Windows, but I haven't got native compilation to
 work there.

 And finally I'm missing time right now to do this by myself. (As always…
 *sigh*)

 When I read about jark+nrepl+cli client, I thought “*dumdidum* someone will
 do it *dumdidum* someone will do it” ;) I appreciate any help and I'm
 willing to help out with support on answering questions and posing
 setting-hair-on-fire requirements.

 Sincerely
 Meikel

 PS (general note): If you want to hack on VimClojure – especially with such
 difficult and essential issue as a different communication channel – I'd
 appreciate to be kept in the loop. I can save time by knowing caveats and
 obstacles. And – frankly – I'd like to know what modifications of VC are
 going on out there. Feel free to discuss such things on the VimClojure
 goggle group. Thank you.

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


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

Re: ANN: Jark 0.3 (using the nrepl protocol)

2011-05-07 Thread isaac praveen
Chas,

 nREPL + jark + some baseline set of introspection utilities and such (started 
 to be described here: 
 http://dev.clojure.org/display/design/IDE+tooling+backend) is looking like a 
 proper foundation for Clojure tooling, regardless of platform/editor/etc.

Awesome.

 FWIW, I'd like to throw out the notion that perhaps some small part of jark 
 might make sense to be rolled into the nREPL project itself (in particular, a 
 command-line interface / client is needed -- there's one there, but it's far 
 from ideal).

Sounds like a good idea. We could discuss further on what can be
integrated. I am excited about this!

 Further, if the jark leads are open to it, it may be worth discussing over on 
 clojure-dev to see what the appetite is among the core folks for a Clojure 
 Contrib project with jark's objectives/scope.

Sure. We need very powerful clojure development and deployment tools.
My request for subscription to clojure-dev got declined :(
Maybe we can discuss this on clojure-jark google groups:
https://groups.google.com/group/clojure-jark

-- 
isaac
http://icylisper.in

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


Re: ANN: Jark 0.3 (using the nrepl protocol)

2011-05-07 Thread Laurent PETIT
2011/5/7 isaac praveen icylis...@gmail.com:
 On Sat, May 7, 2011 at 5:50 PM, Laurent PETIT laurent.pe...@gmail.com wrote:
 Yeah, nrepl support for CCW, which Chas personnally did, has been an
 incredibly valuable addition.

 I'm glad to see more tools adopting it for backend support !


 I agree.

 Also, the nrepl-server itself should be bundled with some basic
 utilities. That is where jark is useful.

 Jark is a tool that provides
 a) a nrepl-server
 b) a set of extensible utilities to manage classpaths, namespaces, JVM  both 
 on
 c) a command-line client that communicates via the nREPL protocol, has
 minimum runtime dependencies and can run on most platforms.

Just a question. The general philosophy of clojure is to have good
base building tools, and maybe the building blocks of more
integrated solutions could also be based on the same philosophy.
I mean, all the points listed in b) could / should / may (?) not be
tied to nrepl-server, should ? Couldn't they live in their own library
?

Of course, I can see the value of having all of this pre-packaged for
ease of use !


 It would be nice to have a jark/nREPL plus SLIME/Vim stack.

 --
 isaac
 http://icylisper.in

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

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


Re: ANN: Jark 0.3 (using the nrepl protocol)

2011-05-07 Thread Laurent PETIT
Maybe a silly question, but anyway ...

for CCW, there is this idea of having it maintain, for each open
project (probably depending on a flag, but that's out of topic), in
the background (totally transparently for the user), a running JVM
environment where CCW would maintain the project classes and
namespaces loaded and up-to-date. Thus CCW would be able to suggest
code completion, report errors, etc., without having to rely
on/interfere with the JVMs the user may have started for his own
needs.

Of course, it would be desirable to be able to not blow all the user's
computer memory ... so maybe having the ability to share JVM between
several open projects in the IDEA, while keeping isolated different
clojure environments, would be a plus.

I had the idea of investigating what the project classlojure has to
provide for this ... but maybe Jark would also be worth studying for
this purpose, or would it not be the appropriate tool for the job ?

2011/5/5 isaac praveen icylis...@gmail.com:
 Hi,

 It is a pleasure to announce the release of Jark 0.3, today.

 Why Jark?
 Startup time of the Java Virtual Machine(JVM) is too slow and thereby
 command-line applications on the JVM are sluggish and very painful to
 use.
 Jark is an attempt to run a persistent JVM daemon and provide a set of
 utilities to control and operate on it.
 It should help in deploying clojure applications on the JVM, running
 command-line applications written in clojure and remote-debugging.

 The motivation is also to provide a very thin nrepl-client that can
 run on any given OS platform. Maybe one on the Android. The client
 host need not even have the JRE installed. The current implementation
 is in python(2.6 or 2.7) as a proof-of-concept and runs only on
 GNU/Linux and Mac OSX.

 Get started: http://icylisper.in/jark/start.html

 Jark has utilites for:
 a. Operating and tuning the JVM
 b. Managing classpaths
 c. Managing packages and repositories that are not project-specific (uses 
 cljr)
 d. Scripting (#!/usr/bin/env jark)  and namespaces.
 All of which can be done remotely.

 This is a sample usage:
 server jark vm start [--port]
 client  jark vm connect [--host] [--port]
 client  jark repl
 ---
 client  jark vm stat
 client  jark cp list
 server jark cp add jar
 client  jark package install -p PACKAGE -v VERSION
 client  jark ns load /path/to.clj
 and so on ..

 The earlier version (0.2) of jark used nailgun as a proof-of-concept
 server and client. The current release (0.3) of jark uses Chas
 Emerick's nrepl protocol for communication. I hope to rewrite the
 client in haskell, so native binaries can be generated, sometime soon.
 Have a look at the roadmap:
 Roadmap: http://icylisper.in/jark/roadmap.html

 Mailing list: https://groups.google.com/group/clojure-jark
 code: https://github.com/icylisper/jark.git

 Special thanks to:
  * Ambrose Bonnaire-Sergeant (for collaborating and providing very
 interesting ideas)
  * Bangalore-clojure group members for continuous feedback:
     Shantanu Kumar
     Abhijith Gopal
     Martin Demello
     Abhijit Hoskeri
 * other early jark users for valuable ideas and fixes

 Thats all folks! Hope you find it useful.
 Screencasts and demos are on the way ...
 --
 isaac
 http://icylisper.in

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

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


Re: ANN: Jark 0.3 (using the nrepl protocol)

2011-05-07 Thread David Nolen
On Sat, May 7, 2011 at 12:50 PM, isaac praveen icylis...@gmail.com wrote:

 Sure. We need very powerful clojure development and deployment tools.
 My request for subscription to clojure-dev got declined :(


Send in a CA! :)

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: What is the purpose of the Identity function?

2011-05-07 Thread Sean Corfield
On Sat, May 7, 2011 at 8:51 AM, Base basselh...@gmail.com wrote:
 At the risk of sounding completely dense, I am having a hard time
 understanding the purpose of the Identity function.  As far as I can
 tell all it does is return what is passed to it.

It's most useful when you have functions that take functions as
arguments. For example, I have code that performs a SQL query and then
runs a map-reduce transformation on that. Sometimes, however, I want
just the original data so I can pass in identity (to map) and have it
be a no-op.

Identity on its own isn't really useful - but in combination with
higher-order functions, it can be very indispensible!
-- 
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: What is the purpose of the Identity function?

2011-05-07 Thread Base
Ahhh -

Thanks all.  Most educational!  This does make sense - I will try and
deconstruct some of the examples where this is used to get a sense of
when / why it is used.  But this helps *tremendously*!!

Thanks!!!


On May 7, 2:09 pm, Sean Corfield seancorfi...@gmail.com wrote:
 On Sat, May 7, 2011 at 8:51 AM, Base basselh...@gmail.com wrote:
  At the risk of sounding completely dense, I am having a hard time
  understanding the purpose of the Identity function.  As far as I can
  tell all it does is return what is passed to it.

 It's most useful when you have functions that take functions as
 arguments. For example, I have code that performs a SQL query and then
 runs a map-reduce transformation on that. Sometimes, however, I want
 just the original data so I can pass in identity (to map) and have it
 be a no-op.

 Identity on its own isn't really useful - but in combination with
 higher-order functions, it can be very indispensible!
 --
 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: What is the purpose of the Identity function?

2011-05-07 Thread Mike Meyer
On Sat, 7 May 2011 12:09:45 -0700
Sean Corfield seancorfi...@gmail.com wrote:
 Identity on its own isn't really useful - but in combination with
 higher-order functions, it can be very indispensible!

Bingo. An HOF accepts a function that filters/mogrifies data before
processing it in some way. Sometimes, you *don't* want to have that
extra step. There are two ways to do that: one is to have two variants
of the HOF - one which uses the function, and one which doesn't (which
may mean it's not an HOF). The other is identity.

Clojure does both, depending. You can see the first in sort and
sort-by, where sort-by uses a keyfn to extract keys from items in the
collection. You could just identity for the keyfn to sort by items,
but this case is so common it gets it's own function -
sort. Similarly, filter takes a predicate to check which items need to
be removed. If you just want to remove false values, the appropriate
predicate is identity. This case isn't very common, so there's no
second version.

 mike
-- 
Mike Meyer m...@mired.org http://www.mired.org/
Independent Software developer/SCM consultant, email for more information.

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

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


How Clojure protocols are implemented internally?

2011-05-07 Thread Dmitry Kakurin
Is there a document describing internal implementation of Clojure
protocols?
I.e. what is happening under the hood?
To be specific suppose I have extended ICountable protocol with a
single count method to String class. What happens when I call (count
some string)?
At what point dynamic dispatch happens and what underlying JVM
mechanism is used?

- Dmitry

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Enhancement for contrib.command-line

2011-05-07 Thread knuthie
Thanks,

this library looks promising...

On 29 Apr., 21:56, gaz jones gareth.e.jo...@gmail.com wrote:
 i wrote a command line arg library after wanting a bit more than the
 one in contrib gave me:

 https://github.com/gar3thjon3s/clargon

 i think you could do what you want using it...



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


Re: How Clojure protocols are implemented internally?

2011-05-07 Thread Jonathan Fischer Friberg
See:
http://clojure.org/protocols
defprotocol will automatically generate a corresponding interface
Although it is not true that a protocol is equivalent to an interface.

For deep under the hood you can check out the source:
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_deftype.clj#L521

As for your specific case:
clojure.core/count uses clojure.lang.RT/count [1]
This function goes through some type checks, the first one being if the type
implements clojure.lang.Counted [2] and if it is, calls the count function
implemented in that type.

[1]
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L505
[2]
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Counted.java

On Sat, May 7, 2011 at 10:00 PM, Dmitry Kakurin dmitry.kaku...@gmail.comwrote:

 Is there a document describing internal implementation of Clojure
 protocols?
 I.e. what is happening under the hood?
 To be specific suppose I have extended ICountable protocol with a
 single count method to String class. What happens when I call (count
 some string)?
 At what point dynamic dispatch happens and what underlying JVM
 mechanism is used?

 - Dmitry

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from 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 Clojure protocols are implemented internally?

2011-05-07 Thread Dmitry Kakurin
Let me rephrase my question to avoid unfortunate confusion with
standard count function:
Suppose I have extended my own IMyCountable protocol with a
single mycount method to String class. What happens when I call
(mycount
some string)?

- Dmitry

On May 7, 1:42 pm, Jonathan Fischer Friberg odysso...@gmail.com
wrote:
 See:http://clojure.org/protocols
 defprotocol will automatically generate a corresponding interface
 Although it is not true that a protocol is equivalent to an interface.

 For deep under the hood you can check out the 
 source:https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_d...

 As for your specific case:
 clojure.core/count uses clojure.lang.RT/count [1]
 This function goes through some type checks, the first one being if the type
 implements clojure.lang.Counted [2] and if it is, calls the count function
 implemented in that type.

 [1]https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/R...
 [2]https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/C...

 On Sat, May 7, 2011 at 10:00 PM, Dmitry Kakurin 
 dmitry.kaku...@gmail.comwrote:







  Is there a document describing internal implementation of Clojure
  protocols?
  I.e. what is happening under the hood?
  To be specific suppose I have extended ICountable protocol with a
  single count method to String class. What happens when I call (count
  some string)?
  At what point dynamic dispatch happens and what underlying JVM
  mechanism is used?

  - Dmitry

  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clojure@googlegroups.com
  Note that posts from new members are moderated - please be patient with
  your first post.
  To unsubscribe from 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


Request for feedback: Tradui

2011-05-07 Thread Andreas Kostler
Hi all,
I've started development on tradui, a translator for the Creole markup 
language. It is not finished or in any deployable shape or form yet, however 
it's progressed enough to gather some feedback on the approach taken.
Please feel free to clone https://github.com/AndreasKostler/tradui.git and 
comment away. 
Kind Regards
Andreas

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


Testing functions that access a database

2011-05-07 Thread Tim McIver
I'm looking for some input as to the best way to test functions that
interact with a database.  I've just started writing some tests for
functions that read/write to a mysql database (using
clojure.contrib.sql) but my problem is that I'd like the tests to
begin with either an empty database or one that has been initialized
with some known data.  Some of my functions add/remove data from the
database and so some of these tests will fail if run again on the
changed database.  I was thinking I'd have a fixture that loaded a
mysql dump file before running the tests but I haven't found any way
to do this in Clojure.  Any suggestions?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Testing functions that access a database

2011-05-07 Thread Ken Wesson
On Sat, May 7, 2011 at 11:37 PM, Tim McIver tmci...@verizon.net wrote:
 I'm looking for some input as to the best way to test functions that
 interact with a database.  I've just started writing some tests for
 functions that read/write to a mysql database (using
 clojure.contrib.sql) but my problem is that I'd like the tests to
 begin with either an empty database or one that has been initialized
 with some known data.  Some of my functions add/remove data from the
 database and so some of these tests will fail if run again on the
 changed database.  I was thinking I'd have a fixture that loaded a
 mysql dump file before running the tests but I haven't found any way
 to do this in Clojure.  Any suggestions?

Have you considered using a mock object in place of the db?

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


Where's incanter chrono?

2011-05-07 Thread Andreas Kostler
Hello all,
Has incanter.chrono disappeared?
(use '(incanter core chrono))
results in
Could not locate incanter/chrono__init.class or incanter/chrono.clj on
classpath:
  [Thrown class java.io.FileNotFoundException]

For both incanter 1.2.3 and incanter 1.2.2

Cheers
Andreas

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


Re: ANN: Java dependency injection in Clojure

2011-05-07 Thread Luc Prefontaine
Hi Alessio,

My plan is to use this to wrap other Java frameworks to simplify their APIs.
Internally, we started to use it to wrap Java libs as sets of resources
accessible from Clojure and it simplifies things a lot.

I have some ideas about wrapping Swing that I will experiment
this summer.

If you have suggestions, they are welcomed. I saw DynaSpring but lacked
the time to go trough it throughly. I will have more time in the next month
to look at it deeper.

Thanx,

Luc P.

On Wed, 4 May 2011 02:21:05 -0700 (PDT)
Alessio Stalla alessiosta...@gmail.com wrote:

 On 4 Mag, 06:53, Luc Prefontaine lprefonta...@softaddicts.ca wrote:
  Hi,
 
  being tired of wandering through a few thousand lines of XML Spring
  bean definitions, I finally wrote a library to start moving away
  from Spring/XML. It's definitively nicer doing dependency
  injection/auto-wiring using Clojure.
 
  This is part of our global effort here to confine Java as much as
  possible to lower layers.
 
  Lacking imagination (or being lazy ?), I called it boing. The
  source code is available athttps://github.com/lprefontaine/Boing
  and the Wiki there describes its scope and capabilities.
 
  It's a 1.0 version. It should make it to prod beginning of this
  summer.
 
  The jar is on Clojars ([org.clojars.lprefontaine/boing 1.0] in
  leiningen).
 
  It may be of interest to people having mixed environments and
  potentially to some using external Java libraries. It's much more
  dynamic than XML and significantly shorter. Look at the examples
  folder.
 
  Comments are welcomed. The TODO list is not yet published but we
  see a few things we want to add to it especially in the area of
  resource management and some optimizations.
 
  Code wise I think it's not too horrible given that I had to squeeze
  this in my already ultra-tight schedule in the last three weeks or
  so.
 
 That's really nice! I did something similar in Common Lisp, called
 DynaSpring [1]. I think this kind of thing fits Lisp perfectly, and
 it's nice to see an implementation of similar ideas in Clojure.
 Perhaps we can mutually take inspiration from each other's projects
 and, why not, even share some code and ideas. Right now I'm not
 actively developing it because I'm no longer using Spring at work, but
 still I like the concept and hope to use it on a real project sooner
 or later.
 
 I wish you well for boing!
 Alessio
 
 [1] code.google.com/p/dynaspring/
 



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