Hi Ralf, Thanks for looking at this. As you suggest, I shall probably try using a SPAD wrapper in some way.
Paul On Sun, 10 Nov 2019 at 12:53, Ralf Hemmecke <[email protected]> wrote: > > Hello Paul, > > I'm not a compiler developer, but if you are not afraid of writing a > short spad program, then you can get around it, see attachment. > > )compile rec.spad > > > (2) -> x := makeRec(2,3) > > (2) [a = 3, b = 2] > Type: MyRec > (3) -> recA(x) > > (3) 3 > Type: PositiveInteger > (4) -> a := 0 > > (4) 0 > Type: NonNegativeInteger > (5) -> recA(x) > > (5) 3 > Type: PositiveInteger > > If you don't want to do this, you must wait for some smarter person that > tells you how to define getA in order to refer to the right a. > > I've found another workaround. > > (1) -> Z ==> Integer > Type: Void > (2) -> R ==> Record(a: Z, b: Z) > Type: Void > (3) -> makeR(x:Integer, y:Integer):R == [x,y] > Function declaration makeR : (Integer, Integer) -> Record(a: Integer > ,b: Integer) has been added to workspace. > Type: Void > (4) -> aForGetA := 'a > > (4) a > Type: Variable(a) > (5) -> getA(r:R):Integer == r.aForGetA > Function declaration getA : Record(a: Integer,b: Integer) -> Integer > has been added to workspace. > Type: Void > (6) -> r := makeR(3, 5) > Compiling function makeR with type (Integer, Integer) -> Record(a: > Integer,b: Integer) > > (6) [a = 3, b = 5] > Type: Record(a: Integer,b: Integer) > (7) -> getA(r) > Compiling function getA with type Record(a: Integer,b: Integer) -> > Integer > > (7) 3 > Type: PositiveInteger > (8) -> a := 0 > > (8) 0 > Type: NonNegativeInteger > (9) -> getA r > > (9) 3 > > > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/fricas-devel/75d8afcb-9fd6-900a-5b2e-7c22a096cf5f%40hemmecke.org. -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/CAN8qZzTp%3DuskMJD5jsUKHytEzQGJfCQWH_9D6t%2BHLfdcbcB%2BCw%40mail.gmail.com.
