def f[T](a:Map[String,T],b:Map[String,T]) = {
val res= (a.keys++b.keys).toList.sorted.mkString(",")
if (res.length == 0) None else Some(res)
}
https://gist.github.com/4694911 def f[T](a:Map[String,T],b:Map[String,T]) = {
val res= (a.keys++b.keys).toList.sorted.mkString(",")
if (res.length == 0) None else Some(res)
}
https://gist.github.com/4694911 (defn f [a b]
(let [res (join "," (sort (distinct (mapcat keys [a b]))))]
(if (empty? res) "<none>" res)))
Also I'm not a Scala expert, but I think 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)