progs/fun/funt.sc
changeset 1036 b84e794b9e88
parent 1031 b62c0002c735
equal deleted inserted replaced
1035:c479d6ef57f8 1036:b84e794b9e88
    14 //    amm funt.sc run fact.fun   
    14 //    amm funt.sc run fact.fun   
    15 //
    15 //
    16 // the first prints out the JVM instructions
    16 // the first prints out the JVM instructions
    17 // the second runs the generated class files
    17 // the second runs the generated class files
    18 
    18 
       
    19 def powerset(xs: Set[Int]) : Set[Set[Int]] = {
       
    20   if (xs == Set()) Set(Set())
       
    21   else { val subs = powerset(xs.tail)
       
    22      subs ++ subs.map(_ + xs.head)
       
    23   }
       
    24 }
       
    25 
       
    26 powerset(Set(1,2,3))
    19 
    27 
    20 import $file.fun_tokens, fun_tokens._
    28 import $file.fun_tokens, fun_tokens._
    21 import $file.fun_parser, fun_parser._ 
    29 import $file.fun_parser, fun_parser._ 
    22 
    30 
    23 // compiler - built-in functions 
    31 // compiler - built-in functions