Commit 9e7d4553 authored by Irene Y Zhang's avatar Irene Y Zhang
Browse files

adding some hints to lab 1 code

parent 712eaf09
......@@ -9,10 +9,21 @@ import "container/list"
// key to the Map function, as in the paper; only a value,
// which is a part of the input file contents
func Map(value string) *list.List {
// Note: The value argument holds one line of text from the file.
// You need to:
// (1) Split up the string into words, discarding any punctuation
// (2) Add each word to the list with a mapreduce.KeyValue struct
// iterate over list and add values
func Reduce(key string, values *list.List) string {
// Note:
// The key argument holds the key common too all values in the values argument
// The values argument is a list of mapreduce.KeyValue structs with the given key.
// You need to:
// (1) Reduce the all of the values in the values list
// (2) Return the reduced/summed up values as a string
// Can be run in 3 ways:
......@@ -28,7 +39,7 @@ func main() {
} else {
mr := mapreduce.MakeMapReduce(5, 3, os.Args[2], os.Args[3])
// Wait until MR is done
<- mr.DoneChannel
} else {
mapreduce.RunWorker(os.Args[2], os.Args[3], Map, Reduce, 100)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment