This preview shows page 1. Sign up to view the full content.
Unformatted text preview: #f Here’s how we look for lines in Fles that match a pattern: (define (grep pattern files) (groupreduce cons ’() (sort-into-buckets (flatmap (lambda (kv-pair) (if (match? pattern (kv-value kv-pair)) (list kv-pair) ’())) files)))) > (grep ’(* i * her *) (append (file->linelist file1) (file->linelist file2) (file->linelist file3))) (((a hard days night) (and i love her)) ((please please me) (i saw her standing there))) Summary. The general pattern here is (groupreduce reducer base-case (sort-into-buckets (map-or-flatmap mapper data ))) This corresponds to (mapreduce mapper reducer base-case data ) in the truly parallel mapreduce exploration we’ll be doing later. 295...
View Full Document
This note was uploaded on 02/17/2010 for the course COMPUTER S 26275 taught by Professor Harvey,b during the Spring '10 term at Berkeley.
- Spring '10