Eduardo Cavazos <[email protected]> writes:
> Eduardo Cavazos wrote:
>
>> Below is a little session. The problem is example 1 from chapter 4.2
>> of Calculus by Gilbert Strang. This is a nice text and is available
>> online:
>>
>> http://ocw.mit.edu/ans7870/resources/Strang/strangtext.htm
>
> Here's an awesome GFDL licensed textbook,
> Vector Calculus by Michael Corral:
>
> http://www.mecmath.net
>
> I added a some examples and exercises from the text to the numero examples:
>
> http://github.com/dharmatech/numero/raw/master/symbolic/examples.scm
>
> Mainly just ones to test partial differentiation and the simplifier.
>
> Scheme+Emacs is funner than Mathematica any day. ;-) I'm thinking
> about an Emacs "notebook" mode whereby output "cells" in the text
> would be updated automatically when inputs are changed. Aziz is
> feeling queasy by now. :-)
>
> I'll be hitting the limits of the cheesy 'infix' parser I have soon so
> I may have to switch up to Aziz's; I checked it out, looks good.
>
> Finally, it would eventually be nice to use 'match' against R6RS
> records. PLTs matcher supports records. Not sure if there's any
> pattern matcher for R6RS which does. As a workaround, I could probably
> do something kludgly like (record->list ...) and match against that.
>
My rather simple algebraic-types library might be enough, here's a small
example extracted from real code:
(define-datatype <clause>
(after-clause (body))
(else-clause (body))
(range-clause (type start-test stop-test body))
(simple-clause (test body))
(arrow-clause (test expr)))
(cases <clause> clause
((simple-clause test body)
(opt-tests (list test) make-simple-clause body))
((range-clause type start-test stop-test body)
(opt-tests (list start-test stop-test)
(lambda args
(apply make-range-clause type args))
body))
(else
(continue (=> opt-clauses (cons clause opt-clauses)))))
Implementation is of `define-datatype' and `cases' is part of spells[0]
(see files spells/algebraic-types.sls and
spells/algebraic-types/helpers.sls).
[0] http://github.com/rotty/spells/tree/master
Happy Hacking, Rotty
--
Andreas Rottmann -- <http://rotty.yi.org/>