From e5511027e8eae660f81f144200cab86ca1871101 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Thu, 17 Jul 2014 13:58:08 +0900 Subject: [PATCH] add type check guards to comparators --- piclib/built-in.scm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/piclib/built-in.scm b/piclib/built-in.scm index 51cfa5f5..c3323516 100644 --- a/piclib/built-in.scm +++ b/piclib/built-in.scm @@ -113,8 +113,12 @@ (dictionary-set! cache sym id) id))) - (define (compare sym1 sym2) - (identifier=? use-env sym1 use-env sym2)) + (define (compare x y) + (if (not (symbol? x)) + #f + (if (not (symbol? y)) + #f + (identifier=? use-env x use-env y)))) (f expr rename compare))) @@ -161,8 +165,12 @@ (dictionary-set! cache sym id) id))) - (define (compare sym1 sym2) - (identifier=? mac-env sym1 mac-env sym2)) + (define (compare x y) + (if (not (symbol? x)) + #f + (if (not (symbol? y)) + #f + (identifier=? mac-env x mac-env y)))) (unwrap (f (wrap expr) inject compare))))