`define binsrch(v,s)=func :local t,b :{1,dim(s)}→b :While b[1]≤b[2] :int(mean(b))→t :If s[t]=v :Return t :t→b[iffn(s[t]<v,1,2)] :EndWhile :Return 0`

returns index if it exists or 0 if the number in not in the list ]]>

And I always thought that cumSum was useless. Where do you guys come up with this stuff? This is amazing…

EDIT: I forgot ask, but the TI-89 — I think when using a conditional statement, it considers neither 1 nor 0 to be true or false. If that makes any sense. Is there a way to get around this? It seems that a lot of programs rely on the fact that 0 is false and 1 is true.

]]>1. `L1=Ans:max(AnscumSum(not(0Ans`

2. `L1=Ans:max(AnscumSum(1 or Ans`

Using…

`startTmr→T For(X,1,3E3) max(L1cumSum(1 or L1 -or- not(0L1 End checkTmr(T`

…#2 was about 4 seconds^{†} faster than #1 over 3000 iterations on my 84+SE. The fact that #1 contained one more operation than #2 wasn't necessarily enough to validate this, but it offered incentive for me to investigate.

^{†}(This is dependent on `L1` being a list of five elements; one element sufficed to save just one second over 3000 iterations.)

Now, I'm almost certain that I will sit back and watch the wrong *slower* one being used, anyhow…

:max((L1=45)cumSum(binomcdf(dim(L1)-1,0

Sure it doesn't make sense, but it works. =)

This is what it looks like step by step, if you want to understand how it works:

max((L1=45)cumSum(binomcdf(dim(L1)-1,0

max(({23,76,45,99,129}=45)cumSum({1,1,1,1,1

max({0,0,1,0,0}*{1,2,3,4,5

max({0,0,3,0,0

3

Good luck!

]]>{23,76,45,99,129}

And I want to figure out which position like an item is. (Like 45 is 3)

How would I do that? ]]>