開発環境
- OS X Yosemite - Apple (OS)
- Emacs (Text Editor)
- Scala (プログラミング言語)
Learning Scala: Practical Functional Programming for the JVM (Jason Swartz (著)、O'Reilly Media)のPart Ⅰ. (Core Scala)、Chapter 4.(Functions)、Exercises 8.(No. 1479)を解いてみる。
その他参考書籍
Exercises 8.(No. 1479)
コード(Emacs)
def convertToStrings[A, B, C](t:(A, B, C)): (A, String, B, String, C, String) =
(t._1, t._1.toString, t._2, t._2.toString, t._3, t._3.toString)
println(convertToStrings(true, 22.25, "yes"))
入出力結果(Terminal, REPL(Read, Eval, Print, Loop))
$ scala-2.11 sample8.scala (true,true,22.25,22.25,yes,yes) $ scala-2.11 Welcome to Scala version 2.11.7 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_25). Type in expressions to have them evaluated. Type :help for more information. scala> :load sample8.scala Loading sample8.scala... convertToStrings: [A, B, C](t: (A, B, C))(A, String, B, String, C, String) (true,true,22.25,22.25,yes,yes) scala> :q $
0 コメント:
コメントを投稿