source: to-imperative/trunk/samples/select2.rf @ 432

Last change on this file since 432 was 432, checked in by pooh, 18 years ago
  • Workaround to allow program compilation.
  • Makefile rules changed to allow correct dependency checking.
  • Removed C++ versions of samples from CVS.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 880 bytes
Line 
1//$use Dos StdIO; //TIMER;
2$use StdIO;
3
4$func  MkArg  eString = ePrefixes;
5$func  Select (eXs) eSets = eXs-or-sFail; * (eXs) or '*'
6$func? Sel    (eXs) eSets = (eXs);
7
8Main =   /*<PrintLN <Time>>,*/
9         <MkArg "1234567890ab"> :: e.Arg,
10         <PrintLN e.Arg>,
11         <Select () e.Arg> :: e.Res,
12         <PrintLN e.Res>,
13         /*<PrintLN <Time>>*/;
14
15MkArg e.String = * e.Prefixes
16   ( ) (e.String) $iter{
17      e.Prefix : e.Prefix-- s =
18        (e.Prefixes (e.Prefix)) (e.Prefix--) ;
19   } :: (e.Prefixes)            (e.Prefix),
20   e.Prefix : /*empty*/
21   = e.Prefixes;
22
23Select (e.Xs) e.Sets = * e.Xs-or-sFail -- (eXs') or '*'
24   {  <Sel (e.Xs) e.Sets>;
25      '*';
26   };
27
28Sel (e.Xs) e.Sets = * (eXs) | $fail;
29   e.Sets : \{
30           /*empty*/ = (e.Xs);
31
32      (e.Set) e.Sets--,
33              e.Set : e sX e,
34         #\{e.Xs : e s.X e;},
35         <Sel (e.Xs sX) e.Sets-->;
36   };
Note: See TracBrowser for help on using the repository browser.