Quick actions

cmd+k|ctrl+k

Navigation

Languages

Logic

Snippet info

Language

Raku

Visibility

public

Author

fernando-correa

Created

2025-05-15T23:11:23.37694Z

Updated

2025-05-16T16:58:36.951978Z

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