On Sun, Mar 04, 2012 at 05:33:42PM -0500, Bill Page wrote: > On Sun, Mar 4, 2012 at 2:38 PM, Serge D. Mechveliani <[email protected]> wrote: > > On Sun, Mar 04, 2012 at 07:00:38PM +0100, Ralf Hemmecke wrote: > > ... > > [..] > > empty() == ["empty"] > > tree(n, l, r) == [[n, l, r]] > > ... > > > > 1. I wonder why ["empty"] is needed instead of "empty" > > (I mimiked this stupidly fron src/algebra/tree.spad*). > > Similarly is tree(n, l, r) == [[n, l, r]], > > -- as if additional [] coerces it to Rep. > > > > Then you should also wonder why two brackets are needed in [[n, l, r]]. > > The answer is clear from: > > (1) -> )show Union(empty : "empty", node : Record(val:INT, left:%, right:%)) > Union(empty: empty,node: Record(val: Integer,left: NIL,right: NIL)) > is a domain constructor. > ------------------------------- Operations -------------------------------- > > ?=? : (%,%) -> Boolean ?case? : (%,empty) -> Boolean > ?case? : (%,node) -> Boolean coerce : % -> OutputForm > construct : empty -> % ?.? : (%,empty) -> empty > ?~=? : (%,%) -> Boolean > construct : Record(val: Integer,left: NIL,right: NIL) -> % > ?.? : (%,node) -> Record(val: Integer,left: NIL,right: NIL) > > where NIL is shown read %. > > The notation [ ... ] is translated as a call to 'construct'.
Thank you. And this )show may be helpful. -- 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.
