I have a list of tuples here, and I want to apply function dir..
on the first element in each tuple. How can I do that? Thanks a lot in advance!
[ ("grid", gridResponse),
("graph", graphResponse),
("image", graphImageResponse),
("timetable-image", timetableImageResponse x),
("graph-fb",toResponse ""),
("post-fb",toResponse ""),
("test", getEmail),
("test-post", postToFacebook),
("post", postResponse),
("draw", drawResponse),
("about", aboutResponse),
("privacy" ,privacyResponse),
("static", serveDirectory),
("course", retrieveCourse),
("all-courses", allCourses),
("graphs", queryGraphs),
("course-info", courseInfo),
("depts", deptList),
("timesearch",searchResponse),
("calendar",calendarResponse),
("get-json-data",getGraphJSON),
("loading",loadingResponse),
("save-json", saveGraphJSON)]
map
? – pdextermap (dir . fst) data
– karakfamap
is very useful! – Mia.Mmap
and explicit recursion with pattern matching.f [] = ... ; f ((x,y):rest) = ...
– chi