virtualwhys
searching PlanetScale…
- 1.▲
- 2.▲
- 3.▲
- 4.▲
- 5.▲
- 6.▲
84 ms·
- 811.▲
- 812.▲
- 813.▲
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}
b - 814.▲
- 815.▲
val plusOne = for(x <- List(1,2,3)) yield x+1
desugars to: List(1,2,3).map(_+1) // or longhand, map(x=> x+1)
and: for(x <- List(1,2,3); y <- List(4,5,6)) yield x*y
desugars to: List(1, - 816.▲
- 817.▲
- 818.▲
- 819.▲
- 820.▲
- 821.▲
- 822.▲
- 823.▲
- 824.▲
- 825.▲
- 826.▲
- 827.▲
- 828.▲
- 829.▲
- 830.▲
- 831.▲
- 832.▲
- 833.▲
- 834.▲
- 835.▲
- 836.▲
- 837.▲
- 838.▲
- 839.▲
- 840.▲
More ›