-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Description
REPL is not adding the first line to history:
Welcome to Scala version 2.10.0.r0-b20110601223329 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_23).
Type in expressions to have them evaluated.
Type :help for more information.
scala> 1
res0: Int = 1
scala> 2
res1: Int = 2
scala> :history
1380 for (Regex.Groups(url) <- hrefs) yield url
1381 Source.fromURL
1382 import scala.io.Source
1383 import scala.util.matching.Regex
1384 import scala.util.matching.Regex._
1385 val hrefRegex = new Regex("""\<a.*?href=\"(http:.*?)\".*?\>.*?\</a>""") // no semi-colons
1386 def linksFromUrl(sourceUrl:String) : List[String] = try { // don't use { } for single-statement methods -- the original was { try { } catch { }
}
1387 val source = Source fromURL sourceUrl // infix notation for infix methods
1388 val hrefs = hrefRegex findAllIn source.mkString // don't convert from Iterator to List prematurely, for performance reasons
1389 val urls = for (Groups(url) <-hrefs matchData ) yield url // as described before
1390 urls.toList // change to list before returning
1391 } catch {
1392 case _ => Nil
1393 }
1394 1
1395 2
1396 :history
1397 exit
1398 2
1399 :history