/* * Copyright (C) 2007-2020 Artima, Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Automatically generated Scala interpreter transcript from: * * Programming in Scala (Fifth Edition) * by Martin Odersky, Lex Spoon, Bill Venners, and Frank Sommers * * http://booksites.artima.com/programming_in_scala_5ed */ scala> def cachedF(s: String) = cache.getOrElseUpdate(s, f(s)) ^ error: not found: value cache ^ error: not found: value f scala> cachedF("abc") ^ error: not found: value cachedF scala> cachedF("abc") ^ error: not found: value cachedF scala> val str = 1 #:: 2 #:: 3 #:: LazyList.empty str: scala.collection.immutable.LazyList[Int] = LazyList() scala> def fibFrom(a: Int, b: Int): LazyList[Int] = a #:: fibFrom(b, a + b) fibFrom: (a: Int, b: Int)LazyList[Int] scala> val fibs = fibFrom(1, 1).take(7) fibs: scala.collection.immutable.LazyList[Int] = LazyList() scala> fibs.toList res2: List[Int] = List(1, 1, 2, 3, 5, 8, 13) scala> val (element, has23) = has123.dequeue ^ error: not found: value has123 scala> def wrap[U](xs: Vector[U]) = evenElems(xs) ^ error: not found: value evenElems scala> val vv = v.view ^ error: not found: value v scala> vv.map(_ + 1) ^ error: not found: value vv scala> res13.map(_ * 2) ^ error: not found: value res13 scala> res14.toVector ^ error: not found: value res14 scala> List(1, 2, 3) res6: List[Int] = List(1, 2, 3) scala> Iterable(1, 2, 3) res7: Iterable[Int] = List(1, 2, 3) scala> mutable.Iterable(1, 2, 3) ^ error: not found: value mutable scala> import collection.mutable.* ^ error: object * is not a member of package scala.collection.mutable scala> val jul: java.util.List[Int] = ArrayBuffer(1, 2, 3).asJava ^ error: not found: value ArrayBuffer scala> val buf: Seq[Int] = jul.asScala ^ error: not found: value jul scala> val m: java.util.Map[String, Int] = scala> val jul: java.util.List[Int] = List(1, 2, 3) ^ error: type mismatch; found : List[Int] (in scala.collection.immutable) required: List[Int] (in java.util) scala> jul.add(7) ^ error: not found: value jul