Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
About
Team
Rules
Stats
Status
Sitemap
Chat
Downloads
Forum
News
Our Projects
Major Community Projects
Recent Posts
Unread Posts
Replies
Tools
SourceCoder3
Other Things...
Omnimaga Radio
TI-83 Plus ASM File Unsquisher
Z80 Conversion Tools
IES TI File Editor
Free RAM areas
Comprehensive Getkeyr table
URL Shortener
Online Axe Tilemap Editor
Help
Contact Us
Change Request
Report Issue/Bug
Team
Articles
Members
View the memberlist
Search For Members
Buddies
Login
Register
Omnimaga
»
Forum
»
Calculator Community
»
TI Calculators
»
TI-BASIC
»
Remove an Element from a List?
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: Remove an Element from a List? (Read 2797 times)
0 Members and 1 Guest are viewing this topic.
collechess
LV3
Member (Next: 100)
Posts: 93
Rating: +22/-2
Remove an Element from a List?
«
on:
June 02, 2011, 08:40:37 pm »
Is it possible to remove an element from a list so the following elements shift to fill in where it was? If so, how?
Logged
Ashbad
Guest
Re: Remove an Element from a List?
«
Reply #1 on:
June 02, 2011, 08:50:17 pm »
I don't believe there is a built-in way of doing so. However, one possible way of doing so would be if you created an intermediate list (one element smaller), and copied all of the cells before and all of the cells after into it.
Logged
Deep Toaster
So much to do, so much time, so little motivation
Administrator
LV13
Extreme Addict (Next: 9001)
Posts: 8217
Rating: +758/-15
Re: Remove an Element from a List?
«
Reply #2 on:
June 02, 2011, 08:56:58 pm »
Yeah, unfortunately there's no way do do it automatically. You could get by with something like this, but it's a bit slow for long lists.
Initial list (numbers 1 to 5):
Code: (TI-BASIC)
[Select]
:{1,2,3,4,5→L₁
Remove third element (leaves {1,2,4,5}):
Code: (TI-BASIC)
[Select]
:seq(L₁(I+(I≥3),I,1,4→L₁
«
Last Edit: June 02, 2011, 09:00:21 pm by Deep Thought
»
Logged
+1/-0 karm for this message
TIfanx1999
ಠ_ಠ ( ͡° ͜ʖ ͡°)
CoT Emeritus
LV13
Extreme Addict (Next: 9001)
Posts: 6173
Rating: +191/-9
Re: Remove an Element from a List?
«
Reply #3 on:
June 02, 2011, 09:01:27 pm »
Off the top of my head...
0 ->L1(element # you want to delete)
For I,1,dimL1
If L1(I)=0 and I!= dimL1
Then
L1(I+1)->L1(I)
0->L1(I+1)
End
End
If the elements don't need to be kept in order it's a bit easier,and I can post code for that as well. The above should work for what you are asking though. I haven't done any BASIC in a while so test it first.
Oh, and != means the not equal operator.
Logged
+1/-0 karm for this message
Print
Pages: [
1
]
Go Up
« previous
next »
Omnimaga
»
Forum
»
Calculator Community
»
TI Calculators
»
TI-BASIC
»
Remove an Element from a List?