Implement char->scalar-value.
authorChris Hanson <org/chris-hanson/cph>
Mon, 30 Jan 2017 09:40:19 +0000 (01:40 -0800)
committerChris Hanson <org/chris-hanson/cph>
Mon, 30 Jan 2017 09:40:19 +0000 (01:40 -0800)
src/runtime/char.scm
src/runtime/runtime.pkg

index 506904cff3611ada896404c6cd52277f57aac447..aee5937672fefac747e0c092c3f58e97025fe55b 100644 (file)
@@ -380,6 +380,11 @@ USA.
 (define-guarantee unicode-char "a Unicode character")
 (define-guarantee unicode-scalar-value "a Unicode scalar value")
 
+(define (char->scalar-value char #!optional caller)
+  (let ((n (char->integer char)))
+    (guarantee unicode-scalar-value? n caller)
+    n))
+
 (define (unicode-char->scalar-value char #!optional caller)
   (guarantee unicode-char? char caller)
   (char->integer char))
index 826dd1ce4a1fbedde55de8b82b923dded73e6c9b..046eabde9bc8c2984b48306c477a352e9b3a7306 100644 (file)
@@ -1339,6 +1339,7 @@ USA.
          char->digit
          char->integer
          char->name
+         char->scalar-value
          char-ascii?
          char-bit:control
          char-bit:hyper