source: applications/trunk/UGPSummerSchool2008/src/Reverse.rf @ 3827

Last change on this file since 3827 was 3827, checked in by yura, 13 years ago
  • Reverse
File size: 467 bytes
Line 
1$module Reverse;
2
3$use StdIO;
4
5$func Reverse e = e;
6
7Reverse {
8        s1 e2 = <Reverse e2> s1;
9        = ;
10};
11
12$func Reverse1 e = e;
13
14Reverse1 e1 = <Reverse2 (e1) ()>;
15
16$func Reverse2 (e) (e) = e;
17
18Reverse2 {
19        (s1 e2) (e3) = <Reverse2 (e2) (s1 e3)>;
20        (     ) (e3) = e3;
21};
22
23$func ReverseWords e = e;
24
25ReverseWords {
26        e1 ' ' e2 = <Reverse e1> ' ' <ReverseWords e2>;
27        e3 = <Reverse e3>;
28};
29
30$func Main = e;
31
32Main = <PrintLn <ReverseWords <ReadLine>>>;
Note: See TracBrowser for help on using the repository browser.