fork download
  1. object Main extends App {
  2. //=========================
  3.  
  4. def longRange(start: Long, to: Long) = new Iterator[Long] {
  5. private var i = start
  6. def hasNext = {
  7. i < to
  8. }
  9. def next() = {
  10. val r = i
  11. i += 1
  12. r
  13. }
  14. }
  15.  
  16. val lol = longRange(0, Long.MaxValue) map (x => x * x)
  17.  
  18. lol drop 5 take 5 foreach println
  19.  
  20. //=========================
  21. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
compilation info
Main.scala:7: error: overloaded method value < with alternatives:
  (x: Double)Boolean <and>
  (x: Float)Boolean <and>
  (x: Long)Boolean <and>
  (x: Int)Boolean <and>
  (x: Char)Boolean <and>
  (x: Short)Boolean <and>
  (x: Byte)Boolean
 cannot be applied to (scala.collection.immutable.IndexedSeq[Long])
        i < to
          ^
one error found
spoj: The program compiled successfully, but Main.class was not found.
      Class Main should contain method: def main(args: Array[String]).
stdout

Standard output is empty