Website | Source (no updates since 2020)

A Bob Nystrom experiment.

It looks a bit like this:

// Generates the sequence of turns needed to draw a dragon curve.
// See: http://en.wikipedia.org/wiki/Dragon_curve
def dragon(0, _)
    ""
end

def dragon(n is Int, turn)
    dragon(n - 1, "R") + turn + dragon(n - 1, "L")
end

print(dragon(5, ""))


Tags: language   jvm   native   vm  

Last modified 07 October 2024