[julia-users] Re: idiomatic way to generate variable length list or tuple?

2014-04-25 Thread andrew cooke
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]

[julia-users] Re: idiomatic way to generate variable length list or tuple?

2014-04-25 Thread andrew cooke
really i'm asking if there's an idiomatic way to do the kind of thing you do with linked lists (usually, in functional languages) in julia... On Friday, 25 April 2014 20:34:43 UTC-3, andrew cooke wrote: oh, cute. no, it's not what i was looking for, unfortunately. i just used 1, 2 and 3

[julia-users] Re: idiomatic way to generate variable length list or tuple?

2014-04-25 Thread Simon Kornblith
You can do: [1, 2, (flag ? 3 : [])] or: tuple(1, 2, (flag ? (3,) : ())...) On Friday, April 25, 2014 7:35:49 PM UTC-4, andrew cooke wrote: really i'm asking if there's an idiomatic way to do the kind of thing you do with linked lists (usually, in functional languages) in julia... On

[julia-users] Re: idiomatic way to generate variable length list or tuple?

2014-04-25 Thread andrew cooke
huh. i do not understand why that works and what i posted earlier did not. anyway, thanks. andrew On Friday, 25 April 2014 21:02:41 UTC-3, Simon Kornblith wrote: You can do: [1, 2, (flag ? 3 : [])] or: tuple(1, 2, (flag ? (3,) : ())...) On Friday, April 25, 2014 7:35:49 PM UTC-4,

[julia-users] Re: idiomatic way to generate variable length list or tuple?

2014-04-25 Thread andrew cooke
oh it's the spaces are column vector thing. On Friday, 25 April 2014 21:26:31 UTC-3, andrew cooke wrote: huh. i do not understand why that works and what i posted earlier did not. anyway, thanks. andrew On Friday, 25 April 2014 21:02:41 UTC-3, Simon Kornblith wrote: You can do: [1,