## scl - Single Linked Cell List

### Module Description

The scl module implements a single linked list that can store cell wide data.

### Module Words

#### List structure

scl% ( -- n )
  Get the required space for a scl variable

#### List creation, initialisation and destruction

scl-init ( scl -- )
  Initialise the scl list
scl-(free) ( scl -- )
  Free the nodes from the heap
scl-create ( "<spaces>name" -- ; -- scl )
  Create a named scl list in the dictionary
scl-new ( -- scl )
  Create a new scl list on the heap
scl-free ( scl -- )
  Free the list from the heap

#### Member words

scl-empty? ( scl -- flag )
  Check for an empty list
scl-length@ ( scl -- u )
  Get the number of nodes in the list
scl-compare! ( xt scl -- )
  Set the compare execution token for sorting the list
scl-compare@ ( scl -- xt )
  Get the compare execution token for sorting the list

#### List words

scl-clear ( scl -- )
  Delete all nodes from the list
scl-append ( x scl -- )
  Append the cell data x in the list
scl-prepend ( x scl -- )
  Prepend the cell data x in the list

#### Index words

scl-index? ( n scl -- flag )
  Check if the index n is valid for the list
scl-set ( x n scl -- )
  Set the cell data x in the nth node in the list
scl-get ( n scl -- x )
  Get the cell data x from the nth node in the list
scl-insert ( x n scl -- )
  Insert cell data x at the nth node in the list
scl-delete ( n scl -- x )
  Delete the nth node from the list, return the cell data from the deleted node

#### Special words

scl-count ( x scl -- u )
  Count the number of occurrences of the cell data x in the list
scl-execute ( i*x xt scl -- j*x )
  Execute xt for every cell data in list
scl-reverse ( scl -- )
  Reverse or mirror the list

#### Search words

scl-find ( x scl -- n )
  Find the first index for cell data x in the list, -1 for not found
scl-has? ( x scl -- flag )
  Check if the cell data x is present in the list
scl-remove ( x scl -- flag )
  Remove the first occurrence of the cell data x from the list, return success

#### Sort words

scl-insert-sorted ( x scl -- )
  Insert the cell data x sorted in the list

#### Inspection

scl-dump ( scl -- )
  Dump the list

generated 03-Jun-2010 by ofcfrth-0.10.0