I fixed a bug, when balancing parenthesis. The next version will report the error correctly as a 'missing parenthesis' error and point to the additional closing parenthesis before the 'set' statement in the error message.
That must have been it. I played with the code a while and then started from scratch and everything worked fine the second time around.
I usually don't miss parenthesis since emacs highlights them as you type them.
I'm trying to convert some outdated python code to lisp to tally the results of our surveys. New survey changes broke the old code. An interpreter like lisp is ideal for throwing in conditionals to break out data by fields. However, keeping tallies in lists of lists of lists is a bit harder than I thought it would be. This part was easier in python (a[j] += 1) vs ??? That's why I'm creating all those variables. Some of them are counts and others are lists of strings (comments). If you know an easier method, I'm game :)
The Vice President has given the go ahead for a cgi program and surveys on the Web next time around. We will have a codes to make sure people have filled out a survey and also not allow them to take a survey twice. The hard part is to convince them the surveys are still anonymous.
The symbol stuff will probably be faster on bigger arrays, you might encapsulate the symbol-mangling stuff in some functions, like shown in 'array.lsp' in the distribution, but for more dimensions: like
(inc-array MyArray 1 4 2 value) ;; same as: MyArray[1][4][2] += value
(inc-array MyArray 1 4 2 value) ;; same as: MyArray[1][4][2] += value
I will create a function inc-array as this will clean upthings considerably.
After carefully reviewing the number of surveys I have, the plain list of values may be the best solution. Just read one survey at a time and a have a list for each question in the survey.
My inc-array will then be just
(inc-array q1 pos value)
I can work with the plain list of values. I will just have a list q1, q2, ..., qn for each survey question. I can first use a conditional expression on (question n, position i) to determine break downs. If the condition is meet, the code can pull out the comments and record them separately. Then I can use the inc-array function:
I wonder if it is time to substitute 'nth' and 'replace-nth' with multi-dimensional versions. You could enter a variable number of index parameters and the functions would automatically go into deeper nested lists (arrays). Indices would be zero-based like before. It also would round out the existing set of matrix fnctions: invert, multiply and transpose (indispensable doing statistics).
The old 'nth' and 'replace-nth' have the index as the first parameter, which doesn't make them suited for simple expansion, maintaining compatibility with old code. So the substitutes would carry a new name. After some versions the old once would be eliminated.