Post Reply 
Create function by program and store as variable ?
09-26-2015, 07:49 PM
Post: #6
RE: Create function by program and store as variable ?
I managed to create the code from string (passed from non-CAS environment) and could call it from non-CAS function.

#cas
mkfun(str):=
BEGIN
fn:=expr(str); // only global var works
END;
#end

EXPORT MKIT()
BEGIN
LOCAL fnstr:="(x,y)->BEGIN
IF x>2 THEN
RETURN(7)
END ;
RETURN(x);
END;";

CAS(mkfun(fnstr));
RETURN CAS.fn(32,1);
END;

MKIT() will return 7

I need something more convenient Sad
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Create function by program and store as variable ? - xset - 09-26-2015 07:49 PM



User(s) browsing this thread: 2 Guest(s)