From 723a4f208e2d4d50c8677bcbdce2f3d5544f4973 Mon Sep 17 00:00:00 2001 From: Saif Eddin G <29315886+azjezz@users.noreply.github.com> Date: Mon, 6 Jul 2020 22:45:13 +0200 Subject: [PATCH] simplify the readme example (#21) --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9aa4ec6..dbb3d69 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,12 @@ use Psl\Iter; */ function foo(iterable $codes): string { - return Str\join(Iter\map( - Iter\filter_nulls($codes), fn($i) => Str\chr($i), - ), ', '); + /** @var Iter\Iterator $codes */ + $codes = Iter\filter_nulls($codes); + /** @var Iter\Iterator $chars */ + $chars = Iter\map($codes, fn(int $code): string => Str\chr($code)); + + return Str\join($chars, ', '); } foo([95, 96, null, 98]);