It draws inspiration from several (especially Java & Python), but there are some aspects of the language that are fully custom and fairly unique (like its trait-based polymorphism).
Here’s a real example that’s used for benchmarking the VM - computing a numeric image of the Mandelbrot fractal:
module benchmark
def scaleX(x, xDim){
return x/xDim * (1.0 - -2.5) + -2.5
}
def scaleY(y, yDim){
return y/yDim * (1.0 - -1.0) + -1.0
}
def mandelbrot(xDim, yDim){
for(var px in 0.0..xDim){
for(var py in 0.0..yDim){
var x0 = scaleX(px, xDim)
var y0 = scaleY(py, yDim)
var x = 0.0
var y = 0.0
var iteration = 0
while(x*x + y*y <= 2*2 && iteration < 1000){
var xTemp = x*x - y*y + x0
y = 2*x*y + y0
x = xTemp
iteration++
}
}
}
}
def main(){
return mandelbrot(250.0, 250.0)
}