Running a Factor Script

| | Comments (0) | TrackBacks (0)
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 ;

"gsl.sf" 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.

0 TrackBacks

Listed below are links to blogs that reference this entry: Running a Factor Script.

TrackBack URL for this entry:

Leave a comment

About this Entry

This page contains a single entry by Jonathan Leto published on November 6, 2008 7:32 AM.

GSL for Factor was the previous entry in this blog.

New blog for my Factor ramblings is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Clicky Web Analytics 42