QuantEcon / QuantEcon.cheatsheet

A cheatsheet for Python and Julia
154 stars 65 forks source link

Creating Vectors by range in Julia should be change. #67

Open sppmg opened 5 years ago

sppmg commented 5 years ago

Hi I am new in Julia.

The Integers from j to n with step size k in Creating Vectors write:

A = j:k:n

It just is a range object in Julia, but in Matlab, it can create a array. So I think maybe change to

A = collect(j:k:n)

or maybe add a row for range and create array.

Thanks your beautiful cheatsheet.

arnavs commented 5 years ago

I can see how this is confusing. I'd rather not teach people to collect() things by default (because the whole point is that it's "lazy," in that it only gives you the actual array if you need it.)

The best approach is probably to explain briefly in a comment. Will do that. Thanks for your helpful feedback, and I'm glad you found the cheatsheet useful.