Re: Deleting last item of a List
Re: Deleting last item of a List
- Subject: Re: Deleting last item of a List
- From: kai <email@hidden>
- Date: Sat, 20 Nov 2004 15:45:45 +0000
On Sat, 20 Nov 2004 13:47:21 +0000, Nigel Garvey wrote:
I had a look in the AppleScript Language Guide this morning. It says:
[quote]
beginning | front
end | back
The beginning and front forms are equivalent and refer to the first
insertion point of the container (insertion point 1). The end and back
forms are equivalent and refer to the last insertion point of the
container (insertion point -1).
Although terms such as beginning and end sound like absolute positions,
they are relative to the existing contents of a container (that is,
before or after the existing contents).
[/quote]
The assertions of equivalence are wrong - at least, with regard to
AppleScript Language lists. "Front" and "back" can only be used
adjectivally and are equivalent to "first" and "last" respectively.
The "insertion point" idea is helpful though. Items can be inserted at
two points in a list: the beginning and the end. Strings don't have any
insertion points, so referring to one of them would cause an error.
;-)
Presumably, with a list, it's quicker to locate the element at or next
to
the 'end' insertion point than it is to identify the last of the list's
"items".
Interesting. There seems to be a contextual thing going on here in
terms of equivalence:
set l to {"a", "b", "c"}
l's end
--> "c"
l's last item
--> "c"
l's back
--> "c"
l's back item
--> "c"
set l's back item to "x" -- or: set l's last item to "x"
l
--> {"a", "b", "x"}
set l's back to "y" -- or: set l's end to "y"
l
--> {"a", "b", "x", "y"}
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden