Skip to content

Instantly share code, notes, and snippets.

@tomonacci
Created April 24, 2016 00:44
Show Gist options
  • Save tomonacci/68c353b5a806407cc18fe94f5909cbc4 to your computer and use it in GitHub Desktop.
Save tomonacci/68c353b5a806407cc18fe94f5909cbc4 to your computer and use it in GitHub Desktop.
Sets of sets
(use srfi-113)
(define (main args)
(let ([a (list->set equal-comparator '(0 1))]
[b (list->set equal-comparator '(1 0))])
#?=(set=? a b)
#?=(set-size (set set-comparator a b)))
(let ([a (list->set equal-comparator '((2 . 1) (1 . 1) (0 . 2) (0 . 0)))]
[b (list->set equal-comparator '((2 . 1) (1 . 1) (0 . 0) (0 . 2)))])
#?=(set=? a b)
#?=(set-size (set set-comparator a b)))
0)
; % gosh -V
; Gauche scheme shell, version 0.9.5_pre1 [utf-8,pthreads], i686-pc-linux-gnu
; % gosh sets-of-sets.gosh
; #?="./sets-of-sets.gosh":6:(set=? a b)
; #?- #t
; #?="./sets-of-sets.gosh":7:(set-size (set set-comparator a b))
; #?- 1
; #?="./sets-of-sets.gosh":10:(set=? a b)
; #?- #t
; #?="./sets-of-sets.gosh":11:(set-size (set set-comparator a b))
; #?- 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment