From 7d23369b60e43193a34d61adfe23930506069a13 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 29 Jan 2024 21:06:02 -0500 Subject: Update to latest hoot. --- js-runtime/reflect.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'js-runtime') diff --git a/js-runtime/reflect.js b/js-runtime/reflect.js index b7d88f3..5ee2928 100644 --- a/js-runtime/reflect.js +++ b/js-runtime/reflect.js @@ -20,7 +20,8 @@ class Complex { this.imag = imag; } toString() { - return `${flonum_to_string(this.real)}+${flonum_to_string(this.imag)}i`; + const sign = this.imag >= 0 && Number.isFinite(this.imag) ? "+": ""; + return `${flonum_to_string(this.real)}${sign}${flonum_to_string(this.imag)}i`; } } class Fraction { @@ -440,9 +441,9 @@ class SchemeModule { string_downcase: Function.call.bind(String.prototype.toLowerCase), make_weak_map() { return new WeakMap; }, - weak_map_get(map, k) { + weak_map_get(map, k, fail) { const val = map.get(k); - return val === undefined ? null: val; + return val === undefined ? fail: val; }, weak_map_set(map, k, v) { return map.set(k, v); }, weak_map_delete(map, k) { return map.delete(k); }, -- cgit v1.2.3