Hello, so for context I’m a R user.
I’ve been trying to use this function
using IterTools
IterTools.product(collect(1:5), collect(1:5))
But I get this output.
Base.Iterators.ProductIterator{Tuple{Vector{Int64}, Vector{Int64}}}(([1, 2, 3, 4, 5], [1, 2, 3, 4, 5]))
This is somewhat confusing to me because in R, usually when you enter a function you get the output right away.
expand.grid(c(1:5), c(1:5))
Var1 Var2
1 1 1
2 2 1
3 3 1
4 4 1
5 5 1
6 1 2
7 2 2
8 3 2
9 4 2
10 5 2
11 1 3
12 2 3
13 3 3
14 4 3
15 5 3
16 1 4
17 2 4
18 3 4
19 4 4
20 5 4
21 1 5
22 2 5
23 3 5
24 4 5
25 5 5
Now I see from another thread that you can get the output by passing it to collect (as shown here), but why is this necessary? And is collect
the function to always use when you want to see what the function outputs?