This commit is contained in:
agra
2026-02-20 13:28:38 +02:00
parent 5956303366
commit 6f927361aa
9 changed files with 657 additions and 36 deletions

View File

@@ -1360,5 +1360,22 @@ END;
print("{}\n", pkg.hello()); // hello from testpkg
}
// --- Pipe operator ---
{
print("--- pipe operator ---\n");
// Basic: a |> f(b) → f(a, b)
print("{}\n", 3 |> pkg.add(4)); // 7
print("{}\n", 5 |> pkg.mul(6)); // 30
// Chaining: a |> f(b) |> g(c) → g(f(a, b), c)
print("{}\n", 3 |> pkg.add(4) |> pkg.mul(2)); // 14
// With non-namespaced functions
print("{}\n", "hello" |> concat(" world")); // hello world
// Chained string ops
print("{}\n", "piped" |> concat(" ok") |> concat("!")); // piped ok!
}
print("=== DONE ===\n");
}