[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



  Hi!

  Thanks to all who answered to my request for scheme on the Amiga.

  Although there are some implementations for the Amiga or at least simple
  to port to the Amiga I decided to write my own scheme.

  Now there is the next problem. No question of minor programming
  difficulties but a severe implementation decision.

  It's about tail recursion. I think there were some discussions about that.

  At first, it is possible to implement scheme that tail recursions (means
  recursions of iterative nature, needing only a constant amount of memory)
  really work without allocating new memory during every recursive application.
  In Abelson + Sussman it is said it is possible and I think in MIT-Scheme it
  is done.

  But HOW can it be done? I think the problem is to determine in every
  application of a compound procedure if it is the last command which is evaluated
  in a procedure. For example, the following is obviously tail recursive:

       (define (dummy x)
          (print x)
          (dummy (1+ x)))

  There it is simple to test if (dummy ...) is the last evaluated expression.
  But this example is senseless and in real programming it would never occur.

       (define (dummy x)
          (if (< x 10)
               (dummy (1+ x))
               'DONE))

  Here you cannot immedeatly see if (dummy ...) is the last evaluated
  expression. In some way you have to analyze the meaning of the procedure.
  To my opinion it is not enough to test additional in special forms like 'if'
  or 'cond' if the application is the last evaluated expression in this form
  because after the 'if' or 'cond' clause there can be other expressions to be
  evaluated.

  Don't know if you see my problem and if there is a simple solution for it.
  Today I asked a professsor and a doctor here at UniDo but both couldn't
  help me. Thank you for your interest. Ciao,

      -Holger

------------------------------------------------------------------------------

  Holger Muenx             muenx@heike.informatik.uni-dortmund.de
  IRB, UniDo
  4600 Dortmund
  West-Germany