Category:Factor: Difference between revisions

Add blurb about running Factor examples
m (fix some inaccurate info)
(Add blurb about running Factor examples)
Line 30:
 
One of Factor's greatest strengths is its ability to factor words into smaller words. Due to the nature of concatenative programming, this is typically a cut and paste job that can be done almost anywhere there is whitespace. Factor also has impressive metaprogramming capabilities. Since Factor is almost entirely written in Factor, there is full introspection support, including seamless access to Factor's parser, allowing one to define new syntax. Factor also offers Lisp-style macros, and in general, Factor code can be treated like a collection ([https://en.wikipedia.org/wiki/Homoiconicity homoiconicity]).
 
==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 binary or run them as a script, 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,
<pre>{{works with|Factor|0.98}}</pre> becomes
{{works with|Factor|0.98}}
 
==Links==
1,808

edits