oldk1331 wrote:
> 
>    concat!(x : %, y : %) ==
>       Qnull x =>
>         Qnull y => x
>         Qpush(first y, x)
>         QRPLACD(x, rest y)$Lisp
>         x
>       z := x
>       while not Qnull Qrest z repeat
>         z := Qrest z
>       QRPLACD(z, y)$Lisp
>       x
> 
> First, if x is null, then Qpush and QRPLACD on x will have no effect.
> (3) -> x:=[]::List PI; concat!(x,[1]); x
> 
>    (3)  []

No:

(5) -> ll := concat!([]$List(Integer), [1, 2, -3])

   (5)  [1,2,- 3]
                                                          Type: List(Integer)

Qpush is a macro, so it assigns new value to x.  It seems that
we should simply have:

       Qnull x => y

For some reason somebody wanted to allocate fresh node for result,
but I see no reason to do this.

> 
> Second, the while loop is just 'tail'.
> 
> Finally, the whole function can just be replaced by
> NCONC(x,y)$Lisp

AFAICS:
1) this would be only place in algebra using NCONC
2) Spad code adds type declarations while Lisp NCONC needs
   to perform some runtime type checking, so Spad
   version should be more efficient (I do not know if
   it is, acutal efficiency depends on quality of Spad
   and Lisp compilers).

I think is is enough reasons to roll our own version.

-- 
                              Waldek Hebisch

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