summaryrefslogtreecommitdiffstats
path: root/one/twelve.scm
diff options
context:
space:
mode:
Diffstat (limited to 'one/twelve.scm')
-rw-r--r--one/twelve.scm58
1 files changed, 0 insertions, 58 deletions
diff --git a/one/twelve.scm b/one/twelve.scm
deleted file mode 100644
index 165a66b..0000000
--- a/one/twelve.scm
+++ /dev/null
@@ -1,58 +0,0 @@
-;;;; Under Creative Commons Attribution-ShareAlike 4.0
-;;;; International. See
-;;;; <https://creativecommons.org/licenses/by-sa/4.0/>.
-
-;;; ____________________________
-;;; < pascal's fucking triangle. >
-;;; ----------------------------
-;;; \ __
-;;; \ (--)
-;;; \ ( )
-;;; \ /--\
-;;; __ / \ \
-;;; U--U\.'@@@@@@`.\ )
-;;; \__/(@@@@@@@@@@) /
-;;; (@@@@@@@@)((
-;;; `YY~~~~YY' \\
-;;; || || >>
-;;;
-
-(define-module (one twelve)
- #:export (compute-triangle
- compute-line
- display-line
- value-at
- print-triangle
- print-line))
-
-(define (compute-triangle n)
- (cond ((= n 1) (list (compute-line n 1)))
- (else (cons (compute-line n 1)
- (compute-triangle (- n 1))))))
-
-(define (compute-line n pos)
- (cond ((> pos n) '())
- (else
- (cons (value-at n pos)
- (compute-line n (+ pos 1))))))
-
-(define (value-at line pos)
- (cond ((= line 1) 1)
- ((= pos 1) 1)
- ((= line pos) 1)
- (else (+
- (value-at (- line 1) (- pos 1))
- (value-at (- line 1) pos)))))
-
-;;;; printing
-
-(define (print-triangle tl level)
- (cond ((= (length tl) 0) #t)
- (else
- (print-triangle (cdr tl) (+ 1 level))
- (print-line (car tl) level))))
-
-(define (print-line l level)
- (let* ((l (map number->string l))
- (line (string-join l)))
- (format #t "~a\n" line)))