date conversions?

2018-09-07 Thread ToddAndMargo

Hi All,

I want to convert "2018 Jun 7" into 2018.06.07".
I know I can do this myself, but is there a utility
already written for this?

https://docs.perl6.org/routine/Date
does not seem to enlighten me.

Many thanks,
-T


--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


RFE: contains documentation

2018-09-07 Thread ToddAndMargo

Dear Perl6,

Would you please consider updating

https://docs.perl6.org/routine/contains

to explain what the second parameters means?

 say "Hello, World".contains(',', 10);  # OUTPUT: «False␤»

and include how to do case insensitive matches.


Many thanks,
-T


case insensitive "contains"?

2018-09-07 Thread ToddAndMargo

Hi All,

How do I use "contains" without regard to case?

$ p6 'if "2018 Jul 7".contains( "jul", 3 ) {say "Yes";}'


Many thanks,
-T


Re: case insensitive "contains"?

2018-09-07 Thread ToddAndMargo

On 09/07/2018 03:49 PM, ToddAndMargo wrote:

Hi All,

How do I use "contains" without regard to case?

$ p6 'if "2018 Jul 7".contains( "jul", 3 ) {say "Yes";}'


Many thanks,
-T



The chat line helped me figure it out:

$ p6 'if "2018 Jul 7".fc.contains( "jul".fc ) {say "Yes";}'
Yes

$ p6 'if "2018 xJul 7".fc.contains( "jul".fc ) {say "Yes";}'
Yes

p6 'if "2018 xul 7".fc.contains( "jul".fc ) {say "Yes";}'



"contains" beginning, end?

2018-09-07 Thread ToddAndMargo

Hi All,

Does "contains" have options for "at the start of" and
"at the end" of matches?


Many thanks,
-T


Re: "contains" beginning, end?

2018-09-07 Thread Timo Paulssen
It does not, but there are methods .starts-with and .ends-with that
probably do what you need.

HTH
  - Timo


On 08/09/18 02:00, ToddAndMargo wrote:
> Hi All,
>
> Does "contains" have options for "at the start of" and
> "at the end" of matches?
>
>
> Many thanks,
> -T


Re: date conversions?

2018-09-07 Thread Vadim Belman
I was once looking for strftime and stumbled over 
https://gist.github.com/salortiz/051c7a81400522e30a7cf12377c02f70 and 
https://github.com/supernovus/perl6-datetime-format

My choice was in favor of DateTime::Format though.

Anyway, often googling with 'perl6 ' might provide one with even 
more information than expected! 😀

> 7 вер. 2018 р. о 18:36 ToddAndMargo  написав(ла):
> 
> Hi All,
> 
> I want to convert "2018 Jun 7" into 2018.06.07".
> I know I can do this myself, but is there a utility
> already written for this?
> 
> https://docs.perl6.org/routine/Date
> does not seem to enlighten me.
> 
> Many thanks,
> -T
> 
> 
> -- 
> ~~
> Computers are like air conditioners.
> They malfunction when you open windows
> ~~
> 

Best regards,
Vadim Belman


Re: RFE: contains documentation

2018-09-07 Thread ToddAndMargo

On 09/07/2018 05:08 PM, Curt Tilmes wrote:



On Fri, Sep 7, 2018 at 7:59 PM ToddAndMargo > wrote:



 >  From the page you linked to "Coerces the invocant and first
argument to
 > Str , and searches for
|$needle| in the
 > string starting from |$start|."
 >
 > I added to the end "...from $start characters into the string". 
Does

 > that make it more clear?

I have no idea what you mean.  I also have no idea what the
second parameter is either.


 >            say "Hello, World".contains(',', 10);      # OUTPUT:
«False␤»

Does "contains" have options for the start, anywhere, or end of the
string?


In that example, $start is specified as 10, so the search for the ',' starts
10 characters into the string "Hello, World", or at the 'l' at the end
of 'World'.  Since the search starts there, it doesn't find the ',', so
the result is False.  The previous exmple specifies $start at 3, so starts
the search 3 characters into the string "Hello, World", or at the
first 'l', so it does find the ',' and outputs True.

Is there better wording you could suggest for the docs that would better 
convey

that concept?

Curt



Okay, I get it now.

The second parameter is what position in the string to
start looking for a match.  I was thinking it was a command,
such as uppercase, only one match, etc..

By the way, your explanation did not get me there.  I had to
experiment with it to figure it out.

My big gripe with the documentation is that it is written as
a refresher for those that already know what they are doing.
This is why I am such a good case for spotting things that
do not resonate with beginners.

I am clueless, until I learn.  When I do, I write my own
notes.  I have been trying to remember to write you guys
when the docs fly over my head.

Many thanks,
-T


Suggested wording:

A second parameter can be added after the string to specify
at which position in the string -- starting at zero -- to
start looking for a match.  Delimiter is a comma.

For example, "e" is the fifth character and occupies
position four in the string:

   say "abcdefghij".contains("e", 4); # position 4 is "e"
   True

   say "abcdefghij".contains("e", 5); # position 5 is "f"
   False


Re: date conversions?

2018-09-07 Thread ToddAndMargo

On 09/07/2018 05:10 PM, Vadim Belman wrote:

Anyway, often googling with 'perl6 ' might provide one with even 
more information than expected! 😀


The only pain-in-the-*** I find with Perl 6 is that Googling it
gives you hordes of Perl 5 hits.


I am just going to do this:

   my %Month = ( "Jan"=>"01", "Feb"=>"02", "Mar"=>"03", "Apr"=>"04", 
"May"=>"05", "Jun"=>"06",
 "Jul"=>"07", "Aug"=>"08", "Sep"=>"09", "Oct"=>"10", 
"Nov"=>"11", "Dec"=>"12" );


Which will give me a chance to play with my favorite kind of array.

:-)

Thank you for the tips!

-T


Re: "contains" beginning, end?

2018-09-07 Thread ToddAndMargo

On 08/09/18 02:00, ToddAndMargo wrote:

Hi All,

Does "contains" have options for "at the start of" and
"at the end" of matches?


Many thanks,
-T


On 09/07/2018 05:01 PM, Timo Paulssen wrote:
> It does not, but there are methods .starts-with and .ends-with that
> probably do what you need.
>
> HTH
>- Timo
>
>

Awesome!  Thank you!


Re: RFE: contains documentation

2018-09-07 Thread Curt Tilmes
On Fri, Sep 7, 2018 at 8:58 PM ToddAndMargo  wrote:

> My big gripe with the documentation is that it is written as
> a refresher for those that already know what they are doing.
> This is why I am such a good case for spotting things that
> do not resonate with beginners.
>
> I am clueless, until I learn.  When I do, I write my own
> notes.  I have been trying to remember to write you guys
> when the docs fly over my head.
>

The documentation isn't a tutorial, but is still improving every day.

I've been making my way through brian d foy's new book "Learning Perl 6:
Keeping the Easy, Hard, and Impossible Within Reach" (
https://www.amazon.com/Learning-Perl-Keeping-Impossible-Within/dp/149197768X
)

It is an awesome learning resource, much more in depth than the online
docs.  I'm very impressed by the thoroughness and overall quality.

I've found it quite an enjoyable read, and have already learned quite a few
things and a better understanding of other things myself.
(I'll try to write an Amazon review when I get a chance -- it will get 5
stars from me.)

Curt
(I was a Kickstarter funder.)


RE: RFE: contains documentation

2018-09-07 Thread Mark Devine
I second that nod.  Learning Perl 6 is fixing up all kinds of my errant mental 
models.  Just what I needed.

Mark


From: Curt Tilmes 
Sent: Friday, September 7, 2018 21:25
To: Todd Chester 
Cc: perl6-users 
Subject: Re: RFE: contains documentation


On Fri, Sep 7, 2018 at 8:58 PM ToddAndMargo 
mailto:toddandma...@zoho.com>> wrote:
My big gripe with the documentation is that it is written as
a refresher for those that already know what they are doing.
This is why I am such a good case for spotting things that
do not resonate with beginners.

I am clueless, until I learn.  When I do, I write my own
notes.  I have been trying to remember to write you guys
when the docs fly over my head.

The documentation isn't a tutorial, but is still improving every day.

I've been making my way through brian d foy's new book "Learning Perl 6: 
Keeping the Easy, Hard, and Impossible Within Reach" ( 
https://www.amazon.com/Learning-Perl-Keeping-Impossible-Within/dp/149197768X )

It is an awesome learning resource, much more in depth than the online docs.  
I'm very impressed by the thoroughness and overall quality.

I've found it quite an enjoyable read, and have already learned quite a few 
things and a better understanding of other things myself.
(I'll try to write an Amazon review when I get a chance -- it will get 5 stars 
from me.)

Curt
(I was a Kickstarter funder.)



Re: RFE: contains documentation

2018-09-07 Thread ToddAndMargo

On 09/07/2018 06:25 PM, Curt Tilmes wrote:

The documentation isn't a tutorial, but is still improving every day.


For the function it is documenting, it had better be
a tutorial.  Otherwise, why would anyone other than a
developer seek its input?  Seriously.  If you can't
figure it out from the documentation, why bother
with the documentation.

In my suggest verbiage, did you notice the attention
I gave to detail?  It is this kind of detail that
is missing.

Thank you for the book recommendation.  I don't do well with
books.  I can't stay awake.  Head hits the table.
I have to just go and write what I need.  Then I learn.

If I get in trouble, I first try to model it from the
command line, then I search google and see if any of
the perl 5 hits will help (perl 6 gets swamped out),
then I look at the Docs, then I ask for help.

And, I write down almost everything I figure out.
I am up to 135 files so far.  You sometimes see them when I
post them back to this mailing list


Re: RFE: contains documentation

2018-09-07 Thread Vadim Belman
You're pretty much mistaken here. No documentation can replace a good book. No 
documentation is capable of providing enough in-depth understanding of The 
Concept. 

I am a sleepy kind of person too. But I managed to get through Perl6 Deep Dive 
by Andrew Shitov in the only possible way: having the book on my iPad and Vim 
on my notebook. Now I'm considering giving a try to the recently released 
Learning Perl6 book – as soon as will have any time for this.  

> 7 вер. 2018 р. о 22:38 ToddAndMargo  написав(ла):
> 
> On 09/07/2018 06:25 PM, Curt Tilmes wrote:
>> The documentation isn't a tutorial, but is still improving every day.
> 
> For the function it is documenting, it had better be
> a tutorial.  Otherwise, why would anyone other than a
> developer seek its input?  Seriously.  If you can't
> figure it out from the documentation, why bother
> with the documentation.
> 

> 
> Thank you for the book recommendation.  I don't do well with
> books.  I can't stay awake.  Head hits the table.
> I have to just go and write what I need.  Then I learn.

Best regards,
Vadim Belman