R/00-generic.R

setGeneric('hash_exists', function(h, keys) standardGeneric('hash_exists'))
setGeneric('hash_keys', function(h) standardGeneric('hash_keys'))
setGeneric('hash_values', function(h, keys = NULL) standardGeneric('hash_values'))
setGeneric('hash_size', function(h) standardGeneric('hash_size'))
setGeneric('hash_insert', function(h, keys, ...) standardGeneric('hash_insert'))
setGeneric('hash_delete', function(h, keys) standardGeneric('hash_delete'))
setGeneric('hash_copy', function(h) standardGeneric('hash_copy'))

#' Generic functions
#' 
#' @name generic
#' @rdname generic
#' @aliases hash_copy
#' @aliases hash_delete
#' @aliases hash_exists
#' @aliases hash_insert
#' @aliases hash_keys
#' @aliases hash_size
#' @aliases hash_values
#' 
#' @details
#' There are the following generic functions:
#' - `hash_exists(h, keys)`: tests whether keys exist.
#' - `hash_keys(h)`: returns a vector of keys.
#' - `hash_values(h, keys = NULL)`: returns a vector of values.
#' - `hash_size(h)`: returns the size of the hash table or hash set.
#' - `hash_insert(h, keys, ...)`: inserts new keys or modify values for existing keys.
#' - `hash_delete(h, keys)`: deletes keys.
#' - `hash_copy(h)`: makes a copy of the hash table or hash set.
#' 
#' They can be used on the hash object created by [`hash_table()`], [`hash_set()`], [`hash_fm_table()`], [`hash_fm_set()`], [`hash_env_table()`], [`hash_env_set()`].
#' 
#' @return
#' `hash_exists()` returns a logical vector. `hash_keys()` returns a character vector. `hash_values()` returns a single vector or a list.
#' `hash_size()` returns an integer scalar. `hash_insert()`, `hash_delete()` and `hash_copy()` all return a hash table object.
NULL

Try the hashtable package in your browser

Any scripts or data that you put into this service are public.

hashtable documentation built on July 27, 2026, 5:09 p.m.