I am going through Parallel Loops and Maps and I am seeming to have difficulty with even accessing the file count_heads.jl
I saved it in my working directory
function count_heads(n)
c::Int = 0
for i = 1:n
c += rand(Bool)
end
c
end
And I can verify it's existence in that directory:
filter(r"count_heads.jl", readdir())
#1-element Array{String,1}:
#"count_heads.jl"
Yet when I attempt the next step in the tutorial.
@everywhere include_string(Main, $(read("count_heads.jl", String)), "count_heads.jl")
ERROR: MethodError: Cannot `convert` an object of type Type{String} to an object of type Array{UInt8,1}
This may have arisen from a call to the constructor Array{UInt8,1}(...),
since type constructors fall back to convert methods.
Looking at just the read("count_heads.jl", String) function I get the source of the error (I think).
read("count_heads.jl", String)gives me"function count_heads(n)\n c::Int = 0\n for i = 1:n\n c += rand(Bool)\n end\n c\nend\n"- Michael K. Borregaard