[exprToUPS(fcn,false,"real:two sides").%series :: XXP]

in fs2ups:

   S ==>  String

     exprToUPS : (FE,B,S) ->  Result

       ++ The possible values of \spad{atanFlag} are \spad{"complex"},
       ++ \spad{"real: two sides"}, \spad{"real: left side"},
       ++ \spad{"real: right side"}, and \spad{"just do it"}.

I'm currently rebuilding.  Does anybody know how to make a tag into a
string?  The following does not work, of course...

)abbrev package TEST Test
Test(): with
         foo: Union("A", "B", "C") ->  String
         bar: Union("A", "B", "C") ->  Symbol
     == add
         foo x == x pretend String
         bar x == x pretend Symbol

If finding such bugs at compile time you'd have to have an enumeration type or do something like

MyATNFlags: with
    a: %
    b: %
    a?: % -> Boolean
    b?: % -> Boolean
  == add
    Rep := Integer
    a: % == 0
    b: % == 1
    a?(x: %): Boolean == rep(x) == 0
    b?(x: %): Boolean == rep(x) == 1

That is basically a union of finitely many predefined objects, or call it an Enumeration, if you like. Maybe a bit cumbersome to program, but typesafe.

I guess, you could even have something like this.

Flags(flags: List String): with
    flag: String -> %
    =: (%, %) -> Boolean
  == add
    Rep := Integer
    flag(s: String): % == for i in 1.. for f in flags repeat
                              if s = f then return per(i)
                          error "This is not a possible flag"
    (x: %) = (y: %) == rep(x) = rep(y)

As you see here, comparison is just done by comparing integers, not strings.

See, for example, OrderedVariableList, it uses the same trick.

http://github.com/hemmecke/fricas-svn/blob/015bd0ce641aadeeb14329cc1aad91071d8d1057/src/algebra/variable.spad.pamphlet#L17

Ralf

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