Skip to content

$-variable pattern matching and nested denominators #400

Description

@tueda

In the following program, in the 1st module, I use the denominators statement and then try a pattern matching (the id statement) with an expression captured in a $-variable, but it fails. After .sort, in the 2nd module, the same code somehow works.

#-
Off stats;
S x;
CF den;
L F = 1/(1+1/(1+x));
P +s;
.sort;
denominators den;
* Just after the denominators statement, the following doesn't work.
if (match(den(x?$x1)));
  P "matched: %$ in %t", $x1;
  id den($x1) = 1;
endif;
P +s;
.sort;
* After sorting, it works.
if (match(den(x?$x2)));
  P "matched: %$ in %t", $x2;
  id den($x2) = 1;
endif;
P +s;
.end;
FORM 4.2.1 (Nov 10 2020, v4.2.1-30-gb0e72a8) 64-bits  Run: Mon Nov 15 12:37:30 2021
    #-

   F =
       + 1/(1 + 1/(1 + x))
      ;

matched: 1 + den(1 + x) in  + den(1 + den(1 + x))

   F =
       + den(1 + den(1 + x))
      ;

matched: 1 + den(1 + x) in  + den(1 + den(1 + x))

   F =
       + 1
      ;

  0.00 sec out of 0.00 sec

If this works in the 2nd module, then it should also work in the 1st module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions