November 2008 Archives

New blog for my Factor ramblings

| | Comments (0) | TrackBacks (0)
I have split off a new blog so that I can concentrate my concatenative nerdiness into one area and enhance it's effect. I have been hacking on the GSL bindings to Factor, specifically the Special Functions. What can I say, Bessel functions are like sirens that sing me to shipwreck...

 I finally have some tests which use the gsl_sf_result structure. Now I need to make the API more Factorish.

  • internally checking the return status and throwing an exception with the proper stringified error message
  • make the user oblivious to the gsl_sf_result struct and return value and error to the data stack
Any other suggestions?

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.

GSL for Factor

| | Comments (0) | TrackBacks (0)
Factor is a new language that is gaining momentum in the open source community. A few of the core members were in town visiting after the creator Slava gave a Google Tech Talk. Over beers and pizza at the Lucky Lab NW the Factor guys told me how FFI works and we had a binding to a Bessel function working within half an hour. It's that frickin' easy! 

Here is the gitweb for factor-gsl, which currently has support for all Bessel functions. 

To clone master repo:

git clone http://leto.net/code/factor.git

Example usage: 

( scratchpad ) USE: gsl.sf.bessel
( scratchpad ) 10 gsl_sf_bessel_J0 .
-0.2459357644513484

There are tests also, but the docs are still a bit rough. 

About this Archive

This page is an archive of entries from November 2008 listed from newest to oldest.

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

Clicky Web Analytics 42