RubyCLR and Avalon

Here’s a teaser screenshot:

The integral was defined by this Ruby code:

integral('a', 'b', 'f(x) dx')

The image that you see was rendered using the technology formerly known as Avalon. This is a part of the new sample application that will ship in the 3rd drop of RubyCLR (probably sometime tonight, or whenever I get enough time to type up a set of release notes). It will let you interactively create mathematical expressions in an Avalon application.

I used Valentin Iliescu’s most excellent Math.Equations library to do the heavy lifting. Most of the equations that you see are really custom layout panels. Valentin graciously agreed over lunch to let me ship his assembly (only 45K) along with RubyCLR so that you can see this stuff in action.

The domain specific language that I created for this sample is far from ideal; I gave myself a 1 day time window to create this sample, and I’ve run out of time. If anyone out there is interested in improving the DSL, go for it (and please share!).

Here’s an excerpt of the DSL that defines the paragraph in the screenshot:


text 'The first fundamental theorem of calculus states that, if ', expr('f')
text 'is continuous on the closed interval', expr('[a,b]'), 'and', expr('F')
text 'is the is the antiderivative (indefinite integral) of ', expr('f')
text 'on', expr('[a,b]'), ', then ', integral('a', 'b', 'f(x) dx = F(b) - F(a)'), '.'

You’ll need to have the February 2006 WinFX CTP to run the WPF sample (but you won’t need it to use any of the other code in the bridge).

Twitter Digg Delicious Stumbleupon Technorati Facebook Email

4 Responses to “RubyCLR and Avalon”

  1. I like this equation DSL idea. If you get it polished up some, it might be cool to have it emit LaTeX as an option – though, LaTeX formulas aren’t all that bad once you get used to it, so maybe it wouldn’t be used.
    Have you taken a look at LaTeX for inspiration for your Equation DSL?

  2. I spent some time a couple of years ago being traumatized by LaTeX. I wasn’t using it to format equations though, so I didn’t look at that stuff at all. I’m going to leave working on the equations DSL to anyone who’s interested. I’ve got my hands full trying to ship RubyCLR 1.0 :)

  3. BTW: where is that lighthouse located (in the photo above)?

  4. I forget exactly where – it’s along the coastline in central Oregon. I spent some time a few years ago doing some work at HP in Corvallis, and drove out to the coast after work one evening.