Questions tagged [map-function]

Higher-order function "map" transforms a collection by applying a given function to each element in it. USE [maps] for geography, [map] or [dictionary] for data types.

A map function is a higher-order function that applies a function to each element in a list, building a list of the results. Examples include map in Python, Scheme, Haskell and Scala, Stream.map in Java 8, array_map in PHP, and std::transform in C++.

A generalized map works with some general type of a collection, applying a function to each element in the collection and building the collection (of the same general type) of the results. An example is fmap in Haskell, etc.

For questions about geography, use the tag instead.

For questions about data types, use the tag instead, which is a synonym tag for .

829 questions
-3
votes
3 answers

Python map() function

Why am I getting an error with map() function in the following code? Why can't map convert negative numbers in the list x. The output should be like "1 --> 2 --> 3". The list should end whenever I enter -999. I am getting an error such as: Traceback…
proggeek
  • 21
  • 4
-4
votes
1 answer

Hey Guys i have a problem in my react class base component by using the setstate please anyone solve this error

This is my and i am trying to fetch api and show the result in my next react component but if i can set the state in the componetmountfunction it can cause the error. !this.state.articles.map is not a function!. Please solve this problem and also…
Rick Kim
  • 1
  • 2
-4
votes
1 answer

mapping value in Python 3

def valMap(x, in_min, in_max, out_min, out_max): return ((x - in_min) * (out_max - out_min)) // (in_max - in_min) + out_min def limit(self, input): if -0.2 <= input <= 0.2: input = 192 if input < -0.2: input =…
user3603948
  • 153
  • 3
  • 12
-8
votes
2 answers

How to get multiple API fetch data avoid first consle.log empty array

When i am trying to fetch multiple API using map() method, and launch the project it's given me empty which is i understand my console.log couldn't able to fetch at the time, and just use Ctrl+s press to save the file again, it's start to giving me…
1 2 3
55
56