Quick actions

cmd+k|ctrl+k

Navigation

Languages

Component class?

Snippet info

Language

Raku

Visibility

public

Author

fernando-correa

Created

2020-04-29T08:09:37Z

Updated

2020-04-29T08:09:37Z

class Component {
    has @.in;
    has @.out;
    
    method run {
        my $zip = Supply.zip(|@!in);
        @!out.push: $zip.map: -> [ $a, $b ] { $a div $b }
        @!out.push: $zip.map: -> [ $a, $b ] { $a % $b }
    }
}

my $c = Component.new: :in[Supply.from-list(10 .. 19), Supply.from-list(1 .. 10)];

$c.run;

$c.out[0].tap: -> $val { say "s1: $val" };
$c.out[1].tap: -> $val { say "s2: $val" }
INFO