diff --git a/src/reports/common.rkt b/src/reports/common.rkt index f738ddfcb..fbbd89d05 100644 --- a/src/reports/common.rkt +++ b/src/reports/common.rkt @@ -202,7 +202,7 @@ (define fabs-impl (get-fpcore-impl 'fabs (repr->prop r) (list r))) (define e (list fabs-impl x)) (define c (context (list x) r r)) - (format "~a = ~a" x* (converter* e c))] + (list (format "~a = ~a" x* (converter* e c)))] [(list 'negabs x) ; TODO: why are x* and x-sign unused? (define x* (string->symbol (format "~a_m" x))) @@ -220,7 +220,7 @@ (define vs* (context-vars ctx*)) ;; We added some sign-* variables to the front of the variable ;; list in `ctx*`, we only want the originals here - (format-sort-instruction (take-right vs* (length vs)) language)])) + (list (format-sort-instruction (take-right vs* (length vs)) language))])) (define (format-sort-instruction vs l) (match l @@ -278,37 +278,31 @@ (define out-prog* (fpcore-add-props out-prog (list ':precision output-prec))) (define versions - (reap - [sow] - (for ([(lang record) (in-dict languages)]) - (match-define (list ext converter) record) - (when (and (fpcore? out-prog*) (or (equal? ext "fpcore") (supported-by-lang? out-prog* ext))) - (define name - (if identifier - (symbol->string identifier) - "code")) - (define out (converter out-prog* name)) - (define prelude-lines - (string-join - (append-map (lambda (instruction) - (let ([l (format-prelude-instruction instruction ctx ctx* lang converter)]) - (if (list? l) - l - (list l)))) - instructions) - (if (equal? lang "TeX") "\\\\\n" "\n") - #:after-last "\n")) - (sow (cons lang - ((if (equal? lang "TeX") - (curry format "\\begin{array}{l}\n~a\\\\\n~a\\end{array}\n") - string-append) - prelude-lines - out))))))) - - (define math-out - (if (dict-has-key? versions "TeX") - (let ([val (dict-ref versions "TeX")]) val) - "")) + (reap [sow] + (for ([(lang record) (in-dict languages)]) + (match-define (list ext converter) record) + (when (and (fpcore? out-prog*) + (or (equal? ext "fpcore") (supported-by-lang? out-prog* ext))) + (define name + (if identifier + (symbol->string identifier) + "code")) + (define out (converter out-prog* name)) + (define prelude-lines + (string-join + (append-map (lambda (instruction) + (format-prelude-instruction instruction ctx ctx* lang converter)) + instructions) + (if (equal? lang "TeX") "\\\\\n" "\n") + #:after-last "\n")) + (sow (cons lang + ((if (equal? lang "TeX") + (curry format "\\begin{array}{l}\n~a\\\\\n~a\\end{array}\n") + string-append) + prelude-lines + out))))))) + + (define math-out (dict-ref versions "TeX" "")) (define dropdown `(select (option "Math") diff --git a/src/reports/core2mathjs.rkt b/src/reports/core2mathjs.rkt index 19e3158ff..09a617c10 100644 --- a/src/reports/core2mathjs.rkt +++ b/src/reports/core2mathjs.rkt @@ -134,8 +134,7 @@ [*gensym-collisions* 1] [*gensym-fix-name* fix-name]) ; make compiler context - (define ctx - (ctx-update-props (make-compiler-ctx) (append '(:precision binary64 :round nearestEven)))) + (define ctx (ctx-update-props (make-compiler-ctx) '(:precision binary64 :round nearestEven))) ; translate (define p (open-output-string)) diff --git a/src/reports/plot.rkt b/src/reports/plot.rkt index 26186b109..e3956bac4 100644 --- a/src/reports/plot.rkt +++ b/src/reports/plot.rkt @@ -133,7 +133,8 @@ ; (a) a power of 10 between n and (n + ε) divisions below max where ε is some tolerance, or ; (b) a value, n divisions below max (define sub-range (round (/ (- max min) (add1 number)))) - (define near (λ (x n) (and (<= x n) (<= (abs (/ (- x n) sub-range)) 0.2)))) ; <- tolerance + (define (near x n) + (and (<= x n) (<= (abs (/ (- x n) sub-range)) 0.2))) ; <- tolerance (for/list ([itr (in-range 1 (add1 number))]) (define power10 (first-power10 (ordinal->real (clamp (- max (* (add1 itr) sub-range)) min max) repr)