Explain what the map function does in a functional language. How does it provide additional abstraction capability in a programming language?
Explain what the map function does in a functional language. How does it provide additional abstraction capability in a programming language?
Chapter20: Creating A Presentation
Section: Chapter Questions
Problem 5QY
Related questions
Question
1.14 Explain what the map function does in a functional language. How does it provide additional abstraction capability in a
Expert Solution
Step 1
The map function builds and returns a list of the results got by applying the argument function to every element in the argument list.
The function expects another function and a collection, like a list as arguments.
Step 2
Example using Lisp:
The first argument to the map is the function abs, which returns the absolute value of its arguments. The second argument to map is a list generated by the function list.
(map abs (list 33 -10 66 88 -4) ) ; Returns (33 10 66 88 4)
Step by step
Solved in 3 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT