List-class: A list extension class.

List-classR Documentation

A list extension class.

Description

Like a list, but has some methods. Completely superflous, but makes copying some code algorithms easier. We implement methods such as append, push, pop and each for iteration. As well, there are some lookup methods.

Arguments

...

passed to constructor

Methods

contains(name)

TRUE if name is key in array

core()

return list

each(FUN, ...)

Iterator for lists, like sapply, but FUN gets passed index, key, and value

flush(...)

Reset array, return contents as list

get_by_name(name)

get item under name

get_id()

Return an id, or name, for an object

get_item(index)

Get item by index

insert(x, name, index)

Insert item into List with 0 the head and index=len() the tail

len()

length

pluck(id, FUN, ...)

Like ext.pluck. Returns array with 'id' extracted from each item in the List

pop()

pop last element of list

push(x, name)

Append x with optional name. If name not specified new id created. Returns name


gWidgets2tcltk documentation built on March 18, 2022, 6:50 p.m.