Compile-time calculation: Difference between revisions

Added AppleScript.
m (/* {{header|Wren}} Oops, wrong name in the header and lang tag.)
(Added AppleScript.)
Line 111:
 
because the final result A_11_15 * A_16_20 * F_10 is a '''value not in range of type "Standard.Integer"''' -- the same intermediate value that was used above to compute '20 choose 10'.
 
=={{header|AppleScript}}==
The values of AppleScript 'property' variables are set when a script's compiled, although they can also be changed when the script's run. (If it's a top-level script run from a compiled file, the values of its properties when it finishes are saved back to the file and the properties will start off with those values next time it's run.) Property declarations are single lines, but the lines can be calls to handlers declared upscript from the properties themselves.
 
<lang applescript>-- This handler must be declared somewhere above the relevant property declaration
-- so that the compiler knows about it when compiling the property.
on factorial(n)
set f to 1
repeat with i from 2 to n
set f to f * i
end repeat
return f
end factorial
 
property compiledValue : factorial(10)
-- Or of course simply:
-- property compiledValue : 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10
 
on run
return compiledValue
end run</lang>
 
{{output}}
<lang applescript>3628800</lang>
 
=={{header|BASIC}}==
557

edits