2015年6月5日金曜日

開発環境

Learning Scala: Practical Functional Programming for the JVM (Jason Swartz (著)、O'Reilly Media)のPart Ⅰ. (Core Scala)、Chapter 1.(Getting Started with the Scalable Language)、Exercises 2, 3, 4, 5.(No. 231)を解いてみる。

Exercises 2, 3, 4, 5.(No. 231)

コード(Emacs)

println("Hello, World!")

入出力結果(Terminal, REPL(Read, Eval, Print, Loop))

$ scala-2.11 
Welcome to Scala version 2.11.6 (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> 22.5 * 9/5 + 32
res0: Double = 72.5

scala> (res0 - 32) * 5/9
res1: Double = 22.5

scala> :load Hello.scala
Loading Hello.scala...
Hello, World!

scala> :paste -raw
// Entering paste mode (ctrl-D to finish)

println("Hello, World!")

// Exiting paste mode, now interpreting.

<pastie>:1: error: expected class or object definition
println("Hello, World!")
^
There were compilation errors!

scala> :paste
// Entering paste mode (ctrl-D to finish)

println("Hello, World!")

// Exiting paste mode, now interpreting.

Hello, World!

scala> :paste Hello.scala
Pasting file Hello.scala...
Hello, World!

scala> :help paste

enter paste mode or paste a file

scala> :quit
$

0 コメント:

コメントを投稿