[julia-users] Re: idiom for WITH-OUTPUT-TO-STRING

2014-11-11 Thread harven
julia version 0.3.3 julia> rdstdout, wrstdout = redirect_stdout() (Pipe(open, 0 bytes waiting),Pipe(open, 0 bytes waiting)) julia> print("hello") julia> s = readavailable(rdstdout) "hello" Using a IOBuffer() is more idiomatic though. Look at the source of the filter functi

[julia-users] Re: idiom for WITH-OUTPUT-TO-STRING

2014-11-09 Thread Toivo Henningsson
In Julia, you typically do not redirect stdout and capture the results (once upon a time you did, but it was slow and gave other issues as well). Instead, all output functions (including print and show) are expected to take an optional first argument of type IO. You can capture the output from su

[julia-users] Re: idiom for WITH-OUTPUT-TO-STRING

2014-11-09 Thread Max Suster
*julia> * "foo"*"bar"

[julia-users] Re: idiom for WITH-OUTPUT-TO-STRING

2014-11-09 Thread Sal Mangano
Strings are immutable so I doubt this is supported. You can use: IOBuffer([*size*]) → IOBuffer Create an in-memory I/O stream, optionally specifying how much initial space is needed. You can also do string interpolation: *ju