Groovy Science Begins

Hello, world! My name’s Ross Angle (in case you need to know that). I just finished setting up the About page, which explains what I intend to do with this blog. Now I intend to do a couple of specific things.

First off, I intend to tell you what I’m doing, why I’m doing it, and how I expect to go about doing it.

Groovy is a JVM-targeted, Java-compatible, Java-like programming language that supports, among other things, closures and operator overloading. That makes it a much more comfortable language for manipulating symbolic expressions. Developers of Java-only scientific libraries don’t have the luxury of that kind of syntactic sugar when they design their libraries, so many of those libraries’ interfaces could theoretically be overhauled for the Groovy programmer in order to take advantage of convenient first-class symbolic expressions. That said, certain Java libraries do trudge through the syntax and provide symbolic expression classes of their own. I plan to make a symbolic expression implementation supported by tools that make it easier for Groovy programmers to adapt it for use with new Java libraries as they come along. Right now, the project is called Groovy Science, but it might be better known at this point as Groovy Scientific Module, based on the name of my application.

The audience for this project is the set of people who want to use Java scientific libraries in Groovy in a less cumbersome way. These people are not necessarily interested in manipulating symbolic expressions themselves, so while the system should provide enough extensibility for them to adapt it to new Java libraries, there should usually be a ready-made solution handy for the most common use cases.

I’m working on this project for Google Summer of Code, and school starts again for me after the summer, so I have these few months to do what I can on this project before my time is severely limited. I’ve essentially broken down the tasks into four parts:

  1. Develop core classes (such as SymbolicExpression).
  2. Develop syntactic sugar for the easy creation of the core classes (using things like operator overloading and AST macros).
  3. Develop tools for manipulating symbolic expressions in perceived common ways (such as simplifying algebraic expressions).
  4. Actually apply these tools to existing Java libraries so that there is an immediate benefit for people who use those libraries in Groovy.

Unless my estimation is off, this list happens to be sorted in multiple ways at once: by priority (from most to least), and by ease of implementation (from most to least), and by dependence (where the later items depend significantly on features that fall somewhere in the items before). That makes it easy for me to build my timeline; I focus on the earlier things on the list until I have them completed enough that the next level is easy to shift to.

Now I’d like to tell you what I’ve been doing up until now.

My beginnings with the Google Summer of Code program have been embarrassingly slow. Linfield College doesn’t let out until the end of May, and the start date for GSoC is May 26th, the Monday before that. I was taking finals until Friday, and I was moving back to California over the weekend, so the first bit of time I could actually devote to the project was a few hours on Sunday, June 1. As if that weren’t enough, my parents and I found out that Sunday that my grandpa was having a big 80th birthday party that we couldn’t bear to miss. That occupied me on Thursday, Friday, and Saturday. Today, 13 business days into the project, is effectively the 7th or 8th day I’ve been able to work.

On the Sunday, Monday, and Tuesday of last week, I spent a lot of time essentially looking over my papers. I made sure I was signed up for the right mailing lists, I set up the accounts I needed to start contributing at the Codehaus, and I signed up for this blog so that I could give status reports (like this one).

For the rest of Tuesday and for all of Wednesday, I was at a roadblock in designing the SymbolicExpression class. I wanted (and still want) to eventually use AST macros to support a kind of Lisp-like quote syntax something like the following:

def twoXPlusTwo = differentiate( q{ x ** 2 + 2 * x + 1 }, q{ x } )

I thought it might be nice to use the AST objects as inspiration for the design the SymbolicExpression class, since an abstract syntax tree is essentially a kind of symbolic expression. Before I looked too deeply into that, however, I wanted to at least figure out how to make { it }.getMetaClass().getClassNode() return something other than null. At the end of Wednesday, I finally decided it wasn’t worth it to spend this much time researching something that could just as easily be added as an afterthought, and I started to make a simple SymbolicExpression implementation more along the lines of what my original idea was as I had proposed the project in the first place. A symbolic expression is simply an operator applied to a list of symbolic expressions, the way function application works in mathematics and in most programming languages. I only got about halfway to a stopping point before I had to leave to visit my grandpa.

When I was finally able to get back to work this Sunday, I finished up the mockup I had started, and I made sure that it worked. I realized I needed to contribute at least something to the repository, so that afternoon and for most of the day on Monday I set to work on commenting and fleshing out my mockup. I also turned my personal Groovy testing ground for that mockup into a full-fledged GroovyTestCase, and I thought was ready to upload. For whatever reason, I couldn’t.

I spent all of Tuesday (yesterday) trying to figure out how to upload the project to the SVN repository. Finally, at the end of the day, it worked. It’s available now for public criticism at

Today, I’ve spent quite a long time already just updating my blog… something like 7 hours… and I’m about to post my update to the gsoc-status mailing list.

In the next few days, I plan to implement some functionality for representing basic algebraic expressions, taking advantage of operator overloading, so that I can have a compelling example to show for documentation purposes. This is a specific application for symbolic manipulation (in that it doesn’t help with other symbolic things like document markup and parse trees), but it’s also an application I expect to be extremely in line with the goals of the project. Oh, and if I find out how to use AST macros the way I want to, I’ll probably get to work on that at some point, but I still might not have much to show until next week even if I find out today; AST macros would be nice, but I don’t see myself absolutely needing them for any other part of the project.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s