Start working on linear set implementation.
This commit is contained in:
parent
fdc5df764f
commit
e7e01069f4
1 changed files with 69 additions and 0 deletions
69
src/util-set-list.scm
Normal file
69
src/util-set-list.scm
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
;;
|
||||||
|
;; util-set-list.scm
|
||||||
|
;;
|
||||||
|
;; Set implementation using lists
|
||||||
|
;;
|
||||||
|
;; ISC License
|
||||||
|
;;
|
||||||
|
;; Copyright 2023 Brmlab, z.s.
|
||||||
|
;; Dominik Pantůček <dominik.pantucek@trustica.cz>
|
||||||
|
;;
|
||||||
|
;; Permission to use, copy, modify, and/or distribute this software
|
||||||
|
;; for any purpose with or without fee is hereby granted, provided
|
||||||
|
;; that the above copyright notice and this permission notice appear
|
||||||
|
;; in all copies.
|
||||||
|
;;
|
||||||
|
;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||||
|
;; WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||||
|
;; WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||||
|
;; AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
|
||||||
|
;; CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
;; OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
;; NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||||
|
;; CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
;;
|
||||||
|
|
||||||
|
(declare (unit util-set-list))
|
||||||
|
|
||||||
|
(module
|
||||||
|
util-set-list
|
||||||
|
(
|
||||||
|
TAG-LSET
|
||||||
|
|
||||||
|
;;make-lset
|
||||||
|
;;lset-add
|
||||||
|
;;lset-remove
|
||||||
|
|
||||||
|
;;lset-member?
|
||||||
|
|
||||||
|
;;lset-merge
|
||||||
|
;;lset-intersect
|
||||||
|
;;lset-subtract
|
||||||
|
|
||||||
|
;;list->lset
|
||||||
|
;;lset->list
|
||||||
|
)
|
||||||
|
|
||||||
|
(import scheme
|
||||||
|
(chicken string)
|
||||||
|
(chicken random))
|
||||||
|
|
||||||
|
(define TAG-LSET
|
||||||
|
(string-intersperse
|
||||||
|
(cons "LSET-"
|
||||||
|
(map (lambda (n)
|
||||||
|
(substring
|
||||||
|
(number->string
|
||||||
|
(+ 256 (char->integer n))
|
||||||
|
16)
|
||||||
|
1))
|
||||||
|
(string->list
|
||||||
|
(random-bytes
|
||||||
|
(make-string 8)))))
|
||||||
|
""))
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
(import util-set-list)
|
||||||
|
|
||||||
|
(print TAG-LSET)
|
Loading…
Add table
Add a link
Reference in a new issue