Hi mates,
I'm trying to produce and algorithm that counts (base 10) and display in such a manner:
Numbers 0 to 9 will produce this output: ((0)(1)(2)(3).....(8)(9))
Numbers 10 to 20 will produce this ouput: ((00)(01)(02)...(09)(10)(11)...(20))
The thing is each time the number gets larger, I would like to cons it in a nice way.
if I call (method 1) then produce ((0)(1)....)
if I call (method 2) then produce ((00)(01)(02).....)
if I call (method 3) then produce ((000)(001)(002)....)
this is my current code which produce terrible output:
(define str "")
(define (method n str)
(if (= n 0)
(display str)
(let loop ((i 0))
(if (< i 52)
(begin
(list (method (- n 1)(list str i)))
(loop (+ i 1)))))))
I have been racking my brains on this problem for a week now. Hope u guys will have a solution for me. =)