Anonymous user
Time a function: Difference between revisions
→{{header|J}}: Corrected misleading comments about variation in requirements.
(→{{header|J}}: Corrected misleading comments about variation in requirements.) |
|||
Line 45:
=={{header|J}}==
Time and space requirements are tested using verbs obtained through the Foreign conjunction (<tt>!:</tt>). <tt>6!:2</tt> returns time required for execution, in floating-point measurement of seconds. <tt>7!:2</tt> returns a measurement of space required to execute. Both receive as input a sentence for execution.
<br>When the Memoize feature or similar techniques are used, execution time and space can both be affected by prior calculations.
===Example===
Function <tt>f2c</tt> is an iterative calculation of the (2^n)-th number in the [http://www.jsoftware.com/jwiki/Essays/Fibonacci_Sequence Fibonacci sequence].
|