« Dvorak | Main | Amazon »

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

TrackBack

TrackBack URL for this entry:
http://www.bradediger.com/blog/mt-tb.cgi/12

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About

This page contains a single entry from the blog posted on April 20, 2007 9:42 AM.

The previous post in this blog was Dvorak.

The next post in this blog is Amazon.

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