pmcrtr (1) [Avatar] Offline
On page 5 of the freely available chapter under the heading Don't get scared by syntax, I think it would be much nicer for the Scala code to be defined as:

def inc(n: Int) = n + 1

It's still valid Scala and it does exactly the same but it's less verbose and compares much more favourably with the accompanying Haskell and Clojure equivalents. As the aim is for the reader to not be scared of the syntax I think it may be best to use the cleanest version of the syntax where possible.

Also, on page 10, in the first REPL example, the integer n is defined as a var. The following lines of code then reference n but don't attempt to mutate it. That being the case, there is no reason why n can't be specified as a val. With one of the cornerstones of FP being immutability, using immutable vals over mutable vars whenever possible is good practice. I think it would be worth adhering to that as early as possible in the book's examples to guide the reader towards thinking in terms of immutability.
aslam.khan (50) [Avatar] Offline
Re: Verbosity and mutation
I originally did use val but opted for var at this stage because it immutability is not a familiar concept for OOP developers. In chapter 2 we converge towards immutability and in chapter 3 we draw attention to val vs var and encourage val from that point onwards.

I'd be keen to hear from others whether the introduction of val this early introduces a point of confusion or clarity.
DhavalDalal (1) [Avatar] Offline
Re: Verbosity and mutation
I think Aslam thats fair to assume the use of var - the way you put OO people at ease with the evolution towards FP is really gentle....its gentle nudging to FP, step-by-step. Overall the tone and learning gradient is just nicely balanced.