Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
26
Task/Multiplication-tables/Scheme/multiplication-tables.ss
Normal file
26
Task/Multiplication-tables/Scheme/multiplication-tables.ss
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
(define iota
|
||||
(lambda (count start step)
|
||||
(let loop ((result (list (+ start (* (- count 1) step)))))
|
||||
(let ((acc (car result)))
|
||||
(if (= acc start)
|
||||
result
|
||||
(loop (cons (- acc step) result)))))))
|
||||
|
||||
|
||||
(define table
|
||||
(lambda (x)
|
||||
(let loop ((count 1)
|
||||
(numbers (iota x 1 1)))
|
||||
(if (not (null? numbers))
|
||||
(begin
|
||||
(display (make-string (* 6 (- count 1)) #\space))
|
||||
(for-each
|
||||
(lambda (n)
|
||||
(let ((number (number->string (* n count))))
|
||||
(display (string-append
|
||||
(make-string (- 6 (string-length number)) #\space)
|
||||
number))))
|
||||
numbers)
|
||||
(newline)
|
||||
(loop (+ count 1)
|
||||
(cdr numbers)))))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue