News for hackers. Stuff that matters.
Re:Map.merge() – One method to rule them all by mruts on Sunday March 31, 2019 @12:19PM (#19536363)
But your python code is still really ugly. In Scala:

import scala.collection.mutable.Map

> val map = Map.empty[String, Int]

> List("hi", "there", "hi").map { x =>

> map(x) = i

> }

Re:Map.merge() – One method to rule them all by virtualwhys on Sunday March 31, 2019 @12:41PM (#19536517)
Not the same but immutable approach is more idiomatic Scala.

    List("hi", "there", "hi")
      .zipWithIndex
      .map { case (x, i) =>
        x -> i
      }.toMap
Re:Map.merge() – One method to rule them all by mruts on Monday April 01, 2019 @02:22PM (#19546421)
That example doesn’t really illustrate the point of updating maps with repeated values.