Skip to content

Instantly share code, notes, and snippets.

@wataru420
Created September 11, 2012 04:12
Show Gist options
  • Save wataru420/3695904 to your computer and use it in GitHub Desktop.
Save wataru420/3695904 to your computer and use it in GitHub Desktop.
class SlowHeadQueue[T](elems:List[T]){
// 末尾を取ってくれば先頭要素
def head = smele.last
// 末尾以外を取ればtailの動作になる
def tail = new SlowHeadQueue(smele.init)
// 連結処理をつかって高速にできる
def append(x:T) = new SlowHeadQueue( x :: smele )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment