Created
September 11, 2012 03:27
-
-
Save wataru420/3695744 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SlowAppendQueue[T](elems:List[T]){ | |
// headはList.headを利用 | |
def head = elem.head | |
// tailもList.tailから生成 | |
def tail = new SlowAppendQueue(elems.tail) | |
// ::: メソッドで結合 | |
def append(x:T) = new SlowAppendQueue(elems ::: List(x)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment