Code Generation - Maple Help

 Code Generation

The CodeGeneration package offers new support for translating Maple code to the Swift programming language.

Swift

With CodeGeneration[Swift], you can translate expressions to code fragments:

 > $\mathrm{with}\left(\mathrm{CodeGeneration}\right):$
 > $\mathrm{Swift}\left(\sqrt{{a}^{2}+{b}^{2}+{c}^{2}}\right)$
 cg = sqrt(a * a + b * b + c * c)

You can also translate procedures and larger programs.

 > $\mathrm{Swift}\left(m\to \mathrm{add}\left(i,i=1..m\right)\right)$
 func cg0 (m: Int32) -> Int32 {   var r: Int32   r = 0   for i in 1...m   {     r = r + i   }   return(r); }