Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,10 @@
-- in some movie script
----------------------------------------
-- Composes 2 call-functions, returns a new call-function
-- @param {symbol|instance} f
-- @param {symbol|instance} g
-- @return {instance}
----------------------------------------
on compose (f, g)
return script("Composer").new(f, g)
end

View file

@ -0,0 +1,34 @@
-- 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

View file

@ -0,0 +1,16 @@
-- compose new function based on built-in function 'sin' and user-defined function 'asin'
f1 = compose(#asin, #sin)
put call(f1, _movie, 0.5)
-- 0.5000
-- compose new function based on previously composed function 'f1' and user-defined function 'double'
f2 = compose(#double, f1)
put call(f2, _movie, 0.5)
-- 1.0000
-- compose new function based on 2 composed functions
f1 = compose(#asin, #sin)
f2 = compose(#double, #triple)
f3 = compose(f2, f1)
put call(f3, _movie, 0.5)
-- 3.0000

View file

@ -0,0 +1,14 @@
-- in some movie script
on asin (x)
res = atan(sqrt(x*x/(1-x*x)))
if x<0 then res = -res
return res
end
on double (x)
return x*2
end
on triple (x)
return x*3
end