Hi,

on a related note, you can discard the "ERROR: i not defined" error because 
it turned out to be an error in a predicate, unrelated to Task and the 
iterator.
(I am surprised it did not provide line numbers for this but maybe it was 
inlined/optimized.)

The Task/iterators now work from the REPL but the hanging issue files 
remains when I call "julia.exe bug1.jl".

Thanks for your help,
Sebastian


On Tuesday, 1 July 2014 20:05:48 UTC+1, Sebastian Nowozin wrote:
>
>
> Hi everyone,
>
> I followed the pattern proposed at 
> http://slendermeans.org/julia-iterators.html (see the "fibtask" function) 
> in order to define an iterator that is traversing a tree data structure as 
> follows:
>
> function search(rt::Tree)
>     function _search(node::InteriorNode)
>         for cn in node.children
>             _search(cn)
>         end
>     end
>     function _search(node::LeafNode)
>         for obj in node.children
>             produce(obj.membervar)
>         end
>     end
>     function _search()
>         _search(rt.root)
>     end
>     Task(_search)
> end
>
> This function dispatches based on the type of node (interior or leaf) and 
> iterates over objects stored with each leaf node of the tree (it is a 
> B-tree).  Eventually I would like to write statements such as:
>
>    for leaf in search(tree)
>       ...
>    end
>
> I tested the above code on both Windows 8.1 with latest 64 bit build as 
> well as on Ubuntu 14.04 git trunk, with code as follows:
>
>    S = search(tree)
>    L = collect(S)
>
> This yields the following error, with line 25 being the collect statement:
>
> ERROR: i not defined
>  in schedule_and_wait at task.jl:251
>  in consume at task.jl:162
>  in collect at array.jl:233
>  in collect at array.jl:240
>  in include at ./boot.jl:244
>  in include_from_node1 at loading.jl:128
>  in process_options at ./client.jl:285
>  in _start at ./client.jl:354
> while loading test_tree1.jl, in expression starting on line 25
>
> Is the above an invalid use of the Task interface?  If so, what are the 
> constraints on the produce statements, and how to fix the above code?
>
> Any help is appreciated.  If it would help I could open an issue on the 
> Julia issue tracker.
>
> Thanks,
> Sebastian
>
>

Reply via email to