chakravala / Reduce.jl

Symbolic parser for Julia language term rewriting using REDUCE algebra

Home Page:http://www.reduce-algebra.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

factor function clogs the pipe and then fails

ghyatzo opened this issue · comments

Hello,

I've been trying to use the function Algebra.factor(r...) but upon calling Algebra.factor(:b) as shown in the docs (where :b is one of my variables) i get the following output

julia> Algebra.factor(:b)
┌ Warning: Reduce pipe clogged by factor function, failure after 17 tries
└ @ Reduce ~/.julia/packages/Reduce/gkKoh/src/Reduce.jl:73
ERROR: Reduce: If generated code has many calls to factor, try to minimize the number of calls with REDUCE switches and use `Reduce.Reset()` if you'd like to start a new pipe.
Stacktrace:
 [1] #parse_args#69(::Int64, ::typeof(parse_args), ::String, ::RExpr) at /Users/ghyatzo/.julia/packages/Reduce/gkKoh/src/parser.jl:358
 [2] #parse_args at ./none:0 [inlined]
 [3] #factor#225 at /Users/ghyatzo/.julia/packages/Reduce/gkKoh/src/parser.jl:437 [inlined]
 [4] factor at /Users/ghyatzo/.julia/packages/Reduce/gkKoh/src/parser.jl:437 [inlined]
 [5] factor(::Symbol) at /Users/ghyatzo/.julia/packages/Reduce/gkKoh/src/parser.jl:798
 [6] top-level scope at none:0

A M(W)E is

using Reduce
@force using Reduce.Algebra
using ReduceLinAlg

Algebra.factor(:b)

what could be the issue?

Not sure yet why that's broken right now, it worked fine in the past.

Alternatively you can use this syntax instead, which still works:

julia> rcall(:(x^2-1),:factor)
:((x + 1) * (x - 1))

julia> rcall(:b,:factor)
:b

The factor method is supposed to do the same thing, but something seems to have changed somewhere to break it. Not sure when I'll get around to fully investigating and fixing it yet.

Issue has now been fixed, was a one-liner fix haha, problem was that:

julia> Algebra.factor == Reduce.factor
false

However, now that it is fixed it is as it should be

julia> Algebra.factor == Reduce.factor
true