#706 for matrix A, A[1,0] give "["

closed
nobody
Lisp Core (471)
5
2006-08-12
2005-03-23
Anonymous
No

Example :

(%i1) A:matrix([1,2],[3,4]);
[1 2]
(%o1) [ ]
[ 3 4]
(%i2) A[1,0];
(%o2) [

Discussion

  • Barton Willis

    Barton Willis - 2005-03-24

    Logged In: YES
    user_id=895922

    Matrices and lists are indexed starting at 1. If you want the
    element of A in the 2nd row first column, use A[2,1].

    So why does A[1,0] evaluate to [ ? Because
    A[1,0] == part(A,1,0). The zeroth part of a non-atom
    is its operator. Now, part(A,1) is a list and part(A,1,0) is
    the operator of a list. Finally, the operator of a list is [.

    I don't consider A[1,0] --> [ to be a bug. Others may
    have different opinions.

    Barton

     
  • Robert Dodier

    Robert Dodier - 2006-08-12
    • status: open --> closed
    • labels: --> Lisp Core
     
  • Robert Dodier

    Robert Dodier - 2006-08-12

    Logged In: YES
    user_id=501686

    Fixed by r1.27 src/mlisp.lisp -- now 0 index => "No such
    matrix element". See also bug report 705734 (list element 0
    => "[").

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks