N00B Java Question

2009-11-24 Thread Peter Wolf
Hi all, Here is a N00B question, but I can not find the answer by Googling, or reading Stuart's book. So, I assume that others will want to find this FAQ in the future. I am calling legacy code, and I need to set the level on the Java Logger. In Java it would look like this import java.ut

Re: doall, dorun, doseq, for - Debugging as a side effect?

2009-03-03 Thread Peter Wolf
RE: Side Effects What about logging? Without a debugger I use lots of print's to debug my code... and that often produces confusing results as things may not get evaluated in the order I expect. For that matter, now that we have integrated Java debuggers, what does setting a breakpoint real

Re: Mathy operations on non-numerics (was "Adding" strings)

2009-02-26 Thread Peter Wolf
e last "else if" in ops() and will only happen when the args are not some sort of Number. Finally, if it doesn't already, I would expect type hints to make things faster. So, it should not be necessary to explicitly call a fast-math library. My 2 n00by cents... P Phil Hagelber

Re: "Adding" strings

2009-02-26 Thread Peter Wolf
he right thing as with other Java and scripting languages? I think this would be popular with non-LISPers. P Laurent PETIT wrote: > (str "foo" "bah") > > and if you have a collection you can (apply str coll) > > HTH, > > -- > Laurent > > 2009/

"Adding" strings

2009-02-26 Thread Peter Wolf
Hey all, What is the idiomatic way to concatenate strings? Here are some things that I expected to work, but didn't (+ "foo" "bah") (conj "foo" "bah") (into "foo" "bah") For the moment I am doing (.concat "foo" "bah") But it seems wrong Thanks P --~--~-~--~~-

Re: Clojure plugin for IntelliJ IDEA published

2009-02-24 Thread Peter Wolf
(def, defn, defmacro etc.) use Go-to > symbol action. > > I'm going to describe all these hints and features in simple > how-to manual. > Our bugtracker is available at > http://www.jetbrain

Re: IntelliJ Plugin -- Wonderful News!

2009-02-08 Thread Peter Wolf
I must have the wrong version of the dev kit; what's the correct > version to be using? > > Thanks, > > Howard > > > On Fri, Feb 6, 2009 at 7:53 AM, Tom Ayerst wrote: > >> That is excellent news. Now I just to learn enough Clojure to properly >> contri

Clojure Maps and Java Maps

2009-02-06 Thread Peter Wolf
Hello, how do I do this elegantly? I have a Clojure Map = {:foo "foo" :bah 3 ... } and I need to pass it to a Java method that is expecting a Map = { "foo" --> "foo" , "bah" --> 3 ...} How does one convert a Clojure Map to the equivalent Java Map? I bet I could do it in one line if I knew t

IntelliJ Plugin -- Wonderful News!

2009-02-06 Thread Peter Wolf
Check out this email! IntelliJ is going to get a *really* good plugin for Clojure :-D I have gladly turned control of the my plugin over to Ilya, and the code has been moved to the JetBrains SVN. I will remain involved and fix bugs as they are found, but Ilya and his team are adding a real t

Re: What profilers are you using?

2009-02-06 Thread Peter Wolf
Hi Sergio, I have been using JProfiler with the IntelliJ Clojure plugin. The combination seems to work fine, except that JProfiler does not know how to display Clojure source code associated with a function. However, there is enough information displayed that you can do it trivially. Peter

Re: Length of Sequence

2009-01-28 Thread Peter Wolf
and Maps. Rich Hickey wrote: > > On Jan 28, 2:19 pm, Chouser wrote: > >> On Wed, Jan 28, 2009 at 2:15 PM, Peter Wolf wrote: >> >> >>> How do I get the length of a sequence? Is there some generic way to >>> find the number of elements in som

Re: Length of Sequence

2009-01-28 Thread Peter Wolf
Thanks guys! I knew I could 'count' on you ;-) Chouser wrote: > On Wed, Jan 28, 2009 at 2:15 PM, Peter Wolf wrote: > >> How do I get the length of a sequence? Is there some generic way to >> find the number of elements in something that might be

Length of Sequence

2009-01-28 Thread Peter Wolf
Here's a dumb question, but I can't find it in the docs: How do I get the length of a sequence? Is there some generic way to find the number of elements in something that might be list, map, vector or lazy? There must be some sort of built in function, or an idiom Thanks P --~--~-~-

Re: IntelliJ Plugin Pre-Alpha 0.03 Available

2009-01-26 Thread Peter Wolf
27;m too lazy to install IntelliJ yet, but maybe with some appealing > screenshots I could change my mind ;-) > > > Thanks, > > -- > Laurent > > 2009/1/23 Peter Wolf mailto:opus...@gmail.com>> > > > For those who like IntelliJ, a new version of the plu

Re: IntelliJ Plugin Pre-Alpha 0.03 Available

2009-01-23 Thread Peter Wolf
to the authors for their work. > > btw, I installed it directly on my mac, without building it. > > Francesco > > On Jan 23, 6:08 pm, Peter Wolf wrote: > >> For those who like IntelliJ, a new version of the plugin is available. >> This one has numerous fixes

IntelliJ Plugin Pre-Alpha 0.03 Available

2009-01-23 Thread Peter Wolf
For those who like IntelliJ, a new version of the plugin is available. This one has numerous fixes, but is mostly interesting because the Debugger and Profiler work (or at least JProfiler). The Debugger and Profiler currently treat Clojure as compiled Java, and don't know how to go from byte

evalOnlyDefs

2009-01-23 Thread Peter Wolf
Looking for opinions from Clojure internals Wizards... I am thinking about "safe loading" for IDEs (see other thread). IDEs need a way to load and resolve code, without calling script code that might be in the file. I was looking the code called by load-file and load. Here is Compiler.eval(

Re: Basic about setting upp Clojure and editor enviroment

2009-01-23 Thread Peter Wolf
Or try the IntelliJ plugin, if you like that IDE http://code.google.com/p/clojure-intellij-plugin/ It works fine on Windows and Linux. We are currently fixing the Mac. P Matt Clark wrote: > If you're not already an emacs user, I found it can be quite the > learning curve getting into it. So

Re: Calling Clojure from Java (again)

2009-01-22 Thread Peter Wolf
fine the symbol "foo", but not call it. (defn foo [message] (pop-up-window message)) (foo "Hi Mom!") If so, I could do references safely. P Stuart Sierra wrote: > On Jan 22, 6:51 pm, Peter Wolf wrote: > >> However, if there is only one Clo

Re: Calling Clojure from Java (again)

2009-01-22 Thread Peter Wolf
Hi Laurent, My questions and current beliefs are: 1) Does Eclipse use the server for resolving references? 2) Is the server visible to the user, or hidden inside Eclipse? 3) Does the server call load-file? 4) Can the user break the server with bogus code in a file? 5) What happens if a file has

Re: Calling Clojure from Java (again)

2009-01-22 Thread Peter Wolf
Thanks for the lengthy reply Laurent, Replies in-line lpetit wrote: > Peter, > > We asked us the same question some weeks ago, on clojuredev. > > We took the path to follow how eclipse launches a java application > when the user requires it to test it. > So we created a customized "launch config

Re: File, Line Number and Usage Info

2009-01-22 Thread Peter Wolf
"open the last e-mail received by the ml, click on > reply, change the subject, throw the body out and replace it by my > own ?" > > If so, then please consider creating a new e-mail each time you start > a new subject ? > If not so, then your mailer may have a problem

Calling Clojure from Java (again)

2009-01-22 Thread Peter Wolf
This is a rejuvenation of the old "calling Java from Clojure" thread I have been looking at the solutions from Mark / 1) From a Java application, read a text file containing Clojure code and invoke specific functions it defines from Java code. 2) Compile Clojure code to bytecode and use

File, Line Number and Usage Info

2009-01-22 Thread Peter Wolf
Here's a dumb question which has been answered before... but I can't find it in the docs. How does one find out the file and line number upon which a symbol was defined? I want to use it for "go-to-defintion" in the IntelliJ plugin. Also, is there any way to find all the code that is referenc

Re: Common backend project?

2009-01-17 Thread Peter Wolf
used to test tools, and ensure common behavior. These would be useful for all tools written in all languages. My 2 cents P Meikel Brandmeyer wrote: > Hi, > > Am 17.01.2009 um 16:22 schrieb Peter Wolf: > >> I think much of the parser, such as the JFlex lexer is certainly >

Re: How to implement "go to definition" and "find all references"

2009-01-17 Thread Peter Wolf
Excellent! How is the Clojure compiler tested? Is there a set Clojure code that serves as Unit tests? I need something with all the corner cases both for syntax and references. Thanks P Stephen C. Gilardi wrote: > > On Jan 17, 2009, at 8:40 AM, Peter Wolf wrote: > >>

Re: How to implement "go to definition" and "find all references"

2009-01-17 Thread Peter Wolf
ted (and maybe not very usefull as is, because it has not > yet be faced to real-world problem). > > Do you think it could be possible to reuse your parser for the needs > of clojuredev , or is it too tied to the intelliJ framework/ > infrastructure ? > > Thanks in advance, &g

Re: How to implement "go to definition" and "find all references"

2009-01-17 Thread Peter Wolf
Actually, the observation below might be really good news. Does it means that all references are resolved at compile time? Do I ever have to run the code to figure out the context of a reference? Or, does the lexical context give me all the information I need? I have already reimplemented t

Re: How to implement "go to definition" and "find all references"

2009-01-16 Thread Peter Wolf
ee in the REPL below". > > How does Slime handle that ? > > Thanks in advance for your answers, (I'm not an experience emacs/slime > user, so feedback welcome !) > > -- > Laurent > > On 16 jan, 19:31, Allen Rohner wrote: > >> On Jan 16, 9:

How to implement "go to definition" and "find all references"

2009-01-16 Thread Peter Wolf
Hello, and thanks for all the help with the IntelliJ plugin. The next feature I want to implement is "references". That is, one selects a symbol, and then can go to the location where that symbol was defined (e.g. def, defn, let, etc.). One can also get a list of all the locations where that

Pre-Alpha of IntelliJ plugin for Clojure

2009-01-14 Thread Peter Wolf
code was marked as an error. Please report all cases, with an S-Expression to opus...@gmail.com. To install go to Settings/Updates and add the following to Plugin Hosts /http://clojure-intellij-plugin.googlecode.com/svn/trunk/plugin/updatePlugins.xml/ Then hit "Check Now" Enjoy!

Re: when performance matters

2009-01-14 Thread Peter Wolf
reduce just hint at the possibilities of a high- > performance, macro-based math library, and I expect similar macros to > come from people actually doing number crunching with Clojure. > > Rich > > On Jan 13, 2:53 pm, Peter Wolf wrote: > >> Why is Clojure slower than Jav

Re: IntelliJ Plugin

2009-01-14 Thread Peter Wolf
J. Is the IntelliJ one in a usable state, or is it > not ready for some alpha-level testers? > > Cheers, Aria > > On Dec 29 2008, 10:36 am, "Justin Johnson" > wrote: > >> On Sat, Dec 27, 2008 at 8:55 AM, Peter Wolf wrote: >> >>> Hi Justi

Re: when performance matters

2009-01-13 Thread Peter Wolf
Why is Clojure slower than Java? And, can it be fixed? Is it just the dynamic lookups? I also want to use Clojure in my work to implement the inner loops, but I was disappointed by a previous discussion looking at the speed of Clojure. As I recall Clojure seems to be about 1/4 the speed of

Re: IntelliJ Plugin

2008-12-27 Thread Peter Wolf
Hi Justin, This is the right place. Thanks for trying the plugin. It would absolutely be helpful to document use of the plugin. However, I am sure you can tell that it is nowhere near ready. I would like to get a basic set of features going and then recruit you and Randall to test and document

Re: IntelliJ Plugin now on Google Code

2008-12-19 Thread Peter Wolf
Of course, having done that, you could help me fix the bugs ;-) P Randall R Schulz wrote: > Peter, > > Great news! > > On Friday 19 December 2008 05:36, Peter Wolf wrote: > >> For those who are following or helping my efforts (thank you), the >> IntelliJ Clojure

IntelliJ Plugin now on Google Code

2008-12-19 Thread Peter Wolf
For those who are following or helping my efforts (thank you), the IntelliJ Clojure plugin code is now on GoogleCode. Enjoy! http://code.google.com/p/clojure-intellij-plugin/source/browse/#svn/trunk/src/org/clojure/intellij Please note that this code is nowhere near ready for use. Syntax col

Re: Does ANTS.CLJ still work?

2008-12-16 Thread Peter Wolf
5) at clojure.lang.Compiler.analyze(Compiler.java:3686) ... 15 more user=> Chouser wrote: > On Mon, Dec 15, 2008 at 11:54 AM, Peter Wolf wrote: > >> I get the following error when I try ANTS.CLJ. Has something changed? >> > > Recent Clojure from SVN and a recent do

Does ANTS.CLJ still work?

2008-12-15 Thread Peter Wolf
Hello I was just following the directions on Ubuntu setup directions on http://riddell.us/clojure/ I get the following error when I try ANTS.CLJ. Has something changed? Peter (defn setup "places initial food and ants, returns seq of ant agents" [] >>> (sync nil (dotimes [i food-pla

Re: Clojure Code Analysis Tools

2008-12-11 Thread Peter Wolf
in. Peter [EMAIL PROTECTED] wrote: > On Dec 2, 4:52 pm, Peter Wolf <[EMAIL PROTECTED]> wrote: > >> I vote that we take Merlyn's code as a base and put it on SourceForge. >> I'll add my Lexer and Parser and work on formatting, parens matching and >> col

Re: Elegant but very slow

2008-12-07 Thread Peter Wolf
ereas Java will always be a slave to clock-rate. Stephen C. Gilardi wrote: > On Dec 7, 2008, at 10:11 AM, Peter Wolf wrote: > > >> Shouldn't the number of processors on the test machine make a big >> difference to how fast it runs? Whereas, the Java version is only &

Re: Elegant but very slow

2008-12-07 Thread Peter Wolf
d MAP instead of a LOOP do the trick? I would expect that to compile into parallel code. Otherwise, why go through all the pain of learning functional programming (and convincing management)? Randall R Schulz wrote: > On Sunday 07 December 2008 07:11, Peter Wolf wrote: > >> I'm

Re: Elegant but very slow

2008-12-07 Thread Peter Wolf
I'm a n00b, but isn't the point of this language to be *faster* than Java?... at least on a multiprocessor machine. Shouldn't the number of processors on the test machine make a big difference to how fast it runs? Whereas, the Java version is only dependent on the clock rate of the individual

Re: Clojure Code Analysis Tools

2008-12-02 Thread Peter Wolf
I just pulled the code down. While it's true that there is no implementation, Curious Bunny (merlyn) did an excellent job of making a minimal custom language plugin. This is something that is lacking in IntelliJ's own documentation. By making a trivial change to Curious's code I was able to c

Re: Clojure Code Analysis Tools

2008-12-02 Thread Peter Wolf
Thanks, I strongly agree. I just emailed curious.attempt.bunny to join forces. Curious, are you out there? P [EMAIL PROTECTED] wrote: > On Dec 2, 12:54 pm, Peter Wolf <[EMAIL PROTECTED]> wrote: > >> Since the code doesn't exist yet, I'd have to say no.

Re: Clojure Code Analysis Tools

2008-12-02 Thread Peter Wolf
ent the API for references, refactoring, formatting etc. [EMAIL PROTECTED] wrote: > On Dec 1, 4:11 pm, Peter Wolf <[EMAIL PROTECTED]> wrote: > >> Since I plan to introduce Clojure into existing large Java projects, I want >> to use a decent IDE. So I am writing a Clojur

Re: Clojure Code Analysis Tools

2008-12-01 Thread Peter Wolf
nd a Parser, however, that was easy :-) Randall R Schulz wrote: > Hi, Peter, > > On Monday 01 December 2008 08:11, Peter Wolf wrote: > >> ... >> >> Since I plan to introduce Clojure into existing large Java projects, >> I want to use a decent IDE. So I a

Re: Clojure Code Analysis Tools

2008-12-01 Thread Peter Wolf
I am an EMACS user, and I started off by trying SLIME. I liked it. Unfortunately, most of my work is in Java, and because every class has its own file, and Java is so "wordy", EMACS is a terrible Java environment (sorry... Java is a terrible language ;-)) Since I plan to introduce Clojure int

Re: offtopic - where are you come from? (poll)

2008-11-24 Thread Peter Wolf
Boston MA --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more optio

Re: Eclipse Plugin- any plans for this?

2008-11-21 Thread Peter Wolf
I've just begun work on an IntelliJ plugin. However since I am new to both Clojure and writing plugins it won't be ready for a while. Eventually I'll be looking for testers. Peter MikeM wrote: > This came up on the list not long ago, don't know what the status is: > > http://code.google.com/p

Re: Stupid Newbie Question-- Auto Indenting in SLIME -- Fixed

2008-11-16 Thread Peter Wolf
ct/slime/> and Emacs, then getting setup with Clojure is pretty straight-forward." http://bc.tech.coop/blog/081023.html But I didn't realize that meant SLIME was dependent on CL. I used CMUCL and everything works now. Thanks Peter Peter Wolf wrote: > OK, I think I found th

Re: Stupid Newbie Question-- Auto Indenting in SLIME

2008-11-16 Thread Peter Wolf
") (add-to-list 'load-path "/usr/share/slime-2008-11-15/") ; your SLIME directory (setq inferior-lisp-program "/usr/share/clojure/clojure") ; your Lisp system (setq swank-clojure-binary "clojure") (require 'clojure-auto) (require 'swank-clojure)

Stupid Newbie Question-- Auto Indenting in SLIME

2008-11-16 Thread Peter Wolf
Hello, I'm feeling dumb... I set up SLIME/SWANK/Clojure on my Linux system, but indentation isn't working. The doc says that indentation should "just work"... but nothing happens. I tried "indent-region", "indent-sexp" and "slime-update-indentation" What's the trick? Thanks P --~--~-

Re: Nother N00B Question

2008-11-05 Thread Peter Wolf
Thanks, the "hello" example on page 25 is perfect. Matt Revelle wrote: > On Nov 5, 2008, at 3:01 PM, Peter Wolf wrote: > > >> I just browsed Stuart's wonderful book. Lots of great stuff, which I >> will enjoy working though >> >> However, I

Re: Nother N00B Question

2008-11-05 Thread Peter Wolf
Duh... I should read more carefully. I just found the section on loop/recur. Still, it might be good to expand that section, and highlight it. I suspect that every N00B will wonder how to implement a console app. And every LISPer will try to implement the REPL in Clojure. P Peter Wolf

Nother N00B Question

2008-11-05 Thread Peter Wolf
I just browsed Stuart's wonderful book. Lots of great stuff, which I will enjoy working though However, I didn't find a section that talks about how to do non-functional stuff in Clojure. Might be a good section to add for N00Bs For example, I'm implementing my Mastermind game. I want to pr

Re: Programming Clojure beta book now available

2008-11-05 Thread Peter Wolf
Just bought mine :-) Matt Revelle wrote: > On Nov 5, 2008, at 12:56 PM, bc wrote: > > >> Since nobody else has mentioned it, I thought people on this group >> would be interested to know that Stuart Halloway's new Clojure book >> "Programming Clojure" is now available. I've also announced it

Re: N00B Question -- Trying to understand Interfaces

2008-11-05 Thread Peter Wolf
Ah thank you, now I am un-stuck. ISeq really only exists for Java interop right? You don't really implement new sequence data types, rather you combine things like ITERATE and MAPCAT with your own functions to define your own sequences. Is it correct to say that sequences are not really a typ

N00B Question -- Trying to understand Interfaces

2008-11-05 Thread Peter Wolf
Hello all, I am just about to write my first Clojure code to teach myself the language. I thought I might try Bulls&Cows aka Mastermind. This is the game where one player hides a pattern of colors, the other guesses a pattern, and the first says something like "1 correct color in the right pl

Re: IntelliJ Plugin

2008-10-29 Thread Peter Wolf
Actually, I realize now that I am going to use EMACS. The thing that makes IntelliJ really great is the automatic refactoring of Java code, and the management of a g-zillion Java files. It really has no big advantages for Clojure. For hacking LISP, EMACS is still the king! Tom Emerson wrote:

Using a Java Debugger with Clojure

2008-10-28 Thread Peter Wolf
Hello all, I am new to Clojure, but not Java or LISP (I used to work at LMI). I am considering a project written in a mixture of Clojure, Java and Groovy. Clojure for the concurrent inner loop. Groovy/Grails for the Web UI. And lots of Java reused from other projects. How would I debug somet