*IF statement [#i204bb42]
**Sample Code 1[#u01684dc]
 a(T):rsrrsr
 b(T):a(2-T)b(T-5)
 c(T):b(T)sc(T-1)
 c(20)
[[English Page]]~
[[Elementary Techniques]] | Techniques of Function | [[Techniques of Recursion]] | [[Techniques of Number]]

In this code, b(T) equals "rsrrsr" if T≡1 mod 5, and no moves otherwise. 
#contents

**Examples [#p8f6fdb5]
-素数 mod 11, divisors
*Function of the form [1]X[2] [#g4076fa7]
**Sample Code 1 [#j3ad53e2]
 a:rsl
 sassassasasaasasaasa
 [24B]

The code above can be compressd by using a function. 

 a:rsl
 f(X):sXa
 f()sf()sf()f()f()af()f()af()

 f(X):sXrsl
 f()f(f()f(f()f()f())f()f())f()
 [19B]

**Sample Code 2 [#s843c0d9]
 x:rsl
 a:xxsxssxsxxxsxsla
 a
 [22B]

 x:rsl
 f(X):xXs
 a:f(f()f())f()xxf()f()la
 a

By adding two extra "s", we can use rslXs function completely!

 x:rsl
 f(X):xXs
 a:f(f()f())f()xxf()f()lass
 a

 f(X):rslXs
 a:f(f()f())f()f(f(f()f()la))
 a
 [19B]

**Examples [#wf59f3bb]
-[[Problem 0863]]
-[[Problem 0864]]

*Function of the form X[1]X [#jb2732e7]
**Sample Code 1 [#yeab0151]
 f(X):XX
 a(X):f(f(f(f(XXr))r))a(srslX)
 a()
 [21B]

 f(X):XrX
 a(X):f(f(f(f(XX))r))a(f(s)lX)
 a()
 [20B]

If we define a function "f(X):X[1]X", we have "f(f(X)) = X[1]X[1]X[1]X", ~
and this equals "(4 times X[1]) minus [1]". ~

**Sample Code 2 [#y7d41dad]
 f(X):XsssX
 f(f(rf(f(rsssssssssrsssrrsssr))))

 f(X):XsssX
 f(f(rf(f(rf(f())f(r)f(r)))))

Functions of the form "X[1]X" works like "double function". ~
Moreover, the function "XsssX" can make "sss" in 1B. ~

**Examples [#g596d286]
-[[Problem 0804]]
-[[Problem 0875]]

*Function with many variables [#i4b374d3]
**Sample Code 1 [#jabb8505]
 f(X,Y):XXXYY
 [8B]
You can use f as double function, and as triple function. ~
This function definition costs less than 
 a(X):XX
 b(X):XXX
 [7B]

**Sample Code 2 [#ubcc5a0c]
 f(X,Y):XYXYYYX
This function can be used
-as "four times function",
-as "three times function",
-to make srsls ans slsrs (f(s,r) and f(s,l)).


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