This preview shows pages 1–8. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: parameter has order 1. o Inductive Function that takes a function as a parameter or returns a function value has order (n+1) where n is the order of its highestorder parameter or returned value. High Order Functions Consider the problem of filtering out a list based on some criteria. Create a function that accepts an integer and returns true if that number is greater than 0, false otherwise. Create a function that accepts a string and returns true if the string is a palindrome, false otherwise. Create a function that accepts a list and a function that will be used to filter out bad elements. Map Example Write a function that doubles the value of every element in a list. Write a function that squares the value of every element in a list. Write a generic map function that accepts (lst, f) and returns the following list: [ f(lst[0]), f(lst[1]), f(lst[2]), , f(lst[n]) ]...
View
Full
Document
This document was uploaded on 03/15/2011.
 Spring '09

Click to edit the document details