This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-30
Channels
- # announcements (3)
- # aws (5)
- # beginners (71)
- # boot (7)
- # calva (74)
- # cider (6)
- # clj-kondo (2)
- # cljs-dev (5)
- # clojars (6)
- # clojure (84)
- # clojure-dev (7)
- # clojure-europe (1)
- # clojure-italy (23)
- # clojure-nl (43)
- # clojure-sanfrancisco (1)
- # clojure-spec (4)
- # clojure-uk (173)
- # clojurebridge (1)
- # clojurescript (14)
- # cursive (44)
- # datomic (9)
- # duct (2)
- # emacs (2)
- # fulcro (4)
- # graalvm (4)
- # graphql (27)
- # hoplon (6)
- # keechma (50)
- # off-topic (3)
- # other-languages (8)
- # pathom (2)
- # pedestal (14)
- # planck (5)
- # re-frame (3)
- # reitit (6)
- # ring (2)
- # robots (2)
- # spacemacs (9)
- # tools-deps (15)
- # vim (44)
In scala I have a function that takes a series of arguments, and I have a Seq with the values that correspond exactly, is there a nice way to pass the sequence as the arguments?
val x = Seq(1,2,3)
def test(a: Int, b: Int, c:Int) {
println(a)
}
test(x.something?)
@hobosarefriends I suspect (but I’m not sure) that this will only work with varargs functions:
def printAll(strings: String*) {
strings.foreach(println)
}
val x = Seq("1","2","3")
printAll(x:_*)
Since Scala can’t determine the length of the Seq at compile time (in general), I don’t think it will accept passing it to a fixed arity function
Aww.. well I guess I’ll just have to destructure it and pass them seperately. Thanks for the help!
There’s also a Scala gitter on which people are sometimes helpful, might make sense to check it there too 🙂