use XList : script "XList"
on run
set an_iterator to XList's make_with({"a", "b", "c"})
repeat while an_iterator's has_next()
set an_item to next() of an_iterator
log an_item
end repeat
set a_queue to make XList
a_queue's unshift("a")
a_queue's unshift("b")
log a_queue's shift()
log a_queue's shift()
set a_stack to make XList
a_queue's push("a")
a_queue's push("b")
log a_queue's pop()
log a_queue's pop()
set a_list to XList's make_with({"a", "b", "c"})
log a_list's item_counts()
log a_list's item_at(2)
log a_list's has_item("b")
log a_list's has_item("d")
log a_list's index_of("b")
log a_list's index_of("d")
log a_list's delete_at(2)
log (set_item of a_list for "e" at 2)
log a_list's list_ref()
log a_list's as_text_with(", ")
set before_c to missing value
script block1
on do(x)
if (x is "c") then
return false
else
set before_c to x
return true
end if
end do
end script
an_iterator's each(block1)
log before_c
script block2
on do(x, sender)
if x is "b" then
tell sender
set_item_at("d", current_index())
end tell
end if
return true
end do
end script
an_iterator's enumerate(block2)
log an_iterator's all_items()
script block3
on do(x)
return x & "a"
end do
end script
log an_iterator's map(block3)
end run