Changeset 4045


Ignore:
Timestamp:
09/25/03 00:40:16 (19 years ago)
Author:
piso
Message:

VECTOR-SUBSEQ: signal an error if start > end.

File:
1 edited

Legend:

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

    r4042 r4045  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Primitives.java,v 1.435 2003-09-24 22:50:56 piso Exp $
     5 * $Id: Primitives.java,v 1.436 2003-09-25 00:40:16 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    38953895    };
    38963896
     3897    // ### vector-subseq
     3898    // vector-subseq vector start &optional end => subsequence
    38973899    private static final Primitive3 VECTOR_SUBSEQ =
    3898         new Primitive3("vector-subseq", PACKAGE_SYS, false) {
    3899         public LispObject execute(LispObject vector, LispObject start,
    3900             LispObject end) throws ConditionThrowable
    3901         {
    3902             AbstractVector v = checkVector(vector);
    3903             return v.subseq(Fixnum.getValue(start),
    3904                 end == NIL ? v.length() : Fixnum.getValue(end));
     3900        new Primitive3("vector-subseq", PACKAGE_SYS, false)
     3901    {
     3902        public LispObject execute(LispObject first, LispObject second,
     3903                                  LispObject third)
     3904            throws ConditionThrowable
     3905        {
     3906            AbstractVector v = checkVector(first);
     3907            int start = Fixnum.getValue(second);
     3908            int end = third != NIL ? Fixnum.getValue(third) : v.length();
     3909            if (start > end)
     3910                throw new ConditionThrowable(new TypeError("start is greater than end"));
     3911            return v.subseq(start, end);
    39053912        }
    39063913    };
Note: See TracChangeset for help on using the changeset viewer.