Another version, if you need speed:
using Formatting
fmtr = generate_formatter( "%10.f" )
join( map( fmtr, [1,2,3] ), "" )
On Monday, December 22, 2014 11:28:03 AM UTC+7, Konstantin Markov wrote:
>
> One possible "partial" solution to your problem:
>
> julia> join (map((x) -> @sprintf("%10f",x), [1 2 3 4 5 6]),"")
> " 1.000000 2.000000 3.000000 4.000000 5.000000 6.000000"
>
>
>
> On Sunday, December 21, 2014 3:04:47 AM UTC+9, Daniel Carrera wrote:
>>
>> Hello,
>>
>> Here is my problem in a nutshell:
>>
>> julia> @sprintf("%10f "^6, 1,2,3,4,5,6)
>> ERROR: @sprintf: first argument must be a format string
>>
>>
>> I cannot use the ^ operator inside a @sprintf, probably because @sprintf
>> is a macro and something weird happens with the order of operation. This is
>> irritating because it is making me write ugly-long lines in my code for
>> something that should be shortened with "^".
>>
>> Is it possible to make @sprintf work correctly? If not, would you
>> consider re-implementing it as a function? I don't understand why Julia
>> makes @sprintf into a macro. The idea seems like a needless deviation from
>> standard behaviour, and in this case it forces me to write uglier code.
>>
>> Cheers,
>> Daniel.
>>
>