learn-julia-the-hard-way icon indicating copy to clipboard operation
learn-julia-the-hard-way copied to clipboard

Chapter 2 ranges are not expanded.

Open driv opened this issue 9 years ago • 2 comments
trafficstars

I'm testing on the latest official docker image which uses 0.5.0.

I'm currently obtaining this result:

julia> a = [0:10]
1-element Array{UnitRange{Int64},1}:
 0:10

Instead of what is shown on the tutorial:

julia> [0:10]
    11-element Array{Int64,1}:
      0
      1
      2
      3
      4
      5
      6
      7
      8
      9
     10

To obtain the same result I have to collect the range:

julia> a = collect(0:10)
11-element Array{Int64,1}:
  0
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10

driv avatar Nov 16 '16 08:11 driv

Is it safe to assume that the tutorial should work with the latest version?

driv avatar Nov 16 '16 09:11 driv

@driv The tutorial was written pre-Arraypocalypse. So you're perfectly right - you now have to collect() ranges. It is my intention to fix this, along with most of the changes and novations that the Arraypocalypse has introduced. I'll keep this issue open pending the fix.

chrisvoncsefalvay avatar Nov 16 '16 10:11 chrisvoncsefalvay