notes28 - (please (please (please (please please please...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
((please please me) love me do) ((please please me) ps i love you) ((please please me) baby its you) ((please please me) do you want to know a secret)) Note that ((please please me) misery) is how Scheme prints the kv-pair ((please please me) . (misery)) . Now we modify our wordcounts1 procedure to accept such kv-pairs: (define (wordcounts files) (groupreduce + 0 (sort-into-buckets (flatmap (lambda (kv-pair) (map (lambda (wd) (make-kv-pair wd 1)) (kv-value kv-pair))) files)))) > (wordcounts (append (file->linelist file1) (file->linelist file2) (file->linelist file3))) ((a . 4) (all . 3) (and . 1) (anna . 1) (any . 1) (ask . 1) (at . 1) (baby . 1) (back . 1) (be . 3) (beethoven . 1) (better . 1) (bother . 1) (boys . 1) (buy . 1) (cant . 2) (chains . 1) (child . 1) (cry . 1) (dance . 1) (days . 1) (do . 4) (dont . 1) (fell . 1) (get . 1) (go . 1) (got . 2) (happy . 1) (hard . 1) (have . 1) (her . 2) (him . 1) (hold . 2) (home . 1) (i . 7) (if . 1) (ill . 2) (im . 1) (instead . 1) (it . 1)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the 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.

Ask a homework question - tutors are online