Files
uwrap/testsuite/tests/core/function/test.wrp
Quentin Ochem f8ec4185be Switch 'self' to 'it'
The usage of the word 'self' to refer to the current iteration became increasingly
confusing with the usual OOP counterpart, in particular because its value can change
in a single expression, independendly of the surrounding object. See previous check
in that uncovered its usage in the fold function.
2020-08-23 22:03:48 -04:00

25 lines
644 B
Plaintext

function is_A_entity (e) do
match e (Entity (f_name ("A"))) do
pick e;
else
pick false;
end;
end;
function get_two_children (e) do
pick e.child (f_name (x"B"));
pick e.child (f_name (x"C"));
end;
function get_B_children (e) do
pick e.child (f_name (x"B")).all();
end;
match is_A_entity (it) do
pick get_two_children (it) weave standard.out (@ & "TWO CHILDREN (ONLY FIRST): " & f_name & "\n");
then
pick get_two_children (it).all () weave standard.out (@ & "TWO CHILDREN (ALL): " & f_name & "\n");
then
pick get_B_children (it).all () weave standard.out (@ & "B CHILDREN (ALL): " & f_name & "\n");
end;