Getting Started with Gen-Class

2008-12-15 Thread CuppoJava
Hi, I just ran into a need for using gen-class, and need some help getting started. I upgraded to the latest Clojure version using svn co https://clojure.svn.sourceforge.net/svnroot/clojure clojure and I run the REPL using java -jar clojure.jar However when I type: user=> (compile) I get the f

Re: Getting Started with Gen-Class

2008-12-15 Thread CuppoJava
Tried "ant clean", it's still giving me the same error. Unable to resolve symbol: compile in this context. Is there a way to check my Clojure version from the REPL? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "C

Re: Getting Started with Gen-Class

2008-12-15 Thread CuppoJava
I checked with SVN. It says I checked out revision number 1160? --~--~-~--~~~---~--~~ 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 To unsubscribe from this g

Re: Getting Started with Gen-Class

2008-12-15 Thread CuppoJava
I tried "ant clean" followed by "ant" which built a clojure.jar which is exactly 488,904 bytes. And i get the message "Unable to resolve symbol: compile in this context" when i type "(compile)" at the REPL. Thanks very much for your help -Patrick --~--~-~--~~~---~--

Re: Getting Started with Gen-Class

2008-12-15 Thread CuppoJava
I'm running the REPL by typing "java -jar clojure.jar" in the directory "C:\clojure" which contains the "clojure.jar" file. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, sen

Re: Getting Started with Gen-Class

2008-12-15 Thread CuppoJava
SOLVED: Hi everyone, thanks for your help. I figured out what I was doing wrong. In my clojure directory there is a subfolder clojure/trunk I was supposed to run "ant" inside "clojure/trunk" and not "clojure". The correct generated "clojure.jar" is 1389436 bytes --~--~-~--~~---

Help Needed Getting Clojure-Mode working with XEmacs

2008-12-19 Thread CuppoJava
Hi everyone, I'm trying to get clojure-mode working under XEmacs and am having troubles. I managed to get it working under GNU Emacs with the following .emacs file: (setq inferior-lisp-program "java -cp C:/clojure/trunk/clojure.jar clojure.lang.Repl") (add-to-list 'load-path "C:/program files/xe

Re: Help Needed Getting Clojure-Mode working with XEmacs

2008-12-20 Thread CuppoJava
Syntax highlighting doesn't seem to work when I open .clj files. And I cannot open the REPL using C-c C-z. I'm not sure if there's an error log that I can show you. I don't know how to access it. Thanks for your help --~--~-~--~~~---~--~~ You received this message

Simple question using Agents.

2008-12-23 Thread CuppoJava
Hi, I'm learning how to use Agents and I need some help getting started with the following code. Some tips and hints would be greatly appreciated. I want to start a thread that counts upward, printing a number once every second. Here's what I have so far: The agent state will be a simple integer

Re: Simple question using Agents.

2008-12-23 Thread CuppoJava
Ahh I see. Thank you for explaining it. I'm a little confused about the (send-off *agent* update) line though. So as I understand it, *agent* is identical to my-agent, while running inside update. Is that correct? And is there any guarantee that the second send-off (send-off *agent* update) won

Re: Simple question using Agents.

2008-12-23 Thread CuppoJava
Thank you for the explanation. It's much clearer now. As an aside: do you know how to import all classes of a package in Clojure? Again, Thanks for your help -Patrick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Simple question using Agents.

2008-12-23 Thread CuppoJava
Yes that's precisely what I'm looking for. When I was still writing Java code, I had the habit of importing complete packages so I didn't have to waste time individually importing the classes I needed. When it's close to release time, I would use an IDE feature to strip down the imports to the nec

Re: doseq and dotimes are broken in clojure coming with enclojure

2008-12-23 Thread CuppoJava
The clojure.jar that comes with Enclojure is extremely out-dated. Until the next version of Enclojure comes out, here's what you can do: Download the official clojure.jar from the Clojure website. (From the website, Not SVN) And replace all of the clojure.jar packaged with Enclojure with your new

Accessing "this" in gen-class constructor

2008-12-26 Thread CuppoJava
Hi, I've hit a stumbling block using Clojure's gen-class facility for constructors. Is there anyway to access "this" inside Clojure's constructor/init function? ie. The following type of code is quite common in Java. How would you do the same in Clojure? public class MyDerivedClass extends Super

Re: How To Make Code More Functional?

2008-12-26 Thread CuppoJava
I'm just getting started myself, and I found Stuart Halloway's blog of great use. Perhaps it'll be of some help to you also. -Patrick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Re: Accessing "this" in gen-class constructor

2008-12-26 Thread CuppoJava
I found that I can use another factory method to workaround this limitation. I can first instantialize the object to get a reference, and then initialize all it's settings. This works only if I don't expect this class to be derived from. Any subclass would expect the class to be fully initialized

Re: Accessing "this" in gen-class constructor

2008-12-27 Thread CuppoJava
Here's my stab at it. I'm having problems with the setDescription() line. Thanks for your help -Patrick (ns test) (gen-class :name test.MyDerivedClass :extends [SuperClass] :init init :constructors {[] [String]}) (defn -init [] ;The following line doesn't work. ;I need to call setDescr

Re: Accessing "this" in gen-class constructor

2008-12-27 Thread CuppoJava
I believe the first parameter must be "this", only in the case of methods . The init function doesn't take a "this" parameter. Here's an example of my problem, MyDerivedClass is a subclass of Thread. This doesn't work, because "this" actually refers to the first argument passed to the constructo

Re: Accessing "this" in gen-class constructor

2008-12-29 Thread CuppoJava
Thanks for the reply Chouser, Yeah, I figured it would be like that. No "this" value actually exists until after the init function is called. The reason I'm asking about this is that it's quite standard practice to set up some parameters inside the constructor of a class. ie. A use-case like th

Re: Accessing "this" in gen-class constructor

2008-12-30 Thread CuppoJava
Ah sorry I missed that. However, you accomplished this only because there exists a constructor in Thread that takes a String name argument. As a general case, it's not usually that convenient... ie. public class MyThread extends Thread{ public MyThread(){ setName("This is my thread");

Re: Accessing "this" in gen-class constructor

2008-12-30 Thread CuppoJava
Haha yeah... it's a rather poor API. I'm making do with a temporary post-constructor hook that I manually call after instantiating the object right now. But it's tedious and error-prone. Thanks for the help Chouser --~--~-~--~~~---~--~~ You received this message b

Accessing static protected fields?

2008-12-30 Thread CuppoJava
Hi, Is there anyway to access a static protected field from within Clojure? I've tried using :exposes in gen-class, however that gives me the following error: java.lang.IncompatibleClassChangeError: Expected non-static field graphics.JMEGame.ALWAYS_SHOW_PROPS_DIALOG Thanks for your replies -P

Re: Accessing static protected fields?

2008-12-30 Thread CuppoJava
Ah okay. I'll dig through the clojure source today and see if I'm able to make a patch myself. Thanks for the reply Rich --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send em

REPL Subtleties. Emacs inferior-mode.

2008-12-30 Thread CuppoJava
Hi, I'm just noticing some subtle threading problems when running a Jme application from the REPL within inferior-lisp mode Emacs. For instance this works: (. jmetest.renderer.TestArrow main nil) But this doesn't: (attempting to execute from a separate thread) (def thread (proxy [Thread] []

Re: REPL Subtleties. Emacs inferior-mode.

2008-12-30 Thread CuppoJava
Thanks Matt, I was actually hoping for you to reply. I found one of your earlier posts mentioning that you got JME working properly interactively with the REPL. Unfortunately, your solution didn't seem to work. I seem to be having the same problem as the guy in this post: http://groups.google.com

Re: REPL Subtleties. Emacs inferior-mode.

2008-12-30 Thread CuppoJava
Haha, I'm now seriously considering getting a Mac... Anyway thanks for your help. I think I'll try installing Slime and Swank and see if that helps at all. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" gr

Re: Stumped - Java hangs when using Swing in Slime

2008-12-30 Thread CuppoJava
I want to add that it's not confined to just Swing applications. I have the exact same problem using JME on an Emacs *inferior-lisp* REPL. The program hangs, until I enter subsequent commands on the REPL. The SwingUtilities trick, and updating to the latest Java runtime doesn't help. I'm going

Re: Stumped - Java hangs when using Swing in Slime

2008-12-30 Thread CuppoJava
I would like to add that nope... installing SLIME didn't seem to help. I'm on Clojure rev. 1160, and the latest SLIME and Swank sources as of December 30 2008. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure

Re: Stumped - Java hangs when using Swing in Slime

2008-12-31 Thread CuppoJava
After some more tinkering, I think the problem lies somewhere in the way Emacs handles IO from the buffers. 1) The System command prompt works perfectly. 2) Inferior-Lisp mode hangs 3) Slime hangs 4) Running a windows shell from within Emacs, and running Java from within the shell also hangs. Sy

Re: Stumped - Java hangs when using Swing in Slime

2008-12-31 Thread CuppoJava
And Xemacs has the same problem... so it might be a problem with Windows then =( --~--~-~--~~~---~--~~ 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 To un

(Classname/staticField) is not the same as Classname/staticField

2009-01-01 Thread CuppoJava
Hi, For some reason the Classname/staticField macro is not working properly for me. graphics=> (AudioSystem/getSystem) # graphics=> AudioSystem/getSystem java.lang.Exception: No such namespace: AudioSystem (NO_SOURCE_FILE:0) I'll try and demonstrate the problem using one of the standard librari

Re: (Classname/staticField) is not the same as Classname/staticField

2009-01-01 Thread CuppoJava
Ah I see. Thanks for clearing that up for me. I didn't realize that functions and fields are resolved differently by that macro. Randall, that function is actually not part of the JDK, it's part of JME, a third-party graphics package. But thank you for helping. -Patrick --~--~-~--~~

Method overloading anomaly. (specifically ArrayList/remove)

2009-01-09 Thread CuppoJava
I just noticed that Clojure is reacting strangely to overloaded methods which take a primitive argument. I'm trying to use ArrayList#remove which is overloaded to both take an integer and an Object argument. Clojure behaves differently in a let binding compared to a def. Correct Behavior: (let [

Re: Method overloading anomaly. (specifically ArrayList/remove)

2009-01-09 Thread CuppoJava
After more experimenting, it seems like a potentially difficult bug to resolve. Clojure attempts to treat all numbers as objects, but in this case, the choice of whether a number is an object or a primitive affects which method is called. (let [temp [(java.util.ArrayList. ["foo"])]] (.remove (f

Re: Method overloading anomaly. (specifically ArrayList/remove)

2009-01-09 Thread CuppoJava
Thanks Chouser, That workaround works nicely for now. I think though that this problem can potentially be the source of many hard-to-find bugs though. ie.. like in my second example, the vector of ArrayLists. --~--~-~--~~~---~--~~ You received this message because y

Re: java static method call anomaly

2009-01-10 Thread CuppoJava
Hi gammelgedden, I've also just recently figured out the reasoning behind Clojure's (Class/staticMethod) notation. (.newInstance TransformerFactory) This notation always expects the second argument to be an object of some sort. This means that TransformerFactory is actually being resolved as a C

Re: Method overloading anomaly. (specifically ArrayList/remove)

2009-01-10 Thread CuppoJava
After a bit more experimenting, I found the following workaround to be suitable for the time-being in case anyone else is having similar troubles. (defn arraylist_remove [#^ArrayList list index] (.remove list (int index))) --~--~-~--~~~---~--~~ You received this

Simple Data Structure Question

2009-01-10 Thread CuppoJava
Hello, I'm stumped as to how I create a mutually referential data structure in Clojure. My compsci is fuzzy. I don't know if what I'm trying to do is possible. Any insight would be helpful. I have a function that creates a Person, given his name and a list of friends. (defn new_person [name & fr

Re: Simple Data Structure Question

2009-01-10 Thread CuppoJava
Thank you for the replies. My actual problem is a bit more convoluted, so I can't separate the issue like in Mark's solution very easily. Stuart's solution is more general, and I think I can apply that in a straight-forward way. Thanks. ps: I'm doing a bit of reading about mutually-recursive data

Setting a value inside a map of map of maps...

2009-01-11 Thread CuppoJava
Hi, I'm just wondering if there's a clever way of creating a new map from an existing map of map of maps.. with a key deep inside altered. ie. given this map: {:a {:b {:c {:d 3 i want to create a new map, with the value at :d increased by 5. I wrote a macro to do this, but it's quite ugly.

Re: Setting a value inside a map of map of maps...

2009-01-11 Thread CuppoJava
That's exactly what I was looking for. Thank you Brian. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, se

Designing a Performance Vector Math library in Clojure.

2009-01-12 Thread CuppoJava
Hi, I'm still getting used to the primitive support in Clojure, and I want to confirm my understanding. As far as I know, primitive support is only supported in local let bindings, right? So in designing a vector math library, To translate from Java, one would write a class with primitive field

Re: Designing a Performance Vector Math library in Clojure.

2009-01-12 Thread CuppoJava
Do you know Java? It'll be easier to explain if you do. In Java, everything is an Object. Object's are treated as references to a specific memory location which holds the actual data. So when you pass an Object to a method, you're only passing the method the memory location of that Object. For p

Re: Designing a Performance Vector Math library in Clojure.

2009-01-13 Thread CuppoJava
Do struct-maps also have boxing and unboxing overhead? Or does the JVM optimize that away? --~--~-~--~~~---~--~~ 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

Re: Macros in interaction with Functions

2009-01-16 Thread CuppoJava
I'm also very interested in this topic. The only reason to write "and" as a macro is for performance reasons. It's much more convenient, programming-wise, if and is a function. Is there anyway to write a macro/function that acts as a function when necessary (so it can be passed as an argument),

Automatic upcasting from int to double.

2009-01-19 Thread CuppoJava
Just wondering if this behavior is by design: (Math/min 0 0.2) java.lang.IllegalArgumentException: No matching method found: min (NO_SOURCE_FILE:0) (Math/min 0.0 0.2) 0.0 Coming from Java, it just stuck out to me, since Java has automatic upcasting. Thanks -Patrick --~--~-~--~~--

Loading two namespaces that :use each other.

2009-01-28 Thread CuppoJava
Hi, I'm unused to managing file dependencies myself, and I'm lost as to how to load two namespaces that reference each other. I'm treating the (use) command as analagous to java's import command. But I've run into problems trying to load this namespace: Do I have to resort to manually separating

Re: Loading two namespaces that :use each other.

2009-01-30 Thread CuppoJava
Mmm, I could create a third namespace that contained the common functionality. But it is an artificial separation. If a user read through the source code, he would think "why is this code separated into two files, when it's dealing with the same thing?" Anyway, here's my use-case: I wrote a sprit

Re: rules for writing macros

2009-02-04 Thread CuppoJava
Personally I find that the clearest way to think about macros, is to treat them like a *very* advanced search-and-replace feature. Just keep in mind that macros expand into code, and check to make sure that your generated code is indeed valid code. --~--~-~--~~~---~--~-

What type of arguments are passed to a macro exactly?

2009-02-06 Thread CuppoJava
Hi, I'm trying to write a macro that outputs a symbol without attempting to resolve it and would appreciate some pointers. eg. I wrote a function that accepts a symbol as an argument (defn print_symbol [a] (println a)) which can be called like this: (print_symbol 'mysymbol) But I want to writ

Re: What type of arguments are passed to a macro exactly?

2009-02-06 Thread CuppoJava
Ah thank you that works perfectly! I actually have a reading list i'm about to set out upon, and Paul Graham's OnLisp is on it. I'm just wondering from your perspective which book do you think I should start on? For someone with many years of experience in Java, but none in Lisp. HDTP OnLisp AN

Re: What type of arguments are passed to a macro exactly?

2009-02-06 Thread CuppoJava
That sounds good, I do plan on purchasing Stuart's book as soon as it reaches an official version. I don't like reading on a computer. And Haskell has always been one of my fascinations. If it had better connectivity to everything else and performance, I would have been very happy to learn that a

Creating a new thread-local binding when the thread already exists.

2009-02-11 Thread CuppoJava
Hi, I just wrote a library that creates an un-initialized global variable, and requires the user to create his own thread-local binding in order to run it. eg. (def *my_environment*) ... and the user would use it like so: (binding [*my_environment* (new_environment)] (start_engine_thread)) An

Re: Fully lazy sequences are coming - feedback wanted!

2009-02-15 Thread CuppoJava
I'm also in support of the optimal names. Clojure is not too widely used in production code yet, and it would be a shame to start compromising design decisions for backwards compatibility already. This is actually one of my (and many other people's) favorite parts about Clojure, the beauty of Lis

Re: Fully lazy sequences are coming - feedback wanted!

2009-02-15 Thread CuppoJava
One thing I did find confusing though was in regards to the doc. Is there a way to more clearly differentiate between a seq and a sequence? Up until now, I've always thought of "seq" as just being shorthand for "sequence" which isn't the case apparently. --~--~-~--~~~--

Does this debugger feature exist?

2009-02-16 Thread CuppoJava
Hi, I've just recently attached JSwat to Clojure and while it provides the functionality that I'm used to back when I was still writing Java code, it's not as streamlined to Clojure as I would like. I'm wondering if anything like this exists yet: A simple breakpoint and stepper, which halts the p

Re: Does this debugger feature exist?

2009-02-17 Thread CuppoJava
cion > is that they're not implemented in swank-clojure yet -- although I'll > admit I haven't tried too hard. > > -Jason > > On Feb 16, 11:38 pm, CuppoJava wrote: > > > Hi, > > I've just recently attached JSwat to Clojure and while it provides the

Idiomatic Way to Write the Following:

2009-02-17 Thread CuppoJava
Hi, I'm wondering if there's a terser more idiomatic way to write the following. I want to get a new vector with the specified indexes removed. I found myself doing this often enough to warrant writing my own function for this but I would be much happier if there's some terse way of expressing thi

Re: Idiomatic Way to Write the Following:

2009-02-17 Thread CuppoJava
Mmm, subvec doesn't quite seem to do the same thing. I want a function that removes certain indexes of a vector: eg. (remove_at [1 2 3 4 5 6] 0 3) => [2 3 5 6] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure

Performance of (fn [] ...)?

2009-02-17 Thread CuppoJava
Hi, I've noticed that I'm creating a lot of maps of functions, and I'm wondering if there's a performance penalty for this. ie. (defn create_fn [] (fn [] (println "hi"))) ((create_fn)) <--- Does this "create" a new function every-time it's called? Or is the function code cached somewhere? Ho

Re: Performance of (fn [] ...)?

2009-02-18 Thread CuppoJava
Thanks for the replies. I have no qualms about creating functions now. =) On Feb 18, 3:15 am, Michael Wood wrote: > On Wed, Feb 18, 2009 at 8:50 AM, David Nolen wrote: > > new MBP 2.53ghz > > > (defn create-fn [] > >   (fn [] (println "hi"))) > > > (time (dotimes [x 4000] > >     (create-fn

Re: Clojure plugin for IntelliJ IDEA published

2009-02-25 Thread CuppoJava
Hi Ilya, I also just started using the plugin and it's very good. Thank you for this great plugin. I have a few questions about how to use it though: How to I start a REPL without loading a script? Just a blank slate REPL? Is there a shortcut for Sending current sexp, or selected text to REPL? M

Re: Clojure plugin for IntelliJ IDEA published

2009-02-26 Thread CuppoJava
Hello Ilya, Thanks for the workaround. I'm glad to hear you're working on a "surround with" feature. Some other parenthesis commands that I most commonly use is: 1) Delete next Sexp. 2) Splice Sexp. (Remove the parenthesis around the current sexp). 3) Move cursor to next/previous sexp. Jus

Please help me get rid of my mutable code.

2009-02-26 Thread CuppoJava
Hi, After having used Clojure for a few months now, I'm still having lots of trouble separating my mutable code from my immutable code. My use- case is pretty typical I think, so I'm wondering what sort of structure everyone else is using. Here's my current structure. I have an engine that manag

Re: Please help me get rid of my mutable code.

2009-02-27 Thread CuppoJava
Thanks very much Itay, I'm reading through your post very carefully. I sounds like it's the answer to all my problems. -Patrick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group,

Re: The Application Context Pattern

2009-02-28 Thread CuppoJava
Hi Itay, I'm a little confused about one aspect of the context pattern. If I understand this write, a listener is a function that takes an old context, and returns a new context, BUT it also calls the appropriate GUI functions (setText, setSize) to ensure that the gui state is consistent with the

Re: Debugging Clojure with IntelliJ IDEA

2009-02-28 Thread CuppoJava
Wow it's incredible how fast your progressing on the plugin. It's already a joy to use. Thank you very much. Is there a way to automatically indent when I press Enter? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Debugging Clojure with IntelliJ IDEA

2009-02-28 Thread CuppoJava
Oh I'm sorry, I was still accidentally running the previous version. Indentation works perfectly. Thank you very much for this plugin. Debugging support is so invaluable to me. May I ask how long you think the Surround-With feature will take? -Patrick PS: I found your profile on the IntelliJ t

IntelliJ Clojure Plugin - Minor Indentation Issues.

2009-03-01 Thread CuppoJava
After using La Clojure a bit more, I noticed a few minor issues with the indentation system. Inside a let form binding, the next line should be indented to one character past the opening bracket. eg. should be like: (let [i "hi" j "hi"]) where j lines up with i. current behavior: (let [i

Re: IntelliJ Clojure Plugin - Minor Indentation Issues.

2009-03-01 Thread CuppoJava
Ticket submitted. Thanks a lot -Patrick --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to

Re: Workflow poll?

2009-03-09 Thread CuppoJava
The lack of a debugger seriously hindered my development process in the beginning. You should look into the IntelliJ plugin. It's very well done, and debugging works flawlessly out of the box. It's sped up my productivity by a factor of three at the very least. I have given Emacs+Slime a fair cha

Re: Static type guy trying to convert

2009-03-10 Thread CuppoJava
I just jumped on Clojure five months ago, and I was a little lost without types at first also. Then I've come to realize that types is not as essential to bug-less software as I previously thought it was. For the following reasons: 1) There's less "types" to begin with. I was a Java programmer, a

Re: Debugging support for clojure?

2009-03-10 Thread CuppoJava
The IntelliJ plugin supports debugging. And using JSwat is also possible, but a little less streamlined. -Patrick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email t

Re: Debugging support for clojure?

2009-03-10 Thread CuppoJava
Have you updated to the latest version? If it's setup properly, you should be able to set breakpoints by clicking on the grey column on the left side of your code. Also, not every line can be breakpointed. Try breakpointing some different lines if you're having problems there. -Patrick --~--~--

Re: filter1 interesting?

2009-03-10 Thread CuppoJava
That's what I was going to say. (some pred col) is what I use so far. --~--~-~--~~~---~--~~ 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 To unsubscribe from

Re: design patterns for event driven applications

2009-03-11 Thread CuppoJava
Hi Anatoly, Unfortunately I don't know of a nice way of expressing an event-driven architecture in Clojure, but I'm very interested in what you said about accomplishing it in Haskell. Would you mind explaining that in some more detail? Perhaps if I understood it, I can even help come up with a Cl

Re: Clojure plugin for IntelliJ IDEA published

2009-03-12 Thread CuppoJava
Hi Ilya, I'm just wondering if it's possible for you to release a quick version update with the latest changes incorporated. I'm interested in the fixes to the namespace-qualified keywords, and the keyword indentation rules specifically. Thanks a lot -Patrick --~--~-~--~~---

Re: Clojure plugin for IntelliJ IDEA published

2009-03-12 Thread CuppoJava
Ah thank you for those instructions. That's very helpful. -Patrick --~--~-~--~~~---~--~~ 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 To unsubscribe from t

Re: Question about IntelliJ Plugin

2009-03-14 Thread CuppoJava
Hi Mark, The classpaths for the IntelliJ plugin are not quite setup properly. This is how I'm working around this. Clojure requires the folder that contains the clojure source code to be in the classpath. I did this in IntelliJ, by attaching a new library to the current project which points to th

Re: Which Java book(s) to order

2009-03-16 Thread CuppoJava
Everything I've learned about Java, I got out of "Beginning Java 2" by Ivor Horton. It covers the base Java language in the first ten chapters, and the rest are dealing with the libraries. I think it pretty much sums up the entire Java platform, as well as a clear perspective on the "Java way" o

What's a convenient way of calling super.method()?

2009-03-21 Thread CuppoJava
Hi, I'm making some heavy use of multi-methods and proxies in my code, and I'm wondering if there's a convenient way of calling "superclass" methods, both for multi-methods and for proxies. For multi-methods, I'm currently doing: (mymethod (assoc object :tag :super-class)) which is a little clum

Re: March 20th 2009 Rich Hickey Appreciation Day!

2009-03-21 Thread CuppoJava
Just a few months ago I had never heard of LISP, and already Clojure is so simple and elegant that I'm more productive now than I ever was in Java. Rich is a shining example of keeping practicality, and community in mind, when designing a new language. Thanks a lot Rich -Patrick --~--~

Re: What's a convenient way of calling super.method()?

2009-03-22 Thread CuppoJava
Thanks for the responses: I read into proxy-super, and it fulfills my needs. But I'm worried about my current approach for multi-methods now: As Mark put it: "Not only is it clumsy, but if mymethod returns a fresh object that is based off of this object in some way (e.g., a non-destructive "sett

Re: What's a convenient way of calling super.method()?

2009-03-24 Thread CuppoJava
*bump* Just letting people know that this is still an important and unresolved issue for me. Calling super multi-methods? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send

Re: What's a convenient way of calling super.method()?

2009-03-29 Thread CuppoJava
Thanks a lot for that David, It works perfectly for me. Are there any circumstances where it doesn't work? I haven't run into any yet, but if there are, I'll design my program around it. -Patrick --~--~-~--~~~---~--~~ You received this message because you are sub

Re: Please suggest a way to learn just enough Java for Clojure

2009-03-31 Thread CuppoJava
+1 to Stuart's answer. Clojure is very tightly integrated with Java. And knowing Java well helps a great deal. Personally I like learning from a more formal, comprehensive, book rather than from spread-out individual tutorials. It gives you the advantage of learning the workflow, and approaches i

Re: speed question

2009-04-01 Thread CuppoJava
>From a quick glance, I think the lack of type hints is what's slowing down your Clojure code. You can set the global variable *warn-on-reflection* to true, to get a sense of where to add your type hints. -Patrick --~--~-~--~~~---~--~~ You received this message be

Re: New release of the enclojure plugin is up.

2009-04-07 Thread CuppoJava
I'm just wondering if anyone who's tried this and the IntelliJ plugin can comment on how they compare. I'm wondering if Enclojure has some basic s-exp functions, like Surround-With-(). --~--~-~--~~~---~--~~ You received this message because you are subscribed to th

Re: New release of the enclojure plugin is up.

2009-04-08 Thread CuppoJava
Thanks for that very informative comparison. I'll give it a try immediately. -Patrick --~--~-~--~~~---~--~~ 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 To

Re: Programming Clojure Beta 9 Is Out

2009-04-09 Thread CuppoJava
Hi Stuart, Thanks very much for writing this book. Do you think the release of the completed book is pretty close? I'm very excited about it. -Patrick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group.

Has anyone on this group ever tried Forth?

2009-04-10 Thread CuppoJava
Hi everyone, I was browsing through webpages and the language Forth caught my eye. Reading through it's supposed advantages it sounded very interesting, and I was wondering if anyone here has any experience with it, and can comment. I'm asking on the Clojure forum instead of the Forth forum becau

Re: Has anyone on this group ever tried Forth?

2009-04-10 Thread CuppoJava
Factor sounds very interesting. But I'm concerned about Slava's decision to run it off his own VM and write his own set of standard libraries. Have you guys ever run into any problems with the lack of libraries? -Patrick --~--~-~--~~~---~--~~ You received this messa

Re: Has anyone on this group ever tried Forth?

2009-04-15 Thread CuppoJava
Thanks for all your replies. I was most interested in whether stack languages provided any easier abstraction capabilities beyond that of lisp/clojure. I read about the Factor implementation, and about how continuations, coroutines, and generators were almost trivial to implement and only required

Help writing a lazy version of this Choose function.

2009-04-18 Thread CuppoJava
Hi, I just wrote a very small combinatorics utility for myself. Choose. It is given a vector of elements, followed by a number that indicates how many elements to "choose" out of the vector. It returns all possible combinations of choosing elements out of while retaining the correct order. I hi

Re: Help writing a lazy version of this Choose function.

2009-04-18 Thread CuppoJava
Wow, that works great. Thanks a lot for your help Laurent. Can you think of any reason why mapcat isn't lazy by default though? I'm wondering if this is by design, or simply because we haven't had the time to update all the library functions to be fully lazy yet. -Patrick --~--~-~--~--

Re: Why does this not work?

2009-05-01 Thread CuppoJava
#(%1 %2) is equivalent to writing (fn [a b] (a b)) The #() macro is really designed just for single line functions. You can work around this using do. #(do %1 %2) will do what you want. -Patrick --~--~-~--~~~---~--~~ You received this message because you are su

Can "for" be enhanced to not have to take a binding?

2009-05-07 Thread CuppoJava
I'm trying to accomplish the following: Create a lazy sequence of calls to f() while pred() is true. And an elegant way to do this seems to be: (for [:while (pred)] (f)) which doesn't work because (for) requires a binding. This can be worked around with: (for [i (constantly 0) :while (pred)] (f

Re: Can "for" be enhanced to not have to take a binding?

2009-05-07 Thread CuppoJava
Yeah (pred) is not supposed to depend on any items inside f. This is why (take-while pred (repeatedly f))) won't work in this situation. (take-while) will always take an element out of f, so that it can be tested using (pred). I don't want any elements of (f) to be looked at if (pred) is false.

Re: Can "for" be enhanced to not have to take a binding?

2009-05-07 Thread CuppoJava
Thanks Meikel. That certainly works. But don't you find: (for [:while (Mouse/hasEvent)] (Mouse/getEvent)) much shorter and easier to understand? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To po

Re: Can "for" be enhanced to not have to take a binding?

2009-05-07 Thread CuppoJava
Thanks for your replies. I've always thought of "for" as a generator. Basically just a loop that produces a lazy collection. So it actually seems very natural to me. But anyway, I think I shall just write my own generator function using lazy-seq and be done with it then. Again, thanks for offer

  1   2   3   4   >