john massey wrote:
Kerm,
I do not know how to use CODE tags. A little torturing, please


Select, aka "highlight", your code with your cursor, and then press the "Code" button. This will put the appropriate tags around your text.

*EDIT*
Btw Kerm, could you move this thread to the TIBasic subforum?
code works like any other tag:

[ code]

your code goes here

[ /code]

Should show you what we mean.

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(⌊TEMP6
⌊OVER1=⌊TEMP6(J
If not(sum(Ans
0→⌊TEMP6(J
Output(1,1,"JA
Output(1,4,J
Output(2,1,"OU
Output(2,5,⌊OVER1
Pause
ClrHome
End
SortD(⌊TEMP6
sum(⌊TEMP6≠0→dim(⌊TEMP6
SortA(⌊TEMP6
Output(1,1,"JA0
Output(1,4,J
Output(2,1,"OU
Output(2,5,⌊OVER1
Pause
ClrHome


These are the test results. All data displayed by output statements.

Results from first pass of For(J loop

J=1 OU {1,0,3,0,5,0,7,0,0,0,0,0,0,0,0,0}

Results from the second pass of the For(J loop

J=2 OU no change from above

Results from outside the ForJ loop

J=3 OU no change from above.

If I have made a mistake in the coding of this site code please advise

Thanks on the how to CODE

Just in case you do not understand {3,5}→⌊TEMP6

Thus on the first pass J should be 3 not 1 on the first pass and J should be 5 not 2 on the second pass
That code is correct - LTemp6 will be returned as {3,5}. If LTemp6 starts as {2,3,5} it will still be returned as {3,5}. I had forgotten to mention that LTemp6 will return the intersection and LOver1 won't be touched by the code.

Also, J will be 1 on the first pass and 2 on the second pass through the For loop. LTemp6(J) will be 3 on the first pass and 5 on the second pass.

Code:
1,0,3,0,5,0,7,0,0,0,0,0,0,0,0,0}→⌊OVER1
ClrHome
0→J
{3,5}→⌊TEMP6
For(J,1,dim(⌊TEMP6
⌊OVER1=⌊TEMP6(J
If not(sum(Ans
0→⌊TEMP6(J
Output(1,1,⌊TEMP6
Pause
ClrHome
End
SortD(⌊TEMP6
sum(⌊TEMP6≠0→dim(⌊TEMP6
SortA(⌊TEMP6
Output(1,1,"JA0
Output(1,4,J
Output(2,1,"OU
Output(2,5,⌊OVER1
Pause
ClrHome

Progress seems to come in small steps. I added 0→J when I checked J on the home screen it was 3. You should note that I checked TEMP6 with this:

Output(1,1,⌊TEMP6. The sort of good news that it showed {1,0,5,7} I was that 3 was removed but I have no idea where the 1 & 7 came from, since {3,5}→⌊TEMP6

The bad news is that the For(J loop made a single pass when I expected it to make two passes.

Edit #1 (post-merge by Kerm):

Code:
{1,0,3,0,5,0,7,0,0,0,0,0,0,0,0,0}→⌊OVER1
ClrHome
0→J
{3,5}→⌊TEMP6
For(J,1,dim(⌊TEMP6
⌊OVER1=⌊TEMP6(J
If not(sum(Ans
0→⌊TEMP6(J
Output(1,1,J
Output(1,5,⌊TEMP6
Pause
ClrHome
End
SortD(⌊TEMP6
sum(⌊TEMP6≠0→dim(⌊TEMP6
SortA(⌊TEMP6
Output(1,1,"JA0
Output(1,4,J
Output(2,1,"OU
Output(2,5,⌊OVER1
Pause
ClrHome

I made some changes in this post from the previous post. In The previous post I had

Output(1,1,⌊TEMP6 in this post I have

Output(1,1,J
Output(1,5,⌊TEMP6

Test data follows
In the first pass J=1 it should hold 3 and ⌊TEMP6 holds {3,5} when it should {5}
In the second pass J=2 it should hold 5 and ⌊TEMP6 holds {3,5} when it should hold {}

I would appear that we do not know yet, know how to remove elements from TEMP6

Edit #2 (post merge by Kerm):

Code:
{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 J=3:Stop
If ⌊TEMP6(1):⌊OVER1*(⌊OVER1≠J)→⌊OVER1
Output(1,1,"JA
Output(1,4,J
Output(2,1,"OV
Output(2,5,⌊OVER1
Pause
ClrHome
End


I would like to go back to an earlier version of the same problem. It can remove elements from a list. They are just the wrong elements. Wink

In the first pass J=1 so OVER1 holds {0,3,5,7} Assuming we could remove 3 from TEMP6 on the first pass I think we could have a Winner.

The fundamental question is how do we remove a specific element from a list from within a running program?

We do not need a specific solution we need a general solution. We need a solution that allows the user, of the program, to respond in ways that will result in this line element in the If statement ⌊TEMP6 having a large number of variations.
please please PLEASE use the button instead of making repeated posts in the same day when someone hasn't replied yet.

And I am sure someone will be along shortly to answer questions.
tifreak8x wrote:
please please PLEASE use the button instead of making repeated posts in the same day when someone hasn't replied yet.

And I am sure someone will be along shortly to answer questions.
Seconded. I just merged the triple post. Jon, the rule of thumb is to only post a new post if no one has responded for at least 24 to 36 hours. If you reply to yourself within less than 24 hours, that's called a "double-post" (or triplepost, or quadpost, etc), and is considered poor netiquette. If it's more than 24 to 36 hours, it's called a "bump" and is a legitimate way of reminding people about a topic they may have accidentally overlooked.
As I get older, I find myself more impatient. I guess it is because I want to get this difficult task completed and I have nothing, other this activity, to keep intellectually engaged during the day.

All that said, I apologize for what, until now, was an unknown protocol to me.
john massey wrote:

Edit #2 (post merge by Kerm):

Code:
{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 J=3:Stop
If ⌊TEMP6(1):⌊OVER1*(⌊OVER1≠J)→⌊OVER1
Output(1,1,"JA
Output(1,4,J
Output(2,1,"OV
Output(2,5,⌊OVER1
Pause
ClrHome
End


I would like to go back to an earlier version of the same problem. It can remove elements from a list. They are just the wrong elements. Wink

In the first pass J=1 so OVER1 holds {0,3,5,7} Assuming we could remove 3 from TEMP6 on the first pass I think we could have a Winner.

The fundamental question is how do we remove a specific element from a list from within a running program?

We do not need a specific solution we need a general solution. We need a solution that allows the user, of the program, to respond in ways that will result in this line element in the If statement ⌊TEMP6 having a large number of variations.


The one problem I see is right here:

Code:
If ⌊TEMP6(1):⌊OVER1*(⌊OVER1≠J)→⌊OVER1

Specifically, here:

Code:
⌊OVER1≠J

If you're comparing LOver1 to J, which is the loop counter, you're comparing LOver1 to the numbers 1 and 2, and 3 and 4 and so on if LTemp6 has more than two entries.
If you do this:

Code:
⌊OVER1≠LTemp6(J)

Then you'll be comparing LOver1 to the elements in LTemp6, i.e. 3 and 5 in this case.
So something like this would work fine, I think.

Code:
{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 J=3:Stop
If ⌊TEMP6(1):⌊OVER1*(⌊OVER1≠LTEMP6(J→⌊OVER1
Output(1,1,"JA
Output(1,4,J
Output(2,1,"OV
Output(2,5,⌊OVER1
Pause
ClrHome
End
SortD(⌊OVER1
sum((⌊OVER1≠0)→dim(⌊OVER1
SortA(⌊OVER1

Code:
ClrHome
0→J
{1,0,0,7}→⌊TEMP6
For(J,1,dim(⌊TEMP6
If J=5:Stop
If ⌊TEMP6(J)=0
End
Output(1,1,"JA
Output(1,4,J
Output(2,1,"TM
Output(2,5,⌊TEMP6
Pause
ClrHome
End
SortD(⌊TEMP6
sum((⌊TEMP6≠0)→dim(⌊TEMP6
SortA(⌊TEMP6
Output(3,1,⌊TEMP6
Pause
ClrHome


Sorry the code in the post above this post does not work

Here is something that does works. You can see that I have changed the values in TEMP6 from {3,5} to {1,0,0,7}
The next thing that is different is these two lines of code

If ⌊TEMP6(J)=0
End
will skip values where TEMP6 has "0"

The three lines of code after the end statement will remove the '0" from TEMP6
Resulting with TEMP6 holding {1,7}

There is just one thing necessary to get this program running and that is to transfer the values of 1,7 to OVER1. I do not know how to do that. Your assistance is requested.

After that we need to have code above this code that will when there are numerous values like {3,5} that code will convert them to 1,0,0,7}
john massey wrote:
these two lines of code

If ⌊TEMP6(J)=0
End
will skip values where TEMP6 has "0"

you need a "Then" in the line after the "If"

john massey wrote:

There is just one thing necessary to get this program running and that is to transfer the values of 1,7 to OVER1. I do not know how to do that. Your assistance is requested.

If you have something in OVER1 and want to add{1,7} to tha list, do this:

Code:
augment(LOVER1,{1,7})-->LOVER1


If you want OVER1 to become {1,7}, then just do this:

Code:
{1,7}-->LOVER1


john massey wrote:

After that we need to have code above this code that will when there are numerous values like {3,5} that code will convert them to 1,0,0,7}


I'm a bit confused.... can you explain?
I believe he wants it to work with all lists, but thats a good point if it is just this one list.

Also the
Quote:
john massey wrote:
these two lines of code

If ⌊TEMP6(J)=0
End
will skip values where TEMP6 has "0"

you need a "Then" in the line after the "If"


You can put an "End" after a lone "IF" statement to act as the usual end for the loop. Is that what you were trying to accomplish john?

Code:
⌊OVER1→⌊TEMP4
prgmTAKETEMP
0→W
0→dim(⌊TEMP6
For(W,1,dim(⌊TEMP4
If (prod(⌊JONL1-⌊TEMP4(W):⌊TEMP4(W→⌊TEMP6(dim(⌊TEMP6)+1
End
Output(1,1,⌊TEMP6
Pause
While 0:L3=TEMP6  L1=TEMP4  L2=JONL1  :End


Here is the code under discussion. It displays {3,5} in the modification it needs to be {1,0,0,7} prgmTAKETEMP removes the "0" from TEMP4. If you want it to test it is


Code:
SortD(⌊TEMP4
sum((⌊TEMP4≠0)→dim(⌊TEMP4
SortA(⌊TEMP4
john massey wrote:

Here is the code under discussion. It displays {3,5} in the modification it needs to be {1,0,0,7} prgmTAKETEMP removes the "0" from TEMP4. If you want it to test it is


Okay, what does LJONL1 contain? I don't see where that came from. Is that what Temp6 used to be ({3,5})?

I just tested this, the only fundamental differences are that it doesn't use the prod( token and it dumps the uncommon elements into LOver1, although you can change that pretty easily.


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

At the bottom of my post of 04 feb 2010 4:58 you will see

While 0: L3= TEMP6 L1=TEMP4 and L2= JONl1 : end
In the original post the author used L3, Li and L1.

I have had significant problems with integrating programs that used these L 1..L6. So to prevent that from happening I changed the L3 to TEMP6.

When I wrote the code I asked Kerm " is my translation correct"?and said yes.
It is my belief that all the lines of code in my origin post must remain in the new post until you get to the If statement. that originally produced TEMP6 to hold {3,5} and now wants to Produce {1,0,0,7} thus replacing 3 & 5 with "0s"
john massey wrote:
that originally produced TEMP6 to hold {3,5} and now wants to Produce {1,0,0,7} thus replacing 3 & 5 with "0s"



Code:
{1,0,3,0,5,0,7,0,0,0,0,0,0,0,0,0-->LOVER1
{3,5-->LTEMP6
:For(J,1,dim(LTEMP6
:LOVER1*(LOVER1!=LTEMP6(J))-->LOVER1
:End


Again, this is all you need to replace 3 & 5; you do not need another "If" statement.

Once these lines are run, you can remove the 0s by doing this:


Code:
SortD(LOver1
sum(LOver1≠0 -> dim(LOver1
SortA(LOver1

Code:
{1,0,3,0,5,0,7,0,0,0,0,0,0,0,0,0-->LOVER1
{3,5-->LTEMP6
:For(J,1,dim(LTEMP6
:LOVER1*(LOVER1!=LTEMP6(J))-->LOVER1
:End


There is one of thing that I do not understand about this code.

What we want to do here is to add "0s" to the present content of TEMP6 thus I do not understand this line of code

LOVER1*(LOVER1!=LTEMP6(J))-->LOVER1

Since this line of code appears to establish a final value in OVER1 and we need to have "0s" inserted where ever there were numbers in the original version of TEMP6

Temp6 should now hold {1,0,0,7}

The actual values of the contents of the first value of TEMP6 is determined by the child using the program.
john massey wrote:

LOVER1*(LOVER1!=LTEMP6(J))-->LOVER1

Since this line of appears to establish a final value in OVER1 and we need to have "0s" in inserted where ever there were numbers in the original version of TEMP6

Temp6 should now hold {1,0,0,7}


That's exactly what it does. Every element in OVER1 that equals TEMP6(J) is replaced with a "0". Try it for yourself Smile
When I ran your program I got on invalid dim error after the first line of code. When I checked OVER1 on the home screen. I got {1,3,5,7}

Should I do this or something else


Code:
ClrListLOVER1
SetUpEditorLOVER1
john massey wrote:
When I ran your program I got on invalid dim error after the first line of code. When I checked OVER1 on the home screen. I got {1,3,5,7}

Should I do this or something else


Code:
ClrListLOVER1
SetUpEditorLOVER1


Can you tell me exactly what you did? Could you show me specifically what code you ran?
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 3
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement