On 12/11/23 14:47, Andy Bach wrote:
I have found that when using `say` for debugging, it has been known to print
out the
previous value of a variable and not the current value. `print` does not do
this.
That would certainly be a surprise to me. I'd think I was
misunderstanding my program,
than a bug in say.
From: ToddAndMargo via perl6-users
Sent: Monday, December 11, 2023 3:24 PM
To: perl6-users@perl.org
Subject: Re: .contains question
CAUTION - EXTERNAL:
> "so" will collapse the junction into a Bool.
> "say" will append a \
"so" will collapse the junction into a Bool.
"say" will append a \n for you, so you don't have to.
On 11 Dec 2023, at 01:52, ToddAndMargo via perl6-users
wrote:
On 10 Dec 2023, at 21:36, ToddAndMargo via perl6-users
wrote:
Hi All,
my Str $x="abc3defg"; if $x.contains( "a" || "b" || "3
my $x="abc45def";
my @y=; say so $x.contains(any @y);
"so" will collapse the junction into a Bool.
"say" will append a \n for you, so you don't have to.
> On 11 Dec 2023, at 01:52, ToddAndMargo via perl6-users
> wrote:
>
>>> On 10 Dec 2023, at 21:36, ToddAndMargo via perl6-users
>>> wrote:
>
On 10 Dec 2023, at 21:36, ToddAndMargo via perl6-users
wrote:
Hi All,
my Str $x="abc3defg"; if $x.contains( "a" || "b" || "3" ) { print "True\n"; } else {
print "False\n" };
True
Is there a way to tell .contains that you want to know
if any of a sequence characters is in a string other that
my @letters = ;
if $x.contains(any @letters) {
...
> On 10 Dec 2023, at 21:36, ToddAndMargo via perl6-users
> wrote:
>
> Hi All,
>
> my Str $x="abc3defg"; if $x.contains( "a" || "b" || "3" ) { print "True\n";
> } else { print "False\n" };
> True
>
> Is there a way to tell .contains that yo
Hi All,
my Str $x="abc3defg"; if $x.contains( "a" || "b" || "3" ) { print
"True\n"; } else { print "False\n" };
True
Is there a way to tell .contains that you want to know
if any of a sequence characters is in a string other that
repeating || over and over. Any [a..z] or [0..9] option?
Many
Yup, you can use it as a method call like this:
perl6 -e '"foobar".&[~~](/foo/).say'
「foo」
HTH
- Timo
Semantically, is a Regex can be "contained" by a String? As Liz wrote, a
regex is "matched" against a String.
Besides that, I'm wondering if the smart match operator ~~ can be used as a
method call?
"foobar".smart-match( /'foo'/ ).say
in place of
( "foobar" ~~ /'foo'/ ).say
AFAIK, it exists t
On Mon, Jun 12, 2017 at 4:07 PM, Elizabeth Mattijsen wrote:
>> On 12 Jun 2017, at 22:04, Will Coleda wrote:
>> On Mon, Jun 12, 2017 at 5:17 AM, Francesco Rivetti wrote:
>>> if you can:
>>>
>>> $s ~~ "foo"
>>> $s ~~ /foo/
>>>
>>> then wouldn't be good to have also:
>>>
>>> $s.contains("foo");
>>>
> On 12 Jun 2017, at 22:04, Will Coleda wrote:
> On Mon, Jun 12, 2017 at 5:17 AM, Francesco Rivetti wrote:
>> if you can:
>>
>> $s ~~ "foo"
>> $s ~~ /foo/
>>
>> then wouldn't be good to have also:
>>
>> $s.contains("foo");
>> $s.contains(/foo/);
>
> The latter is currently available as:
>
>>
On Mon, Jun 12, 2017 at 5:17 AM, Francesco Rivetti wrote:
> if you can:
>
> $s ~~ "foo"
> $s ~~ /foo/
>
> then wouldn't be good to have also:
>
> $s.contains("foo");
> $s.contains(/foo/);
The latter is currently available as:
> "foobar".match(/'foo'/);
「foo」
> IOW, overload .contains() with St
On 06/12/2017 01:42 AM, Elizabeth Mattijsen wrote:
On 12 Jun 2017, at 01:27, ToddAndMargo wrote:
perl6 -e 'my $x = "\t"; if $x !~~ /<[A..Z a..z 0..9]>/ {say "out"} else {say
"in"}'
Would this be easier to do with $x.contains? Or would it
be too worky?
.contains only takes a *single string
Thinking about this...
> On 12 Jun 2017, at 11:17, Francesco Rivetti wrote:
>
> if you can:
>
> $s ~~ "foo"
> $s ~~ /foo/
>
> then wouldn't be good to have also:
>
> $s.contains("foo");
> $s.contains(/foo/);
>
> IOW, overload .contains() with Str and Regex
>
> F
>
> On 06/12/2017 10:42 AM,
if you can:
$s ~~ "foo"
$s ~~ /foo/
then wouldn't be good to have also:
$s.contains("foo");
$s.contains(/foo/);
IOW, overload .contains() with Str and Regex
F
On 06/12/2017 10:42 AM, Elizabeth Mattijsen wrote:
On 12 Jun 2017, at 01:27, ToddAndMargo wrote:
perl6 -e 'my $x = "\t"; if $x !~
> On 12 Jun 2017, at 01:27, ToddAndMargo wrote:
> perl6 -e 'my $x = "\t"; if $x !~~ /<[A..Z a..z 0..9]>/ {say "out"} else {say
> "in"}'
>
> Would this be easier to do with $x.contains? Or would it
> be too worky?
.contains only takes a *single string* to look up. So it is only useful for
ch
Hi All,
perl6 -e 'my $x = "\t"; if $x !~~ /<[A..Z a..z 0..9]>/ {say "out"} else
{say "in"}'
Would this be easier to do with $x.contains? Or would it
be too worky?
Many thanks,
-T
17 matches
Mail list logo