Author Topic: The List Thread  (Read 4348 times)

0 Members and 1 Guest are viewing this topic.

Offline Speler

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 857
  • Rating: +6/-2
    • View Profile
The List Thread
« on: September 24, 2006, 04:02:00 pm »
Written for the 83/84/SE

From an earlier conversation today I noticed that alot of people have trouble with lists (Ok, I admit it, actually I just got really bored and decided to do something, but the conversation did occur).  Well here we go, feel free to post with comments, corrections and your own uses:

First of all, a list is a set of numbers with the ammount of numbers in the list accessable with dim(
    .  This can be altered with
[New number]->dim(
    .  You may access each individual variable in a list using
      (location of the value to be accessed.

      Now, many people are annoyed with the lack of useful commands available for lists, but with some creativity you can do anything.  For example, if you want to do something like inlist( just do seq(
        (X),X,
[First Value],[Last value] (pretty straitfoward) and for say inlist( you can do something like max(([value]=
    )seq(X,X,1,dim(
      .

      One of the nice things about lists is that they are the only variable that is actually user defined and is therefore very useful in highscores, storeing stats, levels, items and just about anything (in a game I am working on I store the levels to user defined lists and then archive them for use when they are necicary).

      Rather then use unarchive always use setUpEditor
        ,
          ,etc, which will not only unarchive it will also create the list if it does not exist (you can then test if it existed before by using dim(
            ).

            Another important command augment( which will put the two lists end to end.

            seq( is a command that is very useful in optimizing (as Weregoose demonstrated to me a while back).  Instead of writing something such as {1,2,3...,9,10 you can write seq(X,X,1,10 and instead of writing something such as {1,1,1... you can write seq(1,X,1,10.  Also you can make stuff like {1,1,1,1,2,2,2,2,3,3,3,3... with creative use of iPart(

            One common question of beginners is how to 'shuffle' a deck of cards stored to a list.  The following code is a common answer:

            rand(52->L1
            SortA([Deck],L1

            Yeah... umm...

            *Super Speler

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
The List Thread
« Reply #1 on: September 27, 2006, 01:43:00 am »
*PINS*
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline kalan_vod

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2715
  • Rating: +10/-0
    • View Profile
    • kalanrock.us
The List Thread
« Reply #2 on: September 27, 2006, 04:16:00 pm »
A nice intro to lists guide, I think many will find it useful .

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
The List Thread
« Reply #3 on: October 05, 2006, 02:23:00 pm »
yea it definetly is useful because I never knew of some of the things Super Speler has informed me of which is great
There are 10 types of people in this world-- those that can read binary, and those that can't.