(define (skip-many a)
(or (and (a) (skip-many a))
(void)))
This is not infinite recursion. The Parser monad used in the Haskell version is simply a stream dressed in monadic clothes (and even C has streams a-la FILE*).As for the second example, the naive translation to scheme is:
(define (print-n-times n s)
(cond
((zero? n) (void))
(else (put-str-ln s)
(print-n-times (sub1 n) s))))
Here, both Haskell & scheme demonstrate constant memory usage; not because of Monads, or strict/lazy evaluation, but because of tail recursion.Also, in your first sentence, I think you meant "strict".