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)