Hi Folks, In recursive functions there is a termination clause that the function first tests for before proceeding. If the test clause succeeds an immediate value is returned, otherwise, a recursive call is made with some modification of input values.
In much code the body of the recursive function has several steps. In languages like python, the if clause is simply put at the head of the function and the rest of the body is written as usual. In Racket I find myself having to define a second function in order to do this, since what can go in the branches of an 'if' statement are limited. Is this the correct pattern, or is there a more elegant way of doing this in racket? e.g. (define (f-recur x y) (if (< x 1) 10 (f-recur-2 x y))) (define (f-recur-2 x y) ... something complex here (f-recur x' y') Many thanks! -Kaushik -- 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. For more options, visit https://groups.google.com/d/optout.