Implement NULL? primitive, different from NOT.
authorChris Hanson <org/chris-hanson/cph>
Tue, 21 Jul 1992 18:19:00 +0000 (18:19 +0000)
committerChris Hanson <org/chris-hanson/cph>
Tue, 21 Jul 1992 18:19:00 +0000 (18:19 +0000)
v7/src/microcode/prim.c

index 6b600628e85b511c2083a6337e5eb7a1ecabda1e..289b231d113f6a1c2c7e6832ad3361e1419a15a4 100644 (file)
@@ -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));
+}
 \f
 /* Cells */