Monday, August 21, 2017

#1 2005-10-13 03:13:07 pm

From:: Malasaña, Madrid
Registered: 2002-11-20
Posts: 2014

What are "linked lists" and "vectors"?

These terms are part of the AppleScript language, are hidden to the public eyes, and are not for use. Also, they don't behave correctly and are not needed. So, just forget them or keep reading for fun...

I only find use for "linked list", under very particular circumstances. For example, you have a list of lists with a single member (a list, of course). If you coerce such list to "linked list", you will see such list of lists reduced to it's minimal expression (that is, "delete every list which has a single member"):


set x to {{{1, 2, 3}}} as linked list
--> {1,2,3}
set x to {{{{{1, 2, 3}, {4, 5, 6}}}}} as linked list
--> {{1, 2, 3}, {4, 5, 6}}

Teorically, both "linked list" and "vector" have only a "length" property, but they will behave just like a regular list (they accept, too, "reverse" and "rest" properties), except for some actions you can apply to it. For example, you can test this:


set x to {1, 2, 3}
set beginning of x to 6
--> {6, 1, 2, 3}

set y to {{1, 2, 3}} as linked list --> {1, 2, 3}
set beginning of y to 5

And you see that you will get an error in the last line (linked lists won't accept "set beginning" nor "set end" statements).

So, don't take worry more about these confusing terms.



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)