[GiNaC-devel] Best way to iterate through an expression

Vladimir V. Kisil kisilv at maths.leeds.ac.uk
Wed May 10 17:30:32 CEST 2017


>>>>> On Tue, 9 May 2017 17:41:33 +0200, Jan Rheinländer <jrheinlaender at gmx.de> said:

    JR> Hi Vladimir, yes, I know about the map() function. But that
    JR> recurses into all sub-expressions, doesn't it? I only want to
    JR> work on the top-level subexpressions. That is, if the expression
    JR> is a mul, on its factors, otherwise on the expression itself.

    JR> I suppose I could pass a level argument to the map function, but
    JR> that seems like a lot of overhead for a simple problem. Most of
    JR> the time I apply only a single line of code to my
    JR> expression. Coding that in a map() function would result in lots
    JR> more lines of code plus an extra function.

    JR> The sort of thing I am thinking of is that iteration over an
    JR> expression would work even if the expression consists e.g. of a
    JR> single integral.

    Yes, Jan, within your task I do not know a better solution than you
  had used... 
	
-- 
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-devel mailing list