In eclipse, write List(1,2,3).zipWithIndex (or, well, something that's legal java. Let's say Collections.reverse(Arrays.asList(1,2,3))), select the entire line, and hit the keyboard shortcut for 'display'. However, I don't think your example is a valid use case of REPL. In that it skips right past the 'L' part of that. REPL is all about loading in some code, running bits and pieces of it, tweaking the system 'live' so to speak. It's not just a single statement evaluation machine. Heck, I have a script called 'quickJava' that fires up an editor, then hangs the contents of what I wrote in a java file template that includes some utility methods (sysout) as well as a wash of import statements, as well as a class declaration and a main method. This way I can test a few things quickly without firing up eclipse. It's no worse than the scala command line REPL if all you need to do is run single commands.
Once you get to the concept of playing around with existing code, using the REPL to inspect things, I'll take eclipse/netbeans debugger over a REPL any day. Incidentally, when Roel and I spend some more time on the lombok eclipse plugin we're going to see how easy it would be to rejigger eclipse's evaluation concepts a bit; I'd be a bit happier if you could just hit enter instead of selecting the expression. But that's a relatively minor nit. NB: Inconsolidata looked weird to me too for about an hour, but now that I've been using it a week, I'm very happy with it (I used to run with dejavu (that's bitstream vera with more unicode chars) - also a very nice font, and inconsolidata now seems somewhat clearer to me than deja). On Jan 21, 5:14 pm, Mohamed Bana <[email protected]> wrote: > Reinier, hi, excellent post. Just to clarify; so you're saying you'd rather > use a debugger than use a REPL? For instance you'd use a debugger > as opposed to launching the REPL and doing > > scala> List(1,2,3).zipWithIndex > res1: List[(Int, Int)] = List((1,0), (2,1), (3,2)) > > and seeing the output in the console. > > I'm very jealous of the Consolas font by Microsoft. When used with > ClearType it is the best programming font out. Inconsolata can't compete > with it. > > —Mohamed > > 2010/1/21 Reinier Zwitserloot <[email protected]> > > > > > ... > > > - Seriously, debuggers rock. They are complicated tools that are > > absolutely amazing at helping you find bugs or even just figuring out > > how something works when you need to maintain something. There's a > > reason smalltalk still has a following, because they were right. Start > > debugging stuff. Use every feature. Learn how to add breakpoints, and > > then evaluate expressions on the spot. Once you've learned this, you > > can take those smug LISPy bastards and tell them to shove their REPL - > > java pretty much has all that and more, *WHEN* you know how to use a > > debugger. Eclipse's is great. So is netbeans. I presume IntelliJ's is > > not too shabby either. > > > - Especially on windows and some linux distros, the out-of-the-box > > font just blows. It's a continuous source of stress and productivity > > drain that you never notice until you fix it, so, _GO FIX IT_. > > Download inconsolidata RIGHT NOW and install it in your editor. You > > can thank me later. Inconsolidata: > >http://www.levien.com/type/myfonts/inconsolata.html > > - or if you don't like that, some alternatives: > >http://hivelogic.com/articles/top-10-programming-fonts- and do this > > even if you do own a mac or work on ubuntu. Monaco is pretty good, but > > inconsolidata and most others on Dan's top 10 handily beat it. > > > ... > > > On Jan 20, 7:57 am, jamesj <[email protected]> wrote: > > > It it interesting to me that in the time that I have listened to the > > > podcast, I have heard lots of banter about which IDE is better, but no > > > discussion about the editing paradigm. IDEs tend to do editing using > > > familiar word processor actions. Watch someone coding in windows some > > > time and see how many times the user has to switch from mouse to > > > keyboard and back and shift positions. Then, go watch some of the old > > > guys that use either VI or Emacs. If you haven't used them before, > > > you will probably be confused with the strangeness of what they do, > > > but also surprised at the speed and productivity. I coded for > > > several years before I had to learn Emacs because I had to work on > > > Unix, and then shortly thereafter, a seasoned veteran talked me into > > > trying VI for a week. (For those who haven't used them, Emacs is a > > > “chording” editor. I.e. it uses lots of ctrl-shift-? combinations. > > > VI is a “state” editor, where the keyboard is either in text entry > > > state or in a command state.) What makes this most interesting to > > > this list, is that modern IDE's support alternate editing models > > > through plugins. > > > > When I use Eclipse or Netbeans I do my editing using a VI style > > > plugin. For me, I prefer the VI “state” approach over the Emacs > > > “chording”. For Eclipse you have to buy the good plugin > > > (www.viplugin.com), which is very reasonably priced, and for Netbeans > > > there is a good free one (jvi.sourceforge.net). If you have never > > > tried VI you may consider just trying it. > > > > You should give yourself several days to learn it, and should keep a > > > note sheet beside you. On the sheet write down the most basic > > > commands and as you need more, add them. Eventually you will quit > > > trying or will just put away the sheet because you don't even think > > > the commnads any more, stuff just happens. The best part, is that > > > with the plugins, a simple click on the toolbar will get you back and > > > forth between the standard and the VI mode. > > > > For those of you who haven't tried it yet, here is a bare-bones > > > tutorial and a few of my favorite things that hurt me to do without > > > VI. > > > > (esc) - switches you to command mode. (anyone using VI hits this a > > > lot) > > > > once in command mode, > > > (a) or (i) - gets you back to editing mode > > > (A) - gets you back to editing mode after jumping to the end of the > > > current line > > > > (h) - move left > > > (l) - move right > > > (j) - down > > > (k) - up > > > (^) - jump to beginning of line > > > ($) - jump to end of line > > > (x) - deletes one character or selection > > > (dd) - deletes the whole current line > > > (4dd) - deletes 4 lines (and you can use whatever count you want) > > > > (Y) - called yank in vi, cuts a whole line > > > (4Y) - would cut 4 lines > > > > (p) - pastes stuff that was yanked. > > > > vi supports multiple buffers, so that you can yank multiple things > > > into specific buffers an then paste them from those buffers. > > > > VI supports simple macros that can be defined and used with 2 or 3 key > > > strokes. A typical use is something like this: I needed the states > > > and postal abbreviations, so I found a page on the web, cut and pasted > > > into my editor, started a macro, made the editing necessary to convert > > > the first line to a line of code followed by a move to the next line, > > > end the macro, then invoke it 50 times. You can't even begin to write > > > a script to do this simple stuff in the time it takes to do it. But, > > > it does require some creativity on your part to describe what you want > > > in generic editing motions. > > > > If you have fun with this stuff, go find a real tutorial and find the > > > best 2% that you want to use. It is definitely not for everyone, but > > > for me, it was one of the best investments of time that I have ever > > > made, and I just wanted to pass along the tip to the next generation. > > > -- > > You received this message because you are subscribed to the Google Groups > > "The Java Posse" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<javaposse%2bunsubscr...@googlegroups > > .com> > > . > > For more options, visit this group at > >http://groups.google.com/group/javaposse?hl=en. -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
