Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7495093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:58:55+00:00 2026-05-29T17:58:55+00:00

If I use map or filter inside another function, does that function become a

  • 0

If I use map or filter inside another function, does that function become a higher-order function? For example:

removeSpaces :: String -> String 
removeSpaces xs = filter (not . isSpace) xs 

Is removeSpaces a higher-order function?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T17:58:55+00:00Added an answer on May 29, 2026 at 5:58 pm

    No, removeSpaces is not a higher-order function.

    A higher-order function is one that takes a function as an argument. removeSpaces doesn’t, so it isn’t.

    Higher-orderness is a property of a function’s interface, not its implementation, so we can tell that removeSpaces isn’t higher-order just by looking at its type: it doesn’t take any functions as arguments, so it’s not higher-order. It is implemented with the use of a higher-order function, but that’s another matter entirely.

    For example, filter is a higher-order function, because it is declared as taking a function as a parameter:

    filter :: (a -> Bool) -> [a] -> [a]
    

    But concat isn’t, because there aren’t any function types (a -> b) as arguments:

    concat :: [[a]] -> [a]
    

    Polymorphism poses a tricky edge-case: you can pass a function to id — id concat [[1, 2], [3, 4]] is [1, 2, 3, 4] — but its type does not declare it as taking any functions as arguments:

    id :: a -> a
    

    In this case, id is not higher-order. A function must explicitly have a function argument in its type to be higher-order.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When you use the Google map api, it is not part of the Android
There are two img elements that use the same map with one area. Now,
I know about map/reduce alghoritm and its use. It's using functions that are called
When should you use map/filter instead of a list comprehension or generator expression?
Is filter/map equivalent to list comprehension? Suppose I have the following function def fib_gen():
I want to use Spring Security, and it says to map the filter to
I'd like to point to a function that does nothing: def identity(*args) return args
I usually use C++ stdlib map whenever I need to store some data associated
I am trying to use the Google Map API- I've successfully managed to add
I always get confused when I am about to use a bit map to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.