Ambi is proving to be a great extensible RPN calculator. Applying the ‘zen’ of RPN to programming fun!
Enjoy the new release of Ambi.
This week I have discovered that the seq operator is not necessary. Initially, I thought that seq would be necessary, however it turns out that the other lambda operators are sufficient. So we now can write an interative approximator of cuberoot in this way …
function; root3;
dowhile;
import dup $n = $guess =;
$guess $prev = $n $prev sq / $prev + .5 * $guess =;
$guess $prev - abs .000000001 >;
$guess export ;
125 root3 .
Not a seq in sight! And we may rewrite the function as a recursive function this way …
function; inner-root3;
if;
import $n = import $prev = $prev $n $prev sq / + .5 * $guess = $guess $prev - abs .000000001 >;
$guess $n inner-root3 $guess =;
$guess export;
function; root3;
import dup inner-root3 export ;
100 root3 .
In addition the current release adds the ++ and — increment and decrement operators.