Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: trevmeister66 on November 16, 2007, 01:44:00 am

Title: List help
Post by: trevmeister66 on November 16, 2007, 01:44:00 am
What would be the fastest way to move every value in a list up one position in the list (thus deleting the last number in the list, and adding a new one at the beginning)?

Example:
{1,2,3,4,5->L1
//What would I do here?
#->L1(1
L1 = {#,1,2,3,4
Title: List help
Post by: JonimusPrime on November 16, 2007, 02:06:00 am
c1-->
CODE
ec1
Agument({#},L1->
dim(L1)-1->L1c2
ec2
that should do it but ti think I spelled that comand wrong.
Title: List help
Post by: DJ Omnimaga on November 16, 2007, 04:00:00 am
Augment*?
Title: List help
Post by: trevmeister66 on November 16, 2007, 09:46:00 am
Sweet it worked :)smile.gif Thanks.
Title: List help
Post by: Speler on November 16, 2007, 02:15:00 pm
No problem (See!  I can be helpful sometimes!)
Title: List help
Post by: JonimusPrime on November 17, 2007, 05:32:00 am
QuoteBegin-Super Speler+16 Nov, 2007, 20:15-->
QUOTE (Super Speler @ 16 Nov, 2007, 20:15)
No problem (See!  I can be helpful sometimes!)  

 Wait I posted the code Not you Speler?   :???:confus.gif
Title: List help
Post by: Speler on November 17, 2007, 06:56:00 am
I was posting in the wrong topic... sorry.
Title: List help
Post by: JoostinOnline on November 17, 2007, 09:16:00 am
QuoteBegin-Super Speler+17 Nov, 2007, 12:56-->
QUOTE (Super Speler @ 17 Nov, 2007, 12:56)
I was posting in the wrong topic... sorry.

Of course you were :angel:ange.gif
Title: List help
Post by: Harrierfalcon on November 17, 2007, 09:40:00 am
c1-->
CODE
ec1?List(cumSum(L1→L1c2
ec2(A lot faster during 100 repetitions) and smaller by 10 bytes.
Title: List help
Post by: simplethinker on November 17, 2007, 10:26:00 am
That cuts out the first element and doesn't add on a new one.

@trevmeister66, if you wanted to move everything down (left in your list) and cut off the first element and add a new number to the end(which is the exact opposite of what you're doing now) you can use c1-->
CODE
ec1?List(cumsum(augment(L1,{Nc2
ec2
which is 7 shorter.  All you would have to do is switch your list around.