The Artima Developer Community
Sponsored Link

Programming in Scala Forum
Error in chapter 8 p.158

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
jc zulian

Posts: 1
Nickname: jc24
Registered: Dec, 2007

Error in chapter 8 p.158 Posted: Jan 3, 2008 5:35 AM
Reply to this message Reply
Advertisement
In section 8.5 towards the end of the page you write :


scala> def twice(op: Double => Double, x: Double) = op(op(x))
twice: ((Double) => Double,Double)Double
scala> twice(_ + 1, 5)
res24: Double = 7.0

The type of op in this example is double => double, which means it is a closure that takes one double as an argument and returns another closure.


Unless I am mistaken it should be :
[..], which means it is a closure that takes one double as an argument and returns another double.

Topic: How do I know when a new version of the PDF is available? Previous Topic   Next Topic Topic: Chap 1, p36

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use