Created
October 6, 2016 23:33
-
-
Save stanch/593f9c241a6bf8e676d324ac9a6d7f4e 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
// git clone https://github.com/stanch/reftree && cd reftree | |
// sbt demo | |
def add(n: Int)(q: Queue[Int]) = Utils.iterate(q, n + 1)(q => q :+ (q.max + 1)).tail | |
def remove(n: Int)(q: Queue[Int]) = Utils.iterate(q, n + 1)(q => q.tail).tail | |
def addRemove(n: Int)(q: Queue[Int]) = Utils.flatIterate(q)(add(n), rm(n)) | |
val queues = Utils.flatIterate(Queue(1, 2, 3), 3)(addRemove(2)) | |
diagram.renderAnimation( | |
"queue", _.copy( | |
onionSkinLayers = 0, diffAccent = true, interpolationFrames = 21, | |
density = 100, delay = 200, silent = false | |
) | |
)(queues) |
Author
stanch
commented
Oct 6, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment