|
355 | 355 | (tr (th "Operator") (th "Subexpression") (th "Explanation") (th "Count") (th "Locations"))) |
356 | 356 | ,@(append* |
357 | 357 | (for/list ([rec (in-list (sort explanations > #:key fourth))]) |
358 | | - (match-define (list op expr expl cnt mcnt flows locations) rec) |
| 358 | + (match-define (list op expr expl cnt mcnt flows locations) rec) |
359 | 359 |
|
360 | | - ;; Ensure locations is always a list or handle it properly |
361 | | - (define safe-locations (if (list? locations) locations '())) |
| 360 | + (define safe-locations (or locations '())) ;; Fallback to empty list if locations is #f |
362 | 361 |
|
363 | | - (append (list `(tr (td (code ,(~a op))) |
| 362 | + (append (list `(tr (td (code ,(~a op))) |
364 | 363 | (td (code ,(~a expr))) |
365 | 364 | (td (b ,(~a expl))) |
366 | 365 | (td ,(~a cnt)) |
367 | 366 | (td ,(~a mcnt)) |
368 | | - ;; Handle locations as a list or provide a fallback |
369 | | - (td (code ,(string-join (map ~a safe-locations) ", ")))) |
| 367 | + ;; Handle flows: Iterate over each flow and create a row |
370 | 368 | (for/list ([flow (in-list (or flows '()))]) |
371 | 369 | (match-define (list ex type v) flow) |
372 | | - `(tr (td "↳") (td (code ,(~a ex))) (td ,type) (td ,(~a v))))))))))))) |
| 370 | + (tr (td "↳") (td (code ,(~a ex))) (td ,type) (td ,(~a v)))) |
| 371 | + |
| 372 | + ;; Handle locations: Iterate over each location's inner lists and create a row for each |
| 373 | + (for/list ([location-list (in-list safe-locations)]) |
| 374 | + ;; Handle each location in the inner list |
| 375 | + (for/list ([location (in-list location-list)]) |
| 376 | + `(tr (td "↳") (td "Location") (td ,(~a location)) (td "")))))))))))))) |
373 | 377 |
|
374 | 378 | (define (render-phase-confusion confusion-matrix) |
375 | 379 | (match-define (list (list true-pos false-neg false-pos true-neg)) confusion-matrix) |
|
0 commit comments