up Inquisit Language Reference

list element

The list element is a general purpose class for storing and selecting any type of item.

Syntax

<list listname>
/ itemprobabilities = (value, value, value, ...] or [expression; expression; expression; ...] or distribution
/ items = (item item item item item item ...) or [expression; expression; expression;...]
/ maxrunsize = integer expression
/ not = (item item item item item item ...) or [expression; expression; expression]
/ poolsize = integer expression
/ replace = boolean
/ resetinterval = integer
/ selectionmode = selectionmode or expression
/ selectionrate = rate
</list>

Properties

list.listname.currentindex
list.listname.currentvalue
list.listname.itemcount
list.listname.itemprobabilities
list.listname.items
list.listname.maximum
list.listname.maxrunsize
list.listname.mean
list.listname.median
list.listname.minimum
list.listname.name
list.listname.nextindex
list.listname.nextvalue
list.listname.poolitems
list.listname.poolsize
list.listname.replace
list.listname.selectedcount
list.listname.selectionmode
list.listname.selectionrate
list.listname.standarddeviation
list.listname.typename
list.listname.unselectedcount
list.listname.variance

Functions

list.listname.appenditem
list.listname.clearitems
list.listname.indexof
list.listname.insertitem
list.listname.item
list.listname.removeitem
list.listname.reset
list.listname.resetselection
list.listname.setitem
list.listname.sort

Remarks

The list element is a data structure for storing ordered sets of items, whether they are strings, values, properties, expressions, or compbinations thereof. It also provides simple and powerful methods for retrieving items from the list. Retrieval can be filtered through built-in algorithms for sequential access and random selection with or without replacement according to uniform or normal distributions. Items can also be retrieved according to custom expressions. Items can also be directly accessed by index through properties or functions.

List can be created statically using the items attribute, or dynamically using the appenditem, insertitem, removeitem, and clearitems functions. An ordered list of integers can be quickly be created by setting the poolsize property. The values in the list will be null, but the currentindex and nextindex could be used for random selection of integers ranging from 1 to the poolsize.

A list can be used drive stimulus item selection by setting /select = list.listName.nextvalue or /select = list.listName.nextindex on the stimulus.

The list element provides a simpler and more predictable implementation of the functionality provided by the counter element and also introduced new functionality. Although the counter element will continue to function as it has, where possible script developers should the list element instead.

Examples

The following list stores a reverse sequence of numbers, selecting them in sequential order:

<list backwards>
/ items = (5, 4, 3, 2, 1)
/ selectionmode = sequence
</list>

The following randomly selects the name of a president without replacement:

<list presidents>
/ items = ("George Washington", "John Adams", "Thomas Jefferson")
</list>

The following selects a countdown of numbers:

<list countdown>
/ selectionmode = sequence
/ items = (3 2 1)
</list>

The following selects a value of 2 for odd numbered trials and 1 for even numbered trials:

<list evenodd>
/ selectionmode = sequence
/ items = [if ( floor(mod(block.test.currenttrialnumber, 2)) == 0 ) 1 else 2]
</list>

The following creates a list of 200 null values and randomly selects without replacement. All items are replaced after 10 blocks or after all of them have been selected.

<list stimulusTracker>
/ poolsize = 200
/ resetinterval = 10
</list>

<picture targetPics>
/ items = targetItems
/ select = list.stimulusTracker.nextindex
</picture>

Send comments on this topic:
Copyright Millisecond Software, LLC. All rights reserved.