newLISP DLL command-line options?

Started by Sammo, December 09, 2003, 08:17:16 AM

Previous topic - Next topic

Sammo

Hi Lutz,



The manual says, "When starting newLISP from the command line, options ... can be specified ..." and then proceeds with explanations of the various switches.  Are some or any of these options available or useful with the newLISP.DLL?  In particular, is the stack size switch (-s) available with the DLL?



Thanks,

-- Sam

Lutz

#1
At the moment none of the options are available in the DLL. The stacks size currently defined as 1024 in CPU_STACK in newlisp.c seems to be enough for all applications I know. Personally I never ran into that limit and I don't know of any user who did. For many years it was at 256 and nobody seemed to care, as newLISP grew I punped it up to 1024.



Some LISP programmers insist on doing all interations through lists with recursion. In most cases a 'dolist' or other iterative formulation of an algorithm is possible and faster or not necessary at all. I.e. 'append'  and many other functions in newLISP take an unlimited number of arguments.



Where recursion is necessary or preferred for a more elegant, understandable solution the limit of 1024 seems to be sufficient.



It is also not clear to me how this limit is handled on Windows these days. It used to be that a DLL shares the max call stack and size with the parent process.



If you think that, this is important for your application I will reconsider and put something in the DLL (would be relatively easy) so you can reset it.



Lutz

Sammo

#2
I don't think I need any of the options although I may have to change my coding style a bit.  Is newLISP tail recursive?  I ask because I am familiar with Scheme and I'm used to writing loops "recursion style" without worrying about stack limits.



Thanks,

-- Sam

Lutz

#3
newLISP does no tail-recursion optimization. Fortunately those tail-recursive routines are also the easiest to re-write them to an iterative pattern.



Lutz