Serge D. Mechveliani wrote:
> 
> Please, how to add an user category instance for Integer ?

Currently in Spad once you define type it is final, so you
can not add new categories to existing type.

> I have
>   )abbrev category DPARSE DParse
>   DParse() : Category ==  Join(Type)  with
> 
>              dParseL : List String -> Product(%, List String)
> 
> and need to assert and implement the instance of  DParse  for Integer.
> After this, it must be possible to apply, for example,
> 
>   dParseL(["(", "I", "12", ")"])  : Product(Integer, List String)
>                                     --> (12, []) 
> 

I do not understand why having a package is not enough?  That
is:

)abbrev package DPARSE DParse

DParse(T : Type) : with
    dParseL : List String -> Product(T, List String)
 == add
  -- put implementation there

Normally we put operation in a domain if it is closely connected
with that domain.  But dParseL seem to be operation which
just happen to have Integer as type of a component of
returned value.

> May be, this needs to define a domain  Integer1  which includes
> Integer and adds the assertion and implementation of  DParse:
> 
>   )abbrev domain INTEGER1 Integer1
>   Integer1(): Exports == Implementation where
> 
>     Exports == DParse()  -- `with' ?
> 

      Exports == Join(IntegerNumberSystem, ConvertibleTo String, OpenMath,_
    Canonical, canonicalsClosed) with
         random   : % -> %
         DParse : List String -> Product(%, List String)

>     Implementation ==  Integer  add
> 
>        rep := Integer
>        dParseL(lexs : List String) : Product(%, List String) ==
>                            construct(0, []) $ Product(%, List String)
>                            --
>                            -- dummy implementation, for testing
> 
> Of course, this fails to compile.
> Can you, please, correct this?
> Thanks,
> 
> ------
> Sergei
> [email protected]
> 
> -- 
> 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.
> 
> 


-- 
                              Waldek Hebisch
[email protected] 

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

Reply via email to