Author Topic: How to filter elements in a list?  (Read 3608 times)

0 Members and 1 Guest are viewing this topic.

Offline blue_bear_94

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 801
  • Rating: +25/-35
  • Touhou Enthusiast / Former Troll / 68k Programmer
    • View Profile
How to filter elements in a list?
« on: August 29, 2013, 09:27:30 pm »
Suppose I have a list, say named R. I want every element less than 100 in R to appear in another list.

Even better, I have another named Q, and I'll need 2 lists, so that the elements in one list matches with the other.

For example:
R = {40, 230, 9, 102, 154, 308, 1}
Q = {1, 2, 3, 4, 5, 6, 7}
should give:
{40, 9, 1}
and
{1, 3, 7}
Due to dissatisfaction, I will be inactive on Omnimaga until further notice. (?? THP hasn't been much success and there's also the CE. I might possibly be here for a while.)
If you want to implore me to come back, or otherwise contact me, I can be found on GitHub (bluebear94), Twitter (@melranosF_), Reddit (/u/Fluffy8x), or e-mail (if you know my address). As a last resort, send me a PM on Cemetech (bluebear94) or join Touhou Prono (don't be fooled by the name). I've also enabled notifications for PMs on Omnimaga, but I don't advise using that since I might be banned.
Elvyna (Sunrise) 4 5%
TI-84+SE User (2.30 2.55 MP 2.43)
TI-89 Titanium User (3.10)
Casio Prizm User? (1.02)
Bag  東方ぷろの

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: How to filter elements in a list?
« Reply #1 on: August 29, 2013, 11:21:15 pm »
What kind of problems are you having developing an algorithm yourself?  Also depending on the application you are using it for, there might be some additional tricks that you could use if the restrictions were changed slightly.

Offline blue_bear_94

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 801
  • Rating: +25/-35
  • Touhou Enthusiast / Former Troll / 68k Programmer
    • View Profile
Re: How to filter elements in a list?
« Reply #2 on: August 29, 2013, 11:35:55 pm »
I'd like a fast way to do this. I can actually think of this:
For(B,1,dim(LR
LR(B
If Ans<E2
Then
Ans->LA(1+dim(LA
LQ(B->LB(1+dim(LB
End

I was wondering who could formulate a faster way.
Due to dissatisfaction, I will be inactive on Omnimaga until further notice. (?? THP hasn't been much success and there's also the CE. I might possibly be here for a while.)
If you want to implore me to come back, or otherwise contact me, I can be found on GitHub (bluebear94), Twitter (@melranosF_), Reddit (/u/Fluffy8x), or e-mail (if you know my address). As a last resort, send me a PM on Cemetech (bluebear94) or join Touhou Prono (don't be fooled by the name). I've also enabled notifications for PMs on Omnimaga, but I don't advise using that since I might be banned.
Elvyna (Sunrise) 4 5%
TI-84+SE User (2.30 2.55 MP 2.43)
TI-89 Titanium User (3.10)
Casio Prizm User? (1.02)
Bag  東方ぷろの

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: How to filter elements in a list?
« Reply #3 on: August 30, 2013, 02:18:54 am »
Hmm I can think of a couple different ways to *almost* do the same thing, but not quite :/