On 06/27/2016 11:14 AM, 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)  []

The specification in says:

http://fricas.github.io/api/UnaryRecursiveAggregate.html#l-unary-recursive-aggregate-concat

concat!: (%, %) -> % if % has shallowlyMutable
    concat!(u, v) destructively concatenates v to the end of u. Note:
concat!(u, v) = setlast!(u, v).

That makes only sense for me if u is nonempty. I think, it should be
explicitly written in the specification that "not empty? u" is required.
Otherwise the specification is wrong, no?

Anyway, "destructive" in FriCAS means that (some) argument may be
modified, but there is not "will be modified". So allowing "empty" as an
argument is OK, but then the specification is nonsense. Same problem
with the specification is in "setlast!".

"setrest!" at least mentions what happens in the empty case.

Ralf

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