Page 1 of 1

Using Project Euler to verify a language (XLISP-PLUS)

Posted: Tue Oct 25, 2011 4:39 pm
by tomalmy
Besides being a good mental exercise, I'm using Project Euler problems to verify the XLISP-PLUS interpreter that I worked on through the 1990's and only recently revived. I have uncovered a bug and a couple cases where I could optimize the code (primary case being 2 to an integer power should be done via shifting). 53 problems so far attempted and completed. My goal is an even 100 and they must all execute in under a minute, even though the language is interpreted. Most have been well under a second.

I particularly was interested in doing this because of LISP's numeric capabilities. I've found that it compares poorly to compiled languages when iterating and to scripting languages for strings. Shouldn't be much of a surprise there. I've sorely missed binary and substring searches and don't have Common Lisp's LOOP macro (nor it's ability to compile loops for efficiency).

Re: Using Project Euler to verify a language (XLISP-PLUS)

Posted: Tue Nov 15, 2011 9:18 pm
by tomalmy
I've now solved about 80 problems, and discovered a second bug in XLISP-PLUS. I also added a couple of functions that are useful for many Project Euler problems, PRINC-TO-STRING and PRIN1-TO-STRING. I had been using the FORMAT function to do the conversion from number to string.

I also made the discovery that the optional dynamic memory allocation code, which was developed to improve memory utilization, causes decreased performance on modern systems with (relative to the early 1990s) gobs of memory.So I've recompiled with that option off.

Project Euler problems exercise some parts of the code much more than others. I've been trying to utilize the various language features to the maximum extent possible.