| 85 | } |
| 86 | |
| 87 | func testSelfJoin() { |
| 88 | words := flow.New().TextFile( |
| 89 | "/etc/passwd", 3, |
| 90 | ).Filter(func(line string) bool { |
| 91 | return !strings.HasPrefix(line, "#") |
| 92 | }).Map(func(line string, ch chan string) { |
| 93 | for _, token := range strings.Split(line, ":") { |
| 94 | ch <- token |
| 95 | } |
| 96 | }).Map(func(line string) (string, string) { |
| 97 | return line, line |
| 98 | }) |
| 99 | |
| 100 | words.Join(words).Map(func(key, left, right string) { |
| 101 | println(key, ":", left, ":", right) |
| 102 | }).Run() |
| 103 | |
| 104 | } |
| 105 | |
| 106 | func testJoin() { |
| 107 | reg, err := regexp.Compile("[^A-Za-z0-9]+") |