Here is my issue: I have two lists as follows: [(Float, Integer)] and [(String, Integer)]. Now I need to define a function that takes these two Lists and two Float values and returns a list of Strings. The two Float values correspond to a range given (min and max). I have to filter the first list so it only contains elements that are within the min and max range. Then, I need to use the filtered list and take it’s Integer values, match them with the Integer values in the second list and return all the String values that match.
I have already defined a function for use as a filter condition that takes a (Float,Integer) and checks the Float value to see if it is within the given range.
And I have defined a function to take a (String,Integer) element and return the String.
I’m just having problems linking everything together, or maybe I am missing something!
You need (for example, there are different ways)
integersFromRangeis basicallymap snd . filter condition, withconditionconstructed from the twoFloats (you have that).stringsFromIntegercould be implemented asmap fst . filter condition. Then you combine the functions withUsing a set of
Integers instead of a list would be more efficient since membership test in aSetis faster than in a list.