john massey wrote:
Kerm,
I do not know how to use CODE tags. A little torturing, please
{1,0,3,0,5,0,7,0,0,0,0,0,0,0,0,0}→⌊OVER1
ClrHome
{3,5}→⌊TEMP6
SortD(⌊OVER1
sum((⌊OVER1≠0)→dim(⌊OVER1
SortA(⌊OVER1
For(J,1,dim(⌊TEMP6
If ⌊TEMP6(1):⌊OVER1*(⌊OVER1≠J)→⌊OVER1
Output(1,1,"JA
Output(1,5,J
Output(2,1,"OV
Output(2,5,⌊OVER1
Pause
ClrHome
End
Test results JA is 1 not 3
Ov is {0,3,5,7). That part is working since it removed the first element in the list. The question is " how do we recover the values of 3 & 5 from TEMP6
Use the first two lines of rthprog's code. It works beautifully if you replase the = sign with a ≠ sign.
This is rthprog's code, it will return a list with 3 and 5 (i.e. the intersection of the lists)
Code: {1,0,3,0,5,0,7,0,0,0,0,0,0,0,0,0→⌊OVER1
ClrHome
{3,5→⌊TEMP6
augment(LOver1,LTemp6-->LA
LA*seq((1≠sum(not(LA-LA(X)))),X,1,dim(LA))-->LA
SortD(LA
sum(LA!=0)-->dim(LA
SortA(LA
This is your code, it will return 1 and 7 (in case you need the numbers that are not in the intersection)
Code: {1,0,3,0,5,0,7,0,0,0,0,0,0,0,0,0→⌊OVER1
ClrHome
{3,5→⌊TEMP6
For(J,1,dim(LOver1
LOver1*(LOver1≠LTemp6(J -> LOver1
SortD(LOver1
sum(LOver1≠0 -> dim(LOver1
SortA(LOver1
End
This is my solution that's based off of your code. It returns 3 and 5 (the intersection again)
Code: {1,0,3,0,5,0,7,0,0,0,0,0,0,0,0,0}→⌊OVER1
ClrHome
{3,5}→⌊TEMP6
For(J,1,dim(LTemp6
LOver1=LTemp6(J
If not(sum(Ans
0 -> LTemp6(J
End
SortD(LTemp6
sum(LTemp6≠0 -> dim(LTemp6
SortA(LTemp6
I hope some of that helps. Rthprog's code already works great, so I'm not really adding anything to that.