[ Non-logical Variables, Arrays, Bags, Shelves and Stores | Reference Manual | Alphabetic Index ]

# shelf_size(+ShelfHandle, -Size)

Get the number of slots of a shelf object

ShelfHandle
  A shelf handle or shelf name
Size
  A variable or integer (output)

## Description

Retrieves the fixed number of slots that the shelf was created with. The slots are numbered from 1 to Size.

Note: If ShelfHandle is not a handle, then it must be an atom or a compound term, and the shelf is identified by this term's toplevel functor together with the context module.

### Modes and Determinism

- shelf_size(+, -) is det

### Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

### Exceptions

(4) instantiation fault
  ShelfHandle is not instantiated
(5) type error
  ShelfHandle is not a shelf
(40) stale object handle
  ShelfHandle refers to an already destroyed shelf

## Examples

        ?- shelf_create(foo(0,0,0), Shelf),
           shelf_size(Shelf, Size).

        Shelf = $&(shelf,"36nzz7")
        S = 3
        Yes (0.00s cpu)

## See Also

shelf_create / 2, shelf_create / 3