top | item 874935

Learning Scala in small bites

20 points| r11t | 16 years ago |matt.might.net | reply

3 comments

order
[+] joe_the_user|16 years ago|reply
Is there a reason the variables in the first example are titled 'x1' through 'x13'? Seems strange and undesirable compared even pseudo-meaning variable names. As another post mentioned, sample code lives forever but this particular coding style isn't what I would to see sticking around.
[+] aschobel|16 years ago|reply
I agree that it seems like an odd practice, could be a mental artifact from using the scala interpreter. When you create objects in the interpreter w/o a name it is starts enumerating at res0.

  Welcome to Scala version 2.7.5.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_15).
  Type in expressions to have them evaluated.
  Type :help for more information.

  scala> "hello"
  res0: java.lang.String = hello

  scala> "world"
  res1: java.lang.String = world
[+] fadmmatt|16 years ago|reply
Thanks for pointing that out.

I don't remember why I did it that way.

I changed them to more sensible variable names.