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

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 constr

Re: gen-class and state...

2011-03-23 Thread Ken Wesson
On Wed, Mar 23, 2011 at 3:43 AM, Jules 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 lin

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

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 wrote: > Short version:  How do I just open an editor,

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

Re: Jesus, how the heck to do anything?

2011-03-23 Thread Stefan Sigurdsson
On Wed, Mar 23, 2011 at 8:50 AM, ultranewb 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

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 wrote: > On Wed, Mar 2

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

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

Re: Jesus, how the heck to do anything?

2011-03-23 Thread Timothy Baldridge
On Wed, Mar 23, 2011 at 8:11 AM, ultranewb 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 "ed

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 thi

Re: Jesus, how the heck to do anything?

2011-03-23 Thread Aaron Cohen
On Wed, Mar 23, 2011 at 9:11 AM, ultranewb 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 "ed

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 wrote: > On Wed, Mar 23, 2011 at 8:11 AM, ultranewb wrote: > > I'll be damned - this worked.  Really, there needs to be some > > prominent, easily-accessible guides fo

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

Re: Jesus, how the heck to do anything?

2011-03-23 Thread ultranewb
On Mar 23, 9:10 pm, Aaron Cohen 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 m

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 w

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 > On Mar 23, 9:10 pm, Aaron Cohen wrote: > > Did you search for getting start

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/lein (Linux, OSX, Cygwin) https://github.c

Re: Jesus, how the heck to do anything?

2011-03-23 Thread ultranewb
On Mar 23, 9:43 pm, Laurent PETIT 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;

Re: Jesus, how the heck to do anything?

2011-03-23 Thread Laurent PETIT
2011/3/23 ultranewb > 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

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

Re: Jesus, how the heck to do anything?

2011-03-23 Thread ultranewb
On Mar 23, 10:15 pm, Timothy Baldridge 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

Re: Jesus, how the heck to do anything?

2011-03-23 Thread Laurent PETIT
2011/3/23 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. >

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://c

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

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 we

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

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

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 runni

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

Re: fs - file system utilities for Clojure

2011-03-23 Thread Daniel Werner
On 23 March 2011 15:21, Jeffrey Schwab 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 w

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.

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

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

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 Not

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 ou

Re: Emacs with Lisp and Clojure.

2011-03-23 Thread Tassilo Horn
Thorsten Wilms 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 go

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 wrote: > I'm t

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.

Re: Noob Question - Clojure number rounding

2011-03-23 Thread Joost
On Mar 23, 8:07 pm, Meikel Brandmeyer 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/r

Re: Jesus, how the heck to do anything?

2011-03-23 Thread ultranewb
On Mar 24, 1:11 am, Mike Meyer 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 w

Re: Jesus, how the heck to do anything?

2011-03-23 Thread ultranewb
Nope, I get a . On Mar 23, 11:23 pm, wschnell 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 le

Re: Jesus, how the heck to do anything?

2011-03-23 Thread Alessio Stalla
On 23 Mar, 23:55, ultranewb wrote: > On Mar 24, 1:11 am, Mike Meyer 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 infrastru

Re: Jesus, how the heck to do anything?

2011-03-23 Thread Phil Hagelberg
On Mar 23, 7:10 am, Aaron Cohen 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 di

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 wrote: > On Mar 24, 1:11 am, Mike Meyer 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

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 developer

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 o

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

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

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

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 yo

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

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 >

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

Re: Jesus, how the heck to do anything?

2011-03-23 Thread ultranewb
On Mar 24, 7:26 am, Armando Blancas 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 subscrib

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 t

Re: Jesus, how the heck to do anything?

2011-03-23 Thread Sean Corfield
On Wed, Mar 23, 2011 at 8:04 PM, ultranewb wrote: > On Mar 24, 7:26 am, Armando Blancas 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 compa

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

Re: Jesus, how the heck to do anything?

2011-03-23 Thread Laurent PETIT
2011/3/24 ultranewb > On Mar 24, 7:26 am, Armando Blancas 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. > Frankly, I'm not awar