You need to splat the tuple first: push!(tuplestorage,newtuple...)
-- John On Jul 24, 2014, at 9:38 AM, [email protected] wrote: > Hi, > Translating some of my code from Python, I am trying to find a means of > concatenating and appending tuples to an array. > > In Python, I was able to do this: > > def createtuplelist: > tuplestorage = [] > for i in range(iteration): > newtuple = foo(i) > tuplestorage.append(newtuple) > return tuplestorage > > In Julia, I have tried to this so far: > function createtuplearray > tuplestorage = Float64[] > for i in Int64[1:iteration] > newtuple = foo(i) > push!(tuplestorage,newtuple) > return tuplestorage > end > > However, doing this in Julia returns the error message ERROR: no method > convert(Type{Float64},(Float64,Float64,Float64,Float64))in push! at > array.jl:659. > Is it possible to append tuples to an array in Julia?
