(define (teken-n x y n)
(if (not (zero? n))
(begin
(teken-symbolen x y)
(teken-n x y (- n 1)))))
(define (teken-symbolen-combinatie x y n)
(if (not (zero? n))
(begin
(let ((acc 0))
(teken-n x y (+ acc 1))
(newline)
(teken-symbolen-combinatie x y (- n 1))))))
The use of (teken-n x y n)
is to print 2 symbols, 'x 'y
in the form xyx
n times on 1 line without any spaces. It works correctly.
what I'm trying to accomplish with (teken-symbolen-combinatie x y n)
would be the output
(teken-symbolen-combinatie '- '* 3)
-*-
-*--*-
-*--*--*-
My code only gives the first symbol combination, in this example -*- 3 times seperated with a newline. Meaning that my first function's last variable doesn't get incremented correctly. I can't figure out why.
EDIT: correction of mistakes within question