Re: I need help with IO.e

2020-05-17 Thread Paul Procacci
Don't 'say' anything. Just let the optimizer spit out the QAST that you are interested in looking at. The following spits out a diff after optimization: # diff -u <(perl6 --target=optimize -e '"test".IO.e') <(perl6 --target=optimize -e '"test".IO.e.Bool') >> Huh. Not sure what I am looking at

Re: I need help with IO.e

2020-05-17 Thread ToddAndMargo via perl6-users
On 2020-05-17 21:48, Paul Procacci wrote: You can check this yourself by looking at the QAST nodes after the static analyzer has had its fill: # diff -u <(perl6 --target=optimize -e '"test".IO.e') <(perl6 --target=optimize -e '"test".IO.e.Bool') Huh. Not sure what I am looking at $ diff

Re: How to find if a drive letter exists?

2020-05-17 Thread ToddAndMargo via perl6-users
On 2020-05-17 21:56, ToddAndMargo via perl6-users wrote: Follow up: Thank you for all the help figuring all this out!

Re: How to find if a drive letter exists?

2020-05-17 Thread ToddAndMargo via perl6-users
Follow up: When I go to maintain this thing in five days or five years and I have one of those "what the h*** is IO.d.Bool suppose to mean?" moments, I created the follow subs to make the code more readable/maintainable. And mind you I can always look up what IO.d.Bool means in my own IO

Re: I need help with IO.e

2020-05-17 Thread Paul Procacci
You can check this yourself by looking at the QAST nodes after the static analyzer has had its fill: # diff -u <(perl6 --target=optimize -e '"test".IO.e') <(perl6 --target=optimize -e '"test".IO.e.Bool') On Mon, May 18, 2020 at 12:25 AM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote:

Re: I need help with IO.e

2020-05-17 Thread ToddAndMargo via perl6-users
On 2020-05-17 21:19, ToddAndMargo via perl6-users wrote: On 2020-05-17 20:28, Paul Procacci wrote: So tack a .Bool at the end. You are coercing a bool to a bool by doing so and hopefully the optimizer is smart enough for people who like to be redundant. ;) Hi Paul, Especially when I can

Re: I need help with IO.e

2020-05-17 Thread ToddAndMargo via perl6-users
On 2020-05-17 20:28, Paul Procacci wrote: So tack a .Bool at the end. You are coercing a bool to a bool by doing so and hopefully the optimizer is smart enough for people who like to be redundant. ;) Hi Paul, Especially when I can never remember when IO.someletter will return a full True

Re: I need help with IO.e

2020-05-17 Thread Paul Procacci
So tack a .Bool at the end. You are coercing a bool to a bool by doing so and hopefully the optimizer is smart enough for people who like to be redundant. ;) On Sun, May 17, 2020 at 6:10 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > On 2020-05-17 14:43, ToddAndMargo via

Re: I need help with IO.e

2020-05-17 Thread ToddAndMargo via perl6-users
On 2020-05-17 14:43, ToddAndMargo via perl6-users wrote: Although    "say 'yes' if 'h:/'.IO.d" is obscure to me and    "say 'h:/'.IO.d.Bool" is very easy for me to understand. Hi Peter, I think it would help if you knew how my mind worked. `if` to me is a Boolean function. If this

Re: I need help with IO.e

2020-05-17 Thread ToddAndMargo via perl6-users
On 2020-05-17 13:04, Peter Pentchev wrote: On Sun, May 17, 2020 at 12:12:51PM -0700, ToddAndMargo via perl6-users wrote: On 2020-05-17 03:36, Peter Pentchev wrote: On Sun, May 17, 2020 at 03:01:34AM -0700, ToddAndMargo via perl6-users wrote: On 2020-05-17 02:30, Peter Pentchev wrote: You

Re: I need help with IO.e

2020-05-17 Thread Peter Pentchev
On Sun, May 17, 2020 at 12:12:51PM -0700, ToddAndMargo via perl6-users wrote: > On 2020-05-17 03:36, Peter Pentchev wrote: > > On Sun, May 17, 2020 at 03:01:34AM -0700, ToddAndMargo via perl6-users > > wrote: > > > On 2020-05-17 02:30, Peter Pentchev wrote: > > > > You said that you would tack

Re: I need help with IO.e

2020-05-17 Thread ToddAndMargo via perl6-users
On 2020-05-17 03:50, Elizabeth Mattijsen wrote: [11:50:21]you don.t need the .Bool, .e already returns a Bool [11:53:07] sometimes IO.someletter returns True of Fail, not False. Tacking .Bool on the end, means I don't have to remember which ones [11:57:23] True or Fail. Typo

Re: I need help with IO.e

2020-05-17 Thread ToddAndMargo via perl6-users
On 2020-05-17 03:36, Peter Pentchev wrote: On Sun, May 17, 2020 at 03:01:34AM -0700, ToddAndMargo via perl6-users wrote: On 2020-05-17 02:30, Peter Pentchev wrote: You said that you would tack Bool at the end in "if" statements, too. Hi Peter, No wonder. I do not remember saying that, but

Re: How to find if a drive letter exists?

2020-05-17 Thread ToddAndMargo via perl6-users
On 2020-05-17 07:47, Brad Gilbert wrote: Why do you have `.Bool` on all of the `.e` tests? Hi Brad, I do this because it keeps me out of trouble. I want back a yes or no answer, not True or Fail (X::IO::DoesNotExist). And I never remember which IO. will return a True or Fail or which

Re: Matching subpatterns in any order, conjunctions, negated matches

2020-05-17 Thread Joseph Brenner
Peter Pentchev wrote: > Actually, there is, and I conveniently did not mention it :) It's the > case when the patterns may overlap: if you do the ' 'the' and 'entrance', you might match 'thentrance', which, depending on > your use case, might not be ideal. That's a good point, but it's true that

Re: How to find if a drive letter exists?

2020-05-17 Thread Brad Gilbert
Why do you have `.Bool` on all of the `.e` tests? A file or directory either exists or it doesn't. So `.e` always returns a Bool. So there is zero reason to try to coerce it to a Bool. You can look at the return value of `.e`. > say '.'.IO.can('e').head.signature (IO::Path:D: *%_ -->

Re: I need help with IO.e

2020-05-17 Thread Elizabeth Mattijsen
[11:50:21] you don.t need the .Bool, .e already returns a Bool [11:53:07]sometimes IO.someletter returns True of Fail, not False. Tacking .Bool on the end, means I don't have to remember which ones [11:57:23]True or Fail. Typo [11:58:21] A Failure is always false

Re: I need help with IO.e

2020-05-17 Thread Peter Pentchev
On Sun, May 17, 2020 at 03:01:34AM -0700, ToddAndMargo via perl6-users wrote: > On 2020-05-17 02:30, Peter Pentchev wrote: > > You said that you would tack Bool at the end in "if" statements, too. > > Hi Peter, > > No wonder. I do not remember saying that, but I could > have. My `if`

Re: I need help with IO.e

2020-05-17 Thread ToddAndMargo via perl6-users
On 2020-05-17 02:30, Peter Pentchev wrote: You said that you would tack Bool at the end in "if" statements, too. Hi Peter, No wonder. I do not remember saying that, but I could have. My `if` statements look like: if not "%Options".IO.d.Bool { say "Creating %Options";

Re: How to find if a drive letter exists?

2020-05-17 Thread ToddAndMargo via perl6-users
On 2020-05-17 00:52, ToddAndMargo via perl6-users wrote: Hi All, Windows 7 & 10 I want to know if a drive letter exists: K:\Windows\NtUtil>df -kPT Filesystem   Type  1024-blocks  Used Available Capacity Mounted on C:/Program Files/Git ntfs 40585620  15044068  25541552 

Re: I need help with IO.e

2020-05-17 Thread Peter Pentchev
On Sun, May 17, 2020 at 02:18:30AM -0700, ToddAndMargo via perl6-users wrote: > On 2020-05-17 01:23, Peter Pentchev wrote: > > On Sat, May 16, 2020 at 06:57:53PM -0700, ToddAndMargo via perl6-users > > wrote: > > > On 2020-05-16 17:44, Peter Pentchev wrote: > > > > On Sat, May 16, 2020 at

Re: I need help with IO.e

2020-05-17 Thread ToddAndMargo via perl6-users
On 2020-05-17 01:23, Peter Pentchev wrote: On Sat, May 16, 2020 at 06:57:53PM -0700, ToddAndMargo via perl6-users wrote: On 2020-05-16 17:44, Peter Pentchev wrote: On Sat, May 16, 2020 at 03:19:05PM -0700, ToddAndMargo via perl6-users wrote: On 2020-05-16 06:38, Peter Pentchev wrote: $ raku

Re: I need help with IO.e

2020-05-17 Thread Peter Pentchev
On Sat, May 16, 2020 at 06:57:53PM -0700, ToddAndMargo via perl6-users wrote: > On 2020-05-16 17:44, Peter Pentchev wrote: > > On Sat, May 16, 2020 at 03:19:05PM -0700, ToddAndMargo via perl6-users > > wrote: > > > On 2020-05-16 06:38, Peter Pentchev wrote: > > > > > $ raku *-e* "your one-liner

How to find if a drive letter exists?

2020-05-17 Thread ToddAndMargo via perl6-users
Hi All, Windows 7 & 10 I want to know if a drive letter exists: K:\Windows\NtUtil>df -kPT Filesystem Type 1024-blocks Used Available Capacity Mounted on C:/Program Files/Git ntfs 40585620 15044068 25541552 38% / D: udf 5294394 5294394