On Sun, Feb 23, 2020 at 05:58:30AM -0700, Matthew Flatt wrote: > > Converting loops into closed form requires more sophisticated and > general induction reasoning than is typical in a compiler. Or it needs > ad hoc pattern patching to cover a few cases --- which I have seen gcc > do, but I don't think that's very common. >
If interest here, though not really converting loops into closed form: A language I saw proposed in the 70's has a loop construct where the request to start a new interaation was done by an 'again' statement. loop i := 3 ... ... if ... then ... ... again i+1 endif endloop Of course the again could occur in positions where it was a genuine recursive call. In most situation, though, it would be recognised as a tail-recursion and be treated like a normal iteration. And yes, there could be more than one loop variable, which would tranlate into more than one function parameter. In a syntactic situation like this, it would be easier to eliminate a loop variable that was not used, because all the calls to the loop body would be explicitly present within the syntax. -- hendrik -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/20200224123118.ejrxvnnusrk6isah%40topoi.pooq.com.