Re:Why we love Scala at Coursera
by deckiedan on Tuesday February 18, 2014 @03:00PM
(#7260655)
Would this be equivalent to:
And then the second example:
In python?
[ Parent
| on HN ]
Re:Why we love Scala at Coursera
by virtualwhys on Tuesday February 18, 2014 @03:13PM
(#7260720)
yup, not sure what Python does with your examples under the hood, but they're equivalent, and, I must say, nicely concise ;-)
In Scala I guess we could go zip-style and do:
List(1,2,3) zip List(4,5,6) map{case(x,y)=> x*y}
but I was trying to demo for comprehensions and their relation to map/flatMap for the OP.