Post Reply 
Type control
03-13-2015, 03:04 PM
Post: #20
RE: Type control
(03-12-2015 09:59 AM)salvomic Wrote:  
(02-23-2015 07:18 PM)Han Wrote:  Just try this:
Code:
#cas
myexample(args):=
  local s;
  s:=SIZE(args);
  IF s==0 THEN RETURN("No args given"); END;
  RETURN(args(s));
END;
#end
...
This doesn't work for non-CAS programs because the Home environment doesn't parse comma-separated entries the same way. The non-CAS programs must either be programmed to take an explicit list of inputs or you must use a CAS program. That is, HOMEPROG(list) where list is an actual list would work for non-CAS programs. ...

Han,
in some CAS program of mine it works well...

now I've a non CAS program, and this code doesn't work:
Code:

EXPORT myprog(a);
BEGIN
local s;
s:= SIZE(a);
IF (s==0 OR TYPE(a)<>0) THEN RETURN("Input a real number"); END;
...
with myprog (not correct, I know) I get the error "Bad argument count" and with myprog() I get "Error: Bad argument value"

So, there isn't any way to control that input?

Thank you

Ensure there are no conflicts between the CAS version of myprog and the non-CAS version of myprog. In other words, name them differently to make sure that when you type myprog you aren't running the wrong program (since different programs can actually have the same name). As for the error (w/ respect to the second code block in your post), it is being generated much further inside your program. What you have posted there does not produce any errors.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Type control - salvomic - 02-22-2015, 03:42 PM
RE: Type control - Han - 02-22-2015, 04:37 PM
RE: Type control - salvomic - 02-22-2015, 04:46 PM
RE: Type control - Joe Horn - 02-22-2015, 08:47 PM
RE: Type control - salvomic - 02-22-2015, 08:52 PM
RE: Type control - Joe Horn - 02-23-2015, 04:17 AM
RE: Type control - salvomic - 02-23-2015, 08:31 AM
RE: Type control - toml_12953 - 02-23-2015, 04:52 PM
RE: Type control - salvomic - 02-23-2015, 05:01 PM
RE: Type control - Joe Horn - 02-23-2015, 11:40 PM
RE: Type control - salvomic - 02-23-2015, 04:51 PM
RE: Type control - Han - 02-23-2015, 05:10 PM
RE: Type control - salvomic - 02-23-2015, 05:40 PM
RE: Type control - Han - 02-23-2015, 07:18 PM
RE: Type control - salvomic - 02-23-2015, 07:29 PM
RE: Type control - salvomic - 03-12-2015, 09:59 AM
RE: Type control - Han - 03-13-2015 03:04 PM
RE: Type control - salvomic - 03-13-2015, 03:18 PM
RE: Type control - Han - 03-13-2015, 06:14 PM
RE: Type control - salvomic - 03-13-2015, 06:29 PM
RE: Type control - Han - 03-13-2015, 06:34 PM
RE: Type control - salvomic - 03-13-2015, 06:44 PM
RE: Type control - salvomic - 03-13-2015, 10:39 PM
RE: Type control - Han - 03-14-2015, 09:49 AM
RE: Type control - salvomic - 03-14-2015, 10:00 AM
RE: Type control - Angus - 02-24-2015, 06:28 AM
RE: Type control - salvomic - 02-24-2015, 06:34 AM
RE: Type control - Joe Horn - 02-25-2015, 05:52 AM



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