RosettaCodeData/Task/Function-composition/Lingo/function-composition-2.lingo

35 lines
718 B
Plaintext

-- parent script "Composer"
property _f
property _g
----------------------------------------
-- @constructor
-- @param {symbol|instance} f
-- @param {symbol|instance} g
----------------------------------------
on new (me, f, g)
me._f = f
me._g = g
return me
end
on call (me)
if ilk(me._g)=#instance then
cmd = "_movie.call(#call,me._g,VOID"
else
cmd = "_movie.call(me._g,_movie"
end if
a = [] -- local args list
repeat with i = 1 to the paramCount-2
a[i] = param(i+2)
put ",a["&i&"]" after cmd
end repeat
put ")" after cmd
if ilk(me._f)=#instance then
return _movie.call(#call, me._f, VOID, value(cmd))
else
return _movie.call(me._f, _movie, value(cmd))
end if
end