Trouble with Splice for Java (i.e. there is no JForm)
- To: mathgroup at smc.vnet.net
- Subject: [mg31855] Trouble with Splice for Java (i.e. there is no JForm)
- From: "Matthew D. Langston" <langston at SLAC.Stanford.EDU>
- Date: Fri, 7 Dec 2001 05:56:50 -0500 (EST)
- Organization: Stanford Linear Accelerator Center
- Sender: owner-wri-mathgroup at wolfram.com
Hello all, I can't figure out how to output Java language constructs using Splice, like I can for Fortran and C/C++ files. For example, here is how x^2 is represented in different languages: C/C++ : Power(x,2) Fortran: x**2 TeX : x^2 Java : Math.pow(x,2) Since there is no JForm command in Mathematica, I have been trying to use CForm. However, I can't figure out how to output the Java syntax. If I try something like this: x^2/.Power->Math.pow then the CForm comes out like this: Dot(Math,pow)(x,2) If I try something like this: x^2/.Power->"Math.pow" then the CForm comes out like this: "Math.pow"(x,2) Can someone help me understand how to get x^2 to output as Math.pow(x,2) please? Thank you. Regards, Matt -- Matthew D. Langston SLD, Stanford Linear Accelerator Center langston at SLAC.Stanford.EDU