refactoring (probably needed for previous days too, oops)

This commit is contained in:
2021-12-21 23:46:46 +01:00
parent 089f2c8800
commit aa77b51cd0
3 changed files with 26 additions and 13 deletions

View File

@@ -1,15 +1,6 @@
(import (srfi :43)) ; vector extensions
(load "../common.scm")
; reads a numnber from input
; also consumes the next non-number character in the file!
(define (get-number file)
(let loop [(n 0)]
(let [(c (get-char file))]
(if (char-numeric? c)
[loop (+ (char->number c) (* n 10))]
n))))
; reads pairs of coordinates
; returns a list of the form (((x1 y1) (x2 y2))...)
(define (read-lines file)