Last active
November 16, 2019 04:39
-
-
Save righ1113/573321cb2786214a95bbd6101d455b9e to your computer and use it in GitHub Desktop.
Refalの練習
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| https://github.com/bmstu-iu9/refal-5-lambda | |
| > chcp 65001 | |
| > srefc.bat test01.ref | |
| */ | |
| /* 先頭と末尾が同じ文字なら、それを削っていく */ | |
| Pal { | |
| = True; | |
| s.1 = True; | |
| s.1 e.2 s.1 = <Prout e.2> <Pal e.2>; /* 左辺は非線形パターン */ | |
| e.1 = False; | |
| } | |
| /* 階乗 */ | |
| Fact { | |
| 0 = 1; | |
| s.1 = <Mul (<Fact <Sub s.1 1>>) s.1>; /* 括弧は消せない */ | |
| } | |
| /* メイン関数 */ | |
| $ENTRY Go { | |
| = <Prout <Pal 'revolver'>> | |
| <Prout '1! = ' <Symb <Fact 1>>> | |
| <Prout '10! = ' <Symb <Fact 10>>> | |
| <Prout '100! = ' <Symb <Fact 100>>> | |
| } | |
| /* | |
| Active code page: 65001 | |
| e:\me\Refal\test01>srefc.bat test01.ref | |
| 'включая' is not recognized as an internal or external command, | |
| operable program or batch file. | |
| *Compiling test01.ref: | |
| ** Compilation succeeded ** | |
| e:\me\Refal\test01>test01 | |
| evolve | |
| volv | |
| ol | |
| False | |
| 1! = 1 | |
| 10! = 3628800 | |
| 100! = 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000 | |
| e:\me\Refal\test01> | |
| */ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment