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.

Reply via email to