and by list i mean array. or set. i just want to be able to iterate over it later. efficiency is neither here nor there.
On Friday, 25 April 2014 20:07:50 UTC-3, andrew cooke wrote: > > > is there some simple, compact way way to add an element or list to a list? > > say i want a list to be [1,2] or [1,2,3] depending on flag. is there an > elegant one-liner that will do that? > > i'm cleaning up some code and what should be a simple thing looks more > important than it should just because of the number of lines it takes. > > i thought [[1 2] flag ? [3] : []] would do it, but > > julia> [[1 2] false ? [3] : []] > ERROR: mismatch in dimension > 1 > in cat_t at > abstractarray.jl:681 > in hcat at > abstractarray.jl:720 > > thanks, > andrew > >
