« March 2007 | Main | June 2007 »

April 2007 Archives

April 20, 2007

Lisp from Rails

Rails-RLisp

The Rails-RLisp plugin is a bridge from Rails to Tomasz Wegrzanowski's RLisp language. Using this plugin, any files with an .rl extension will be compiled as RLisp instead of Ruby. These files can be weaved into your Rails app where you would normally use Ruby files.

Rails-RLisp is available from svn://svn.madriska.com/plugins/rlisp.

The plugin hacks Rails's Dependencies mechanism to autoload .rl files where needed.

.rl files will be compiled into Ruby files of the same name, with an .rlc (Ruby Lisp Compiled) extension. Files will automatically be recompiled if the corresponding .rl file is changed.

Example

1. Install the plugin:

$ script/plugin install svn://svn.madriska.com/plugins/rlisp

2. Create a test file, app/models/lisp_test.rl:

(defclass LispTest)
(class LispTest
  (method hello (name) 
    (print (+ "Hello, " [name to_s])))
  (method fib (x)
    (if (== x 0) 
      1
      (* x [self fib (- x 1)]))))

3. Test the class loading:

$ script/console 
Loading development environment.
>> LispTest.new.fib 12
=> 479001600
>> LispTest.new.hello "world"
Hello, world
=> nil

References

  1. RLisp Home Page
  2. Compiler for RLisp

About April 2007

This page contains all entries posted to Brad Ediger in April 2007. They are listed from oldest to newest.

March 2007 is the previous archive.

June 2007 is the next archive.

Many more can be found on the main index page or by looking through the archives.