I managed to get a license to do some testing. I noticed some weird occurrences. I have attached the files I am working with.
- I made it a command just to test it.
- I tabbed/added a few comment lines for the ) to make the code easier for me to read.
- I commented the get file out and replaced with a findfile, as I want this to run and not have user input.
- I changed the order of where the "Unable to open..." occurred as it was displaying whenever the code ran.
I then ran into a few errors/issues. Most of these issues I could resolve in a workaround dealing with the csv, but in a perfect world the lisp will take care of these situations:
1) Dealing with the ENDOFLIST. When replacing
(setq next-line (read-line open-ssht))
with
(and
(setq next-line (read-line open-ssht))
(not (wcmatch (strcase next-line) "*ENDOFLIST*"))
);;End And
It truncates the list by 1. If there are 5 items in the list and then the ENDOFLIST, the resulting list will be 4 items long. {Obvious workaround is to duplicate the final line in the csv before the ENDOFLIST} When i remove the *'s from the code, it treats the ENDOFLIST as another item within the list.
2) When implementing the Loop:
(if (and sym-list data-list)
(progn
(setq col-cnt 0)
(while (< col-cnt (length sym-list))
(set (read (nth col-cnt sym-list)) (mapcar '(lambda (x) (nth col-cnt x)) data-list))
(princ "\n")
(princ (read (nth col-cnt sym-list)))
(princ " = ")
(princ (eval (read (nth col-cnt sym-list))))
(setq col-cnt (1+ col-cnt))
);;End While
(princ)
);;End Progn
);;End If
If the *ENDOFLIST* is in the code, i only receive a list of the minimum items for ALL lists. If i remove the *, then it acts as if that was not the case, and the resulting lists have the ENDOFLIST as an item. {Workaround is to use the previous method of (set (read (car sym-list)) (mapcar 'car data-list)) and just add a new line for each new column ie. for a 4th column adding (set (read (cadddr sym-list)) (mapcar 'cadddr data-list))}
3) In odd cases, the lists will be different lengths, as seen in the attached .csv. Sometimes newly added columns will be less or more than the previous columns. In these cases currently the extra ,,,, to get to the newest longer column are handled oddly by the code. {workaround is by opening the csv into excel and moving/ordering the columns so the longer line is always on the left and the shorter list is on the right}
Could these issues be solved by using the DOSLIB and that coding in LISP without it is causing these issues?