aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/santa-example/main.go38
-rw-r--r--stmutil/containers.go8
2 files changed, 19 insertions, 27 deletions
diff --git a/cmd/santa-example/main.go b/cmd/santa-example/main.go
index 76c0fbc..dcc8067 100644
--- a/cmd/santa-example/main.go
+++ b/cmd/santa-example/main.go
@@ -3,28 +3,28 @@
//
// The problem is given as:
//
-// Santa repeatedly sleeps until wakened by either all of his nine reindeer,
-// back from their holidays, or by a group of three of his ten elves. If
-// awakened by the reindeer, he harnesses each of them to his sleigh,
-// delivers toys with them and finally unharnesses them (allowing them to
-// go off on holiday). If awakened by a group of elves, he shows each of the
-// group into his study, consults with them on toy R&D and finally shows
-// them each out (allowing them to go back to work). Santa should give
-// priority to the reindeer in the case that there is both a group of elves
-// and a group of reindeer waiting.
+// Santa repeatedly sleeps until wakened by either all of his nine reindeer,
+// back from their holidays, or by a group of three of his ten elves. If
+// awakened by the reindeer, he harnesses each of them to his sleigh,
+// delivers toys with them and finally unharnesses them (allowing them to
+// go off on holiday). If awakened by a group of elves, he shows each of the
+// group into his study, consults with them on toy R&D and finally shows
+// them each out (allowing them to go back to work). Santa should give
+// priority to the reindeer in the case that there is both a group of elves
+// and a group of reindeer waiting.
//
// Here we follow the solution given in the paper, described as such:
//
-// Santa makes one "Group" for the elves and one for the reindeer. Each elf
-// (or reindeer) tries to join its Group. If it succeeds, it gets two
-// "Gates" in return. The first Gate allows Santa to control when the elf
-// can enter the study, and also lets Santa know when they are all inside.
-// Similarly, the second Gate controls the elves leaving the study. Santa,
-// for his part, waits for either of his two Groups to be ready, and then
-// uses that Group's Gates to marshal his helpers (elves or reindeer)
-// through their task. Thus the helpers spend their lives in an infinite
-// loop: try to join a group, move through the gates under Santa's control,
-// and then delay for a random interval before trying to join a group again.
+// Santa makes one "Group" for the elves and one for the reindeer. Each elf
+// (or reindeer) tries to join its Group. If it succeeds, it gets two
+// "Gates" in return. The first Gate allows Santa to control when the elf
+// can enter the study, and also lets Santa know when they are all inside.
+// Similarly, the second Gate controls the elves leaving the study. Santa,
+// for his part, waits for either of his two Groups to be ready, and then
+// uses that Group's Gates to marshal his helpers (elves or reindeer)
+// through their task. Thus the helpers spend their lives in an infinite
+// loop: try to join a group, move through the gates under Santa's control,
+// and then delay for a random interval before trying to join a group again.
//
// See the paper for more details regarding the solution's implementation.
package main
diff --git a/stmutil/containers.go b/stmutil/containers.go
index 2ce05e4..c7a4a49 100644
--- a/stmutil/containers.go
+++ b/stmutil/containers.go
@@ -88,10 +88,6 @@ func (m Map) Set(key, value any) Mappish {
return m
}
-func (m Map) Get(key any) (any, bool) {
- return m.Map.Get(key)
-}
-
func (sm Map) Range(f func(key, value any) bool) {
iter := sm.Map.Iterator()
for !iter.Done() {
@@ -116,10 +112,6 @@ func (sm SortedMap) Set(key, value any) Mappish {
return sm
}
-func (sm SortedMap) Get(key any) (any, bool) {
- return sm.SortedMap.Get(key)
-}
-
func (sm SortedMap) Delete(key any) Mappish {
sm.SortedMap = sm.SortedMap.Delete(key)
return sm