aboutsummaryrefslogtreecommitdiff
path: root/challenge-145/abigail/scheme/ch-1.scm
blob: 561fb645c27ed374b18f0febfe58ad4709f0a301 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
;;;
;;; See ../README.md
;;;

;;;
;;; Run as: guile --no-auto-compile ch-1.scm < input-file
;;;

(use-modules (ice-9 rdelim))

(define (dotproduct a b)
    (if (null? a) 0
        (+ (* (car a) (car b))
              (dotproduct (cdr a) (cdr b)))))

(display (dotproduct (map string->number (string-split (read-line) #\ ))
                     (map string->number (string-split (read-line) #\ ))))
(newline)