0
declare
fun {Power N M}
  if M == 0 then
      1
   else
    local  X in {power N M div 2}
      if {M mod 2 } == 0 then
     X*X
      else
     N*X*X
      end
    end
  end
  {browse power 2 8 }

I keep getting errors for this program, specifically I keep getting "Unexpected T_ENDOFFILE". The point of this program is to calculate the power of a number more efficiently than a program we used for a previous assignment.

0 Answers0