The Artima Developer Community
Sponsored Link

Programming in Scala Forum
Chapter 3: p58

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
Carsten Eckelmann

Posts: 6
Nickname: careck
Registered: Jun, 2003

Chapter 3: p58 Posted: Dec 27, 2007 6:01 PM
Reply to this message Reply
Advertisement
In the footnote(2) on that page you refer to the example

val onetwoThreeFour = oneTwo ::: threeFour

to introduce the right handed associativity of operators ending in a colon.

However even the most astute reader would not have spotted that from this example because you introduced the ::: operator to 'concatenate a passed list on the List on which it is invoked'. This short description does not reveal whether the passed list will be prepended or appended, thus the reader will have no problem with believing the ::: operator to be called on the left operand.

Only the following example

val oneTwoThree = 1 :: twoThree

will make a reader stop to wonder! Here it is clear that twoThree could hardly be added to an Int to form a new List.

I believe that the footnote would make more sense if it's applied to the second example where :: is introduced, OR the description of ::: should be more specific.

Cheers,
Carsten.

Topic: Error in Chapter 6: p124 Previous Topic   Next Topic Topic: How far can I expect to take implicit conversions?

Sponsored Links



Google
  Web Artima.com   

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