list based programming
- Subject: list based programming
- From: Edwin Woollett
- Date: Tue, 22 Dec 2009 17:07:33 -0800
Thanks for the "heads up" on copylist.
(%i1) load(dirac);
(%o1) "c:/work3/dirac.mac"
(%i2) d1 : [si,be,la,al,p,al];
(%o2) [si,be,la,al,p,al]
(%i3) g1 : [be,rh,ta];
(%o3) [be,rh,ta]
(%i4) g2 : copylist(g1);
(%o4) [be,rh,ta]
(%i5) rr:simp_ddgL (d1,g1);
(%o5) [1,[p,la],[si,rh,ta]]
(%i6) g11 : rr[3];
(%o6) [si,rh,ta]
(%i7) g2;
(%o7) [be,rh,ta]
------------------------------------------
> < /* make a copy of g1 for later use */
> <
> < (%i4) g2 : g1;
>
> Try
> g2 : copylist(g1);
> instead. Your assignment creates g2 as an alias for g1,
> whereas you want to copy g1.
> Leo
>
> < (%o4) [be,rh,ta]
> < (%i5) g2;
> < (%o5) [be,rh,ta]
> <
> < /* now call simp_ddgL */
Ted Woollett