This page is kept for historical purposes only. Please see the home page for my current situation. —Luca Saiu.


I can show you my solution, now that the deadline has expired. Here it is.

DEVL 2009 - Third TP (2009-10-06)

Task: write an expression simplifier.

Deadline: the end of the afternoon lab session.

No group projects for this without my authorization.


I have written some Scheme code for symbolically computing the derivative of an expression. The code is very similar to what I have sketched last week on the blackboard, with the only significant difference of using quasiquoting instead of the list function.

You can find the code here:

The code works, but produces very redundant expressions: for example (derivative '(* x a) 'x) returns (+ (* 1 a) (* 0 x)) instead of just a.

Your task consists in writing a function taking an expression (for example the result of a derivative call) and returning another equivalent but simpler expression. For example (+ 0 (* (sin x) 1)) should be trasformed into (sin x).

Execute this at the beginning, if you are in the lab:

source ~saiu/add-prefix ~saiu/usr
then you can use guile.

There are many possible solutions of varying complexity and power; I will take both point of views in consideration when assigning your bonus. Pay attention to copyright and license headers.

Back to my home page...

Luca Saiu
Last modified: 2009-10-15
Copyright © 2009 Luca Saiu
Verbatim copying and redistribution of this entire page are permitted provided this notice is preserved.