Browse Source

Re-introduce error function in strings.nbt

David Peter 1 year ago
parent
commit
8b9879741e
1 changed files with 2 additions and 2 deletions
  1. 2 2
      numbat/modules/core/strings.nbt

+ 2 - 2
numbat/modules/core/strings.nbt

@@ -45,7 +45,7 @@ fn _hex_digit(x: Scalar) -> String =
 
 fn _digit_in_base(x: Scalar, base: Scalar) -> String =
   if base < 2 || base > 16
-    then "base must be between 2 and 16" # TODO
+    then error("base must be between 2 and 16")
     else if mod(x, 16) < 10 then chr(48 + mod(x, 16)) else chr(97 + mod(x, 16) - 10)
 
 fn _number_in_base(x: Scalar, b: Scalar) -> String =
@@ -63,7 +63,7 @@ fn hex(x: Scalar) -> String = if x < 0 then "-{hex(-x)}" else "0x{_number_in_bas
 # TODO: once we have anonymous functions / closures, we can implement base in a way
 # that it returns a partially-applied version of '_number_in_base'. This would allow
 # arbitrary 'x -> base(b)' conversions.
-fn _not_implemented(unused: Scalar) -> String = "<bases other than 2, 8, 10, and 16 are currently not implemented>"
+fn _not_implemented(unused: Scalar) -> String = error("bases other than 2, 8, 10, and 16 are currently not implemented")
 fn base(b: Scalar) -> Fn[(Scalar) -> String] =
   if b == 2
     then bin