朱莉婭0.5上Juliabox朱莉婭MethodError:沒有方法匹配採取(:: Base.AbstractIOBuffer {陣列{UInt8,1}})
爲什麼以下函數定義產生以下錯誤:
Julia MethodError: no method matching take!(::Base.AbstractIOBuffer{Array{UInt8,1}})
function CoinTrials(x,y; numtrials=100000, numcoins=5)
Yes=[]
No=[]
for trial in 1:numtrials
trialresults=[]
for coin in 1:numcoins
result = rand(1,2)
push(vec,trialresults)
end
if len(filter(x->x==1,trialresults)) >=3
Yes+=1
else
No+=1
end
end
@printf(Yes,No)
end
這段代碼有很多語法錯誤,朱莉婭0.5甚至沒有接近編譯它。什麼是vec? printf必須將字符串字面量作爲其第一個參數。請更正代碼。 – Terminus