Fundamentals of Computer Science I: Media Computing (CS151.01 2008S)

List Iteration Procedures


(foreach! func lst)
Traditional higher-order list procedure. Evaluate func on each element of the given list. Called primarily for side effects.
(map func lst)
Standard higher-order list procedure. Create a new list, each of whose elements is computed by applying func to the corresponding element of lst.

Creative Commons License

Samuel A. Rebelsky, rebelsky@grinnell.edu

Copyright (c) 2007-8 Janet Davis, Matthew Kluber, and Samuel A. Rebelsky. (Selected materials copyright by John David Stone and Henry Walker and used by permission.)

This material is based upon work partially supported by the National Science Foundation under Grant No. CCLI-0633090. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.

This work is licensed under a Creative Commons Attribution-NonCommercial 2.5 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/2.5/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.