Vincent Hui (3) [Avatar] Offline
#1
In my use case, I need to transform multiple types of inputs in order. I extend the example shown in figure 2.2 in the book to tell the problem I have.
There are 2 types of inputs: 1. a collection of people 2. a collection of foods
and I need to transform inputs to a string that states what a person will eat, male eat 2 foods, female eat 1 food.
Let's say a collection of people is
[{"name":"Tom","sex":"m"}, {"name":"Rose","sex":"f"}, {"name":"David","sex":"m"}]
a collection of foods is
["apple","mango","noodle","egg","potato"]
The expected output is
["Tom will eat apple and mango","Rose will eat noodle","David will eat egg and potato"]

Thanks