JuliaTutorials
JuliaTutorials copied to clipboard
Reduce and Parallel Prefix - DummyArray type definition not working
I am trying to learn Julia and I come across this set of great tutorials.
However, when something in the tutorial went wrong, I am not yet equipped to fix it.
for the prefix notebook, the definition of DummyArray gave out an error syntax: extra token "DummyArray" after end of expression
the definition is as below:
isdefined(:DummyArray) || type DummyArray
length :: Int
read :: Vector
history :: Vector{Any}
DummyArray(length, read=[], history=[])=new(length, read, history)
end
I tried JuliaBox to run the same code, and it yielded the same error message. I am a bit lost as to what the example is trying to demonstrate and how exactly should I define a type in Julia? is it with type or struct keyword? I tried struct and no luck.
Unfortunately, that tutorial is out of date — it's written against version 0.6 (or maybe even older) and hasn't been updated for 1.0.
Looks like @alanedelman has an updated version from a few months ago — I've not tried it but that should give us a better starting point at getting the version here back up to date!
https://github.com/alanedelman/18.337_2018/blob/master/Lectures/Lecture18_11_07/Reduce%20and%20Parallel%20Prefix.ipynb
@mbauman thanks for the pointer, tried the @alanedelman version without any luck.
Completely understand the growing pains of young language. I am interested in Julia precisely because it is at a stage where any member of the community can still contribute and shape its future. I am particularly excited because julia is mostly written in julia.
Would be great if there's an up-to-date tutorial for Julia 1.x, but I understand the resources is limited.
is there anywhere I can learn about type and struct in 1.x? some example code would be fine.