Modulinos: Difference between revisions

Content added Content deleted
(Use 'lifemain')
(→‎{{header|Factor}}: Show how to ./factor run=fibonacci)
Line 308: Line 308:
MAIN: first-15</lang>
MAIN: first-15</lang>


One can run the main program in the listener:
One can run the main program from the listener:


<pre>( scratchpad ) "fibonacci" run
<pre>( scratchpad ) "fibonacci" run
Loading resource:work/fibonacci/fibonacci.factor
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377</pre>

One can also run the main program as a script:

<pre>$ ./factor run=fibonacci
Loading resource:work/fibonacci/fibonacci.factor
Loading resource:work/fibonacci/fibonacci.factor
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377</pre>
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377</pre>
Line 319: Line 325:
( scratchpad ) 20 fib .
( scratchpad ) 20 fib .
6765</pre>
6765</pre>

However, nothing happens if you run it as a script (<tt>./factor work/fibonacci/fibonacci.factor</tt>), because there is no code to call the main entry point.


=={{header|Haskell}}==
=={{header|Haskell}}==