chris@umcp-cs.UUCP (Chris Torek) (08/03/86)
In article <371@nbs-amrf.UUCP> manheime@nbs-amrf.UUCP (Ken Manheimer) writes: >The binding scheme is important. [The one in MLisp] can be >very insidious and have enourmous impact on applications. >You lose recursion ... to the Mlisp binding bug. Actually, it *is* possible to write recursive routines. You have to use a two-stage argument evaluation method: (defun foo $foo-arg1 (setq $foo-arg1 (arg 1)) (progn $foo-local-var (setq $foo-local-var $foo-arg1) ...)) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@mimsy.umd.edu
manheime@nbs-amrf.UUCP (Ken Manheimer) (08/04/86)
> In article <371@nbs-amrf.UUCP> manheime@nbs-amrf.UUCP (Ken Manheimer) writes: > >The binding scheme is important. [The one in MLisp] can be > >very insidious and have enourmous impact on applications. > >You lose recursion ... to the Mlisp binding bug. > > Actually, it *is* possible to write recursive routines. You have > to use a two-stage argument evaluation method: > > (defun foo $foo-arg1 > (setq $foo-arg1 (arg 1)) > (progn $foo-local-var > (setq $foo-local-var $foo-arg1) > ...)) > -- > In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516) > UUCP: seismo!umcp-cs!chris > CSNet: chris@umcp-cs ARPA: chris@mimsy.umd.edu You might as well just forget explicitly passing the value to the subordinate invocation of the function and instead call a helper function that uses a single "state" variable over the duration of its multiple incursions. Eg: (defun fooMain $foo-arg (setq $foo-arg (arg 1)) (...) ;;; miscellaneous foo preparation (fooHelper)) (defun fooHelper (xxx $foo-arg) ;;; miscellaneous operations on/wrt $foo-arg (if (fooPred $foo-arg) (fooHelper)) ...) I think you can do the same thing in fortran (?). I'd hate to write a substantial suite of programs where you had to worry about this kind of finagling, though. (Come to think of it, i have done a lot of hacking on, um, rmail, info, ..., and this certainly was at times a pain. Doable, but not pleasant, and it certainly engenders a weird contortion to the code...) Ken. ...!seismo!nbs-amrf!manheime