Skip to content

Commit 63458d5

Browse files
committed
Added set operations to README
1 parent a613da2 commit 63458d5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,21 @@ The functions `dnow`, `tnow` and `dtnow` return respectively the current string-
6161

6262
Notice that you need to have parenthesis after the function name to invoke the function call.
6363

64+
65+
### Computing with sets
66+
67+
While you can just use the regular python to do set computations, there's a few functions included for convinience: `set_intersect`, `set_difference` and `set_symdiff`.
68+
69+
The functions takes two iterable arguments, which are turned into sets, and the computations are performed:
70+
71+
set_intersect('foo bar', 'foo baz') = {'b', 'a', ' ', 'o', 'f'}
72+
set_intersect('foo baz', 'foo bar') = {'b', 'a', ' ', 'o', 'f'}
73+
set_difference('foo baz', 'foo bar') = {'z'}
74+
set_difference('foo bar', 'foo baz') = {'r'}
75+
set_symdiff('foo baz', 'foo bar') = {'z', 'r'}
76+
set_symdiff('foo bar', 'foo baz') = {'z', 'r'}
77+
78+
6479
### Formatting numbers
6580

6681
The fnuction `formatnum` formats numbers, and takes two mandatory and an optional argument:

0 commit comments

Comments
 (0)