On Thursday, April 13, 2017 at 12:07:27 PM UTC-4, Waldek Hebisch wrote:
>
> Raymond Rogers wrote:
> >
> > On Thursday, April 13, 2017 at 8:28:30 AM UTC-4, Raymond Rogers wrote:
> > >
> > > It seems that my macro/rule scheme has hit a bump in the road. When I
> > > run the small test program below the second evocation "ex_1(m+n)"
> posts:
> > > "There are 1 exposed and 0 unexposed library operations named
> ...."
> > > I think that applyRules([ex..],xx,1) doesn't like rules that have more
> > > than one rule. This does seem to contradict the intention (?).
> > > BTW: the "macro" keyword can be left out and it still bombs.
> > >
> > > Notice that it works okay with the second rule commented out.
> > > +++
> > > )expose APPRULE
> > > ++ Setup
> > > ex_rule := rule
> > > a+b == plus
> > > ++ a-b == minus
> > > ex_1_rule := rule
> > > a+b == plus
> > > a-b == minus
> > > macro ex(xx) == applyRules([ex_rule],xx,1)
> > > macro ex_1(xx) == applyRules([ex_1_rule],xx,1)
> > >
> > > ++ Test
> > > ex(m+n)
> > > ex_1(m+n)
> > >
> > > +++
> > >
> > > Built on:
> > > LinuxMint 17 (qiana)
> > > Gnome:3.8.4 (Ubuntu 2015-12-02)
> > > Kernel: 3.13.0-24-generic (#47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014)
> > > GCC: 4.8 (x86_64-linux-gnu)
> > > Xorg: 1.15.1 (12 February 2015 02:49:29PM)
> > >
> > > I can forward configure and make log files if wanted.
> > >
> > >
> > >
> > > I figured out the way to avoid the problem:
> > Make separate rules and then list them in the applyRules like so:
> > BR_R_rule_1 := rule
> > binomial(n+1,k+1) == binomial(n,k)+binomial(n,k+1)
> > BR_R_rule_2 := rule
> > binomial(n,k) == binomial(n-1,k)+binomial(n-1,k-1)
> > macro BR_R(xx) == applyRules([BR_R_rule_1,BR_R_rule_2],xx,1)
> > -------
> > Not exactly in the documentation (that I can see) but is consistent
> with
> > some
> > of the usages of applyRulles in some fricas files.
> > Incidentally the "macro" isn't necessary in my case.
>
> Well, you should have all needed info:
>
> (1) -> ex_rule := rule (a+b == plus ; a-b == minus)
>
> (1) {b + a == plus, - b + a == minus}
> Type:
> Ruleset(Integer,Integer,Expression(Integer))
> (2) -> rule a+b == plus
>
> (2) b + a == plus
> Type:
> RewriteRule(Integer,Integer,Expression(Integer))
>
> So, the second version produces thing of type RewriteRule, while
> the first produces Ruleset. 'applyRules' takes the first argument
> of type List(RewriteRule). The documentation does not explain this
> specific type mismatch, but it explains that types must match.
>
> --
> Waldek Hebisch
>
Thanks!
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.