1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | object Main extends App { //========================= def longRange(start: Long, to: Long) = new Iterator[Long] { private var i = start def hasNext = { i < to } def next() = { val r = i i += 1 r } } val lol = longRange(0, Long.MaxValue) map (x => x * x) lol drop 5 take 5 foreach println //========================= } |
b2JqZWN0IE1haW4gZXh0ZW5kcyBBcHAgewovLz09PT09PT09PT09PT09PT09PT09PT09PT0KCmRlZiBsb25nUmFuZ2Uoc3RhcnQ6IExvbmcsIHRvOiBMb25nKSA9IG5ldyBJdGVyYXRvcltMb25nXSB7CiAgICBwcml2YXRlIHZhciBpID0gc3RhcnQKICAgIGRlZiBoYXNOZXh0ID0gewogICAgICAgIGkgPCB0bwogICAgfQogICAgZGVmIG5leHQoKSA9IHsKICAgICAgICB2YWwgciA9IGkKICAgICAgICBpICs9IDEKICAgICAgICByCiAgICB9Cn0KCnZhbCBsb2wgPSBsb25nUmFuZ2UoMCwgTG9uZy5NYXhWYWx1ZSkgbWFwICh4ID0+IHggKiB4KQoKbG9sIGRyb3AgNSB0YWtlIDUgZm9yZWFjaCBwcmludGxuCgovLz09PT09PT09PT09PT09PT09PT09PT09PT0KfQ==
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]).
-
result: Compilation error (maybe you wish to see an example for Scala)


