[Maxima-commits] Maxima, A Computer Algebra System branch master updated. 765607874d66159c08ac5b1345e8863688645a31
Subject: [Maxima-commits] Maxima, A Computer Algebra System branch master updated. 765607874d66159c08ac5b1345e8863688645a31
From: Dieter Kaiser
Date: Sun, 30 Oct 2011 00:36:04 +0200
Am Samstag, den 29.10.2011, 09:26 -0700 schrieb Raymond Toy:
> On 10/29/11 9:09 AM, Andreas Eder wrote:
> > This is an automated email from the git hooks/post-receive script. It was
> > generated because a ref change was pushed to the repository containing
> > the project "Maxima, A Computer Algebra System".
> >
> > The branch, master has been updated
> > via 765607874d66159c08ac5b1345e8863688645a31 (commit)
> > via 8333a526386da6b3e60df9f3f9e285aea13cf615 (commit)
> > from a2674edd749bb03ac09876bef3ee60ecbe60e422 (commit)
> >
> > Those revisions listed above that are new to this repository have
> > not appeared on any other notification email; so we list those
> > revisions in full, below.
> >
> >
> > replace remred by cl function delete-duplicates
> >
> >
> > diff --git a/src/solve.lisp b/src/solve.lisp
> > index 9c0cdc2..075b2fb 100644
> > --- a/src/solve.lisp
> > +++ b/src/solve.lisp
> > @@ -906,7 +906,7 @@
> > (defmfun $linsolve (eql varl)
> > (let (($ratfac))
> > (setq eql (if ($listp eql) (cdr eql) (ncons eql)))
> > - (setq varl (if ($listp varl) (remred (cdr varl)) (ncons varl)))
> > + (setq varl (if ($listp varl) (delete-duplicates (cdr varl)) (ncons varl)))
> > (do ((varl varl (cdr varl)))
> > ((null varl))
> > (when (mnump (car varl))
> > @@ -915,11 +915,6 @@
> > (make-mlist-simp)
> > (solvex (mapcar 'meqhk eql) varl (not $programmode) nil))))
> >
> > -;; REMRED removes any repetition that may be in the variables list
> > -;; The NREVERSE is significant here for some reason?
> > -
> > -(defun remred (l) (if l (nreverse (union1 l nil))))
> > -
> >
> Is this change correct? delete-duplicates doesn't seem to be the same
> as remred since remred reverses the result of union1. I did not check
> to see what union1 does, though. Perhaps it puts things in reverse so
> nreverse puts them back in the same order?
At least, for SBCL the functions can return the elements in a different
order:
(remred '(a b a c b)) -> (A B C)
(delete-duplicates '(a b a c b)) -> (A C B)
I think it is necessary to use the keyword :from-end
(delete-duplicates '(a b a c b) :from-end t) -> (A B C)
In addition I think the test function must be #'equal to get an
equivalent result:
(remred '(((mplus) a b) ((mplus) a b)))
(((MPLUS) A B))
(delete-duplicates '(((mplus) a b) ((mplus) a b)) :from-end t)
(((MPLUS) A B) ((MPLUS) A B))
(delete-duplicates '(((mplus) a b) ((mplus) a b)) :test
#'equal :from-end t)
(((MPLUS) A B))
Perhaps there are some further slightly differences.
Dieter Kaiser