codesections/_

`wrap-words` gives error when using named argument `:length`

Opened this issue · 0 comments

Test one-liner, without wrap-words function:

~ % raku -e 'use _; my $a = lines.skip(6).[0]; put $a;' US_Constitution.txt
We the People of the United States, in Order to form a more perfect Union, establish Justice, insure domestic Tranquility, provide for the common defence, promote the general Welfare, and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Constitution for the United States of America.

Below works without named argument. But is it actually wrapping text (inserting \n, etc.)?

~ % raku -e 'use _; my $a = lines.skip(6).[0]; put wrap-words($a);' US_Constitution.txt
We the People of the United States, in Order to form a more perfect Union, establish Justice, insure domestic Tranquility, provide for the common defence, promote the general Welfare, and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Constitution for the United States of America.

Below, adding named argument :length(40) throws error:

~ % raku -e 'use _; my $a = lines.skip(6).[0]; put wrap-words($a, :length(40));' US_Constitution.txt
Impossible coercion from 'Str' into 'Any': named arguments passed
  in block <unit> at -e line 1

~ %

Version/Installation_Log:

admin@mbp rakudo-2023.05 % /Users/admin/rakudo/rakudo-2023.05/install/share/perl6/site/bin/zef install _  --verbose
===> Searching for: _
===> Updating fez mirror: https://360.zef.pm/
===> Updated fez mirror: https://360.zef.pm/
===> Found: _:ver<0.0.2>:auth<zef:codesections> [via Zef::Repository::Ecosystems<fez>]
===> Fetching [OK]: _:ver<0.0.2>:auth<zef:codesections> to /var/folders/yt/l8245119545_9b4bhx09qssc0000gn/T//.zef/1701626257.50589/1701626261.50589.8803.49092724005/8dd4f26016c40477ba5b7883e9329b555b455f87.tar.gz
===> Extraction [OK]: _ to /var/folders/yt/l8245119545_9b4bhx09qssc0000gn/T//.zef/1701626257.50589/8dd4f26016c40477ba5b7883e9329b555b455f87.tar.gz
===> Testing: _:ver<0.0.2>:auth<zef:codesections>
[_] t/01-selective-imports.rakutest .......... ok
[_] t/PatternMatch/01-import.rakutest ........ ok
[_] t/PatternMatch/02-basic.rakutest ......... ok
[_] t/PrintDbg/01-import.rakutest ............ ok
[_] t/PrintDbg/02-basic.rakutest ............. ok
[_] t/SelfRecursion/01-import.rakutest ....... ok
[_] t/SelfRecursion/02-basic.rakutest ........ ok
[_] t/TestDoctestMarkdown/02-basic.rakutest .. ok
[_] t/TestFluent/02-basic.rakutest ........... ok
[_] t/TextParagraphs/01-import.rakutest ...... ok
[_] t/TextParagraphs/02-basic.rakutest ....... ok
[_] t/TextWrap/01-import.rakutest ............ ok
[_] t/TextWrap/02-basic.rakutest ............. ok
[_] t/TextWrap/03-intermediate.rakutest ...... ok
[_] All tests successful.
[_] Files=14, Tests=47, 12 wallclock secs ( 0.03 usr  0.06 sys + 14.41 cusr  1.17 csys = 15.67 CPU)
[_] Result: PASS
===> Testing [OK] for _:ver<0.0.2>:auth<zef:codesections>
===> Installing: _:ver<0.0.2>:auth<zef:codesections>
===> Install [OK] for _:ver<0.0.2>:auth<zef:codesections>