I support the application of this patch and will commit it if I don't
hear any complaints until tonight.

In fact, (at least I know it from Aldor), the order of evaluation of the
arguments is unspecified, so if in the case of clisp it is evaluating
the second argument before the first, then this is still OK and the SPAD
code needs to be corrected as Qian has done.

Thanks, Qian.

Ralf

On 10/25/2017 02:01 PM, oldk1331 wrote:
> This bug happens with FriCAS built with clisp-2.49,
> a test failed in tensor.input, "Testcase: MonoidRing".
> 
> It should read 'r.first.exp' before the destructive 'reverse! r'.
> 
> The behavior of reverse! is different in clisp and sbcl.
> 
> https://github.com/oldk1331/fricas/commit/5dfe1d273f31fea51fccbf2c02cbd335ee195789.patch
> 
> diff --git a/src/algebra/free.spad b/src/algebra/free.spad
> index cb1072b4..39a7847e 100644
> --- a/src/algebra/free.spad
> +++ b/src/algebra/free.spad
> @@ -476,8 +476,9 @@ FreeGroup(S : SetCategory) : Join(Group,
> RetractableTo S) with
>              empty? r => makeMulti q
>              empty? q => makeMulti reverse! r
>              r.first.gen = q.first.gen =>
> -              setlast!(h := reverse! r,
> -                                [q.first.gen, q.first.exp + r.first.exp])
> +              -- read 'r.first.exp' before the destructive 'reverse! r'
> +              newexp := q.first.exp + r.first.exp
> +              setlast!(h := reverse! r, [q.first.gen, newexp])
>                makeMulti concat!(h, rest q)
>              makeMulti concat!(reverse! r, q)



-- 
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 fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
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