ClojureCLR in production ?

2011-03-23 Thread Jules
I am writing a server in Java/Clojure.

It has a C# client.

As the protocol between them becomes more complex (remote objects etc)
I am looking at writing a client-side library to support comms with
the server.

It occurred to me that instead of writing this in C# I could perhaps
reuse a lot of my Clojure code via ClojureCLR and top it off with
rewriting relevant Java pieces either in C# or more Clojure.

Given the Clojure-in-Clojure effort this seems the natural way to go
to achieve portability over the two platforms.

I was wondering whether anyone else had ClojureCLR in production and
how they felt about it ? Whether it will be mature enough in say 3
months to support a production app ?

Thanks for your time,

Jules

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


gen-class and state...

2011-03-23 Thread Jules
I only have a brief posting window this morning (I have to leave for
work) so have not researched this as well as I should before coming to
the list - so please forgive if this is a bit lame...

Should I still be using gen-class to achieve link time compatibility
with Java ?

If so, why am I constrained to using a single field to hold my state
(.state) ? (or have I missed something?).

I am finding that all my gen-class-ed types need to define themselves,
as well as a structure for their immutable parts and a structure for
their mutable parts. Every method invocation involves at least two
lookups one to fetch the immutable part from the .state field and one
to lookup some useful piece of data in it.

I'd like to reduce this to one lookup, directly into an immutable
field in the POJO.

Why doesn't gen-class allow e.g. :state [^Integer i ^String s ] in
a more record like way ? and perhaps a flag to indicate that I want it
to inherit the necessary fn-ality such that I can dereference fields
in it in the same way as in a record ?

It may be that I am using an out of date way of achieving my goals -
I'd appreciate some guidance either way ? I am aware of e.g.
defprotocol and reify but am under the impression that they are for
dynamic typing creation and will not give me link-time compatibility
with the Java code in  my project ?

thanks for your time,

Jules

-- 
You 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: gen-class and state...

2011-03-23 Thread Ken Wesson
On Wed, Mar 23, 2011 at 3:43 AM, Jules jules.gosn...@gmail.com wrote:
 I only have a brief posting window this morning (I have to leave for
 work) so have not researched this as well as I should before coming to
 the list - so please forgive if this is a bit lame...

 Should I still be using gen-class to achieve link time compatibility
 with Java ?

 If so, why am I constrained to using a single field to hold my state
 (.state) ? (or have I missed something?).

 I am finding that all my gen-class-ed types need to define themselves,
 as well as a structure for their immutable parts and a structure for
 their mutable parts. Every method invocation involves at least two
 lookups one to fetch the immutable part from the .state field and one
 to lookup some useful piece of data in it.

 I'd like to reduce this to one lookup, directly into an immutable
 field in the POJO.

If you're implementing an interface, you can use deftype to create
objects with multiple mutable and immutable fields and with methods
corresponding to that interface.

And you can use definterface to make an interface. You don't even have
to call the objects via the interface. :)

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


Jesus, how the heck to do anything?

2011-03-23 Thread ultranewb
Short version:  How do I just open an editor, type in some Clojure
code, save it in a file, and then run it?

Long version:  Okay, I'm very new to Clojure.  But I'm not a Java
programmer (don't want to be).  I'm not used to all this complexity
just to do something simple.  What I want to do is the normal
programming that I do with every other environment and language I
work with, i.e. I edit some source code on screen, save it in a file,
and either compile/run, or interpret it or whatever.  But I haven't
figured out how to do that yet, and don't know if it's possible.

I downloaded Netbeans and Enclojure.  It runs fine.  I can get a REPL,
blah blah.  But have no idea how to do anything real i.e. execute a
program saved in a file.  Again, I want to edit some code with the
very nice editor, save it, and hit some button that says execute or
perhaps compile and execute or perhaps build and execute or
whatever.  But apparently there is a heck of a lot more to it than
that.  I understand that you have to build a project or whatever.
Fine - I did that.  Still, I have no idea which directory out of that
huge structure I'm supposed to put code in, I have no idea how to set
up all these dependencies or whatever.  I did try some random stuff,
i.e. saving a file in various directories and hitting build but that
didn't work.  I also tried editing various files that were already
there, hoping one of them was the main file I was supposed to be
dumping source code into, but that didn't work either.

So I downloaded Clojure Box.  It installs and runs fine.  Again, I get
a REPL no problem.  But there's only so much coding I can do in a
REPL.  Again, I'd like to do more.

I spent a long time trying to find some help online (googling, etc),
but everything I've found assumes I know too much, i.e. how to set up
all these projects and dependencies.

Actually, I'm not interested in fooling with all the boilerplate and
crap AT ALL.  So if I HAVE to do that, I'm outta here.  But something
tells me I may not have to, i.e. there may be some automated tool
somewhere, or some template files I can just use over and over, or
some trick to use like just name your program 'main' and stick it
in such-and-such directory.

Any help?

-- 
You 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: Jesus, how the heck to do anything?

2011-03-23 Thread Tim Robinson
I suggest skipping right to leiningen:

https://github.com/technomancy/leiningen

Once you spend a few minutes creating a project template, you can
then run a simple command to create a jar file and run it.

Tim


On Mar 23, 1:50 am, ultranewb pineapple.l...@yahoo.com wrote:
 Short version:  How do I just open an editor, type in some Clojure
 code, save it in a file, and then run it?

 Long version:  Okay, I'm very new to Clojure.  But I'm not a Java
 programmer (don't want to be).  I'm not used to all this complexity
 just to do something simple.  What I want to do is the normal
 programming that I do with every other environment and language I
 work with, i.e. I edit some source code on screen, save it in a file,
 and either compile/run, or interpret it or whatever.  But I haven't
 figured out how to do that yet, and don't know if it's possible.

 I downloaded Netbeans and Enclojure.  It runs fine.  I can get a REPL,
 blah blah.  But have no idea how to do anything real i.e. execute a
 program saved in a file.  Again, I want to edit some code with the
 very nice editor, save it, and hit some button that says execute or
 perhaps compile and execute or perhaps build and execute or
 whatever.  But apparently there is a heck of a lot more to it than
 that.  I understand that you have to build a project or whatever.
 Fine - I did that.  Still, I have no idea which directory out of that
 huge structure I'm supposed to put code in, I have no idea how to set
 up all these dependencies or whatever.  I did try some random stuff,
 i.e. saving a file in various directories and hitting build but that
 didn't work.  I also tried editing various files that were already
 there, hoping one of them was the main file I was supposed to be
 dumping source code into, but that didn't work either.

 So I downloaded Clojure Box.  It installs and runs fine.  Again, I get
 a REPL no problem.  But there's only so much coding I can do in a
 REPL.  Again, I'd like to do more.

 I spent a long time trying to find some help online (googling, etc),
 but everything I've found assumes I know too much, i.e. how to set up
 all these projects and dependencies.

 Actually, I'm not interested in fooling with all the boilerplate and
 crap AT ALL.  So if I HAVE to do that, I'm outta here.  But something
 tells me I may not have to, i.e. there may be some automated tool
 somewhere, or some template files I can just use over and over, or
 some trick to use like just name your program 'main' and stick it
 in such-and-such directory.

 Any help?

-- 
You 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: Jesus, how the heck to do anything?

2011-03-23 Thread David Jagoe
Have a look at leiningen. Its a build tool that manages your project
environment, allows you to compile your code to a jar etc.

http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Leiningen
https://github.com/technomancy/leiningen/blob/master/TUTORIAL.md

lein run -m org.you.main

will be a convenient way to run the code in the org.you.main namespace.


Cheers,
David

On 23 March 2011 09:50, ultranewb pineapple.l...@yahoo.com wrote:
 Short version:  How do I just open an editor, type in some Clojure
 code, save it in a file, and then run it?

 Long version:  Okay, I'm very new to Clojure.  But I'm not a Java
 programmer (don't want to be).  I'm not used to all this complexity
 just to do something simple.  What I want to do is the normal
 programming that I do with every other environment and language I
 work with, i.e. I edit some source code on screen, save it in a file,
 and either compile/run, or interpret it or whatever.  But I haven't
 figured out how to do that yet, and don't know if it's possible.

 I downloaded Netbeans and Enclojure.  It runs fine.  I can get a REPL,
 blah blah.  But have no idea how to do anything real i.e. execute a
 program saved in a file.  Again, I want to edit some code with the
 very nice editor, save it, and hit some button that says execute or
 perhaps compile and execute or perhaps build and execute or
 whatever.  But apparently there is a heck of a lot more to it than
 that.  I understand that you have to build a project or whatever.
 Fine - I did that.  Still, I have no idea which directory out of that
 huge structure I'm supposed to put code in, I have no idea how to set
 up all these dependencies or whatever.  I did try some random stuff,
 i.e. saving a file in various directories and hitting build but that
 didn't work.  I also tried editing various files that were already
 there, hoping one of them was the main file I was supposed to be
 dumping source code into, but that didn't work either.

 So I downloaded Clojure Box.  It installs and runs fine.  Again, I get
 a REPL no problem.  But there's only so much coding I can do in a
 REPL.  Again, I'd like to do more.

 I spent a long time trying to find some help online (googling, etc),
 but everything I've found assumes I know too much, i.e. how to set up
 all these projects and dependencies.

 Actually, I'm not interested in fooling with all the boilerplate and
 crap AT ALL.  So if I HAVE to do that, I'm outta here.  But something
 tells me I may not have to, i.e. there may be some automated tool
 somewhere, or some template files I can just use over and over, or
 some trick to use like just name your program 'main' and stick it
 in such-and-such directory.

 Any help?

 --
 You 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: Jesus, how the heck to do anything?

2011-03-23 Thread Stefan Sigurdsson
On Wed, Mar 23, 2011 at 8:50 AM, ultranewb pineapple.l...@yahoo.com wrote:

 Short version:  How do I just open an editor, type in some Clojure
 code, save it in a file, and then run it?


Open a new file hello.clj in your current directory.

Type in (println hello world), save and close.

Run with java -jar /path/to/clojure.jar hello.clj

Cheers,

Stefan

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

Re: Jesus, how the heck to do anything?

2011-03-23 Thread Timothy Baldridge
After you have lein installed, give La Clojure a try. It's the best
IDE plugin I've found, and runs with InteliJ. You can do

lein pom

And lein will create a project file for you that you can open with La Clojure.

Timothy

On Wed, Mar 23, 2011 at 7:25 AM, Stefan Sigurdsson ste...@gmail.com wrote:
 On Wed, Mar 23, 2011 at 8:50 AM, ultranewb pineapple.l...@yahoo.com wrote:

 Short version:  How do I just open an editor, type in some Clojure
 code, save it in a file, and then run it?

 Open a new file hello.clj in your current directory.
 Type in (println hello world), save and close.
 Run with java -jar /path/to/clojure.jar hello.clj
 Cheers,
 Stefan

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



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

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


Extra params for a handler inside Ring's wrap-params

2011-03-23 Thread Thorsten Wilms

Hi!

Routing, using ring.middleware.params and net.cgrand.moustache:

(def tlog-app-handler
  (app [admin ]
{:get (app ...snip...)
 :post (app wrap-params [[path not-empty] ] submit-article)}


Thanks to wrap-params, I can destructure request params within 
submit-article. However, I also want to have path. Without 
wrap-params, it would simply be:


(app [[path not-empty] ] (submit-article path))



(app wrap-params [[path not-empty] ] (partial submit-article path))

results in nth not supported on this type: PersistentHashMap

assoc-param (see 
http://mmcgrana.github.com/ring/middleware.params-api.html) looks like 
it could be what I need, but I can't find out how to use it in this 
context (what wraps what and what is the right map?)


I realize that I could extract path from the request map, but I would 
prefer a solution where what has been taken apart already is used, 
instead of repeating that work.



--
Thorsten Wilms

thorwil's design for free software:
http://thorwil.wordpress.com/

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


Re: Jesus, how the heck to do anything?

2011-03-23 Thread ultranewb
I'll be damned - this worked.  Really, there needs to be some
prominent, easily-accessible guides for just dumb, ultra-basic stuff
like this.  I'm talking guides that assume the user has no knowledge
of anything except programming and editing (I mean, I don't even
know what the heck a jar file is).   And these guides need to be
linked right at the front page of the Clojure site.

Anyway, thanks.


On Mar 23, 7:25 pm, Stefan Sigurdsson ste...@gmail.com wrote:
 On Wed, Mar 23, 2011 at 8:50 AM, ultranewb pineapple.l...@yahoo.com wrote:
  Short version:  How do I just open an editor, type in some Clojure
  code, save it in a file, and then run it?

 Open a new file hello.clj in your current directory.

 Type in (println hello world), save and close.

 Run with java -jar /path/to/clojure.jar hello.clj

 Cheers,

 Stefan

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


Re: Jesus, how the heck to do anything?

2011-03-23 Thread Timothy Baldridge
On Wed, Mar 23, 2011 at 8:11 AM, ultranewb pineapple.l...@yahoo.com wrote:
 I'll be damned - this worked.  Really, there needs to be some
 prominent, easily-accessible guides for just dumb, ultra-basic stuff
 like this.  I'm talking guides that assume the user has no knowledge
 of anything except programming and editing (I mean, I don't even
 know what the heck a jar file is).   And these guides need to be
 linked right at the front page of the Clojure site.

 Anyway, thanks.


If it helps, I feel your pain. I bought books on Clojure, read
everything I could, and it still took me 8 months of on and off again
trials till I finally understood how it worked. Part of the issue is
Java, imo. The whole java class path thing is very annoying. I think I
got python up and running on my box in a matter of minutes. C# has
such a nice IDE that it's super-simple to start programming in that.
Even Ruby has excellent instructions on how to get started.

Clojure on the other hand has it's own way of doing things, and when
it can't resolve something it looks to Java, and from there Java tries
to find libs and symbols and if it can't, it just blows up with some
cryptic Java exception. Yeah...that's the down-side of working with a
language that sits on the JVM.

/rant

Don't get me wrong, I love Clojure, but the learning curve can be steep.

Timothy

-- 
You 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: Jesus, how the heck to do anything?

2011-03-23 Thread Nick Zbinden

MMhh it would be to hard to design a little guid for this.

There are peole who don't know java and if you don't know what a jar
file is you can understand java -jar. Somethink like that should be on
the clojure website. Something like A Letter to a new Clojure
Developer.

Posting stuff like this in a blog want be good because once people
find it its outdated.

Possible Content:

Starting with whats a VM. Showing what the JVM needs to run. How to
Compile to that with clojure. What are the tools to make this
practical ...

-- 
You 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: Jesus, how the heck to do anything?

2011-03-23 Thread Aaron Cohen
On Wed, Mar 23, 2011 at 9:11 AM, ultranewb pineapple.l...@yahoo.com wrote:
 I'll be damned - this worked.  Really, there needs to be some
 prominent, easily-accessible guides for just dumb, ultra-basic stuff
 like this.  I'm talking guides that assume the user has no knowledge
 of anything except programming and editing (I mean, I don't even
 know what the heck a jar file is).   And these guides need to be
 linked right at the front page of the Clojure site.

 Anyway, thanks.



http://clojure.org/getting_started
http://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started
http://www.assembla.com/wiki/show/clojure/Getting_Started

Did you search for getting started guides? If so and you didn't find
these, how can they be made easier to find? If you didn't find them,
why not? If you found them and they didn't help, why not?

-- 
You 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: Jesus, how the heck to do anything?

2011-03-23 Thread ultranewb
Yes, the issue isn't Clojure at all, it's Java.  At any rate, thanks
for feeling my pain.


On Mar 23, 8:59 pm, Timothy Baldridge tbaldri...@gmail.com wrote:
 On Wed, Mar 23, 2011 at 8:11 AM, ultranewb pineapple.l...@yahoo.com wrote:
  I'll be damned - this worked.  Really, there needs to be some
  prominent, easily-accessible guides for just dumb, ultra-basic stuff
  like this.  I'm talking guides that assume the user has no knowledge
  of anything except programming and editing (I mean, I don't even
  know what the heck a jar file is).   And these guides need to be
  linked right at the front page of the Clojure site.

  Anyway, thanks.

 If it helps, I feel your pain. I bought books on Clojure, read
 everything I could, and it still took me 8 months of on and off again
 trials till I finally understood how it worked. Part of the issue is
 Java, imo. The whole java class path thing is very annoying. I think I
 got python up and running on my box in a matter of minutes. C# has
 such a nice IDE that it's super-simple to start programming in that.
 Even Ruby has excellent instructions on how to get started.

 Clojure on the other hand has it's own way of doing things, and when
 it can't resolve something it looks to Java, and from there Java tries
 to find libs and symbols and if it can't, it just blows up with some
 cryptic Java exception. Yeah...that's the down-side of working with a
 language that sits on the JVM.

 /rant

 Don't get me wrong, I love Clojure, but the learning curve can be steep.

 Timothy

-- 
You 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: fs - file system utilities for Clojure

2011-03-23 Thread Jeffrey Schwab
Not so.  Windows commands of the form someProgram /some/path often mistake 
/some/path for command-line switches (like Unix flags).  I had real-world 
problems with this when trying to run a Rails app on Windows, because of the 
issue discussed here: http://www.ruby-forum.com/topic/50137

-- 
You 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: Jesus, how the heck to do anything?

2011-03-23 Thread Brett Morgan
There is this genre of coming of age films that shows the hero getting
beaten up by a bully, then a montage scene, then glorious victory.

You are transitioning from the being beaten up by the bully scene to the
montage scene. Time for lots of study =)

On Wed, Mar 23, 2011 at 7:20 AM, ultranewb pineapple.l...@yahoo.com wrote:

 On Mar 23, 9:10 pm, Aaron Cohen aa...@assonance.org wrote:
  Did you search for getting started guides? If so and you didn't find
  these, how can they be made easier to find? If you didn't find them,
  why not? If you found them and they didn't help, why not?

 Yes, I had previously found all those guides, and much more
 (screencasts, etc).  They didn't help because they either showed you
 how to get a REPL up and going, or they showed you how to download and
 run something like NetBeans.  In the first case, there is only so much
 coding you can do in a REPL.  In the latter case, fine - I have
 NetBeans.  NOW what do I do?

 --
 You 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: Jesus, how the heck to do anything?

2011-03-23 Thread Laurent PETIT
Did you follow the presentation of getting started with
Eclipse+Counterclockwise, where the step by step guide explains how to setup
your environment, and also how to create a hello world project ?

2011/3/23 ultranewb pineapple.l...@yahoo.com

 On Mar 23, 9:10 pm, Aaron Cohen aa...@assonance.org wrote:
  Did you search for getting started guides? If so and you didn't find
  these, how can they be made easier to find? If you didn't find them,
  why not? If you found them and they didn't help, why not?

 Yes, I had previously found all those guides, and much more
 (screencasts, etc).  They didn't help because they either showed you
 how to get a REPL up and going, or they showed you how to download and
 run something like NetBeans.  In the first case, there is only so much
 coding you can do in a REPL.  In the latter case, fine - I have
 NetBeans.  NOW what do I do?

 --
 You 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: Jesus, how the heck to do anything?

2011-03-23 Thread Stefan Sigurdsson
Maybe try Leiningen? It is very nice, and it can take care of much of the
Java hassle more or less behind the scenes.

First download

https://github.com/technomancy/leiningen/raw/master/bin/leinhttps://github.com/technomancy/leiningen/raw/master/bin/lein.bat
(Linux,
OSX, Cygwin)
https://github.com/technomancy/leiningen/raw/master/bin/lein.bat (Windows)

and put in /tmp or C:\Temp, then add to your path:

export PATH=/tmp:${PATH} (Linux...)
set PATH=C:\Temp;%PATH% (Windows)

Then run

lein self-install
lein new hello
cd hello
echo (defn -main [] (println \hello core\))  src/hello/core.clj
lein run -m hello.core

(The echo is slightly different on Windows... just edit the file if that's a
problem :)

If that works, then simply try

lein

and read through the other options, followed up with

lein help whatever-strikes-your-fancy

Cheers,

Stefan

On Wed, Mar 23, 2011 at 3:20 PM, ultranewb pineapple.l...@yahoo.com wrote:

 On Mar 23, 9:10 pm, Aaron Cohen aa...@assonance.org wrote:
  Did you search for getting started guides? If so and you didn't find
  these, how can they be made easier to find? If you didn't find them,
  why not? If you found them and they didn't help, why not?

 Yes, I had previously found all those guides, and much more
 (screencasts, etc).  They didn't help because they either showed you
 how to get a REPL up and going, or they showed you how to download and
 run something like NetBeans.  In the first case, there is only so much
 coding you can do in a REPL.  In the latter case, fine - I have
 NetBeans.  NOW what do I do?

 --
 You 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: Jesus, how the heck to do anything?

2011-03-23 Thread ultranewb
On Mar 23, 9:43 pm, Laurent PETIT laurent.pe...@gmail.com wrote:
 Did you follow the presentation of getting started with
 Eclipse+Counterclockwise, where the step by step guide explains how to setup
 your environment, and also how to create a hello world project ?

No I did not, because I didn't go the Eclipse route; rather, I tried
NetBeans and Emacs.  That's two platforms.  If you are saying that the
presentation for a third platform - Eclipse - answers my questions
posted here, perhaps it would be a good idea to factor those answers
out of the Eclipse presentation and placed somewhere else?  Just an
idea, anyway.

On another note, I must say that the people here seem so friendly and
willing to help, thank goodness.  If the posters here thus far are
indicative of the community at large, newbies coming in should be in
good hands.

-- 
You 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: Jesus, how the heck to do anything?

2011-03-23 Thread Laurent PETIT
2011/3/23 ultranewb pineapple.l...@yahoo.com

 On another note, I must say that the people here seem so friendly and
 willing to help, thank goodness.  If the posters here thus far are
 indicative of the community at large, newbies coming in should be in
 good hands.


They are

-- 
You 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: Jesus, how the heck to do anything?

2011-03-23 Thread Timothy Baldridge
 No I did not, because I didn't go the Eclipse route; rather, I tried
 NetBeans and Emacs.

That was my experience as well. I have tried many Eclipse based IDEs
and they all were slow, buggy, and utterly worthless. So I didn't even
try to touch Eclipse.

Emacs is...wellemacs. Sorry, but when I'm trying to learn a
language, remembering what spell to cast on the keyboard to get the
editor to run my script, was just a little too much to keep track of
at one time.

NetBeans has some major flaws, such as don't click the Start REPL on
the run menu, as that doesn't work too well. Instead click on your
project and click Start REPL
(http://stackoverflow.com/questions/1674793/enclojure-repl-cant-find-dependent-clj-file-on-load).
That's just sad.

From what I've read and heard, TextMate would probably do exactly what
I want, but that only runs on Mac.

Timothy

-- 
You 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: Jesus, how the heck to do anything?

2011-03-23 Thread ultranewb
On Mar 23, 10:15 pm, Timothy Baldridge tbaldri...@gmail.com wrote:
  No I did not, because I didn't go the Eclipse route; rather, I tried
  NetBeans and Emacs.

 That was my experience as well. I have tried many Eclipse based IDEs
 and they all were slow, buggy, and utterly worthless. So I didn't even
 try to touch Eclipse.

Yes, I didn't state it earlier, but in fact I had a horrible
experience with Eclipse before, and thus purposefully avoided it this
go-around.

-- 
You 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: Jesus, how the heck to do anything?

2011-03-23 Thread Laurent PETIT
2011/3/23 Timothy Baldridge tbaldri...@gmail.com

  No I did not, because I didn't go the Eclipse route; rather, I tried
  NetBeans and Emacs.

 That was my experience as well. I have tried many Eclipse based IDEs
 and they all were slow, buggy, and utterly worthless. So I didn't even
 try to touch Eclipse.


It's a shame that such past experiences have made you avoid even trying
ccw/Eclipse combo.

That said, what's important is that you're sufficiently happy with the
solution you have currently.

Cheers,

-- 
Laurent



 Emacs is...wellemacs. Sorry, but when I'm trying to learn a
 language, remembering what spell to cast on the keyboard to get the
 editor to run my script, was just a little too much to keep track of
 at one time.

 NetBeans has some major flaws, such as don't click the Start REPL on
 the run menu, as that doesn't work too well. Instead click on your
 project and click Start REPL
 (
 http://stackoverflow.com/questions/1674793/enclojure-repl-cant-find-dependent-clj-file-on-load
 ).
 That's just sad.

 From what I've read and heard, TextMate would probably do exactly what
 I want, but that only runs on Mac.

 Timothy

 --
 You 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: Jesus, how the heck to do anything?

2011-03-23 Thread Rayne
I wrote this post: http://blog.raynes.me/?p=48 for the precise purpose
of showing newbies how to do what you want to do. One could make
things a lot easier by writing an 'official' guide, assuming mine
didn't meet that particular cut, along the lines of what I was aiming
for and link it on http://clojure.org

On Mar 23, 3:50 am, ultranewb pineapple.l...@yahoo.com wrote:
 Short version:  How do I just open an editor, type in some Clojure
 code, save it in a file, and then run it?

 Long version:  Okay, I'm very new to Clojure.  But I'm not a Java
 programmer (don't want to be).  I'm not used to all this complexity
 just to do something simple.  What I want to do is the normal
 programming that I do with every other environment and language I
 work with, i.e. I edit some source code on screen, save it in a file,
 and either compile/run, or interpret it or whatever.  But I haven't
 figured out how to do that yet, and don't know if it's possible.

 I downloaded Netbeans and Enclojure.  It runs fine.  I can get a REPL,
 blah blah.  But have no idea how to do anything real i.e. execute a
 program saved in a file.  Again, I want to edit some code with the
 very nice editor, save it, and hit some button that says execute or
 perhaps compile and execute or perhaps build and execute or
 whatever.  But apparently there is a heck of a lot more to it than
 that.  I understand that you have to build a project or whatever.
 Fine - I did that.  Still, I have no idea which directory out of that
 huge structure I'm supposed to put code in, I have no idea how to set
 up all these dependencies or whatever.  I did try some random stuff,
 i.e. saving a file in various directories and hitting build but that
 didn't work.  I also tried editing various files that were already
 there, hoping one of them was the main file I was supposed to be
 dumping source code into, but that didn't work either.

 So I downloaded Clojure Box.  It installs and runs fine.  Again, I get
 a REPL no problem.  But there's only so much coding I can do in a
 REPL.  Again, I'd like to do more.

 I spent a long time trying to find some help online (googling, etc),
 but everything I've found assumes I know too much, i.e. how to set up
 all these projects and dependencies.

 Actually, I'm not interested in fooling with all the boilerplate and
 crap AT ALL.  So if I HAVE to do that, I'm outta here.  But something
 tells me I may not have to, i.e. there may be some automated tool
 somewhere, or some template files I can just use over and over, or
 some trick to use like just name your program 'main' and stick it
 in such-and-such directory.

 Any help?

-- 
You 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: Jesus, how the heck to do anything?

2011-03-23 Thread wschnell
Hi,

I started with NetBeans and Enclojure and never used anything else.
You can just go File/New Project, say this is going to be a Clojure
project, give it a name. This will be your new active project in the
projects tree on the left. There you go to Source Packages, down the
tree to defpackage.clj, hack the source and hit the green Run main
project button to run it. You should have the output window open, so
you see your hello world - it is under Window/output. Later, you
left-click the project (in the project tree) and you will find that
Enclojure has made you a jar by default (this is the JVM equivalent of
an executable file).

-- 
You 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: Jesus, how the heck to do anything?

2011-03-23 Thread rob levy
 Emacs is...wellemacs. Sorry, but when I'm trying to learn a
 language, remembering what spell to cast on the keyboard to get the
 editor to run my script, was just a little too much to keep track of
 at one time.


You either love emacs or you don't.  I used to be surprised that there were
*any* lispers who don't prefer emacs, considering the wonderful things you
can do with emacs lisp, and the many other conveniences for working with
s-expressions, slime, etc.  I wonder if the mixed lineage of Clojure is the
reason why there are many Clojurers who don't prefer emacs.  My guess is
that emacs still holds a majority even in the Clojure lisp world, and almost
definitely in the Common Lisp world.

As for the OP, yes Java is very annoying.  Lein solves most of the Java
annoyances, as others have also said.  When *not* using lein, I *still* find
it very annoying to say, write a script that does the correct java classpath
incantations to get something to compile or run as a script.  Java is just
painful.

-- 
You 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: Jesus, how the heck to do anything?

2011-03-23 Thread Jeff Heon
 Type in (println hello world), save and close.

 Run with java -jar /path/to/clojure.jar hello.clj

Very handy to know. It might be nice to have it on 
http://clojure.org/getting_started
and/or
on http://www.assembla.com/wiki/show/clojure/Getting_Started as
Running a Clojure script from the command line or
Getting started with a plain old text editor :)

-- 
You 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: Jesus, how the heck to do anything?

2011-03-23 Thread Tim Robinson
 From what I've read and heard, TextMate would probably do exactly what I 
 want, but that only runs on Mac.

Note there is a Windows version of textmate.

http://www.e-texteditor.com/

And I've been able to use the bundles from the mac version in the
windows version (for other languages at least - I haven't tried the
clojure one yet).

Tim

On Mar 23, 9:15 am, Timothy Baldridge tbaldri...@gmail.com wrote:

-- 
You 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: Clojure in Small Pieces -- Literate Clojure

2011-03-23 Thread daly

On Wed, 2011-03-23 at 00:31 -0700, Christian Schuhegger wrote: 
 Does a public repository exist (e.g. on github) where people could
 clone the repository and potentially contribute?



There is no repository. Everything (including all of the runnable
source) is in a single book. To build a running Clojure REPL and
a PDF copy of the book do:

wget http://literatesoftware.com/clojure.pamphlet
wget http://literatesoftware.com/tangle.c 
(the tangle.c source is also in the book so you could extract 
 it from the pamphlet file instead)
wget http://literatesoftware.com/clojure.pdf
(not really necessary as the next step will create the pdf
 but you might want to read it first)
gcc -o tangle tangle.c
tangle clojure.pamphlet Makefile Makefile
make

You end up with a running Clojure REPL and a PDF of the book.

To make changes just modify the clojure.pamphlet file and type
make

You can send me your complete changed version or do
diff -Naur clojure.pamphlet.original clojure.pamphlet.new clojure.patch

The basic philosophy of literate programming is that you 
are writing for other people, not for the machine. This book
is an attempt to make the Clojure source code readable by
more people. What we are trying to do is start from the ideas
and move to the code so people understand why the code does
what it does.

Tim Daly




-- 
You 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: Jesus, how the heck to do anything?

2011-03-23 Thread Mike Meyer
On Wed, 23 Mar 2011 00:50:10 -0700 (PDT)
ultranewb pineapple.l...@yahoo.com wrote:

 Short version:  How do I just open an editor, type in some Clojure
 code, save it in a file, and then run it?
 
 Long version:  Okay, I'm very new to Clojure.  But I'm not a Java
 programmer (don't want to be).

I don't think you can get very far in Clojure without having to come
to grips with the Java infrastructure. It ain't Unix.

Anyway, I wrote
http://www.mired.org/writing/a-guide-to-javaless-clojure to help
people get as far as possible without having to deal with the that
infrastructure.

mike
-- 
Mike Meyer m...@mired.org http://www.mired.org/consulting.html
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


Re: fs - file system utilities for Clojure

2011-03-23 Thread Daniel Werner
On 23 March 2011 15:21, Jeffrey Schwab j...@schwabcenter.com wrote:
 Not so.  Windows commands of the form someProgram /some/path often mistake
 /some/path for command-line switches (like Unix flags).

Yes, working around this issue is discussed in the Wikipedia article I
linked to.

 I had real-world
 problems with this when trying to run a Rails app on Windows, because of the
 issue discussed here: http://www.ruby-forum.com/topic/50137

Mhh, that sounds dire, especially this comment:

However, the Unicode Win32API -- which will be used in the future --
does not accept /.

Thanks for bringing it up.

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


Noob Question - Clojure number rounding

2011-03-23 Thread JDuPreez
I'm trying to round a decimal number like 78.37898794 to say 78.379,
without converting it to a string. I've been struggling to get this
right and to get info on it. The closest that I've found is to use:
format %.3f. But format converts the number to a string. Not exactly
what I'm trying to do.

How can I do this in Clojure, or where is info on how to do it? Thanks
for your help.

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


Emacs with Lisp and Clojure.

2011-03-23 Thread mmwaikar
Hi,

I am a newbie to Ubuntu (10.10) and Emacs (23). I have been able to
satisfactorily setup Eclipse and CCW, thanks to feedback from CCW user
group members. However, I wanted to explore Clojure through Emacs.

I have clojure-mode 1.7.1, slime and slime-repl 20100404 installed.
I've also installed the ELPA. I've read the assembla wiki and also
seen Lau Jensen's video on getting started with Emacs and clojure. I
have the following in my ~/.emacs file (please note, some of the lines
are commented) -

;; Set up the Common Lisp environment
(add-to-list 'load-path /usr/share/common-lisp/source/slime/)
(add-to-list 'load-path /opt/clojure-mode/)

;;(add-hook 'slime-repl-mode-hook 'clojure-mode-font-lock-setup)
;;(add-to-list 'package-archives '(marmalade . http://marmalade-
repo.org/packages/) t)

;;(setq inferior-lisp-program /usr/bin/sbcl)
(setq x-select-enable-clipboard t)

(require 'clojure-mode)
(require 'slime)
(slime-setup)

(setq slime-lisp-implementations
'((clojure  (/usr/bin/clojure))
  (sbcl (/usr/bin/sbcl

;;; This was installed by package-install.el.
;;; This provides support for the package system and
;;; interfacing with ELPA, the package archive.
;;; Move this code earlier if you want to reference
;;; packages in your .emacs.
(when
(load
 (expand-file-name ~/.emacs.d/elpa/package.el))
  (package-initialize))

Now when I try to install swank-clojure, I get the following message -
File exists: /home/manoj/.emacs.d/elpa/clojure-mode-1.7.1/clojure-
mode.el

And then, after running Emacs, when I say, C-u M-x slime, it prompts
me with Run lisp: lisp and when I change lisp to Clojure, I get a
clojure prompt.

But -
1) There is no auto indentation (so when I go to the next line, after
say (defn some[]), it starts with the first col. in this new line)

2) I can also delete the user = prompt (where as with SBCL prompt, it
says the text is read-only).

Please let me know if I am doing something wrong or missing some
steps.

I would also like the ability to run Lisp and / or Clojure in Emacs
(because I am learning both of them).

Thanks in advance,
Manoj.

-- 
You 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: Noob Question - Clojure number rounding

2011-03-23 Thread Meikel Brandmeyer
Hi,

a bit naive, but it seems to work…

user= (defn round
 [x  {p :precision}]
 (if p
   (let [scale (Math/pow 10 p)]
 (- x (* scale) Math/round (/ scale)))
   (Math/round x)))
#'user/round
user= (round 78.37898794)
78
user= (round 78.37898794 :precision 3)
78.379

There are probably thousand reasons not to do that…

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: Noob Question - Clojure number rounding

2011-03-23 Thread .Bill Smith
Another way:

(defn myround [x precision] (- x (bigdec) (.movePointRight precision) (+ 
0.5) (int) (bigdec) (.movePointLeft precision)))

-- 
You 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: Emacs with Lisp and Clojure.

2011-03-23 Thread Thorsten Wilms

On 03/23/2011 08:07 PM, mmwaikar wrote:


Now when I try to install swank-clojure, I get the following message -
File exists: /home/manoj/.emacs.d/elpa/clojure-mode-1.7.1/clojure-
mode.el


I vaguely recall that I had the same problem and solved it by simply 
moving the existing clojure-mode.el out of the way. You can delete it, 
if that works.




But -
1) There is no auto indentation (so when I go to the next line, after
say (defn some[]), it starts with the first col. in this new line)


Could be the job of Paredit (I'm not sure what does what, here).


--
Thorsten Wilms

thorwil's design for free software:
http://thorwil.wordpress.com/

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


Re: Emacs with Lisp and Clojure.

2011-03-23 Thread Tassilo Horn
Thorsten Wilms t...@freenet.de writes:

Hi,

 1) There is no auto indentation (so when I go to the next line, after
 say (defn some[]), it starts with the first col. in this new line)

 Could be the job of Paredit (I'm not sure what does what, here).

No, paredit has nothing to do with that.  He probably goes to the next
line with RET, which is `newline' by default.  Maybe he wants to bind
`newline-and-indent' to RET, instead.

  (define-key clojure-mode-map (kbd RET) 'newline-and-indent)

Bye,
Tassilo

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


Re: Noob Question - Clojure number rounding

2011-03-23 Thread Brenton
You may also consider using java interop here.

(defn round [s n]
  (.setScale (bigdec n) s java.math.RoundingMode/HALF_EVEN))

= (round 3 78.37898794)
= 78.379

see

http://download.oracle.com/javase/1.5.0/docs/api/java/math/BigDecimal.html

Brenton

On Mar 23, 11:08 am, JDuPreez jacques...@gmail.com wrote:
 I'm trying to round a decimal number like 78.37898794 to say 78.379,
 without converting it to a string. I've been struggling to get this
 right and to get info on it. The closest that I've found is to use:
 format %.3f. But format converts the number to a string. Not exactly
 what I'm trying to do.

 How can I do this in Clojure, or where is info on how to do it? Thanks
 for your help.

-- 
You 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: Deep recursion, continuation passing style, trampolining and memoization

2011-03-23 Thread Tim Webster
@Mark, yeah, I meant using the bottom-up approach and passing that
matrix as the accumulator. (I thought that I remembered seeing such an
implementation in the goopy library, but when I looked today I didn't
find any lev implementation at all.)

@Christian, yes, I missed the point of your question. When I hear the
words stack overflow I reach for recur.

On Mar 23, 1:32 am, Christian Schuhegger
christian.schuheg...@gmail.com wrote:
 Actually Mark is right. My point is not about the Levenshtein
 distance. I've even found a quite nice and concise implementation here
 on the list a few weeks ago:
 generic (works for any seq) levenshtein 
 distancehttps://groups.google.com/group/clojure/browse_frm/thread/c5da3ac1b67...

 My point is about what the subject says: deep recursion, CPS,
 trampolining and memoization.

 My question is: how to do that in idiomatic clojure in general?

-- 
You 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: Noob Question - Clojure number rounding

2011-03-23 Thread Joost
On Mar 23, 8:07 pm, Meikel Brandmeyer m...@kotka.de wrote:
 Hi,

 a bit naive, but it seems to work…

 user= (defn round
          [x  {p :precision}]
          (if p
            (let [scale (Math/pow 10 p)]
              (- x (* scale) Math/round (/ scale)))
            (Math/round x)))
 #'user/round
 user= (round 78.37898794)
 78
 user= (round 78.37898794 :precision 3)
 78.379

 There are probably thousand reasons not to do that…

Most important one being that it won't be reliable. Floats are
fundamentally not compatible with decimal rounding. You'll have to
switch to some other representation like (big) decimals, fixed point
or strings to get 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: Jesus, how the heck to do anything?

2011-03-23 Thread ultranewb
On Mar 24, 1:11 am, Mike Meyer m...@mired.org wrote:
  Long version:  Okay, I'm very new to Clojure.  But I'm not a Java
  programmer (don't want to be).

 I don't think you can get very far in Clojure without having to come
 to grips with the Java infrastructure. It ain't Unix.

Well, for me I guess it will depend on how much coming to grips I
have to do.  If it is much more than clicking on some automation tool
to generate boilerplate (leinengen?), or typing in java -jar blah
blah at a command prompt, I'm outta here.  I have been offered money
to program in java in the past.  I turned it down, turning the phrase
you couldn't pay me to program in java into a reality.  It's fair to
state that I hate java more than any other language.  I'd rather
program in COBOL than java.

-- 
You 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: Jesus, how the heck to do anything?

2011-03-23 Thread ultranewb
Nope, I get a no main class found.

On Mar 23, 11:23 pm, wschnell walter.schn...@online.de wrote:
 Hi,

 I started with NetBeans and Enclojure and never used anything else.
 You can just go File/New Project, say this is going to be a Clojure
 project, give it a name. This will be your new active project in the
 projects tree on the left. There you go to Source Packages, down the
 tree to defpackage.clj, hack the source and hit the green Run main
 project button to run it. You should have the output window open, so
 you see your hello world - it is under Window/output. Later, you
 left-click the project (in the project tree) and you will find that
 Enclojure has made you a jar by default (this is the JVM equivalent of
 an executable file).

-- 
You 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: Jesus, how the heck to do anything?

2011-03-23 Thread Alessio Stalla
On 23 Mar, 23:55, ultranewb pineapple.l...@yahoo.com wrote:
 On Mar 24, 1:11 am, Mike Meyer m...@mired.org wrote:

   Long version:  Okay, I'm very new to Clojure.  But I'm not a Java
   programmer (don't want to be).

  I don't think you can get very far in Clojure without having to come
  to grips with the Java infrastructure. It ain't Unix.

 Well, for me I guess it will depend on how much coming to grips I
 have to do.  If it is much more than clicking on some automation tool
 to generate boilerplate (leinengen?), or typing in java -jar blah
 blah at a command prompt, I'm outta here.  I have been offered money
 to program in java in the past.  I turned it down, turning the phrase
 you couldn't pay me to program in java into a reality.  It's fair to
 state that I hate java more than any other language.  I'd rather
 program in COBOL than java.

Unless you're doing very strange or advanced things, you aren't
required to write any Java code in order to use Clojure. However, this
doesn't mean you won't have to deal with some JVM tools and libraries
sooner or later. After all, tight integration with the JVM is often
cited as one of Clojure's key points. Some people like it, some don't
- it has both advantages and drawbacks, despite what fanboys on both
sides believe.

I don't use Clojure myself - I just follow this NG because it's full
of nice people and a great source of inspiration, but I'm a user of
another Lisp - so I hope the following is not considered trolling,
but: imho, if the JVM is too much an impediment for you, then Clojure
probably is not the right choice for you. Clojure today is both a Lisp
with strong support for certain kinds of concurrency constructs, AND a
JVM language; it's hard to separate the two aspects (as it is today;
things might change in the future). In other words, the JVM is not
just an implementation detail. Perhaps unfortunately, as far as I
know, no language with the same characteristics as Clojure exists
outside of the JVM (apart from ClojureCLR, but I guess that if one
hates the JVM, he'll hate the CLR too).

Just my .02.
Alessio

-- 
You 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: Jesus, how the heck to do anything?

2011-03-23 Thread Phil Hagelberg
On Mar 23, 7:10 am, Aaron Cohen aa...@assonance.org wrote:
 http://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started
 [...]

 Did you search for getting started guides? If so and you didn't find
 these, how can they be made easier to find? If you didn't find them,
 why not? If you found them and they didn't help, why not?

The wikibooks getting started page is frankly pretty intimidating. I
can't see a new user actually wading through all that and finding
something useful from it.

Is the wikibooks site maintained? My only experience with it has been
finding 2008-era advice on it, and even that extremely disjoint. There
are a handful of pages with solid content that has aged well, but with
all the new documentation efforts that have come up recently perhaps
something could be done to retire it? Outdated documentation is a big
burden for maintainers as well as newbies.

-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
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: Jesus, how the heck to do anything?

2011-03-23 Thread Mike Meyer
On Wed, 23 Mar 2011 15:55:51 -0700 (PDT)
ultranewb pineapple.l...@yahoo.com wrote:

 On Mar 24, 1:11 am, Mike Meyer m...@mired.org wrote:
   Long version:  Okay, I'm very new to Clojure.  But I'm not a Java
   programmer (don't want to be).
 
  I don't think you can get very far in Clojure without having to come
  to grips with the Java infrastructure. It ain't Unix.
 
 Well, for me I guess it will depend on how much coming to grips I
 have to do.  If it is much more than clicking on some automation tool
 to generate boilerplate (leinengen?), or typing in java -jar blah
 blah at a command prompt, I'm outta here.  I have been offered money
 to program in java in the past.  I turned it down, turning the phrase
 you couldn't pay me to program in java into a reality.  It's fair to
 state that I hate java more than any other language.  I'd rather
 program in COBOL than java.

I tend to agree - and I've written just enough of both to give that
statement some weight. Then again, I used to say that the major
difference between programming in COBOL and digging ditches is that
programming in COBOL pays better.

The thing is, you can deal with the Java infrastructure without having
to write any Java. They use XML files for everything, so you wind up
writing lots of little and not-so-little XML files to use the
infrastructure. The Clojure community is building tools that let you
write S-expressions (as understood by Clojure) instead of those XML
files. They either replace some Java tool, or produce the XML for you.

I'm not sure going from Java to XML is a win. I *am* sure that going
from XML to S-expressions is a win. But that still leaves you with a
lot of infrastructure (when compared to a unix philosophy equivalent)
to deal with to do things that are reasonable tasks for JVM-based
tools.

mike
-- 
Mike Meyer m...@mired.org http://www.mired.org/consulting.html
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


Re: gen-class and state...

2011-03-23 Thread Stuart Sierra
Ahead-of-time compiled (AOT) code with `defprotocol` and `defrecord` creates 
interfaces and classes you can access from Java.  You don't need gen-class, 
which is usually only necessary for public static void main methods and 
edge-case Java interop problems.

I wrote about this on IBM developerWorks: 
http://www.ibm.com/developerworks/java/library/j-clojure-protocols/#N1058C

-Stuart Sierra
clojure.com

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

Re: Jesus, how the heck to do anything?

2011-03-23 Thread Armando Blancas
 I have been offered money
 to program in java in the past.  I turned it down, turning the phrase
 you couldn't pay me to program in java into a reality.  It's fair to
 state that I hate java more than any other language.  I'd rather
 program in COBOL than java.

That's quite alright. Nine out of ten people here hate java; even
people who love java hate java, that's normal. If you have the
interest and motivation to do some cool things with this technology --
work or fun-- hang in there and after a while all that pain becomes
just a chore; that's when you've come to grips with it, as Mike said.
The last time I felt that pain was last year when I learned maven to
write my clojure apps. It was painful but they helped in this board
and now I'm OK with it. But there's no question that to use Clojure
you need a good grasp of java, the language and infrastructure, no way
around that. Once you learn that you might hate it some more.

-- 
You 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: Jesus, how the heck to do anything?

2011-03-23 Thread Sean Corfield
On Wed, Mar 23, 2011 at 9:30 AM, Jeff Heon jfh...@gmail.com wrote:
 Type in (println hello world), save and close.

 Run with java -jar /path/to/clojure.jar hello.clj

 Very handy to know. It might be nice to have it on 
 http://clojure.org/getting_started

It's here: http://clojure.org/repl_and_main so it sounds like the
latter could / should be more discoverable. I suggest adding something
like the following between the Editing and Debugging sections on the
getting_started page:

To learn more about the REPL described above or running simple
Clojure scripts, read the section [The REPL and main].

I just walked another Clojure / Java newbie through the Leiningen
process and they were excited to see their first .clj file run - but
they also complained about how unapproachable Clojure seems if you're
not a Java weenie because the classpath / dependency thing. The
current state of IDE tooling doesn't help newbies either - and
recommending Emacs to folks coming from a non-Lisp background is
likely to be a non-starter if they already have a favorite editor. And
of course, all this is worse on Windows than Mac / Linux (but that's
true for nearly every open source language project, IMO).
-- 
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: Jesus, how the heck to do anything?

2011-03-23 Thread Stuart Sierra
This is a well-known problem for people new to the JVM.  There is a FAQ 
under development at http://dev.clojure.org/display/doc/FAQ to which I have 
just added a Java Ecosystem section and a Running section.  Let me know 
if there are other questions you ran into that should be included.

Project management and dependencies are a whole other problem.  As this 
thread indicates, there are plenty of tools to address it, but nothing 
matching the convenience you may be used to from scripting languages.  
That's mostly just the pain of being on a very large platform designed for 
enterprise-type projects, but that was a choice made for the other 
advantages it brings.

Thanks,
-Stuart Sierra
clojure.com

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

Re: Jesus, how the heck to do anything?

2011-03-23 Thread Michael Gardner
On Mar 23, 2011, at 7:26 PM, Armando Blancas wrote:

 But there's no question that to use Clojure
 you need a good grasp of java, the language and infrastructure, no way
 around that.

I don't know about that. I've been teaching a young'un Clojure without ever 
mentioning anything about Java. Knowing a bit about the JVM and .jar files and 
such might be helpful in setting things up initially, and certainly Java 
libraries (both standard and third-party) can come in handy to solve certain 
kinds of problems; but even for that you don't really need to know Java the 
language.

Then again, maybe I'm underestimating how hard it would be to read Java API 
docs without knowing the language...

-- 
You 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: Jesus, how the heck to do anything?

2011-03-23 Thread Lee Spector

On Mar 23, 2011, at 8:26 PM, Armando Blancas wrote:
  But there's no question that to use Clojure
 you need a good grasp of java, the language and infrastructure, no way
 around that. Once you learn that you might hate it some more.

I don't think that has to be true. It depends both on what you're using the 
language for and the tools that are made available.

I almost never need java interop for the things that I do, and if the tool 
options were a little better then I would be able to remain blissfully ignorant 
of java infrastructure as well. By if the tools were a little better I mean 
if there was a beginner-friendly and background-agnostic option for editing 
and running programs, and managing simple projects, without complicated 
installation or configuration (it should be a one-click download/install!) or a 
steep learning curve for any of the pieces. 

There are a couple of good options for all of the pieces of this, but IMHO 
nothing that handles them all reasonably well simultaneously.  But I do think 
it's possible, that several projects are close to achieving this from different 
directions, and that people in this community could make it happen if they 
appreciated the need. FWIW the thing that seems closest to me, that I've seen, 
is textmate-clojure: it uses cake to provide a straightforward, flexible, and 
community-idiomatic way to run and manage projects, and it provides 
language-aware editing that's simple to set up and has almost no learning 
curve. Unfortunately it doesn't appear to be actively supported and issues 
posted on the github site several months ago haven't been addressed. And it's 
not cross-platform (which doesn't bother me too much since I generally work in 
Mac OS). But still, it's an existence proof for a reasonable solution to many 
of the problems that the OP raised (and many problems that I have using and 
teaching Clojure). 

If there was an actively supported, cross-platform system that does what 
textmate-clojure almost does, and if a pointer to such a thing could be on the 
clojure.org getting started page, then I think that new users would have a 
vastly better experience and that the entire community would benefit.

 -Lee

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


Should destructure emit not nthnext, but nthrest?

2011-03-23 Thread Takahiro Hozumi
Hi,
I think destructure should not produce nthnext, because it realize an
element of sequence more than needed.

For example:
(defn inc-seq [i]
  (iterate #(let [x (inc %)] (println realize: x) x) i))
;= #'user/inc-seq

(take 1 (inc-seq 0))
;= (0)

(take 1 (let [[x  xs] (inc-seq 0)] (cons x xs)))
; realize: 1
;= (0)

(macroexpand '(let [[x  xs] (inc-seq 0)] (cons x xs)))
;= (let* [vec__2630 (inc-seq 0)
  x (clojure.core/nth vec__2630 0 nil)
  xs (clojure.core/nthnext vec__2630 1)]
 (cons x xs))

Although nthrest isn't in clojure, why not to use nthrest instead of
nthnext in destructure?
What do you think?

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


Re: Jesus, how the heck to do anything?

2011-03-23 Thread Chas Emerick

On Mar 23, 2011, at 8:26 PM, Armando Blancas wrote:

 I have been offered money
 to program in java in the past.  I turned it down, turning the phrase
 you couldn't pay me to program in java into a reality.  It's fair to
 state that I hate java more than any other language.  I'd rather
 program in COBOL than java.
 
 That's quite alright. Nine out of ten people here hate java; even
 people who love java hate java, that's normal. If you have the
 interest and motivation to do some cool things with this technology --
 work or fun-- hang in there and after a while all that pain becomes
 just a chore; that's when you've come to grips with it, as Mike said.
 The last time I felt that pain was last year when I learned maven to
 write my clojure apps. It was painful but they helped in this board
 and now I'm OK with it. But there's no question that to use Clojure
 you need a good grasp of java, the language and infrastructure, no way
 around that. Once you learn that you might hate it some more.

You certainly don't need to know much of anything about Java-the-language, but 
it's hard to get very far without understanding how the JVM works, at least in 
some critical (and basic) ways.

Perhaps a (bad) analogy might be the relationship between e.g. Python and 
POSIX.  A lot of what makes python great is that it provides a great 
abstraction for various system-level libraries and services that are defined by 
POSIX.  Not having even a rudimentary understanding of those underpinnings will 
always put you at a disadvantage.

In any case, Clojure is *very* young.  All of the tooling available for it 
currently has been assembled by volunteers in the community, all of which are 
(understandably, I think) scratching their own itches, most of which are 
inevitably not going to be those felt by total greenhorns.  That tooling will 
get better, and will become more and more palatable to newcomers, but it's not 
going to happen overnight.

FWIW, it looks like effective introductory/educational environments for Java 
started appearing *years* after it was introduced (looks like BlueJ came out 
5-6 years after Java 1.0? [1]).  We'll get there, and probably in far less 
time. :-)

- Chas

[1] http://en.wikipedia.org/wiki/BlueJ

-- 
You 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: Should destructure emit not nthnext, but nthrest?

2011-03-23 Thread Alan
If you don't plan to use the rest arguments, and in fact don't care
about them at all, why are you binding them to something?

More importantly, it would make the following idiom a lot more clumsy:

(defn sum [list]
  (let [[x  xs] list]
(+ x (if xs
   (sum xs)
   0

Using rest would cause the xs part to always be true, because to
determine whether the sequence is empty you would have to call seq on
it.

On Mar 23, 6:23 pm, Takahiro Hozumi fat...@googlemail.com wrote:
 Hi,
 I think destructure should not produce nthnext, because it realize an
 element of sequence more than needed.

 For example:
 (defn inc-seq [i]
   (iterate #(let [x (inc %)] (println realize: x) x) i))
 ;= #'user/inc-seq

 (take 1 (inc-seq 0))
 ;= (0)

 (take 1 (let [[x  xs] (inc-seq 0)] (cons x xs)))
 ; realize: 1
 ;= (0)

 (macroexpand '(let [[x  xs] (inc-seq 0)] (cons x xs)))
 ;= (let* [vec__2630 (inc-seq 0)
               x (clojure.core/nth vec__2630 0 nil)
               xs (clojure.core/nthnext vec__2630 1)]
          (cons x xs))

 Although nthrest isn't in clojure, why not to use nthrest instead of
 nthnext in destructure?
 What do you think?

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


Re: Jesus, how the heck to do anything?

2011-03-23 Thread ultranewb
On Mar 24, 7:26 am, Armando Blancas armando_blan...@yahoo.com wrote:
 That's quite alright. Nine out of ten people here hate java;

Actually, I didn't know that.  I imagined that 9 out of 10 people here
would be java-ites.  It's good to know that I'm in good company.

-- 
You 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: Should destructure emit not nthnext, but nthrest?

2011-03-23 Thread Takahiro Hozumi
 If you don't plan to use the rest arguments, and in fact don't care
 about them at all, why are you binding them to something?
I omitted code for sake of simplicity.
There are situations which require rest arguments.

 Using rest would cause the xs part to always be true
You're right. I see to use nthrest instead of nthnext can break code,
so unfortunately this is unwelcome change.
Thanks!

On 3月24日, 午前11:28, Alan a...@malloys.org wrote:
 If you don't plan to use the rest arguments, and in fact don't care
 about them at all, why are you binding them to something?

 More importantly, it would make the following idiom a lot more clumsy:

 (defn sum [list]
   (let [[x  xs] list]
     (+ x (if xs
            (sum xs)
            0

 Using rest would cause the xs part to always be true, because to
 determine whether the sequence is empty you would have to call seq on
 it.

 On Mar 23, 6:23 pm, Takahiro Hozumi fat...@googlemail.com wrote:







  Hi,
  I think destructure should not produce nthnext, because it realize an
  element of sequence more than needed.

  For example:
  (defn inc-seq [i]
    (iterate #(let [x (inc %)] (println realize: x) x) i))
  ;= #'user/inc-seq

  (take 1 (inc-seq 0))
  ;= (0)

  (take 1 (let [[x  xs] (inc-seq 0)] (cons x xs)))
  ; realize: 1
  ;= (0)

  (macroexpand '(let [[x  xs] (inc-seq 0)] (cons x xs)))
  ;= (let* [vec__2630 (inc-seq 0)
                x (clojure.core/nth vec__2630 0 nil)
                xs (clojure.core/nthnext vec__2630 1)]
           (cons x xs))

  Although nthrest isn't in clojure, why not to use nthrest instead of
  nthnext in destructure?
  What do you think?

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


Re: Jesus, how the heck to do anything?

2011-03-23 Thread Sean Corfield
On Wed, Mar 23, 2011 at 8:04 PM, ultranewb pineapple.l...@yahoo.com wrote:
 On Mar 24, 7:26 am, Armando Blancas armando_blan...@yahoo.com wrote:
 That's quite alright. Nine out of ten people here hate java;

 Actually, I didn't know that.  I imagined that 9 out of 10 people here
 would be java-ites.  It's good to know that I'm in good company.

Heh, even as a long-time Java developer (since '97), I'm here because
I want something _better_ than Java. It's why I learned Groovy in 2008
(sort of Java-lite - fixes most of Java's problems but suffers from
performance issues compared to Java), Scala in 2009 (sort of Java++
- fixes most of Java's problems but suffers from a split personality
since it's a hybrid OO/FP language and has a frightening type system -
for the people I need to work with), and then Clojure in 2010.

I went to production with Groovy (in 2008) and it was a successful
project. I went to production with Scala in 2010 and I'm sort of happy
with it. We're going to production with Clojure in 2011. Yay!
-- 
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: Emacs with Lisp and Clojure.

2011-03-23 Thread mmwaikar
But the same enter key works properly when I am using Lisp, so why
shouldn't it be the default in Clojure as well?

Also, after removing clojure-mode, when I try to install swank-
clojure, it again installs the clojure-mode, but fails to install
itself?

regards,
Manoj.

On Mar 24, 12:45 am, Tassilo Horn tass...@member.fsf.org wrote:
 Thorsten Wilms t...@freenet.de writes:

 Hi,

  1) There is no auto indentation (so when I go to the next line, after
  say (defn some[]), it starts with the first col. in this new line)

  Could be the job of Paredit (I'm not sure what does what, here).

 No, paredit has nothing to do with that.  He probably goes to the next
 line with RET, which is `newline' by default.  Maybe he wants to bind
 `newline-and-indent' to RET, instead.

   (define-key clojure-mode-map (kbd RET) 'newline-and-indent)

 Bye,
 Tassilo

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