home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / samples / rexx / usepipe.cmd < prev   
OS/2 REXX Batch file  |  1999-05-11  |  2KB  |  37 lines

  1. /******************************************************************************/
  2. /*  pipe                     Object REXX Samples                              */
  3. /*                                                                            */
  4. /*  Show samples uses of the pipe implementation in PIPE.ORX                  */
  5. /*                                                                            */
  6. /*  This program demonstrates how one could use the pipes implemented in the  */
  7. /*  pipe sample.                                                              */
  8. /******************************************************************************/
  9.  
  10. info = .array~of('Tom','Mike','Rick','Steve')  /* Create an array to use      */
  11.                                                /* filters on (any collection  */
  12.                                                /* would work).                */
  13.  
  14. pipe = .filter[.sorter,.reverser,.displayer]   /* Pipe to sort, reverse       */
  15.                                                /* elements and display.       */
  16.  
  17. pipe~go(info)                                  /* Run it                      */
  18.  
  19. say '-----------------------------------'
  20.  
  21. pipe = .filter[.selector['e'],.displayer]      /* Pipe to select elements with*/
  22.                                                /* 'e' and display.            */
  23.  
  24. pipe~go(info)                                  /* Run it                      */
  25.  
  26. say '-----------------------------------'
  27.  
  28. pipe = .filter[.sorter,.stem~new(a.)]          /* Pipe to sort, put in a.     */
  29.  
  30. pipe~go(info)                                  /* Run it                      */
  31.  
  32. Do i = 1 To a.0                                /* Show stem values            */
  33.   Say a.i
  34. End
  35.  
  36. ::REQUIRES pipe
  37.