Some other random feeback (no pun intended): the function

flip() = rand(["head", "tail"])


is rather inefficient.  It allocates a temporary array and two strings, 
just to compare the result to "head".   It would be more Julian and far 
more efficient just to do flip() = rand(Bool) to return true or false.

Rather than the explicit convert(Int64,x), you can can just explictly 
declare n::Int64 to force it to stay an Int64, and of course this is only 
an optimization (for type stability) in the case where x is not an integer 
... and if x is not an integer, the convert(Int64,x) might throw an 
exception (e.g. if x == 3.4), so I'm not quite sure I see the point.  In 
general, there is usually a more elegant way to do things than explicit 
calls to convert.

Rather than a Task, a more natural and far more efficient analogue of a 
Python generator is probably "iterable" object 
<http://docs.julialang.org/en/latest/manual/interfaces/#man-interfaces-iteration>,
 
which defines "start" and "next" and "done" methods so that you can iterate 
over it.     Though I don't understand the point in this notebook since the 
first thing you do is to call "collect" to stuff the result into an array; 
you might as well just use a loop to initialize the array directly.

Reply via email to