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/bitset | Urn

data/bitset

This module implements bit sets

(bitsets-and x y)

Defined at lib/data/bitset.lisp:260:2

Performs a logical AND between two bitsets and returns the result as a new bitset

Example:

> (define a (make-bitset))
out = «bitset: »
> (define b (make-bitset))
out = «bitset: »
> (set-bit! a 2)
out = nil
> (set-bit! b 2)
out = nil
> (bitsets-and a b)
out = «bitset: 00000004»

(bitsets-or x y)

Defined at lib/data/bitset.lisp:288:2

Performs a logical OR between two bitsets and returns the result as a new bitset

Example:

> (define a (make-bitset))
out = «bitset: »
> (define b (make-bitset))
out = «bitset: »
> (set-bit! a 0)
out = nil
> (set-bit! b 1)
out = nil
> (bitsets-or a b)
out = «bitset: 00000003»

(bitsets-xor x y)

Defined at lib/data/bitset.lisp:322:2

Performs a logical XOR between two bitsets and returns the result as a new bitset

Example:

> (define a (make-bitset))
out = «bitset: »
> (define b (make-bitset))
out = «bitset: »
> (set-bit! a 0)
out = nil
> (set-bit! a 1)
out = nil
> (set-bit! b 1)
out = nil
> (bitsets-xor a b)
out = «bitset: 00000001»

(cardinality bs)

Defined at lib/data/bitset.lisp:210:2

Returns the number of set bits in the bitset BS

Example:

> (define bs (make-bitset))
out = «bitset: »
> (set-bit! bs 1)
out = nil
> (set-bit! bs 4)
out = nil
> (cardinality bs)
out = 2

(clear-bit! bs bit)

Defined at lib/data/bitset.lisp:92:2

Clears the bit in the bitset BS with the specified index BIT

> (define bs (make-bitset))
out = «bitset: »
> (set-bit! bs 5)
out = nil
> bs
out = «bitset: 00000020»
> (clear-bit! bs 5)
out = nil
> bs
out = «bitset: 00000000»

(flip-bit! bs bit)

Defined at lib/data/bitset.lisp:131:2

Inverts the value of the bit in the bitset BS with the specified index BIT

Example:

> (define bs (make-bitset))
out = «bitset: »
> (flip-bit! bs 2)
out = nil
> bs
out = «bitset: 00000004»
> (flip-bit! bs 2)
out = nil
> bs
out = «bitset: 00000000»

(get-bit bs bit)

Defined at lib/data/bitset.lisp:54:2

Returns the value of the bit in the bitset BS with the specified index BIT

Example:

> (define bs (make-bitset))
out = «bitset: »
> (set-bit! bs 5)
out = nil
> (get-bit bs 5)
out = true

(intersects x y)

Defined at lib/data/bitset.lisp:233:2

Tests if two bitsets share any of the same set bits

Example:

> (define a (make-bitset))
out = «bitset: »
> (define b (make-bitset))
out = «bitset: »
> (set-bit! a 2)
out = nil
> (set-bit! b 2)
out = nil
> (intersects a b)
out = true

(make-bitset other)

Defined at lib/data/bitset.lisp:28:2

Creates a new, empty bitset

(next-clear-bit bs start)

Defined at lib/data/bitset.lisp:181:2

Finds the next clear bit in the bitset BS after the index START. If no clear bit is found, -1 is returned

Example:

> (define bs (make-bitset))
out = «bitset: »
> (set-bit! bs 0)
out = nil
> (set-bit! bs 1)
out = nil
> (next-clear-bit bs 0)
out = 2

(next-set-bit bs start)

Defined at lib/data/bitset.lisp:154:2

Finds the next set bit in the bitset BS after the index START. If no set bit is found, -1 is returned

Example:

> (define bs (make-bitset))
out = «bitset: »
> (set-bit! bs 5)
out = nil
> (next-set-bit bs 2)
out = 5

(set-bit! bs bit)

Defined at lib/data/bitset.lisp:73:2

Sets the bit in the bitset BS with the specified index BIT

Example:

> (define bs (make-bitset))
out = «bitset: »
> (set-bit! bs 5)
out = nil
> bs
out = «bitset: 00000020»

(set-bit-value! bs bit value)

Defined at lib/data/bitset.lisp:113:2

Sets the value of the bit in the bitset BS with the specified index BIT to VALUE

```cl

(define bs (make-bitset)) out = «bitset: » (set-bit-value! bs 2 true) out = nil bs out = «bitset: 00000004» (set-bit-value! bs 2 false) out = nil bs out = «bitset: 00000000»

Undocumented symbols

  • $bitset Defined at lib/data/bitset.lisp:28:2
  • (bitset? bitset) Defined at lib/data/bitset.lisp:28: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.