ATSLIB/libats/linset_avltree

This package implements linear sets based on the AVL-tree structure. Note that such sets are particularly efficient for supporting search operations.


  • set
  • set_vtype
  • compare_elt_elt
  • linset_nil
  • linset_make_nil
  • linset_sing
  • linset_make_sing
  • linset_is_nil
  • linset_isnot_nil
  • linset_is_member
  • linset_isnot_member
  • linset_copy
  • linset_free
  • linset_insert
  • linset_takeout
  • linset_takeout_opt
  • linset_remove
  • linset_takeoutmax
  • linset_takeoutmax_opt
  • linset_takeoutmin
  • linset_takeoutmin_opt
  • fprint_linset
  • fprint_linset$sep
  • linset_foreach
  • linset_foreach_env
  • linset_foreach$fwork
  • linset_listize
  • linset_listize1
  • linset_avltree_height

  • set

    Synopsis

    vtypedef set (a:t0p) = set_vtype (a)

    Description

    The type constructor set is a shorthand for set_vtype.

    set_vtype

    Synopsis

    absvtype set_vtype (a:t@ype+) = ptr

    Description

    Given a type T, the abstract viewtype set_vtype(T) is for a set storing elements of the type T. Note that set_vtype is co-variant in its type argument.

    compare_elt_elt

    Synopsis

    fun{a:t0p}
    compare_elt_elt (x1: a, x2: a):<> int

    Description

    This function is for comparing set elements.

    linset_nil

    Synopsis

    fun{} linset_nil{a:t0p} ():<> set(a)

    linset_make_nil

    Synopsis

    fun{} linset_make_nil{a:t0p} ():<> set(a)

    linset_sing

    Synopsis

    fun{a:t0p} linset_sing (x: a):<!wrt> set(a)

    linset_make_sing

    Synopsis

    fun{a:t0p} linset_make_sing (x: a):<!wrt> set(a)

    linset_is_nil

    Synopsis

    fun{}
    linset_is_nil {a:t0p} (xs: !set(INV(a))):<> bool

    linset_isnot_nil

    Synopsis

    fun{}
    linset_isnot_nil {a:t0p} (xs: !set(INV(a))):<> bool

    linset_is_member

    Synopsis

    fun{a:t0p}
    linset_is_member (xs: !set(INV(a)), x0: a):<> bool

    linset_isnot_member

    Synopsis

    fun{a:t0p}
    linset_isnot_member (xs: !set(INV(a)), x0: a):<> bool

    linset_copy

    Synopsis

    fun{a:t0p}
    linset_copy (!set(INV(a))):<!wrt> set(a)

    linset_free

    Synopsis

    fun{a:t0p}
    linset_free (xs: set(INV(a))):<!wrt> void

    linset_insert

    Synopsis

    fun{a:t0p}
    linset_insert
      (xs: &set(INV(a)) >> _, x0: a):<!wrt> bool

    linset_takeout

    Synopsis

    fun{a:t0p}
    linset_takeout
    (
      &set(INV(a)) >> _, a, res: &(a?) >> opt(a, b)
    ) :<!wrt> #[b:bool] bool(b) // endfun

    linset_takeout_opt

    Synopsis

    fun{a:t0p}
    linset_takeout_opt (&set(INV(a)) >> _, a):<!wrt> Option_vt(a)

    linset_remove

    Synopsis

    fun{a:t0p}
    linset_remove
      (xs: &set(INV(a)) >> _, x0: a):<!wrt> bool

    linset_takeoutmax

    Synopsis

    fun{a:t0p}
    linset_takeoutmax
    (
      xs: &set(INV(a)) >> _, res: &a? >> opt(a, b)
    ) :<!wrt> #[b:bool] bool (b)

    linset_takeoutmax_opt

    Synopsis

    fun{a:t0p}
    linset_takeoutmax_opt (xs: &set(INV(a)) >> _):<!wrt> Option_vt(a)

    linset_takeoutmin

    Synopsis

    fun{a:t0p}
    linset_takeoutmin
    (
      xs: &set(INV(a)) >> _, res: &a? >> opt(a, b)
    ) :<!wrt> #[b:bool] bool (b)

    linset_takeoutmin_opt

    Synopsis

    fun{a:t0p}
    linset_takeoutmin_opt (xs: &set(INV(a)) >> _):<!wrt> Option_vt(a)

    fprint_linset

    Synopsis

    fun{a:t0p}
    fprint_linset (out: FILEref, xs: !set(INV(a))): void

    fprint_linset$sep

    Synopsis

    fun{}
    fprint_linset$sep (FILEref): void // ", "

    linset_foreach

    Synopsis

    fun{a:t0p}
    linset_foreach (set: !set(INV(a))): void

    linset_foreach_env

    Synopsis

    fun{
    a:t0p}{env:vt0p
    } linset_foreach_env
      (set: !set(INV(a)), env: &(env) >> _): void

    linset_foreach$fwork

    Synopsis

    fun{
    a:t0p}{env:vt0p
    } linset_foreach$fwork
      (x: a, env: &(env) >> _): void

    linset_listize

    Synopsis

    fun{a:t0p}
    linset_listize (xs: set(INV(a))): List0_vt (a)

    linset_listize1

    Synopsis

    fun{a:t0p}
    linset_listize1 (xs: !set(INV(a))): List0_vt (a)

    linset_avltree_height

    Synopsis

    fun{a:t0p}
    linset_avltree_height (!set(INV(a))):<> intGte (0)

    Description

    Given a set xs represented by some AVL-tree, this function returns the height of the tree.
    This page is created with ATS by Hongwei Xi and also maintained by Hongwei Xi. SourceForge.net Logo