#!/usr/bin/ruby

func compose(f,g) {
    func (*args) {
        f(g(args...));
    }
}

var cube  = func(a) { a.pow(3) };
var croot = func(a) { a.root(3) };

var flist1 = [Number.method(:sin),  Number.method(:cos),   cube];
var flist2 = [Number.method(:asin), Number.method(:acos), croot];

flist1.range.each { |i|
    say compose(flist1[i], flist2[i])(0.5);
}
