Skip to content

repl eats program output #1369

Closed
Closed
@DarkDimius

Description

@DarkDimius

taken from http://scalapuzzlers.com/#pzzlr-013

Welcome to Scala.next (pre-alpha)  (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45).
Type in expressions to have them evaluated.
Type :help for more information.
scala> implicit object RomanOrdering extends Ordering[RomanNumeral] {
         def compare(a: RomanNumeral, b: RomanNumeral) = a.value compare b.value
       }
defined module RomanOrdering
scala>
scala>
val numerals = SortedSet(RomanNumeral("M", 1000), RomanNumeral("C", 100), RomanNumeral("X", 10), RomanNumeral("I", 1), RomanNumeral("D", 500), RomanNumeral("L", 50),  RomanNumeral("V", 5))
numerals: scala.collection.immutable.SortedSet[RomanNumeral] = TreeSet(RomanNumeral(I,1), RomanNumeral(V,5), RomanNumeral(X,10), RomanNumeral(L,50), RomanNumeral(C,100), RomanNumeral(D,500), RomanNumeral(

scala>
scala> println("Roman numeral symbols for 1 5 10 50 100 500 1000:")
Roman numeral symbols for 1 5 10 50 100 500 1000:
scala> for (num <- numerals; sym = num.symbol) { print(s"${sym} ") }
scala> numerals map { _.symbol } foreach { sym => print(s"${sym} ") }
scala>

The numbers were printed, but then they were swallowed by repl and replaced by scala> invitation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions