Jensen's Device: Difference between revisions
Content added Content deleted
m (→{{header|Wren}}: Changed to Wren S/H) |
(→{{header|Forth}}: replaced FVARIABLE ii with VARIABLE i1 (i is integer in the task description)) |
||
Line 733: | Line 733: | ||
The following version passes i and 1/i as execution tokens and is thus closer to the original, but less idiomatic: |
The following version passes i and 1/i as execution tokens and is thus closer to the original, but less idiomatic: |
||
<syntaxhighlight lang="forth"> |
<syntaxhighlight lang="forth">: sum ( i-xt lo hi term-xt -- r ) |
||
: |
\ stack effects: i-xt ( -- addr ); term-xt ( -- r1 ) |
||
0e swap 1+ rot ?do ( |
0e swap 1+ rot ?do ( r1 xt1 xt2 ) |
||
i |
i 2 pick execute ! dup execute f+ |
||
loop 2drop ; |
loop 2drop ; |
||
⚫ | |||
variable i1 \ avoid conflict with Forth word I |
|||
⚫ | |||
=={{header|Fortran}}== |
=={{header|Fortran}}== |