[GiNaC-list] list input

Vladimir V. Kisil kisilv at maths.leeds.ac.uk
Sun Mar 1 12:01:34 CET 2015


>>>>> On Sun, 01 Mar 2015 05:38:41 -0500, soppon <gvitbsord at aol.com> said:

    soppon> Hi. I'm trying to use list as input. List as output prints
    soppon> {expr1,expr2,..}, list.nops() is varying.  When I write list
    soppon> as: parser reader; somelist=reader(cin); where input to cin:
    soppon> {expr1,expr2,..} at the end shift-D It returns
    soppon> somelist={expr1,expr2,..}, somelist.nops()=1.  When
    soppon> accessing the 2nd and higher element of list, program gets
    soppon> segmentation fault.


    I am not completely sure, but the following example may give you a
  hint:

  ex l1=lst(a,b,c);
  lst l2=l1;

  In this case l1.nops()=3, but l2.nops()=1, because l2 has the only
  element equal to l1 as a whole. To get thing right you may use:

  ex l1=lst(a,b,c);
  lst l2=ex_to<lst>(l1);

  To analyse situation use somelist.dbgprint() or even
  somelist.dbgprinttree().
-- 
Vladimir V. Kisil                 http://www.maths.leeds.ac.uk/~kisilv/
  Book:     Geometry of Mobius Transformations     http://goo.gl/EaG2Vu
  Software: Geometry of cycles          http://moebinv.sourceforge.net/


More information about the GiNaC-list mailing list