map(S,f):
map(S,f)={b|∃c∈S,f(c)=b}
So, for a to be in map(S,f), then a must be one of the b's from the above expression and... the rest is an exercise for the reader :-)
the set of b's such that there exists a c in S, such that f(c)=b. In other words, it′s the set of numbers which are the result of applying the function f to some number in S.
What he say is :
You need to return a mapped result set ( ( Int ) => Boolean ).
In other words, the Boolean condition means you need to "find a mapped value f(c) equal to the testing value (b) exists in S"
The results set satisfy that boolean condition is the mapped result set.
This also a one liner of map function.
Example : input set S { 1, 3, 6, 7} , map f ( (x: Int) => (x + 1) ) ,
if there exists a value f( value) == result int in S { 1, 3, 6, 7}
- if there has a value f( 1 ) == result int in S{1,3,6,7}
- f( value ) ---> (1+1) == result int in S{1, 3, 6, 7} = 2
- f( value ) ---> (3+1) == result int in S{1, 3, 6, 7} = 4
- f( value ) ---> (6+1) == result int in S{1, 3, 6, 7} = 7
- f( value ) ---> (7+1) == result int in S{1, 3, 6, 7} = 8
Is it just me or is an unbounded version of the map function "map(s: Set, f: Int => Int): Set" not possible?!
--
You received this message because you are subscribed to the Google Groups "fp-cn" group.
To post to this group, send email to fp...@googlegroups.com.
To unsubscribe from this group, send email to fp-cn+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/fp-cn?hl=en.