diff --git a/10-syntax-scoring/code.scm b/10-syntax-scoring/code.scm index c30002a..007bb33 100644 --- a/10-syntax-scoring/code.scm +++ b/10-syntax-scoring/code.scm @@ -1,9 +1,4 @@ -; get list of lines from a file -(define (get-lines file) - (let loop [(lines '())] - (if (eof-object? (peek-char file)) - lines - (loop (cons (get-line file) lines))))) +(load "../common.scm") ; check if character can close chunk (define (closing? c) diff --git a/common.scm b/common.scm index 9f7c4d6..8b6e854 100644 --- a/common.scm +++ b/common.scm @@ -1,5 +1,12 @@ (import (srfi :43)) ; vector extensions +; get list of lines from a file +(define (get-lines file) + (let loop [(lines '())] + (if (eof-object? (peek-char file)) + lines + (loop (cons (get-line file) lines))))) + ; returns a list of numbers parsed from the first line of the file, ; separated by commas (define (read-comma-separated-numbers file)