News for hackers. Stuff that matters.
Re:View of Scala from Java by grdvnl on Friday January 04, 2013 @02:17AM (#5006639)
Even, I find this strange and I may be wrong. With your definition, when I use the for construct, I see this:

    scala> for (y<-x if x > 2)
         | println(y)
    <console>:9: error: value > is not a member of Array[Int]
              for (y<-x if x > 2)
                             ^

As you suggested, there may be a idiomatically better way to get implicit inference and also use the filters. I would be glad if some one corrects me on that.

Edit: Yeah, I see the silly error I made. I'll better get some sleep. I will leave this comment intact, for the responses to make sense.

Re:View of Scala from Java by ponzao on Friday January 04, 2013 @02:31AM (#5006664)
You are comparing an array of integers with an integer. You would want to do this instead:

    for (y <- x if y > 2) ...
Re:View of Scala from Java by jlh276 on Friday January 04, 2013 @02:46AM (#5006687)
Get some sleep, then spend another week playing with Scala and its REPL. It's a terrific tool to learn. If you like Eclipse, install the Scala IDE and the Scala Worksheet. It's rough around the edges, but it's even better than the REPL.
Re:View of Scala from Java by grdvnl on Friday January 04, 2013 @02:49AM (#5006697)
Yes, I have been using the Scala IDE and Scala worksheet for my initial learning. As you said, it is great and more friendly than the REPL itself. It reminds me of Python Notebook in terms of being able to get good feedback and recursively edit.
Re:View of Scala from Java by thebluesky on Friday January 04, 2013 @03:36AM (#5006805)
Most folks find that the IntelliJ Scala plugin is the best tool rather than Eclipse.
Re:View of Scala from Java by halvsjur on Friday January 04, 2013 @04:45AM (#5006946)
Have you tried the Scala Worksheet for Eclipse? Pretty cool.

I see that the recently released IDEA 12 has a similar feature (but so far incomplete and undocumented according to their bug tracker).

Re:View of Scala from Java by effn on Friday January 04, 2013 @02:32AM (#5006666)
You made a typo, it should be "y > 2" in your filter expression.