Replace in a recursive function

Sample Code 1

a(X):XXXXrXXXXla(srslX)
a(r)
(20B)

The code above can be compressed by replacing XXXX by another variable.

a(X,Y):YrYla(srslX,XXXX)
a(r,)
(19B)

Examples

Special first term

Sample Code 1

a(X,Y):YrYla(srslX,XXXX)
a(r,sss)

Even if you replace something by Y, the rule of Y isn't applied for "1st Y".
Thus, you can use "1st Y" freely.

Sample Code 2

a(X,Y):XYXa(XX,l)
a(srsl,r)

Sample Code 3

a(X,Y):XXXXYa(sX,YYl)
a(r,)

In this code, "1st Y" and "2nd Y" is special.

Examples

Multiple recursion

Sample Code 1

f(X):ssXlssf(sX)
f()
(12B)

This code can be compressed by recycling "ss":

f(X):ssXlf(f(sX))
f()
(11B)

Sample Code 2

育たない再帰とかで

Examples


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS