News for hackers. Stuff that matters.
Re:Why I absolutely love java by rlmw on Tuesday February 08, 2011 @06:49PM (#2195456)
-- Haskell

filter even [1,2,3,4]

Re:Why I absolutely love java by Xk on Tuesday February 08, 2011 @06:57PM (#2195490)
Save some characters:

filter even [1..4]

I've found most of the time when you're trying to get incredibly short expressions that aren't obfuscated, haskell wins.

Re:Why I absolutely love java by T_S_ on Tuesday February 08, 2011 @06:52PM (#2195471)
Or

take 2 (filter even [1..]) // take as many as you want

Re:Why I absolutely love java by rlmw on Tuesday February 08, 2011 @06:56PM (#2195486)
This is true, I forgot to mention that the haskell version trivially scales to infinite lists. You can use partial application to encourage code reuse as well:

evens = filter even

Re:Why I absolutely love java by T_S_ on Tuesday February 08, 2011 @07:40PM (#2195632)
Even better.
Re:Why I absolutely love java by lfborjas on Tuesday February 08, 2011 @06:52PM (#2195472)
this looks really nice, gotta learn me some haskell
Re:Why I absolutely love java by T_S_ on Tuesday February 08, 2011 @07:37PM (#2195617)
You can. For free. Later this week in Mountain View. From some of the world's best and friendliest Haskell experts.

<http://wiki.hackerdojo.com/w/page/32992961/Haskell-Hackathon...;

Newbies take special note of the Saturday session.

Re:Why I absolutely love java by ricree on Tuesday February 08, 2011 @07:53PM (#2195673)
I'm currently in the process of learning it, and I'd definitely recommend it.

If nothing else, it's great having a compiler that can catch a large amount of errors without getting bogged down in the type boilerplate that many other static languages require.

Implicit static typing is definitely something I miss when working in other languages.