Category:Factor: Difference between revisions

Content added Content deleted
Line 32: Line 32:


==About Factor examples on Rosetta Code==
==About Factor examples on Rosetta Code==
Most of the newer examples are meant to be copied and pasted directly into the listener (Factor's REPL) where they should run without issue. In order to deploy the examples to a binaries or run them as scripts, you'll need to put them in a vocabulary (e.g. <code>IN: myvocab</code> and set a <code>MAIN:</code> word which acts as the entry point for the program. If an example doesn't run, it probably means that the example only works in an older version of Factor. Most of the time, this is because certain words have been changed without maintaining backwards compatibility (e.g. <code>iota</code> became <code><iota></code> in Factor 0.98).
Most of the newer examples are meant to be copied and pasted directly into the listener (Factor's REPL) where they should run without issue. In order to deploy the examples to binaries or run them as scripts, you'll need to put them in a vocabulary (e.g. <code>IN: myvocab</code> and set a <code>MAIN:</code> word which acts as the entry point for the program. If an example doesn't run, it probably means that the example only works in an older version of Factor. Most of the time, this is because certain words have been changed without maintaining backwards compatibility (e.g. <code>iota</code> became <code><iota></code> in Factor 0.98).


For this reason, it is advised that examples use the <code>works with</code> template to indicate which version of Factor the example works with. For example,
For this reason, it is advised that examples use the <code>works with</code> template to indicate which version of Factor the example works with. For example,