If I have a list of [0 1 2], I'd like to recursively generate a a choice that corresponds to the Power Set. That is:

choice
  [0 1 2]
[] [0 1]
[] [0 2]
[] [1 2]
[] [0]
[] [1]
[] [2]
[] nil
end

What I came up with was:

fun {PowerSet L}
  choice
     L = nil
  [] L = _|_
  [] D L = _|D in {PowerSet D}
  end
end

local X in
  X = {SolveAll {PowerSet [0 1 2]}}
  {Show X}
end

But this goes into a wait state. So, what I'm I doing wrong? Is the problem in the way I'm using SolveAll, or in the PowerSet function (or both)?

Thanks,
Chris Rathman



_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to