tags:

views:

472

answers:

2
+2  A: 

I have no idea why it doesn't work (I got the same result) but if you rewrite it as:

let calcPowerSet =
   let rec innerCalc = 
      function
      | ([], []) -> [[]]
      | ((head::tail), (cHead::cTail)) -> 
         innerCalc (tail, (cHead::cTail)) @ innerCalc (tail, (head::cHead::cTail))
      | ((head::tail), []) -> 
         innerCalc (tail, []) @ innerCalc (tail, [head])
      | ([], collect) -> [collect]
   innerCalc

it seems to work fine under Mac (intel) with Mono 2.4 and F# 1.9.6.2

Johan Kullbom
(see my comments in the question's comments)I change my function by using an inner function like Johan's method and it works. See the changes here: http://pastebin.com/m6ec637a7
phi
Yep, worked for me too.
Philip Harris
+2  A: 

FYI, turns out the F# team is aware of this bug, it is a bug in Mono 2.4 that Mono team is aware of (dunno if has been fixed yet).

Brian
Good to know - is there a bug forum for that so I can follow it's progress?
Philip Harris
A quick web search findshttps://bugzilla.novell.com/show_bug.cgi?id=419828
Brian
Still about F# and mono bugs, I remember a post on the Flying Frog Consultancy blog which proved that - as of version 2.2 of mono - tail recursion wasn't adequately supported yet and resulted in leaked memory (don't know how's the situation now as I don't do mono).
emaster70