Re: How to use sub/method 'dir'

2018-11-27 Thread Brad Gilbert
On Mon, Nov 26, 2018 at 6:26 PM Trey Harris wrote: > > > > On Mon, Nov 26, 2018 at 04:56 Fernando Santagata > wrote: >> >> On Sun, Nov 25, 2018 at 5:34 PM Brad Gilbert wrote: >>> >>> The reason `dir('a', test => { .IO.d })` doesn't work like you expect >>> is that it is passed strings. >> >>

Re: How to use sub/method 'dir'

2018-11-27 Thread Fernando Santagata
I can only argue that since the function's name 'dir' reminds a shell level command, and 'ls a' and 'dir a' work in a certain way, I was expecting that the function 'dir' worked in the same way, following the Principle of Least Surprise :-) On Tue, Nov 27, 2018 at 1:37 AM Trey Harris wrote: > >

Re: How to use sub/method 'dir'

2018-11-26 Thread Trey Harris
On Mon, Nov 26, 2018 at 19:26 Trey Harris wrote: > > > On Mon, Nov 26, 2018 at 04:56 Fernando Santagata < > nando.santag...@gmail.com> wrote: > >> On Sun, Nov 25, 2018 at 5:34 PM Brad Gilbert wrote: >> >>> The reason `dir('a', test => { .IO.d })` doesn't work like you expect >>> is that it is

Re: How to use sub/method 'dir'

2018-11-26 Thread Trey Harris
On Mon, Nov 26, 2018 at 04:56 Fernando Santagata wrote: > On Sun, Nov 25, 2018 at 5:34 PM Brad Gilbert wrote: > >> The reason `dir('a', test => { .IO.d })` doesn't work like you expect >> is that it is passed strings. >> > > Thank you! > I could have inferred that from the declaration of the

Re: How to use sub/method 'dir'

2018-11-26 Thread Fernando Santagata
On Sun, Nov 25, 2018 at 5:34 PM Brad Gilbert wrote: > The reason `dir('a', test => { .IO.d })` doesn't work like you expect > is that it is passed strings. > Thank you! I could have inferred that from the declaration of the 'test' argument here https://docs.perl6.org/routine/dir where the test

Re: How to use sub/method 'dir'

2018-11-25 Thread Brad Gilbert
The reason `dir('a', test => { .IO.d })` doesn't work like you expect is that it is passed strings. > dir('a', test => {.say}); . c b .. ("a/.".IO "a/c".IO "a/b".IO "a/..".IO) So `.IO.d` is looking to see if the CWD directory had a directory of that name, not the `a`

Re: How to use sub/method 'dir'

2018-11-25 Thread Fernando Santagata
To further clarify, what I did to prepare this test is: mkdir -p test/a/b cd test echo > a/c On Sun, Nov 25, 2018 at 11:11 AM Fernando Santagata < nando.santag...@gmail.com> wrote: > Here's output of 'a/b'.IO.d from the REPL: > > > 'a/b'.IO.d > True > > On Sun, Nov 25, 2018 at 1:52 AM Timo

Re: How to use sub/method 'dir'

2018-11-25 Thread Fernando Santagata
Here's output of 'a/b'.IO.d from the REPL: > 'a/b'.IO.d True On Sun, Nov 25, 2018 at 1:52 AM Timo Paulssen wrote: > The dir method gives you entries in the directory you pass. If you don't > pass a test it'll use the default test which is none(".", ".."), i.e. > "anything except . and ..". > >

Re: How to use sub/method 'dir'

2018-11-24 Thread Timo Paulssen
The dir method gives you entries in the directory you pass. If you don't pass a test it'll use the default test which is none(".", ".."), i.e. "anything except . and ..". I'm not sure why using { .IO.d } as the test would not give you b, though. Can you check what "a/b".IO.d outputs? Maybe that