On 23 April 2014 09:59, jiazhaoconga <[email protected]> wrote:
> On Wed, Apr 23, 2014 at 9:54 PM, Bill Page <[email protected]> wrote:
>> Strictly speaking the following commands to the interpreter
>>
>>      plus (f,g) == x+->f(x)+g(x)
>>
>> and
>>
>>      double n == n + n
>>
>> do not define functions but rather "modes".  A mode can stand for many
>> possible functions.
>>
>> On the other hand
>>
>>     plus(f:INT->INT,g:INT->INT):INT->INT == (x:INT):INT +-> f(x)+g(x)
>>
>> does define a function.
>>
>> Your interpreter example works for me if types are fully specified.
>
>
> Exactly, but I want the 'plus' to return a "mode" rather than a function,
> so that I can specialize it with different types later: I want to do not only
> h(4) but also h(3.5), as if I have defined h as 'h x == double x + double x'.
>

Hmmm... Acutally I really wouldn't expect this to work in the
interpreter given what I know about it's design, but it seems OK in
when using the compiler:

(3) -> h := plus2(double2,double2)$PLSPKG(FLOAT,FLOAT)

   (3)  theMap(PLSPKG;plus2;3M;1!0,655)
                                                       Type: (Float -> Float)
(4) -> h 3.5

   (4)  14.0
                                                                  Type: Float
(5) ->

-- 
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.

Reply via email to