(1 to 10) map { _ * 2 }
(1 to 1000).reduceLeft( _ + _ )
List(49, 58, 76, 82, 88, 90) partition ( _ > 60 )
I guess one common syntax for this pattern isn't sufficient. :( To be perfectly clear about my objection, these are the same basic operation: call a function on an iterable with an additional function argument. One is dotfree and uses braces. One uses a dot. And one is dotfree and uses parens. I feel like it would be a lot better if there were only one way to do this. (words.foldLeft(false)( _ || tweet.contains(_) ))
|| . . . in every other language that means "logical or". What non-intuitive connotation does it have here? val results = XML.load("http://search.twitter.com/search.atom?&q=scala)
Oh man, why can't it be XML.parse(URL.fetch(...)). (n: Int) => (2 to n) |> (r =>
r.foldLeft(r.toSet)((ps, x) => if (ps(x)) ps -- (x * x to n by x) else ps))
This language has a damn operator fetish. This is sort of ok . . . I suppose these operators mean something to someone, but why do they have to also break conventions by doing things like creating a binary --.Despite these complaints, and many others, I'm still weirdly drawn to this language. I want a smaller version of this. Managed, non-crazy (I'm looking at you, Go), and providing functional features. But I want that in a package that doesn't give me ten million billion different ways to do the same thing.