# IRC channel logs

## 2015-05-07.log

back to list of logs

<stis>(n (u '(7 4 1) (c '(3 5 7))) (u '(1 2) (c '(1 2 4 5)))))
<stis>\$3 = #<(7 1 2) ⊔ (3 5 4)ᶜ>
<stis>scheme@(guile-user)>
<stis>(with-lset-operators (c (n (u '(7 4 1) (c '(3 5 7))) (u '(1 2) (c '(1 2 4 5))))))
<stis>\$1 = (3 5 4)
<stis>scheme@(guile-user) [1]>
<stis>the code can be reached at https://gitlab.com/gule-log/guile-log/blob/master/ice-9/set/complement.scm
<mark_weaver>stis: I haven't read the whole backlog, but personally I don't know what "set complement" means without reference to a universal set.
<mark_weaver>maybe it's my ignorance, dunno
<stis>mark_weaver: X-A u X-B = X-(A n B)
<stis>X-A n X-B = X-(AuB)
<stis>so when you take the complement of a you do X-A
<stis>and then can algebraically in all set operators finally arrive at
<stis>X-A
<stis>or A
<mark_weaver>okay, so X looks like the "universal set" that I was referring to
<stis>okey, just to say that you can let X be a variable and dudce that your final expression is
<stis>X-A
<stis>or X
<stis>then you can fill in your world interpretation of the final result
<stis>so you donot need to define the universe from beforehand
<mark_weaver>okay, then you are working not with sets, but with symbolic expressions
<mark_weaver>which is fine
<stis>yep
<stis>so the complemetn is a specially marked object, a struct
<mark_weaver>but obviously then you cannot ask questions like "is the complement of set A the empty set"
<mark_weaver>until you have defined the universe
<stis>yep
<stis>this is not especially tricky, just that the knowledge that this can be done is missing
<stis>the cool thing is to make this work for ordered sets
<stis>the you use expresion of the type A u c(B), B-A=B
<stis>in stead of just c(B-A) (that would destroy the order information
<stis>the example above that I posted is preserving the order in a predictable way
<mark_weaver>I'm not familiar with the term "ordered set". usually I hear the terms "total order", "partial order", etc
<mark_weaver>but again, it might be my ignorance
<stis>e.g. X u B defines X is befor B and that applies to both the complement part and the normal set part of X and Y
<stis>but just as a product space kind of order, there need not be any cross issues beteen the complemetn part and the normal part of the representation
<stis>the posted code is well documented, read it and you will see how it works
<stis>an ordered set is a set that is totaly ordered, e.g.
<stis>list sets defines a total order on them, srfi-1 does not reserve the order, I needed to create a new version of union.
<stis>srfi-1's intersection does indees preserve the order
<stis>e.g. in A n B, B just removes the elements in A and does nor reshuffle
<mark_weaver>does the SRFI-1 specification require that, or might it simply be an accident of the implementation?
<mark_weaver>I suspect that the SRFI-1 set operations are meant to work on (unordered) sets.
<mark_weaver>since the word "set" by itself usually implies "unordered" in mathematical discourse
<mark_weaver>well, rather that is does not imply any ordering
<mark_weaver>s/is/it/
<stis>no you are right, better then to define a ordererd set operator in that library
<stis>and not use srfi'1 references
<stis>i missed that
<stis>er in the code i'm writing directly
<stis>he order in which elements appear in the result is the same as they appear in list1
<stis>so lset-intersection is okay
<stis>from srfi-1
<stis>lset-difference is the same. Then fine I just needed to rewrite union
<stis>which is done.
<stis>tty
<nalaginrut>morning guilers~
<paroneayea>hi nalaginrut
<nalaginrut>heya
<paroneayea>how goes the hacks, nalaginrut ?
<nalaginrut>paroneayea: well, I just added MVC to Artanis, and controller works now
*paroneayea rotating between the things he's procrastinating on
<paroneayea>oh cool nalaginrut
<nalaginrut>one may pick it up easily if one has already familiar with rails
<nalaginrut>but just similar, many things are different from rails
<nalaginrut>s/has/has been
***michel_mno_afk is now known as michel_mno
<wingo>moin
<lloda>do we have non-capturing groups in (ice-9 regex)? (?:abc) doesn't seem to work.
<ijp>lloda: I don't think so
<ijp>lloda: iirc the regexp syntax is emacsish, so you probably need to add a tone of backslashes
<ijp>i.e. "\\\\(?:abc\\\\)"
<please_help>Can guile allocate on the stack as an optimization?
<ijp>not really
<lloda>ijp: capturing groups work without backslashes, you need then for literal parens
<lloda>web tells me (?: ) is a PCRE feature :-/
<lloda>then -> them
<davexunit>someone should make a cool talk about Guile and be a presenter at Strange Loop 2015
<dsmith-work>Thursday Greetings, Guilers
<stis>heya guilers!
***michel_mno is now known as michel_mno_afk