digitalmars.D - Scala collections
- bearophile <bearophileHUGS lycos.com> Jun 17 2011
- Timon Gehr <timon.gehr gmx.ch> Jun 17 2011
- bearophile <bearophileHUGS lycos.com> Jun 17 2011
- Timon Gehr <timon.gehr gmx.ch> Jun 17 2011
- Russel Winder <russel russel.org.uk> Jun 18 2011
A nice video with readable slides, mostly about Scala collections: http://www.parleys.com/#id=2184&sl=71&st=5 Martin Odersky looks like a very intelligent person (about as Hongwei Xi, author of ATS language). Scala collections look very integrated with each other and with functional-style programming. And they look good for parallelism too. A flatMap() sounds useful in Phobos. It means flat(map()) where map returns a small collection, and flat flattens them all in a single result. There is a similar function in Haskell too. Scala partition returns a 2-tuple. I'd like a similar functional function in Phobos too, that doesn't touch the input range. Bye, bearophile
Jun 17 2011
bearophile wrote:A nice video with readable slides, mostly about Scala collections: http://www.parleys.com/#id=2184&sl=71&st=5 Martin Odersky looks like a very intelligent person (about as Hongwei Xi, author of ATS language). Scala collections look very integrated with each other and with functional-style programming. And they look good for parallelism too. A flatMap() sounds useful in Phobos. It means flat(map()) where map returns a small collection, and flat flattens them all in a single result. There is a similar function in Haskell too. Scala partition returns a 2-tuple. I'd like a similar functional function in Phobos too, that doesn't touch the input range. Bye, bearophile
Wow, neat. Thanks for sharing. I'm hardly halfway through, but I think we need to steal some Scala features sometime! =) It makes even D feel verbose. What I especially like: "var"/"val" are very short names for often used keywords. (not too descriptive though) Scala's way of doing the equivalent of inline delegates. (_.age < 18) vs (at least) (a){return a.age < 18;} or unaryFun!"a.age<18". List comprehensions. Is it maybe possible to get equivalent functionality and conciseness in a library solution? auto-return of last statement / def foo():Type=result for short function definitions. Infix functions and custom operators. Simple pattern matching (bearophile's well-known tuple unpacking sugar) Tuples. Tuples. Tuples. Cheers, Timon
Jun 17 2011
Timon Gehr:I'm hardly halfway through, but I think we need to steal some Scala features sometime! =)
The most important features of Scala are in its refined type system. The things you underline aren't the most important ones."var"/"val" are very short names for often used keywords. (not too descriptive though)
In origin it was "invariant", then we have asked for "immutable", but now I like val better because it's shorter. I have seen D code use more "const" maybe just because "immutable" is a longer word.List comprehensions. Is it maybe possible to get equivalent functionality and conciseness in a library solution?
List comps are good to improve psychological chunking. In dlibs1 I have a select that apes them, but we are not there.Simple pattern matching (bearophile's well-known tuple unpacking sugar)
Scala pattern matching is far more than just unpacking tuples. But currently I don't miss it a lot. Bye, bearophile
Jun 17 2011
bearophile wrote:Timon Gehr:I'm hardly halfway through, but I think we need to steal some Scala features sometime! =)
The most important features of Scala are in its refined type system. The things
I just underlined features I am somewhat missing from D. I think templates and CTFE can be used to build complex systems more easily than by using the caps of a refined type system. But I am definitely going to look into it. Apparently, it provides VERY nice means to define beautiful syntax in a library!"var"/"val" are very short names for often used keywords. (not too descriptive
In origin it was "invariant", then we have asked for "immutable", but now I like
because"immutable" is a longer word.
=(. Well, definition blocks help somewhat: immutable{ int a=8383,b=foo(); bool c=true; }List comprehensions. Is it maybe possible to get equivalent functionality and conciseness in a library solution?
List comps are good to improve psychological chunking. In dlibs1 I have a select
Simple pattern matching (bearophile's well-known tuple unpacking sugar)
Scala pattern matching is far more than just unpacking tuples. But currently I
Yes, I only miss the most basic features too.Bye, bearophile
Cheers, - Timon
Jun 17 2011
Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2011-06-17 at 21:12 -0400, bearophile wrote: [ . . . ]"var"/"val" are very short names for often used keywords. (not too desc=
=20 In origin it was "invariant", then we have asked for "immutable", but now=
" maybe just because "immutable" is a longer word. [ . . . ] Groovy folk debated this one a few days ago, and the consensus was that val and var are far too similar to have such huge differences of semantics. In the Java context, to which Groovy is intimately tied, using def and final seems to be winning the day. =20 --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel russel.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Jun 18 2011









Timon Gehr <timon.gehr gmx.ch> 