The SF Perl Raku Study Group, 01/29 at 1pm PDT
George Sand to Gustave Flaubert, November 29th, 1866: "I have never ceased to wonder at the way you torment yourself over your writing. Is it just fastidiousness on your part? There is so little to show for it... As to style, I certainly do not worry myself, as you do, over that. The wind bloweth as it listeth through my old harp." The Raku Study Group January 29, 2023 1pm in California, 9pm in the UK An informal meeting: drop by when you can, show us what you've got, ask and answer questions, or just listen and lurk. Perl and programming in general are fair game, along with Raku, Zoom meeting link: https://us02web.zoom.us/j/85019303942?pwd=NDd4YmJpZ1YzZGE5QmRvTnlybVNJUT09 Passcode: 4RakuRoll RSVPs are useful, though not needed: https://www.meetup.com/san-francisco-perl/events/291222813/
Re: `lines.contains( / \h / )` returning True for input strings not containing horizonal whitespace
Thanks Sean. Made some progress. I like this result better: ~$ raku -e 'put "1\n2\n3";' | raku -e 'lines.map(*.contains(/ \h /)).put;' False False False Thx, Bill. On Thu, Jan 26, 2023 at 12:12 PM Sean McAfee wrote: > On Thu, Jan 26, 2023 at 12:05 PM William Michels via perl6-users < > perl6-users@perl.org> wrote: > >> ~$ raku -e 'put "1\n2\n3";' | raku -e 'put lines.contains(/ \h /) ?? True >> !! False;' >> True >> > > lines() returns a Seq. The contains method for a Seq coerces its argument > to a Str and calls contains on that Str. And: > > $ raku -e 'put "1\n2\n3"' | raku -e 'put lines.Str' > 1 2 3 > > There's your horizontal whitespace. > >
Re: `lines.contains( / \h / )` returning True for input strings not containing horizonal whitespace
On Thu, Jan 26, 2023 at 12:05 PM William Michels via perl6-users < perl6-users@perl.org> wrote: > ~$ raku -e 'put "1\n2\n3";' | raku -e 'put lines.contains(/ \h /) ?? True > !! False;' > True > lines() returns a Seq. The contains method for a Seq coerces its argument to a Str and calls contains on that Str. And: $ raku -e 'put "1\n2\n3"' | raku -e 'put lines.Str' 1 2 3 There's your horizontal whitespace.
`lines.contains( / \h / )` returning True for input strings not containing horizonal whitespace
Hi, I'm seeing an issue where I try to write parallel code between `slurp` and `lines`, expecting that when I feed each one-liner a string with vertical whitespace (but not horizontal whitespace), the two methods will be differentiated--since lines autochomps by default. ~$ raku -e 'put "1\n2\n3";' | raku -e 'put slurp.contains(/ \h /) ?? True !! False;' False ~$ raku -e 'put "1\n2\n3";' | raku -e 'put lines.contains(/ \h /) ?? True !! False;' True However, my 'control case' (second example above) is showing that a string devoid of apparent whitespace is coming up positive, i.e. returning True. I would think this is a 'trap for the unwary', if it is indeed the specified behavior. Comments/feedback welcome and appreciated. FYI I'm on Rakudo™ v2022.07. Thx, Bill.