On 04/23/2014 04:41 PM, jiazhaoconga wrote:
> For example, D(compose(f,g)) == compose(D(f),g) * D(g)
> [without mention independent variable 'x']
> which "*" is _*(f,g) == x+->f(x)*g(x)
FriCAS can do this easily, but the point is that FriCAS needs to know
about the types of f, g, D, and compose and *.
Even more, that all must fit together. As you have shown, you can easily
program such things in SPAD.
> And such high order functors should be generic, which take generic
> function as parameters and can return generic function as return value.
That cannot work. You are basically asking that the system delays
everything until you ask for a value. That is basically saying that all
you do is untyped and only when you evaluate types will be tried to
match. In other words, you basically move all the typing stuff from
compiletime to runtime. That's not how FriCAS works. FriCAS wants to
know all types at compiletime. That's the main difference to most of the
other CAS.
What you always can do is, to create a huge function space where all
your functions live and which exports certain functionality. Then you
can define higher order functions over that universe in a .spad file and
later use it. That would be the natural approach in FriCAS (IMHO).
The problem is in the design of FriCAS. Internally everything has a
type. So when you ask for "generic functions" which type would you
assign to such a function?
BTW, the interpreter is relaxing that strictness about type a bit.
Furthermore, in the interpreter (not in SPAD), you can define
foo(a,b)==a+b
perfectly fine, but foo("a","b") makes no sense. And that is only
because the interpreter delayed the definition of your function, because
no types were given.
For higher order function, the interpreter seems to have limitations.
Well, the interpreter has a lot of intelligence, but is sometimes wrong
or not intelligent enough.
Ralf
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.