Re:Crafting Code in Clojure
by aaroniba on Friday February 01, 2013 @07:45PM
(#5154533)
The equivalent clojure code would be:
Also I'm not a Scala expert, but I think you want .keySet instead of .keys, otherwise they won't be unique, right?
[ Parent
| on HN ]
> you want .keySet instead of .keys, otherwise they won't be unique, right?
scala> val p = Map(1->4,5->3)
scala> p.keys
res0: Iterable[Int] = Set(1, 5)
scala> p.keySet
res1: scala.collection.immutable.Set[Int] = Set(1, 5)
scala> p.keys++p.keys
res2: Iterable[Int] = Set(1, 5)
scala> p.keySet++p.keySet
res3: scala.collection.immutable.Set[Int] = Set(1, 5)