Change strip-angle-brackets to work on symbols too.
authorChris Hanson <org/chris-hanson/cph>
Thu, 18 Jan 2018 04:02:06 +0000 (20:02 -0800)
committerChris Hanson <org/chris-hanson/cph>
Thu, 18 Jan 2018 04:02:06 +0000 (20:02 -0800)
src/runtime/global.scm

index b24344481b99d3e25bfd742b7f2959d51a7b2c3b..bc34ed172351c44002fa23cfb42989b6f00bc62b 100644 (file)
@@ -342,10 +342,17 @@ USA.
   (object-new-type (ucode-type constant) 1))
 
 (define (strip-angle-brackets name)
-  (if (and (string-prefix? "<" name)
-          (string-suffix? ">" name))
-      (substring name 1 (fix:- (string-length name) 1))
-      name))
+  (let ((maybe-strip
+        (lambda (s)
+          (and (string-prefix? "<" s)
+               (string-suffix? ">" s)
+               (substring s 1 (fix:- (string-length s) 1))))))
+    (if (string? name)
+       (or (maybe-strip name) name)
+       (let ((s (maybe-strip (symbol->string name))))
+         (if s
+             (string->symbol s)
+             name)))))
 \f
 (define (for-each-interned-symbol procedure)
   (with-obarray-lock