On Sunday, July 13, 2014 10:24:03 AM UTC-4, paul analyst wrote: > > Julia Documentation: > cartesianmap(f, dims) > Given a dims tuple of integers (m, n, ...), call f on all combinations of > integers in the ranges 1:m, 1:n, > etc. > Example: > julia> cartesianmap(println, (2,2)) > 11 > 21 > 12 > 22 > > > julia>x= cartesianmap(2,2) > ERROR: no method cartesianmap(Int64, Int64) > > How to take variable (array) x= > 11 > 21 > 12 > 22 > > ? > > Paul > > Something like this perhaps? >
julia> a = [] 0-element Array{None,1} julia> cartesianmap((x,y)->(global a=vcat(a,(x,y))),(2,2)) julia> a 4-element Array{(Int64,Int64),1}: (1,1) (2,1) (1,2) (2,2) But maybe better?: [{"$x$y" for x=1:2,y=1:2 }...] 4-element Array{ASCIIString,1}: "11" "21" "12" "22"