guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

set-o-mat


From: Stefan Israelsson Tampe
Subject: set-o-mat
Date: Sun, 10 May 2015 21:33:59 +0200

Hello guilers!

ANOUNCEMENT: functional sets  and functional set generator aka the set-o-mat library

I have made some fairly good progress into making a set library that takes assoc like objects
like assoc's and vhashes, and ouputs a functional set / setmap / ordered set / ordered setmap
library that includes the complement operator. 

You may find it at,

https://gitlab.com/tampe/set-o-mat

--------------
Complements is based no symbolic algebra and does not require an instantiation of the world
But some operations needs a world to exists. See the documentation in ice-9/set/complement.scm

ice-9/vset.scm contains the functional set operations related to guile's vlist.scm and the assoc structure defined theirin. 

ice-9/set/complement.scm contains a small library that does set-operations with complements on lists, you may use those to check out and study the complement operator.


Example
scheme@(guile-user)> (use-modules (ice-9 vset))scheme@(guile-user)> (voset-union 7 (voset-complement (voset-intersection (voset-union 1 2 3) (voset-union 3 1))))
$7 = #<#<set len=1> ⊔ #<set len=2>ᶜ>
scheme@(guile-user)> (vset-union 7 (voset-complement (voset-intersection (voset-union 1 2 3) (voset-union 3 1))))
$8 = #<∅ ⊔ #<set len=2>ᶜ>
scheme@(guile-user)> (vset->list (voset-intersection (voset-union 1 2 3 4 5 6 7) (voset-union 7 (voset-complement (voset-intersection (voset-union 1 2 3) (voset-union 3 1))))))
$11 = (7 2 4 5 6)
scheme@(guile-user)> (vset->list (vset-intersection (vset-union 1 2 3 4 5 6 7) (vset-union 7 (vset-complement (voset-intersection (vset-union 1 2 3) (vset-union 3 1))))))
$12 = (2 4 5 6 7)
scheme@(guile-user)> 

Thats' all folks. Happy hacking.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]