May 2019
Beginner to intermediate
466 pages
10h 44m
English
We can refactor our code to eliminate the generic Dict data structure and represent our articles with specialized Article composite types.
Let's create a new file in our sixdegrees/ work folder, and name it Articles.jl. Edit the file by typing in the corresponding module declaration. Then, add the definition of our type and export it:
module Articles
export Article
struct Article
content::String
links::Vector{String}
title::String
image::String
end
end
We could've added the Article type definition to the Wikipedia.jl file, but chances are this will grow and it's better to keep them separated instead.
Another thing to note is that both the module and the type are Julia entities that are loaded in the same scope. For this ...
Read now
Unlock full access