Eval troubles

2009-09-03 Thread Miron Brezuleanu
Hello, I'm a Clojure newbie (many thanks to Rich Hickey and everyone involved - it's a great programming environment) and I have some trouble with 'eval'. What I'm trying is: $ java -cp clojure.jar clojure.lang.Repl Clojure 1.1.0-alpha-SNAPSHOT user=> (let [x 1] (eval '(inc x))) java.lang.Except

Re: Eval troubles

2009-09-03 Thread Christian Vest Hansen
You need to unquote the x to get its value from the let. You can do that with the tilde character inside syntax quotes: user=> (let [x 1] (eval `(inc ~x))) 2 On Thu, Sep 3, 2009 at 8:24 AM, Miron Brezuleanu wrote: > > Hello, > > I'm a Clojure newbie (many thanks to Rich Hickey and everyone invol

Re: Eval troubles

2009-09-03 Thread Konrad Hinsen
On 3 Sep 2009, at 08:24, Miron Brezuleanu wrote: > user=> (let [x 1] (eval '(inc x))) > java.lang.Exception: Unable to resolve symbol: x in this context > (NO_SOURCE_FILE:1) > > (on a freshly downloaded&compiled clojure from github) > > According to my understanding of http://clojure.org/evaluati

Lazy binding

2009-09-03 Thread ngocdaothanh
Hi, In Rails you can create a view like this: my_view.erb: <%= "hello" + @name %> I'm new to Clojure. I want to create something like the above like this: (defn my-view [] (str "hello" name)) The point is: * name is not known when my-view is defined * I don't want to pass name as a argument

Re: Eval troubles

2009-09-03 Thread Miron Brezuleanu
Hello, thanks everyone for replies, On Thu, Sep 3, 2009 at 2:36 PM, Konrad Hinsen wrote: > > On 3 Sep 2009, at 08:24, Miron Brezuleanu wrote: > > > user=> (let [x 1] (eval '(inc x))) > > java.lang.Exception: Unable to resolve symbol: x in this context > > (NO_SOURCE_FILE:1) > > > > (on a freshl

Re: Filter Causing StackOverflowError?

2009-09-03 Thread tmountain
I had a suspicion that something similar to this might be happening. As I said in the first message, including a doall on the filters prevented the issue from happening. I will relay this info back to my friend. Thanks for the help. On Sep 3, 12:04 am, John Harrop wrote: > On Wed, Sep 2, 2009 at

Re: Eval troubles

2009-09-03 Thread Jarkko Oranen
On Sep 3, 9:24 am, Miron Brezuleanu wrote: > Hello, > > I'm a Clojure newbie (many thanks to Rich Hickey and everyone involved > - it's a great programming environment) and I have some trouble with > 'eval'. > > What I'm trying is: > $ java -cp clojure.jar clojure.lang.Repl > Clojure 1.1.0-alpha-

Re: Searching the group archives

2009-09-03 Thread Chouser
On Wed, Sep 2, 2009 at 10:48 PM, Aaron Brooks wrote: > > Rich, Chouser or other Clojure group admin, > >    It may be helpful to put the search link in the currently unused > welcome message section of the group "Home" page. I've also seen that area used to mention the potential delay to first-ti

Re: Filter Causing StackOverflowError?

2009-09-03 Thread tmountain
The function returns a map with the keys being word pairs and the value being a single word. It is a component of a larger program. user=> (generate-chain "a quick brown fox jumps over the lazy dog") {("the" "lazy") ("dog"), ("over" "the") ("lazy"), ("jumps" "over") ("the"), ("fox" "jumps") ("ove

Re: Lazy binding

2009-09-03 Thread Jarkko Oranen
On Sep 3, 3:42 pm, ngocdaothanh wrote: > Hi, > > In Rails you can create a view like this: > > my_view.erb: > <%= "hello" + @name %> > > I'm new to Clojure. I want to create something like the above like > this: > > (defn my-view [] >   (str "hello" name)) > > The point is: > * name is not known

Re: Lazy binding

2009-09-03 Thread Jarkko Oranen
Oops, accidentally sent the post before it was ready. Oh, well... --~--~-~--~~~---~--~~ 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

Re: Backporting clojure.contrib.logging

2009-09-03 Thread Stuart Sierra
yes. -SS On Sep 2, 5:27 pm, Phil Hagelberg wrote: > Hello! > > I've backported contrib's logging.clj library to work with Clojure > 1.0. It was just a handful of modifications wrt how the import function > worked. > > I'd like to get it included in the clojure-1.0-compat branch of > contrib. Sha

Re: Lazy binding

2009-09-03 Thread Stuart Sierra
Check out www.stringtemplate.org, a Java template library with a functional design. -SS On Sep 3, 8:42 am, ngocdaothanh wrote: > Hi, > > In Rails you can create a view like this: > > my_view.erb: > <%= "hello" + @name %> > > I'm new to Clojure. I want to create something like the above like > t

Re: Eval troubles

2009-09-03 Thread Konrad Hinsen
On 3 Sep 2009, at 14:43, Miron Brezuleanu wrote: > Is there a way to get the list of symbols bound locally and to access > their values? I don't think so. Python and Clojure are quite different languages. Python is much more dynamic, with variable lookup happening at runtime. In Clojure, onl

Re: Lazy binding

2009-09-03 Thread tmountain
I believe the way this works in rails has to do with the order in which variables are resolved. In this case, @name is an instance variable that's already been assigned elsewhere (your controller). Rails loads the view after the controller class has been instantiated. For this to work, the view is

Re: Eval troubles

2009-09-03 Thread Miron Brezuleanu
Hi, On Thu, Sep 3, 2009 at 4:26 PM, Konrad Hinsen wrote: > > On 3 Sep 2009, at 14:43, Miron Brezuleanu wrote: > >> Is there a way to get the list of symbols bound locally and to access >> their values? > > I don't think so. Python and Clojure are quite different languages. > Python is much more d

Re: maplocalleader & vimclojure

2009-09-03 Thread bballant
Hi, I got vimclojure working after some pain. Perhaps checking out how I have things set up will help: br...@milo:~/clojure$ ls clojure clojure-contrib programs slime swank-clojure vimclojure-2.1.2 br...@milo:~/clojure$ pwd /home/brian/clojure I put the command to start nailgun into an exe

Re: maplocalleader & vimclojure

2009-09-03 Thread Nik Kolev
not sure whether I am doing something wrong, but for a project with many jar artifacts [1] that have to be classpath-fed to nailgun I need to armwrestle vim(clojure) to start honoring the mappings and calling into vimclojure's (version 2.1.2) guts and onto nailgun... Here's what I mean by armwrest

Another Clojure Box - Version 1.4

2009-09-03 Thread Darmac
Hi, I just release version 1.4 of ACB. Changelog: ++ Customized version of SciTE 2.01. It's accept \n in tooltips and have a simple clojure lexer (don't use lisp lexer any more). ++ Better SciTE autocomplete (recognize ?,- and others keyword symbols) ++ Now you can resize file explorer in SciTE (

Re: maplocalleader & vimclojure

2009-09-03 Thread MarkSwanson
I had trouble installing it too. Here is exactly what my problems were and my solutions: NOTE: Meikel -> Thank you for writing vimclojure! I think it's great! Please accept these issues from the perspective of someone who is trying to help you make vimclojure better. 1. For some reason (and only

Re: maplocalleader & vimclojure

2009-09-03 Thread MarkSwanson
Hmm. I just spent some time writing about what I got stuck on and my solutions and suggestions but Google lost it all when I clicked submit. Here is an abbreviated post: First, thanks for writing vimclojure! I think it's great! 1. README.txt contains incorrect information about what jar files a

Re: maplocalleader & vimclojure

2009-09-03 Thread MarkSwanson
On Sep 3, 12:09 pm, MarkSwanson wrote: > Hmm. I just spent some time writing about what I got stuck on and my > solutions > and suggestions but Google lost it all when I clicked submit. Ok... I did wait a bit and refresh the page a couple of times. I guess I just didn't wait long enough. Sorry f

clojureshell-maven-plugin - easier clojure startup with maven

2009-09-03 Thread Fredrik Appelberg
Hello everyone, I've just released the first tentative version of Clojureshell. It's a simple maven plugin that allows you to easily start a clojure REPL or run a Swank server in the context of any maven project. This means that maven does all the dependency management heavy lifting; all runtime d

Re: maplocalleader & vimclojure

2009-09-03 Thread bballant
I also want to say thanks for making vimclojure. I'm just getting back into Lisp/Scheme/Clojure after not touching a Lisp dialect or emacs for 10 years. Because it's on just about every default Linux install, I've become very familiar and efficient in vim and I didn't want to re-learn emacs (may

Windows user

2009-09-03 Thread Emeka
Hello Meikel, I am still waiting for the day I could start off using vimclojure on my PC. Is vimclojure ready for my environment? And is it easy to install? Regards, Emeka --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gro

Example of using ANTLR from Clojure?

2009-09-03 Thread Paul Henning
Does anyone have an example of how to call ANTLR from Clojure? I imagine that it is not that difficult using the Java interop features, but my Java skills are pathetic. Thanks, Paul --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: maplocalleader & vimclojure

2009-09-03 Thread Meikel Brandmeyer
Hi, Am 03.09.2009 um 17:42 schrieb MarkSwanson: 1. For some reason (and only with vimclojure) I used the tilde (~) in my classpath. It simply didn't work. When I used full pathnames it worked.Maybe the symbolic links in my path caused problems with this. Do not use tildes. Tilde is a shell th

Re: Windows user

2009-09-03 Thread Meikel Brandmeyer
Hello Emeka, Am 03.09.2009 um 18:01 schrieb Emeka: I am still waiting for the day I could start off using vimclojure on my PC. Is vimclojure ready for my environment? And is it easy to install? I'm using a Windows setup at work and works without much trouble. Currently the setup is a bit

Re: maplocalleader & vimclojure

2009-09-03 Thread Meikel Brandmeyer
Hi, Am 03.09.2009 um 17:20 schrieb Nik Kolev: + I open a clojure module that depends (directly or indirectly on the aforementioned jar artifacts [1]) + When I do that I get the syntax highlighting and the omni- completions This is good sign. + But I don't get any of the 'vimclojure comman

Re: maplocalleader & vimclojure

2009-09-03 Thread Bokeh Sensei
Hi Meikel, I think you did a fantastic job with VimClojure! It's really what has gotten me started with Clojure and back to Java. I had very carefully read your instructions, including the README.txt, but still managed to not get it to work at first. Of course I was the one that screwed up! Prob

No line information in debugger

2009-09-03 Thread Bokeh Sensei
I can't get JSwat to display and break on lines in my Clojure code. Does anybody knows how this works? What files, output could I verify to get myself out of this problem? (I can get attach JSwat to a Repl, no problem, can pause it and continue it) --~--~-~--~~~---~--~

Re: maplocalleader & vimclojure

2009-09-03 Thread ronen
Im also not getting Clojure when calling :nmap, n * /<+.\{-1,}+>c/+>/e n \gp * :GitPullRebase n \gc * :GitCommit n \gA * :GitAdd n \ga * :GitAdd n \gl * :GitLog n \gs * :GitStatus n \gD * :GitDiff --cached n \gd * :

Importing All from java package?

2009-09-03 Thread Gorsal
Hello! I was just wandering if it was possible to import all from a java package . For example, in java i can do import org.eclipse.jface.text.*; And i can use IDocument, which is contained under org.eclipse.jface.text.IDocument; In clojure, I try (ns ParenMatcher (:gen-class :implements

Re: Importing All from java package?

2009-09-03 Thread eyeris
I'm pretty sure that you need to either name each class you want to import inside your :import form or you need to import the package and then each use of the classes in that package need to be manually resolved (e.g. org.eclipse.jface/IDocument). Though I never have been able to use the ns macro

Re: Lazy binding

2009-09-03 Thread ngocdaothanh
Using a map of keywords is a good solution, but I think it is somewhat just boilerplate code to satisfy the compiler, not to satisfy developers (yes, human). In view we have to write (:my-var map) everywhere. Is there a better way, something like lazy variable binding or lazy function binding? To

Re: clojureshell-maven-plugin - easier clojure startup with maven

2009-09-03 Thread ngocdaothanh
What do you mean "Swank server"? Could you explain about that? On Sep 4, 1:40 am, Fredrik Appelberg wrote: > Hello everyone, > > I've just released the first tentative version of Clojureshell. It's a > simple maven plugin that allows you to easily start a clojure REPL or run a > Swank server in

Re: clojureshell-maven-plugin - easier clojure startup with maven

2009-09-03 Thread Stuart Sierra
Cool! I'm glad to see people working on more/better Clojure-Maven integration. This is an important piece of the puzzle. Looking forward to adding this to my (just started) blog series on Clojure-Maven: http://stuartsierra.com/2009/09/03/mavens-not-so-bad -SS On Sep 3, 12:40 pm, Fredrik Appe

Re: Importing All from java package?

2009-09-03 Thread Stuart Sierra
On Sep 3, 6:31 pm, Gorsal wrote: > Hello! I was just wandering if it was possible to import all from a > java package . For example, in java i can do > > import org.eclipse.jface.text.*; This is not supported right now. I don't think it's likely in the future, either. -SS --~--~-~--~--

Re: No line information in debugger

2009-09-03 Thread Stuart Sierra
I don't know about JSwat, but I know that code entered directly at the REPL (or eval'ed from SLIME) doesn't have line numbers. -SS On Sep 3, 5:25 pm, Bokeh Sensei wrote: > I can't get JSwat to display and break on lines in my Clojure code. > Does anybody knows how this works? > What files, outp

Re: clojureshell-maven-plugin - easier clojure startup with maven

2009-09-03 Thread Mark Derricutt
Cool, I've meaning to reply to your post about merging that into maven-clojure-plugin but have been snowed under at $work this week. I've never actually looked at swank but from what I understand of it it'd be darn useful. On Fri, Sep 4, 2009 at 4:40 AM, Fredrik Appelberg < fredrik.appelb...@gmai

Re: clojureshell-maven-plugin - easier clojure startup with maven

2009-09-03 Thread Mark Derricutt
Great post - makes me feel rather slack for not (yet) blogging my own plugin. -- Pull me down under... Sent from Auckland, Auk, New Zealand On Fri, Sep 4, 2009 at 1:21 PM, Stuart Sierra wrote: > Looking forward to adding this to my (just started) blog series on > Clojure-Maven: > http://stuarts

Re: clojureshell-maven-plugin - easier clojure startup with maven

2009-09-03 Thread Stuart Sierra
On Sep 3, 9:15 pm, ngocdaothanh wrote: > What do you mean "Swank server"? Could you explain about that? Swank is the "back-end" of SLIME, the interactive Lisp programming environment for Emacs. SLIME is written in Emacs Lisp and runs inside the Emacs process. Swank runs in the Lisp process, wh

Re: clojureshell-maven-plugin - easier clojure startup with maven

2009-09-03 Thread J. McConnell
On Thu, Sep 3, 2009 at 12:40 PM, Fredrik Appelberg < fredrik.appelb...@gmail.com> wrote: > > I've just released the first tentative version of Clojureshell. It's a > simple maven plugin that allows you to easily start a clojure REPL or run a > Swank server in the context of any maven project. Th

RE: Importing All from java package?

2009-09-03 Thread Seth Burleigh
OK! Thanks for the responses. -Original Message- From: clojure@googlegroups.com [mailto:cloj...@googlegroups.com] On Behalf Of Stuart Sierra Sent: Thursday, September 03, 2009 8:23 PM To: Clojure Subject: Re: Importing All from java package? On Sep 3, 6:31 pm, Gorsal wrote: > Hello! I

Interactive heuristic

2009-09-03 Thread Phil Hagelberg
I'm finding some situations in my projects where I want to know if the code is running from an interactive environment or not. It would be great if environment developers could agree on a convention to signal this. I suggest something like an *environment* variable that would be bound to a strin

Re: No line information in debugger

2009-09-03 Thread Bokeh Sensei
Actually I was just doing a load-file from the Repl. I'm currently trying the Netbeans Enclojure plugin but same results. In Enclojure, I'm using the same code, except it's called from the generated -main function. It compiles and runs just fine, it's just not possible to set breakpoints for som

Re: Eval troubles

2009-09-03 Thread James Sofra
Hi, I am not familiar with the Python code.interact() thing and what it does so I may be missing something but if you are looking to do debugging is there a reason you can't use a Java debugger to debug your Clojure code? (I have heard some people have had success for JSwat.) I guess that is not

Re: Lazy binding

2009-09-03 Thread James Sofra
Not to distract from the talk on how to achieve these things in Clojure but I really want to second Stuart's recommendation of StringTemplate, it really is a great library and is seamless to use from Clojure. I would recommend it for any templating needs, not just HTML views, in fact I have used

Re: Interactive heuristic

2009-09-03 Thread Stuart Sierra
The problem is, I think, that everyone will have a slightly different definition of "interactive environment." If I run java ... clojure.main path/to/file.clj does that count? What about java ... my.compiled.namespace ? Or what about a REPL thread inside another application? Or a Cloju

Re: Eval troubles

2009-09-03 Thread Stuart Sierra
On Sep 3, 9:26 am, Konrad Hinsen wrote: > I don't think so. Python and Clojure are quite different languages.   > Python is much more dynamic, with variable lookup happening at   > runtime. Or, more simply, Python is an interpreter, Clojure is a compiler. So Clojure's "eval" actually compiles t

Re: Lazy binding

2009-09-03 Thread ngocdaothanh
Compojure's default view syntax looks great (same idea as Yaw's EHTML: http://yaws.hyber.org/dynamic.yaws). It allows one to "stay in Clojure". I found an example of integrating StringTemplate (and Hibernate) with Clojure: http://bitbucket.org/kumarshantanu/blogjure/ Is there more example of int

re: atom vs. ref

2009-09-03 Thread Raoul Duke
reading the docs for atom turned out to make sense, now :-) http://clojure.org/atoms having the discussion helped set the stage in my head for groking i think, thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Eval troubles

2009-09-03 Thread Miron Brezuleanu
Hello, On Fri, Sep 4, 2009 at 4:01 AM, James Sofra wrote: > > Hi, > > I am not familiar with the Python code.interact() thing and what it > does so I may be missing something but if you are looking to do > debugging is there a reason you can't use a Java debugger to debug > your Clojure code? (I

Re: Eval troubles

2009-09-03 Thread Miron Brezuleanu
Hello, On Fri, Sep 4, 2009 at 8:04 AM, Stuart Sierra wrote: > > On Sep 3, 9:26 am, Konrad Hinsen wrote: >> I don't think so. Python and Clojure are quite different languages. >> Python is much more dynamic, with variable lookup happening at >> runtime. > > Or, more simply, Python is an interpret

Re: No line information in debugger

2009-09-03 Thread Bokeh Sensei
FIXED! I found in the Java Preferences -> Advanced ->Enable Tracing and Enable Logging were checked. I unchecked them and also reset all JVMs to their defaults, using the reset button :) And it works, my line numbers get generated by the JVM and I can debug in NetBeans On Sep 3, 9:12 pm, Bokeh

Re: Windows user

2009-09-03 Thread Emeka
I will wait for the windows installer . Regards, Emeka On Thu, Sep 3, 2009 at 8:07 PM, Meikel Brandmeyer wrote: > Hello Emeka, > > Am 03.09.2009 um 18:01 schrieb Emeka: > > I am still waiting for the day I could start off using vimclojure on my >> PC. Is vimclojure ready for my environment? An

Re: Eval troubles

2009-09-03 Thread Konrad Hinsen
On 4 Sep 2009, at 07:04, Stuart Sierra wrote: > Or, more simply, Python is an interpreter, Clojure is a compiler. So > Clojure's "eval" actually compiles the form into Java bytecode, then > executes it. I'd say both Python and Clojure are somewhere in between the classical extremes of "interp