Fibonacci numbers (dc)
We store the 2 first Fibonacci numbers on the primary stack.
<<fib.dc>>= 0p 1p
The max value is stored in register S.
 Macro definition
A macro for calculating the next Fibonacci number is stored in register m.
The macro ends in a command to execute itself, if register S is greater than the number on top of the stack. This is how we implement loops in dc.
<<fib.dc>>= [sa d la + sr la lr p d lS >m]sm
 Running the macro
This command will execute the macro stored in register m.
 Running the script
This is how to execute this script:
Note: dc does not like extra carriage-return characters at end of line, so downloading it with Windows file encoding will give you some error messages.