| Author |
Comment/Response |
Bishshoy Das
|
02/20/12 3:19pm
I am trying to run this code:
In[1]:= fn[arg_] := StringLength[ToString[arg]]
In[2]:= fn[abcd]
Out[2]= 4
In[4]:= fnc = Compile[{arg},StringLength[ToString[arg]]]
Out[4]= CompiledFunction[{arg},StringLength[ToString[arg]],-CompiledCode-]
In[5]:= fnc[abcd]
During evaluation of In[5]:= CompiledFunction::cfsa: Argument abcd at position 1 should be a machine-size real number. >>
Out[5]= 4
For the compiled version of the same function, I get an error. Please help me correct this. Also I would like to know if there is anyway I can pass String arguments to any Compiled Functions directly without using ToString[_Symbol] override. Thank you.
URL: , |
|