# How-to implement iteration over a result of an iteration in a functional way

I have a pure function

f:= #1 * #2 * #3 &;


Which I can invoke in a following way:

f[#,2,3]& /@ {1,2,3}


Which yields following result:

{6, 12, 18}


How could I do something like this:

f[#1,#2,3]& /@ {{1,2,3},{1,2,3}}


such that the return product would look like:

{{3,6,9},{6,12,18},{9,18,27}}


I understand there is a syntax error above. I struggle coming up with a functional solution which would avoide iteration and loops. I'd greatly appreciate any assistance.

Example based on OOP (conceptual):

List<Integer> nums = new ArrayList<Integer>();
for(int i = 1; i < 5; i++){
for(int m = 1; m < 3; m++){
product = i * m * 3;
}
}
System.out.println("Product: " + nums.toString());

• If you want all combinations of possible #1 and #2, use Outer. Commented Jun 15, 2015 at 16:16
• mathematica.stackexchange.com/questions/85165/… deals with this problem Commented Jun 15, 2015 at 16:27

As mentioned in the comments, the construct you are probably looking for is Outer (see its documentation page).
You could then define the following function to achieve what you indicated, even without using Map:
Clear[func]