Logic
use Logic;
sub mother( :$name is raw, :$child is raw ) is logic { True }
mother :name<aline>, :child<fernanda>;
mother :name<aline>, :child<sophia>;
mother :name<virginia>, :child<aline>;
say "-" x 10;
say "- mother";
.indent(4).say for query {
my $name;
my $child;
mother
}
say "-" x 10;
say "- mother :name<aline>";
.indent(4).say for query {
my $name;
my $child;
mother :name<aline>
}
say "-" x 10;
say "- mother :name<aline>, :child<sophia>";
.indent(4).say for query {
my $name;
my $child;
mother :name<aline> :child<sophia>
}
say "-" x 10;
say "- mother :name<no-one>";
.indent(4).say for query {
my $name;
my $child;
mother :name<no-one>
}
sub human(:$name is raw) is logic { True }
human :name<pitagoras>;
say "-" x 10;
say "- human";
.indent(4).say for query { human }
say "-" x 10;
say "- human :name<pitagoras>";
.indent(4).say for query { human :name<pitagoras> }
say "-" x 10;
say "- human :name<aline>";
.indent(4).say for query { human :name<aline> }
say "\n- Adding aline as a human";
human :name<aline>;
say "-" x 10;
say "- human :name<aline>";
.indent(4).say for query { human :name<aline> }
say "-" x 10;
say '- my $child; mother :$child; human :name($child)';
.indent(4).say for query {
my $child;
mother :$child;
human :name($child)
}
INFO