"I'm sure it'll reveal an error in my thinking"
To avoid importing math I had changed my upper limit early on but I 'd
misread it.
The critical line in error should be changed to:
for j := 0; j < int(math.Pow(2.0, float64(len(set)))/2.0); j++ {
--
You received this message because you are
Thanks Michael,
I appreciate the information. Because I'm trying to learn Go, I'm more
interested in what should cause it to stop running part way through the
process without generating an error. It just seems bizarre to me but I'm
sure it'll reveal an error in my thinking.
--
You receive
Thanks Ian,
You are correct (although the post I submitted yesterday had the clobbering
lines incorrect - that was one of my experiments to see if rebuilding the
3D slice differently would overcome the problem). The code below is my
original.
Yes, the function works by building fresh version
The top 3 lines of the function I posted yesterday were not correct but I
couldn't edit them. Unfortunately, in my experiments with the slice I had
changed them and didn't realize before posting. The correct version is:
package main
import (
"fmt"
"time")
func get_partitions(set []s
I've been implementing some Python code in Go to learn the language. In
Python this will generate a Set Partition. The Go equivalent follows.
The Go runs fine for list element sizes 2 and 3 (which means the recursion
is running properly). Also 4 but at 5 and above it generates the intial
sets