Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

Difference between Base.product and Iterators.product?

$
0
0

They seem identical down to the documentation:

help?> Base.product
  product(iters...)

  Return an iterator over the product of several iterators. Each generated element
  is a tuple whose ith element comes from the ith argument iterator. The first
  iterator changes the fastest.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> collect(Iterators.product(1:2, 3:5))
  2×3 Array{Tuple{Int64,Int64},2}:
   (1, 3)  (1, 4)  (1, 5)
   (2, 3)  (2, 4)  (2, 5)

help?> Iterators.product
  product(iters...)

  Return an iterator over the product of several iterators. Each generated element
  is a tuple whose ith element comes from the ith argument iterator. The first
  iterator changes the fastest.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> collect(Iterators.product(1:2, 3:5))
  2×3 Array{Tuple{Int64,Int64},2}:
   (1, 3)  (1, 4)  (1, 5)
   (2, 3)  (2, 4)  (2, 5)

4 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 2795

Trending Articles