On 12 October 2017 at 22:02, oldk1331 <[email protected]> wrote: >> Since the 'Rep' is 'List' and true in Lisp (and >> in SPAD) is anything that is not 'nil' > > No. Boolean in SPAD should be a 2-object category, > aka 'false' and 'true', represented by NIL and T. >
I do not understand 'Boolean' as a category. The 'Boolean' domain satisfies the following categories: 'OrderedSet', 'Finite', 'Logic'. Thinking of Boolean as a category in the mathematical sense seems unnecessarily abstract. There is no reason that the two values in Boolean need to be represented internally by just two values. If that were the case then it would be appropriate also for Boolean to satisfy the category 'Canonical'. There is no evidence in the documentation for 'Boolean' that the authors intended this domain to be canonical. Instead, like many other domains in FriCAS it is quite normal for domains to be implemented as a quotient over their Rep. This means that equality in the domain is not the same as equality in its Rep. This is consistent with common Lisp. So far as I can see equality in 'Boolean' and the boolean operators themselves have been implemented so that False is represented by 'nil' and True is any other value just like in Lisp. >> retractable? x == x pretend Boolean > > This 'pretend' is much worse that CONSP. > In what sense? > Maybe is a low level domain, and it's one of the few "inline domains", > it's totally OK to have $Lisp calls. > Yes. I was just suggesting that calling Lisp functions is no different than making the assumption that the data values should be interpreted in the same manner as Lisp in which case this function has a slightly faster implementation. > On 10/12/17, Bill Page <[email protected]> wrote: >> If we are willing to admit a Lisp dependency in 'Maybe' calling CONSP >> isn't really needed. Since the 'Rep' is 'List' and true in Lisp (and >> in SPAD) is anything that is not 'nil', the best definition of >> 'wrap?/retractable?' is just >> >> retractable? x == x pretend Boolean >> >> Then >> >> if not retractable? m then error("too bad") >> >> generates inline code like: >> >> (COND ((NULL |m|) (|error| "too bad"))) >> -- 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 https://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.
