I was wondering if AutoLISP does tail recursion elimination (like Scheme
does). I've got experience programming in Scheme, and recently I started
doing some programming in AutoLISP. My Scheme programming style uses a lot
of tail recursion... I'm wondering if in AutoLISP I should be using an
iterative style instead?
Thanks...
--
Carl Laurence Gonsalves - ········@undergrad.math.uwaterloo.ca
Computer Science, University of Waterloo
http://www.undergrad.math.uwaterloo.ca/~clgonsal/
http://www.csclub.uwaterloo.ca/~clgonsal/
Carl - No AutoLISP is NOT properly tail-recursive, and you can easily
exhaust the stack with recursion. There are some limited circumstances
where it is appropriate (mainly where you can be sure the depth of
recursion will not exhaust the stack), but for the most part, you should
use iterative constructs (like while, repeat, foreach, mapcar).
--
/*******************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Expert AutoCAD Programming and Customization */
/* --------------------------------------------------- */
/* Co-Author of Maximizing AutoCAD R13 and */
/* Maximizing AutoLISP for AutoCAD R13 */
/* --------------------------------------------------- */
/* Contributing Author CADENCE Magazine */
/* --------------------------------------------------- */
/* ··········@compuserve.com */
/* ·············@worldnet.att.net */
/* http://ourworld.compuserve.com/homepages/tonyt */
/*******************************************************/
Carl Laurence Gonsalves <········@undergrad.math.uwaterloo.ca> wrote in
article <··························@xiaoxiao.uwaterloo.ca>...
> I was wondering if AutoLISP does tail recursion elimination (like Scheme
> does). I've got experience programming in Scheme, and recently I started
> doing some programming in AutoLISP. My Scheme programming style uses a
lot
> of tail recursion... I'm wondering if in AutoLISP I should be using an
> iterative style instead?
>
> Thanks...
>
> --
> Carl Laurence Gonsalves - ········@undergrad.math.uwaterloo.ca
> Computer Science, University of Waterloo
> http://www.undergrad.math.uwaterloo.ca/~clgonsal/
> http://www.csclub.uwaterloo.ca/~clgonsal/
>
>