Changeset 5855


Ignore:
Timestamp:
02/16/04 15:31:52 (17 years ago)
Author:
piso
Message:

MAKE-CLOSURE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/Primitives.java

    r5846 r5855  
    33 *
    44 * Copyright (C) 2002-2004 Peter Graves
    5  * $Id: Primitives.java,v 1.570 2004-02-16 01:12:12 piso Exp $
     5 * $Id: Primitives.java,v 1.571 2004-02-16 15:31:52 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    13411341
    13421342    // ### %defun
    1343     // %defun name arglist body environment => name
     1343    // %defun name arglist body &optional environment => name
    13441344    private static final Primitive _DEFUN = new Primitive("%defun", PACKAGE_SYS, false)
    13451345    {
     
    13631363                if (symbol.getSymbolFunction() instanceof SpecialOperator) {
    13641364                    String message =
    1365                         symbol.getName() + " is a special operator and may not be redefined";
     1365                        symbol.getName() + " is a special operator and may not be redefined.";
    13661366                    return signal(new ProgramError(message));
    13671367                }
     
    42144214    };
    42154215
     4216    // ### make-closure lambda-form environment => closure
     4217    private static final Primitive2 MAKE_CLOSURE =
     4218        new Primitive2("make-closure", PACKAGE_SYS, false)
     4219    {
     4220        public LispObject execute(LispObject first, LispObject second)
     4221            throws ConditionThrowable
     4222        {
     4223            if (first instanceof Cons && first.car() == Symbol.LAMBDA) {
     4224                final Environment env;
     4225                if (second == NIL)
     4226                    env = new Environment();
     4227                else
     4228                    env = checkEnvironment(second);
     4229                return new Closure(first.cadr(), first.cddr(), env);
     4230            }
     4231            return signal(new TypeError("Argument to MAKE-CLOSURE is not a lambda form."));
     4232        }
     4233    };
     4234
    42164235    // ### streamp
    42174236    private static final Primitive1 STREAMP = new Primitive1("streamp", "object")
     
    42334252
    42344253    // ### evenp
    4235     private static final Primitive1 EVENP = new Primitive1("evenp","integer")
     4254    private static final Primitive1 EVENP = new Primitive1("evenp", "integer")
    42364255    {
    42374256        public LispObject execute(LispObject arg) throws ConditionThrowable
     
    42424261
    42434262    // ### oddp
    4244     private static final Primitive1 ODDP = new Primitive1("oddp","integer")
     4263    private static final Primitive1 ODDP = new Primitive1("oddp", "integer")
    42454264    {
    42464265        public LispObject execute(LispObject arg) throws ConditionThrowable
     
    42514270
    42524271    // ### numberp
    4253     private static final Primitive1 NUMBERP = new Primitive1("numberp","object")
     4272    private static final Primitive1 NUMBERP = new Primitive1("numberp", "object")
    42544273    {
    42554274        public LispObject execute(LispObject arg)
     
    42604279
    42614280    // ### realp
    4262     private static final Primitive1 REALP = new Primitive1("realp","object") {
     4281    private static final Primitive1 REALP = new Primitive1("realp", "object")
     4282    {
    42634283        public LispObject execute(LispObject arg)
    42644284        {
Note: See TracChangeset for help on using the changeset viewer.