"Serge D. Mechveliani" <[email protected]> writes: > On Tue, Mar 13, 2012 at 11:24:02AM +0100, Ralf Hemmecke wrote: >> Hi Sergei, >> >> last night I was thinking a bit of a good design for a generic interface >> to any external program not only Haskell. >> [..] >> For the input I see two approaches. >> >> 1) FriCAS basically already gets a collection of strings that contains >> the expression already in a tree form. Then the task would be to turn >> the tree form into an element of the requested type. >> >> 2) FriCAS gets a big string of input, with enough information about >> types. Then the respective type is asked to parse the string where for >> subparts this parsing procedure might (actually should) delegate parts >> of the parsing to "subtypes" of the corresponding type. ("Subtype" is >> somewhat wrong, what I mean is that for example Fraction(Integer) >> delegates part of the parsing to Integer). >> >> I believe that (2) is more flexible, but I somehow get headaches, when I >> think about where to implement the parsing of >> >> gcd(2,3) >> >> if it is known that 2 and 3 are of type Integer? For gcd it might be >> easy to have this implemented in Integer. But what about such functions >> as >> >> zero?(3) >> >> does it belong to Integer or to Boolean or to none of both?
I didn't follow the discussion too closely, but I believe I thought about a similar problem a long time ago. I am very much convinced that in the end FriCAS needs a domain InputForm that leaves no ambiguity, that is, every call has to be fully specified. (Possibly with the exception of a very few types like integer, float, string. Note that the domain exists, but most domains abuse it.) Then it would be up to the calling program to * either do the parsing itself and provide a datastructure usable by InputForm * or let FriCAS do the parsing. Furthermore, every domain in FriCAS having InputForm could communicate well with such programs. (There are domains where providing InputForm is almost impossible in general, eg. Stream) This would help also the Sage interface. All the best, Martin -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/fricas-devel?hl=en.
