Math::Farnsworth - A Turing Complete Language for Mathematics


  use Math::Farnsworth;
  my $hubert = Math::Farnsworth->new();

  my $result = $hubert->runString("10 km -> miles");

  my $result = $hubert->runFile("file.frns");

  print $result;


THIS IS A BETA RELEASE! There are typos in the error messages and in the POD. There are also probably plenty of bugs. It is being released early because there have been a number of people who have shown interest in having it released. Not every feature is documented yet and a future release will have that cleaned up along with some of the hairier parts of the internal API. Math::Farnsworth is a programming language originally inspired by Frink (see ). However due to certain difficulties during the creation of it, the syntax has changed slightly and the capabilities are also different. Some things Math::Farnsworth can do a little better than Frink, other areas Math::Farnsworth lacks.


Modules and Libraries you need before this will work


ALL of the methods here call die whenever something doesn't go right. This means that unless you want bad input to them to cause your program to fail you should wrap any calls to them with eval {}. When they call die they will give you back a message explaining what went wrong, this is useful for telling a user what they have done.


This method takes a string (or multiple strings) and executes them as Math::Farnsworth expressions. For more information on making Math::Farnsworth expressions, see Math::Farnsworth::Docs::Syntax.


This takes a file name and executes the entire file as a single Math::Farnsworth expression.


This takes a Math::Farnsworth::Value and turns it into a string for perl to be able to display. This method WILL disappear in a future version.


None by default.


At the moment all known bugs are related to badly formatted output, this will be rectified in a future release.


The following features are currently missing and WILL be implemented in a future version of Math::Farnsworth

  • Better control over the output

    • Adjustable precision of numbers

    • Better defaults for certain types of output

  • Passing arguments by reference

  • Syntax tree introspection inside the language itself

  • Better Documentation


Math::Farnsworth::Docs::Syntax Math::Farnsworth::Docs::Functions

There is also an RT tracker for the module (this may change) setup at, you can also reach the tracker by sending an email to <>


Ryan Voots <>


Copyright (C) 2008 by Ryan Voots

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.0 or, at your option, any later version of Perl 5 you may have available.