simplified using scheme control constructs
This commit is contained in:
@@ -44,13 +44,7 @@
|
|||||||
|
|
||||||
; returns the largest value obtained while applying pick to each element of lst
|
; returns the largest value obtained while applying pick to each element of lst
|
||||||
(define (get-max lst pick)
|
(define (get-max lst pick)
|
||||||
(let loop [(m 0)
|
(apply max (map pick lst)))
|
||||||
(lst lst)]
|
|
||||||
(if (null? lst)
|
|
||||||
m
|
|
||||||
[loop
|
|
||||||
(max m (pick (car lst)))
|
|
||||||
(cdr lst)])))
|
|
||||||
|
|
||||||
(define (sign value)
|
(define (sign value)
|
||||||
(cond
|
(cond
|
||||||
@@ -95,10 +89,10 @@
|
|||||||
(let* [(width (+ 1 (get-max lines get-max-x)))
|
(let* [(width (+ 1 (get-max lines get-max-x)))
|
||||||
(height (+ 1 (get-max lines get-max-y)))
|
(height (+ 1 (get-max lines get-max-y)))
|
||||||
(image (make-image width height))]
|
(image (make-image width height))]
|
||||||
(let loop! [(lines lines)]
|
(for-each
|
||||||
(when (not (null? lines))
|
(lambda (line)
|
||||||
(additively-rasterize-line! image (car lines) allow-diagonals)
|
(additively-rasterize-line! image line allow-diagonals))
|
||||||
(loop! (cdr lines))))
|
lines)
|
||||||
image))
|
image))
|
||||||
|
|
||||||
; count pixels with value strictly higher than 1
|
; count pixels with value strictly higher than 1
|
||||||
|
|||||||
Reference in New Issue
Block a user