Running a Factor Script
For those who are put off by the interactive UI part of Factor, you can run a script from the command-line like so
#! /Users/leto/git/factor/factor -script
USING: gsl gsl.sf.result gsl.sf.bessel gsl.sf.log kernel tools.test ;
Note the space after the ! is necessary because every "word" in Factor must be separated by a space. The practice of running factor as a non-interactive script is not encouraged, but in certain situations it wins the day. The above script could be factored to take an argument of a subsystem to test and then I would make a key-binding in vim (or emacs or whatever) so that when I am editing a file and I type ,t it shows me the results of that subsystems tests.
All of this stuff can be done in the interactive UI, but I think people will fiddle with Factor more if they can easily bolt it onto their current workflow. People tend not to even try things that require totally changing their current tool chain. For me, I am editing the source of the GSL bindings in VIM, so having that script is invaluable. I hack on the source and whenever I change anything important I run the tests by hitting 2 keys. It is really important to make running and writing tests as easy as possible, or they won't get written at all.
Today ...... is a good day to hack.
Listed below are links to blogs that reference this entry: Running a Factor Script.
TrackBack URL for this entry: