From e056b72f6f0afcc4fe5b7365002c17ef9bbdfa41 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Mon, 23 Feb 2015 13:10:58 -0500 Subject: [PATCH] Added (procedure?) --- cgen.scm | 1 + runtime.h | 17 +++++++++++++++++ trans.scm | 1 + 3 files changed, 19 insertions(+) diff --git a/cgen.scm b/cgen.scm index d3a2683e..2812d321 100644 --- a/cgen.scm +++ b/cgen.scm @@ -494,6 +494,7 @@ ((eq? p 'null?) "Cyc_is_null") ((eq? p 'number?) "Cyc_is_number") ((eq? p 'pair?) "Cyc_is_cons") + ((eq? p 'procedure?) "Cyc_is_procedure") ((eq? p 'string?) "Cyc_is_string") ((eq? p 'eof-object?) "Cyc_is_eof_object") ((eq? p 'symbol?) "Cyc_is_symbol") diff --git a/runtime.h b/runtime.h index 1385cf18..207ab5ff 100644 --- a/runtime.h +++ b/runtime.h @@ -682,6 +682,23 @@ static object Cyc_is_char(object o){ return boolean_t; return boolean_f;} +static object Cyc_is_procedure(object o) { + int tag; + if (!nullp(o) && !is_value_type(o)) { + tag = type_of(o); + if (tag == closure0_tag || + tag == closure1_tag || + tag == closure2_tag || + tag == closure3_tag || + tag == closure4_tag || + tag == closureN_tag || + tag == primitive_tag) { + return boolean_t; + } + } + return boolean_f; +} + static object Cyc_is_eof_object(object o) { if (!nullp(o) && !is_value_type(o) && type_of(o) == eof_tag) return boolean_t; diff --git a/trans.scm b/trans.scm index 2804d1d3..192f9025 100644 --- a/trans.scm +++ b/trans.scm @@ -550,6 +550,7 @@ null? number? pair? + procedure? string? symbol? current-input-port