chrisvoncsefalvay / learn-julia-the-hard-way

Learn Julia the hard way!
https://app.gitbook.com/@chrisvoncsefalvay/s/learn-julia-the-hard-way/
Other
772 stars 153 forks source link

Chapter 2 ranges are not expanded. #41

Open driv opened 7 years ago

driv commented 7 years ago

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 commented 7 years ago

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

chrisvoncsefalvay commented 7 years ago

@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.