@ss6153 wrote:
....
I want this function to take variable number of texts ....
How should I modify (2) such that variable number of texts can be read from the file and passed to the function?
....
I'm not aware of a way to do that. As far as I know, functions with arguments need to have a known number of them, which is why if you don't supply the known number when calling the function, you get a "too few arguments" or "too many arguments" error. Could it determine too few or too many if it isn't looking for a specific number?
I would think the way to do it is to read in the "number of texts" and assign them to variables inside the routine. You don't say whether they're comma-delimited in one line in the .csv file, or from separate lines in it. In either case, it will probably involve a (while) function, either to step through the comma-delimited pieces or to read the lines in the file. You can set an indeterminate number of variables using the (set) function:
(setq varno 0); initial value to be stepped up each time
(while (setq txt {get next text element, by whatever means})
(set (read (strcat "var" (itoa (setq varno (1+ varno))))) {txt directly, or something calculated from it})
); while
That should [untested] set the first text element pulled into the variable var1, the next into var2, etc., as long as there are text elements to pull. Then use those variables in whatever the routine needs to do.
Kent Cooper, AIA