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
""" | |
Print a subtype tree from the specified `roottype` | |
""" | |
function subtypetree(roottype, level=1, indent=4) | |
level == 1 && println(roottype) | |
for s in subtypes(roottype) | |
println(join(fill(" ", level * indent)) * string(s)) | |
subtypetree(s, level+1, indent) | |
end | |
end |
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
// Estimate PI using monte carlo simulation | |
// See http://www.davidrobles.net/blog/2014/06/22/estimating-pi-using-monte-carlo-simulations/ | |
import 'dart:math'; | |
Random rnd = new Random(); | |
// Return a random point within [-1, 1] coordinate plane | |
class UnitPoint { | |
double x; |
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
for i in 1...100 { | |
println([["FizzBuzz","Fizz"],["Buzz","\(i)"]][min(1,i%3)][min(1,i%5)]) | |
} |
NewerOlder