Re: [julia-users] Re: convert array elements
Well, what do you know, it behaves differently in a function. Food for thought. Thanks a lot! On Thu, May 12, 2016 at 3:38 PM, Kristoffer Carlsson wrote: > Try it in a function. Array comprehensions are a bit annoying that the > results depend on the ability of type inference to figure out the result > type. There is an issue tracking this: > https://github.com/JuliaLang/julia/issues/7258 > > On Thursday, May 12, 2016 at 3:36:06 PM UTC+2, Michael Borregaard wrote: >> >> Awesome, thank you! I love the Julia 0.5 implementation. >> PS. On my system ["$x" for x in ID] gives an Array{Any}, this seems to be >> a general issue with array comprehensions. >> >> On Thu, May 12, 2016 at 12:38 PM, Steven G. Johnson >> wrote: >> >>> >>> >>> On Thursday, May 12, 2016 at 6:34:30 AM UTC-4, Michael Borregaard >>> wrote:y - the 'easiest' way of doing this is ID = [UTF8String("$x") for x in ID] >>> map(string, ID) converts all elements of ID to strings. You could also >>> use ["$x" for x in ID]. In Julia 0.5 you can do string.(ID) >>> >> >>
Re: [julia-users] Re: convert array elements
Try it in a function. Array comprehensions are a bit annoying that the results depend on the ability of type inference to figure out the result type. There is an issue tracking this: https://github.com/JuliaLang/julia/issues/7258 On Thursday, May 12, 2016 at 3:36:06 PM UTC+2, Michael Borregaard wrote: > > Awesome, thank you! I love the Julia 0.5 implementation. > PS. On my system ["$x" for x in ID] gives an Array{Any}, this seems to be > a general issue with array comprehensions. > > On Thu, May 12, 2016 at 12:38 PM, Steven G. Johnson > wrote: > >> >> >> On Thursday, May 12, 2016 at 6:34:30 AM UTC-4, Michael Borregaard wrote:y >> - the 'easiest' way of doing this is >>> >>> ID = [UTF8String("$x") for x in ID] >>> >>> >> map(string, ID) converts all elements of ID to strings. You could also >> use ["$x" for x in ID]. In Julia 0.5 you can do string.(ID) >> > >
Re: [julia-users] Re: convert array elements
Awesome, thank you! I love the Julia 0.5 implementation. PS. On my system ["$x" for x in ID] gives an Array{Any}, this seems to be a general issue with array comprehensions. On Thu, May 12, 2016 at 12:38 PM, Steven G. Johnson wrote: > > > On Thursday, May 12, 2016 at 6:34:30 AM UTC-4, Michael Borregaard wrote:y > - the 'easiest' way of doing this is >> >> ID = [UTF8String("$x") for x in ID] >> >> > map(string, ID) converts all elements of ID to strings. You could also > use ["$x" for x in ID]. In Julia 0.5 you can do string.(ID) >
[julia-users] Re: convert array elements
On Thursday, May 12, 2016 at 6:34:30 AM UTC-4, Michael Borregaard wrote:y - the 'easiest' way of doing this is > > ID = [UTF8String("$x") for x in ID] > > map(string, ID) converts all elements of ID to strings. You could also use ["$x" for x in ID]. In Julia 0.5 you can do string.(ID)