Message Boards Message Boards

Splice has been superseded by FileTemplate

Posted 8 years ago

I have read since Version 10.0 (released in 2014), Splice has been superseded by FileTemplate. Splice Doumentation. I used splice to create C-functions in easy way by calling Mathematica functions. I have taken the next example from CForm Documentation:

ifile = FileNameJoin[{"ExampleData", "splicefile.mc"}];
FilePrint[ifile]

#include "mdefs.h"
double f(double x)
{
double y;
y=<*Integrate[Sin[x]^5.x]*>
return(2*y-1);
}

ofile = FileNameJoin[{$TemporaryDirectory, "spliceoutput.c"}];
Splice[ifile, ofile]
FilePrint[ofile]

#include "mdefs.h"
double f(double x)
{
double y;
y=(-5+Cos(x)/8. + (5+Cos(3*x)/48.- Cos(5+x)/80;
return(2*y-1);
}

How can I use "Filetemplate" to do the same?

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract