new, set new
Full Description
swirl
Syntax
  new shelf-type? shelf-name (^string-expression)? insertion-point?
  set new shelf-type? shelf-name  (^ string-expression)? insertion-point?

Where:
shelf-type

    An optional herald, which can be counter, switch, or stream.

insertion-point
    A phrase describing where in the shelf the new item should be inserted. The insertion point is identified using the keywords before or after. If no insertion point is specified, the item is placed in the last position on the shelf.


Purpose

new inserts a new item onto a shelf and can only be invoked on shelves that have been declared variable:

  local counter x variable initial-size 0
  new x

By default, the new item is inserted after the last item on the shelf. You can insert the new item before or after another item:

  new x after item 2
  new x before key "fred"
  new x before lastmost

To make the new item the first item on the shelf, you can use before item 1 or after item 0.

A new item can be given a key as it is inserted:

  new x key "fred" before key "barney"
  new x key "wilma" after item 6 

The set new action combines the new and set actions into one action so that

  new x key "fred" before item 1
  set x key "fred" to 5
can be replaced with:
  set new x key "fred" before item 1 to 5

Copyright © OmniMark Technologies Corporation, 1988-1998.