#!/usr/bin/ruby

#
## https://rosettacode.org/wiki/Function_composition
#

func compose(f, g) {
    func(x) { f(g(x)) };
};
var fg = compose(func(x){sin(x)}, func(x){cos(x)});
say fg(0.5);   # => 0.7691963548410084218525147580510688880995
