From: Chris Hanson Date: Tue, 21 Jul 1992 18:19:00 +0000 (+0000) Subject: Implement NULL? primitive, different from NOT. X-Git-Tag: 20090517-FFI~9213 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=e78dc9648453808ceed65c71244f8aa86c5fd01d;p=mit-scheme.git Implement NULL? primitive, different from NOT. --- diff --git a/v7/src/microcode/prim.c b/v7/src/microcode/prim.c index 6b600628e..289b231d1 100644 --- a/v7/src/microcode/prim.c +++ b/v7/src/microcode/prim.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/prim.c,v 9.34 1992/06/10 21:48:30 jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/prim.c,v 9.35 1992/07/21 18:19:00 cph Exp $ -Copyright (c) 1988-1992 Massachusetts Institute of Technology +Copyright (c) 1988-92 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -196,7 +196,7 @@ DEFINE_PRIMITIVE ("EQ?", Prim_eq, 2, 2, 0) /* (NOT OBJECT) Returns #T if OBJECT is #F. Otherwise returns #F. This is - the primitive known as NOT, NULL?, and FALSE? in Scheme. + the primitive known as NOT and FALSE? in Scheme. Touches the argument. */ DEFINE_PRIMITIVE ("NOT", Prim_not, 1, 1, 0) @@ -206,6 +206,18 @@ DEFINE_PRIMITIVE ("NOT", Prim_not, 1, 1, 0) TOUCH_IN_PRIMITIVE ((ARG_REF (1)), object); PRIMITIVE_RETURN (BOOLEAN_TO_OBJECT (object == SHARP_F)); } + +/* (NULL? OBJECT) + Returns #T if OBJECT is '(). Otherwise returns #F. + Touches the argument. */ + +DEFINE_PRIMITIVE ("NULL?", Prim_null_p, 1, 1, 0) +{ + fast SCHEME_OBJECT object; + PRIMITIVE_HEADER (1); + TOUCH_IN_PRIMITIVE ((ARG_REF (1)), object); + PRIMITIVE_RETURN (BOOLEAN_TO_OBJECT (object == EMPTY_LIST)); +} /* Cells */