June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -1,4 +1,8 @@
|
|||
class Node(n: Int, link: Node) {
|
||||
var data = n
|
||||
var next = link
|
||||
sealed trait List[+A]
|
||||
case class Cons[+A](head: A, tail: List[A]) extends List[A]
|
||||
case object Nil extends List[Nothing]
|
||||
|
||||
object List {
|
||||
def apply[A](as: A*): List[A] =
|
||||
if (as.isEmpty) Nil else Cons(as.head, apply(as.tail: _*))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,3 @@
|
|||
class Node {
|
||||
var data: Int
|
||||
var next = this
|
||||
|
||||
def this(n: Int, link: Node) {
|
||||
this()
|
||||
if (next != null){
|
||||
data = n
|
||||
next = link
|
||||
}
|
||||
}
|
||||
def main(args: Array[String]): Unit = {
|
||||
val words = List("Rosetta", "Code", "Scala", "Example")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue