Dear Karina!

Thank you very much.

Mahmood.



Karina Steffens wrote:

> Hi Mahmood,
>
> > What is the actual difference between Property Lists and Linear Lists.
>
> A linear list stores a bunch of "things", such as integers, strings,
> symbols, other lists - whatever you want really.
>
> For example:
> myList = ["Picard", 50, ["Kirk", "Spock"]]
>
> When you need to access one of the objects, you access it by it's position
> in the list.
>
> put myList[1]
> -- "Picard"
>
> put myList[3]
> --["Kirk", "Spock"]
>
> When the item stored in the list is another list, you can access it by first
> accessing the number of the item in the list (which is a list) and then then
> the number of the item in the list that you've just acccessed:
>
> x = myList[3]     --(that will be the list ["Kirk, "Spock"])
> y = myList[2]        --(that will be "Spock")
> put y
> --"Spock"
>
> Or much more easily:
> put myList[3][2]
> --"Spock"
>
> That's all very well, but when you write lst[2] and get the result of 50,
> what does it really tell you? You have to know what the second position in a
> list means.
> But say you had a list like this:
>
> property list:
> IdList = [#name: "Picard", #age: 50, #kids: ["Kirk", "Spock"]
>
> Each entry in the list is a "property", which is basically a variable that
> holds a value, so that the value of #name is "Picard" etc.
>
> put IdList[#name]
> --50
>
> You'd access it like this:
> put IdList[#age]
> --50
>
> put IdList[#name]
> --"Picard"
>
> put IdList[#kids]
> --["Kirk", "Spock"]
>
> put IdList[#kids][1]
> --["Kirk"]
>
> You're list suddenly becomes a mini database, where you can store and access
> records that actually mean something.
> And you can turn it into a real database by making a "super list", such as
> this:
>
> Database = [[#name: "Picard", #age: 50, #kids: ["Kirk", "Spock"], [#name:
> "Data", #age: 30, #kids: ["Spot"]]
>
> If you analise this list you'll see it's a bunch of different lists:
> first you have a linear list "Database", that holds two entries, each of
> these is a property lists.
>
> put Database[1]
> --[#name: "Picard", #age: 50, #kids: ["Kirk", "Spock"]
>
> put Database[2]
> --[#name: "Data", #age: 30, #kids: ["Spot"]
>
> Zooming in on one of these, you have a property list, with 3 properties
> (variables) that hold values.
> The first two are simple: the value of #name is "Picard"
> The third one is another list, this time linear: ["Kirk", "Spock"]
>
> So how do you access the entry "Kirk" in this super-list?
>
> put Database[1][#kids][1]
> --"Kirk"
>
> Likewise,
> put Database[2][#kids][[1]
> --"Spot"
>
> This makes lists, and especially property lists into a very powerful tools
> for programming.
>
> I just hope I didn't confuse you even more with all this :)
>
> Regards,
> Karina Steffens,
> Lead Programmer
>
> Martello Media Ltd.
> 4 Islington Avenue
> Sandycove
> Co. Dublin
>
> Tel: +353 1 2844668
> Fax: +353 1 2803195
> http://www.martellomm.ie
>
> [To remove yourself from this list, or to change to digest mode, go to
> http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
> email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
> Lingo-L is for learning and helping with programming Lingo.  Thanks!]


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to