|
347 | 347 |
|
348 | 348 | (define (render-phase-explanations explanations) |
349 | 349 | `((dt "Explanations") |
350 | | - (dd (details |
351 | | - (summary "Click to see full explanations table") |
352 | | - (table |
353 | | - ((class "times")) |
354 | | - (thead |
355 | | - (tr (th "Operator") (th "Subexpression") (th "Explanation") (th "Count") (th "Locations"))) |
356 | | - ,@(append* |
357 | | - (for/list ([rec (in-list (sort explanations > #:key fourth))]) |
358 | | - (match-define (list op expr expl cnt mcnt flows locations) rec) |
359 | | - |
360 | | - (define safe-locations (or locations '())) ;; Fallback to empty list if locations is #f |
361 | | - |
362 | | - (append (list `(tr (td (code ,(~a op))) |
363 | | - (td (code ,(~a expr))) |
364 | | - (td (b ,(~a expl))) |
365 | | - (td ,(~a cnt)) |
366 | | - (td ,(~a mcnt)) |
367 | | - |
368 | | - ;; Handle locations: Iterate over each location's inner lists and create a row for each |
369 | | - (for/list ([location-list (in-list safe-locations)]) |
370 | | - ;; Handle each location in the inner list |
371 | | - (for/list ([location (in-list location-list)]) |
372 | | - `(tr (td "↳") (td "Location") (td ,(~a location)) (td "")))) |
373 | | - |
374 | | - (for/list ([flow (in-list (or flows '()))]) |
375 | | - (match-define (list ex type v) flow) |
376 | | - `(tr (td "↳") (td (code ,(~a ex))) (td ,type) (td ,(~a v)))))))))))))) |
| 350 | + (dd |
| 351 | + (details |
| 352 | + (summary "Click to see full explanations table") |
| 353 | + (table |
| 354 | + ((class "times")) |
| 355 | + (thead |
| 356 | + (tr (th "Operator") (th "Subexpression") (th "Explanation") (th "Count") (th "Locations"))) |
| 357 | + ,@ |
| 358 | + (append* |
| 359 | + (for/list ([rec (in-list (sort explanations > #:key fourth))]) |
| 360 | + (match-define (list op expr expl cnt mcnt flows locations) rec) |
| 361 | + |
| 362 | + (define safe-locations (or locations '())) ;; Fallback to empty list if locations is #f |
| 363 | + |
| 364 | + (append |
| 365 | + (list |
| 366 | + `(tr |
| 367 | + (td (code ,(~a op))) |
| 368 | + (td (code ,(~a expr))) |
| 369 | + (td (b ,(~a expl))) |
| 370 | + (td ,(~a cnt)) |
| 371 | + (td ,(~a mcnt)) |
| 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 "")))) |
| 377 | + (for/list ([flow (in-list (or flows '()))]) |
| 378 | + (match-define (list ex type v) flow) |
| 379 | + `(tr (td "↳") (td (code ,(~a ex))) (td ,type) (td ,(~a v)))))))))))))) |
377 | 380 |
|
378 | 381 | (define (render-phase-confusion confusion-matrix) |
379 | 382 | (match-define (list (list true-pos false-neg false-pos true-neg)) confusion-matrix) |
|
0 commit comments