Jump to content

Time a function: Difference between revisions

→‎{{header|J}}: Link added to M. documentation
(added c++)
(→‎{{header|J}}: Link added to M. documentation)
Line 74:
=={{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 [http://www.jsoftware.com/help/dictionary/dmcapdot.htm Memoize] feature or similar techniques are used, execution time and space can both be affected by prior calculations.
===Example===
(6!:2,7!:2) '|: 50 50 50 $ i. 50^3'
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.