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

>  retractable? x == x pretend Boolean

This 'pretend' is much worse that CONSP.

Maybe is a low level domain, and it's one of the few "inline domains",
it's totally OK to have $Lisp calls.

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")))
>
> On 10 October 2017 at 19:38, oldk1331 <[email protected]> wrote:
>> On Tue, Oct 10, 2017 at 8:05 PM, Bill Page <[email protected]>
>> wrote:
>>>>> I think probably that  (NULL (NULL x)) is optimized by Lisp
>>>>> (at least by SBCL).
>>>>
>>>> Yes, but at Spad level, (CONSP X) is inlined, while
>>>> (NULL (NULL x)) is not inlined, which involves a ELT lookup
>>>> and a function call.
>>>>
>>>
>>> OK. I must not have measured what I thought I had measured.  Why is
>>> (NULL (NULL x)) not inlined? It looks like it should be easy.
>>
>> Probably because that is a nested call.  The current Spad compiler
>> is weak at optimization anyway.
>>
>
> --
> 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.
>

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

Reply via email to