Trabb Pardo–Knuth algorithm: Difference between revisions
Added Arturo implementation
(Updated to work with Nim 1.4: added missing parameter type; added "import "sequtils". Also changed output to print a result per line.) |
Drkameleon (talk | contribs) (Added Arturo implementation) |
||
Line 260:
:EndFor
∇</lang>
=={{header|Arturo}}==
<lang rebol>proc: function [x]->
((abs x) ^ 0.5) + 5 * x ^ 3
ask: function [msg][
to [:floating] first.n: 11 split.words strip input msg
]
loop reverse ask "11 numbers: " 'n [
result: proc n
print [n ":" (result > 400)? -> "TOO LARGE!" -> result]
]</lang>
{{out}}
<pre>11 numbers: 1 2 3 4 5 6 7 8 9 10 11
11.0 : TOO LARGE!
10.0 : TOO LARGE!
9.0 : TOO LARGE!
8.0 : TOO LARGE!
7.0 : TOO LARGE!
6.0 : TOO LARGE!
5.0 : TOO LARGE!
4.0 : 322.0
3.0 : 136.7320508075689
2.0 : 41.41421356237309
1.0 : 6.0</pre>
=={{header|AutoIt}}==
|