3 ms·
"But in fact, in the end result the Scala collection libraries are actually unique, nobody, no other language has a library like that, where you say you have a
by primodemus 16y ago
"But in fact, in the end result the Scala collection libraries are actually unique, nobody, no other language has a library like that, where you say you have a rich set of collection types, a rich set of collection operations, in particular bulk operations, that take function parameters like Map, Filter, Flat Map, these sort of things and you have the uniform return type principle which says that every operation can be applied on a collection and yields the value of the same collection as a result. So if you apply a map to a set, you get a set, if you apply a map to a sequence, you get a sequence. "
Anyone knows how Scala's collections compares to C#'s linq?
- barrkel 16y agoAs I understand it, the operations it supports all correspond to the Func<T> version of LINQ in C#, as opposed to the Expression<Func<T>> versions. That is, you can do much if not all that you can in C# so long as you're passing around closures rather than expression trees. LINQ uses expression trees to convert the body of the closure to SQL where and when necessary. I would guess you'd need to play around with operator overloading to simulate the same effect in Scala, and end up with something slightly more clumsy and less integrated (i.e. less tool support, diagnostics etc.) as a result.
- deleted 16y ago[deleted]