turn a lazy list into a concurrent lazy list
Switch branches/tags
Nothing to show
Clone or download
gfldex Merge pull request #1 from samcv/SPDX-license
Use SPDX identifier in license field of META6.json
Latest commit 5217bc3 Apr 30, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
example add ⇒ Oct 17, 2016
lib/Concurrent implement postfix ⇒ Oct 17, 2016
t implement Concurrent::Channelify Oct 17, 2016
.travis.yml initial commit Oct 16, 2016
LICENSE initial commit Oct 16, 2016
META6.json Use SPDX identifier in license field of META6.json Apr 27, 2017
README.md doc .no-thread Oct 17, 2016



Build Status

Turn a lazy list into an auto-threading lazy list.


use v6;
use Concurrent::Channelify;

my \l1 = (10_000_000..10_100_000).grep({.is-prime});

for my $c := channelify(l1) {
    $c.channel.close if $_ > 10_010_000;
    say $_

my \l2 = <a b c>;

for l2⇒ {
    say $_



sub channelify(Positional:D, :$no-thread = False)

Return a new lazy list that is turned into a Channel. If no-thread is True do not start a thread to generate values. The environment variable RAKUDO_MAX_THREAD with a value smaller then 2 has the same effect then no-thread, if set before the use-statement is executed.

The channel can be accessed by calling the mixed in method channel. Closing the channel will force the lazy list to stop producing values and kill the associated thread.

To query if a thread was started call the mixed in method no-thread.

postfix ⇒

see sub channelify