mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
add `nil?' primitive
* libguile/boolean.c (scm_nil_p): New function. * libguile/vm-i-scheme.c (nilp, not_nilp): * libguile/vm-i-system.c (br_if_nil, br_if_not_nil): New instructions. Renumber other ops. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Increment. * module/language/assembly/compile-bytecode.scm (compile-bytecode): Add support for writing `br-if-nil' and `br-if-not-nil' instructions. * module/language/assembly/disassemble.scm (code-annotation): Add `br-if-nil' and `br-if-not-nil' to the list of branch instructions. * module/language/tree-il/compile-glil.scm: Add `nil?' to `*primcall-ops*'. (flatten): Use the new branch instructions for `nil?' conditionals. * module/language/tree-il/primitives.scm: Add `nil?' to `*interesting-primitive-names*', `*effect-free-primitives', and `*effect+exception-free-primitives*'.
This commit is contained in:
parent
6937c7aa8b
commit
9348168ed5
8 changed files with 180 additions and 132 deletions
|
@ -62,6 +62,14 @@ SCM_DEFINE (scm_not, "not", 1, 0, 0,
|
|||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
SCM_DEFINE (scm_nil_p, "nil?", 1, 0, 0,
|
||||
(SCM x),
|
||||
"Return @code{#t} iff @var{x} is nil, else return @code{#f}.")
|
||||
#define FUNC_NAME s_scm_nil_p
|
||||
{
|
||||
return scm_from_bool (scm_is_lisp_false (x));
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
SCM_DEFINE (scm_boolean_p, "boolean?", 1, 0, 0,
|
||||
(SCM obj),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue