Skip to content

Instantly share code, notes, and snippets.

@wataru420
Created September 11, 2012 03:27
Show Gist options
  • Save wataru420/3695744 to your computer and use it in GitHub Desktop.
Save wataru420/3695744 to your computer and use it in GitHub Desktop.
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