[ 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
A shelf handle or shelf name
A variable or integer (output)


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


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


(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


    ?- 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