Created
September 11, 2012 04:12
-
-
Save wataru420/3695904 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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