[Haskell-cafe] The Q Programming Language can do symbolic manipulation -- Haskell?

Chris Kuklewicz haskell at list.mightyreason.com
Wed Aug 16 12:08:03 EDT 2006


Greg Buchholz wrote:
> Casey Hawthorne wrote:
>> The Q Programming Language can do the following:
>>
>> sqr X = X*X
>>
>> ==>sqr 5
>> 25
>>
>> ==>sqr (X+1) 
>> (X+1)*(X+1)
>>
>> Can Haskell do symbolic manipulation?
> 
>     Typeful symbolic differentiation of compiled functions
>     
>     http://www.haskell.org/pipermail/haskell/2004-November/014939.html
> 

And a GADT version of differentiation:

http://haskell.org/hawiki/ShortExamples_2fSymbolDifferentiation

which also does some simplifications.  I have a version that I did not post that 
uses the hs-plugins:  It can take a function like

f x = x * log x + 7 * (-x) + (2**x) - (sin x)

and compute the derivative, simplify it, emit the haskell code for it,  compile 
it via hs-plugins, and be able to use it.

Of course, you can't INLINE a new function like that, but the performance is 
still very good.


More information about the Haskell-Cafe mailing list