type inference still need enhance,any better suggestion for this example?

Posted by iamsungod on Stack Overflow See other posts from Stack Overflow or by iamsungod
Published on 2010-05-24T13:31:33Z Indexed on 2010/05/24 13:41 UTC
Read the original article Hit count: 264

Filed under:
|

for instance in Clojure:

user=> (map #(* % 2) (concat [1.1 3] [5 7]))

(2.2 6 10 14)

but in Scala:

scala> List(1.1,3) ::: List(5, 7) map (_ * 2)

<console>:6: error: value * is not a member of AnyVal
       List(1.1,3) ::: List(5, 7) map (_ * 2)
                                       ^

Here ::: obtain a list of type List,oops then failed. Can any coding more intuitively like Clojure above?

© Stack Overflow or respective owner

Related posts about scala

Related posts about clojure