I thought this Rosetta code task was pretty cool. The goal is to make a function that takes two functions as arguments, and returns a new function that combines them.
Turns out this is pretty easy to do in MiniScript, as long as you're careful to use @ when you want to refer to a function rather than call the function.
funcA = function(x)
return x * 10
end function
funcB = function(x)
return x + 5
end function
compose = function(f, g)
return function(x)
return f(g(x))
end function
end function
f = compose(@funcA, @funcB)
print f(3) // should be equal to (3+5)*10
Pretty neat, eh? 🙂