GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Try online
  • GitLab
  • GitHub

This view

  • Original page
  • New address

GeezerVison is showing urn-lang.com — data/set | Urn

data/set

This module implements hash sets as backed by hash maps, optionally with a custom hash function.

(cardinality set)

Defined at lib/data/set.lisp:137:2

Return the number of elements in SET.

Example:

> (cardinality (set-of 1 2 3))
out = 3
> (cardinality (set-of 1 1 2))
out = 2

(disjoint? &sets)

Defined at lib/data/set.lisp:152:2

Is the intersection of SETS empty?

Example:

> (disjoint? (set-of 1 2 3) (set-of 3 4 5))
out = false
> (disjoint? (set-of 1 2 3) (set-of 4 5 6))
out = true

(element? set val)

Defined at lib/data/set.lisp:36:2

Check if VAL is an element of SET.

Example:

> (element? (set-of 1 2 3) 1)
out = true

(insert set &vals)

Defined at lib/data/set.lisp:67:2

Build a copy of SET with VALs inserted.

Example

> (insert (set-of 1 2 3) 4 5 6)
out = «hash-set: 1 2 3 4 5 6»

(insert! set &vals)

Defined at lib/data/set.lisp:48:2

Insert VALS into SET.

Example

> (define set (set-of 1 2 3))
out = «hash-set: 1 2 3»
> (insert! set 4)
out = «hash-set: 1 2 3 4»
> set
out = «hash-set: 1 2 3 4»

(intersection &sets)

Defined at lib/data/set.lisp:106:2

The set of values that occur in all the SETS.

Example:

> (intersection (set-of 1 2 3) (set-of 3 4 5))
out = «hash-set: 3»
> (intersection (set-of 1 2 3) (set-of 3 4 5) (set-of 7 8 9))
out = «hash-set: »

(make-set hash)

Defined at lib/data/set.lisp:6:2

Create a new, empty set with the given HASH-FUNCTION. If no hash function is given, make-set defaults to using object identity, that is, id.

Note: Comparison for sets also compares their hash function with pointer equality, meaning that sets will only compare equal if their hash function is the same object.

Example

> (make-set id)
out = «hash-set: »

(set->list set)

Defined at lib/data/set.lisp:176:2

Convert SET to a list. Note that, since hash sets have no specified order, the list will not nescessarily be sorted.

(set-of &values)

Defined at lib/data/set.lisp:164:2

Create the set containing VALUES with the default hash function.

Example:

> (set-of 1 2 3)
out = «hash-set: 1 2 3»

(union &sets)

Defined at lib/data/set.lisp:84:2

The set of values that occur in any set in the SETS.

Example:

> (union (set-of 1 2 3) (set-of 4 5 6))
out = «hash-set: 1 2 3 4 5 6»
> (union (set-of 1 2) (set-of 2 3) (set-of 3 4))
out = «hash-set: 1 2 3 4»

Undocumented symbols

  • $set Defined at lib/data/set.lisp:6:2
  • (set? set) Defined at lib/data/set.lisp:6:2

Tutorial

  • An Introduction to Urn
  • Guess the number
  • Finding errors
  • Macros and more
  • How do I do X?
  • Integrating with Lua
  • The compiler API

Reference

  • Syntax
  • Special forms
  • CLI
  • The REPL

Recent News

  • Version 0.7.0 released
  • Version 0.6.1 released
  • Version 0.6.0 released

All libraries

  • Symbol index
  • compiler/helpers
  • compiler
  • compiler/nodes
  • compiler/optimise
  • compiler/pass
  • compiler/pattern
  • compiler/resolve
  • control/comparison
  • control/prompt
  • control/setq
  • core/base
  • core/binders
  • core/demand
  • core/list
  • core/match
  • core/method
  • core/prelude
  • core/string
  • core/symbol
  • core/table
  • core/type
  • data/alist
  • data/bitset
  • data/format
  • data/function
  • data/graph
  • data/set
  • data/struct
  • io/argparse
  • io/foreign
  • io
  • io/term
  • lua/basic
  • lua/bit32
  • lua/coroutine
  • lua/debug
  • lua/io
  • lua/math
  • lua/os
  • lua/package
  • lua/string
  • lua/table
  • lua/utf8
  • luajit/bit
  • luajit/ffi
  • luajit/jit
  • math/bignum
  • math/bit32
  • math/complex
  • math
  • math/matrix
  • math/numerics
  • math/rational
  • math/vector
  • prelude
  • test/assert
  • test/check
  • test
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.