Re: Filter Causing StackOverflowError?

2009-09-03 Thread Krukow
On Sep 2, 7:02 pm, tmountain tinymount...@gmail.com wrote: (defn generate-chain [source]   (loop [the-list (map #(list (first (split-at 2 %)) (last %))                       (partition 3 1 (.split (.replace source \n ) )))          res (hash-map)]     (if (empty? the-list)       res  

Re: A better flatten

2009-09-03 Thread Meikel Brandmeyer
On Sep 3, 1:13 am, Sudish Joseph sud...@gmail.com wrote: (defn flatten-2 [lst]   (lazy-seq     (if-let [x (first lst)]       (let [xs (rest lst)]         (if (seq? x)           (concat (flatten-2 x) (flatten-2 xs))           (cons x (flatten-2 xs))) This version is broken: user=

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

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 Brezuleanumbr...@gmail.com wrote: Hello, I'm a Clojure newbie (many thanks to Rich Hickey and

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 of

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 konrad.hin...@fastmail.net 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)

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 jharrop...@gmail.com wrote: On

Re: Eval troubles

2009-09-03 Thread Jarkko Oranen
On Sep 3, 9:24 am, Miron Brezuleanu mbr...@gmail.com 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

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) (over), (brown fox) (jumps),

Re: Lazy binding

2009-09-03 Thread Jarkko Oranen
On Sep 3, 3:42 pm, ngocdaothanh ngocdaoth...@gmail.com 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

Re: Backporting clojure.contrib.logging

2009-09-03 Thread Stuart Sierra
yes. -SS On Sep 2, 5:27 pm, Phil Hagelberg p...@hagelb.org 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

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 ngocdaoth...@gmail.com 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

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

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

Re: Eval troubles

2009-09-03 Thread Miron Brezuleanu
Hi, On Thu, Sep 3, 2009 at 4:26 PM, Konrad Hinsenkonrad.hin...@fastmail.net 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.

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

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

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

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

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

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

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

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!

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

Re: Importing All from java package?

2009-09-03 Thread Stuart Sierra
On Sep 3, 6:31 pm, Gorsal s...@tewebs.com 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 bokeh.sen...@gmail.com wrote: I can't get JSwat to display and break on lines in my Clojure code. Does anybody knows how this

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 the.stuart.sie...@gmail.comwrote: Looking forward to adding this to my (just started) blog series on

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

2009-09-03 Thread Stuart Sierra
On Sep 3, 9:15 pm, ngocdaothanh ngocdaoth...@gmail.com 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

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

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 s...@tewebs.com

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

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

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

Re: Eval troubles

2009-09-03 Thread Stuart Sierra
On Sep 3, 9:26 am, Konrad Hinsen konrad.hin...@fastmail.net 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

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

Re: Eval troubles

2009-09-03 Thread Miron Brezuleanu
Hello, On Fri, Sep 4, 2009 at 4:01 AM, James Sofrajames.so...@gmail.com 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

Re: Eval troubles

2009-09-03 Thread Miron Brezuleanu
Hello, On Fri, Sep 4, 2009 at 8:04 AM, Stuart Sierrathe.stuart.sie...@gmail.com wrote: On Sep 3, 9:26 am, Konrad Hinsen konrad.hin...@fastmail.net wrote: I don't think so. Python and Clojure are quite different languages. Python is much more dynamic, with variable lookup happening at