Re: I need syntax to sub declare return a hash and an array

2020-01-21 Thread Peter Pentchev
On Tue, Jan 21, 2020 at 07:16:17PM -0800, Todd Chester via perl6-users wrote: > > > On 2020-01-21 18:57, Tom Browder wrote: > > On Tue, Jan 21, 2020 at 18:34 Todd Chester via perl6-users > > mailto:perl6-users@perl.org>> wrote: > > > > On 2020-01-21 16:09, Todd Chester via perl6-users

Re: REPL and arrows problem

2020-01-21 Thread Norman Gaywood
On Wed, 22 Jan 2020 at 13:30, Todd Chester via perl6-users < perl6-users@perl.org> wrote: > On 2020-01-21 16:38, Todd Chester via perl6-users wrote: > > Fedora31 > I have Fedora 31 and Readline does not seem to be working for me in the raku REPL as well. But see below! > $ rpm -qa \*raku\* >

Re: I need syntax to sub declare return a hash and an array

2020-01-21 Thread Todd Chester via perl6-users
On 2020-01-21 18:57, Tom Browder wrote: On Tue, Jan 21, 2020 at 18:34 Todd Chester via perl6-users mailto:perl6-users@perl.org>> wrote: On 2020-01-21 16:09, Todd Chester via perl6-users wrote: >> 4) A block (that is the { ... } bit) will always 'return' the last >> expression

Re: I need syntax to sub declare return a hash and an array

2020-01-21 Thread Tom Browder
On Tue, Jan 21, 2020 at 18:34 Todd Chester via perl6-users < perl6-users@perl.org> wrote: > On 2020-01-21 16:09, Todd Chester via perl6-users wrote: > >> 4) A block (that is the { ... } bit) will always 'return' the last > >> expression evaluated. > > > > Seems to me I have see the last

Re: Using raku/perl6 as unix "cat"....

2020-01-21 Thread Todd Chester via perl6-users
On 2020-01-21 11:08, William Michels via perl6-users wrote: Good answers, all. Thanks to everyone for contributing. For anyone who wants a golfed "cat" replacement, command line arguments can give you shorter code: Hi William, I don't know if I contributed anything at all, but you are most

Re: REPL and arrows problem

2020-01-21 Thread Todd Chester via perl6-users
On 2020-01-21 16:38, Todd Chester via perl6-users wrote: Fedora31 Xfce 4.14 xfce4-terminal-0.8.9.1-1.fc31.x86_64 $ rpm -qa \*raku\* xfce4-terminal-0.8.9.1-1.fc31.x86_64 $ raku -v This is Rakudo version 2019.07.1 built on MoarVM version 2019.07.1 implementing Perl 6.d.

REPL and arrows problem

2020-01-21 Thread Todd Chester via perl6-users
Hi All, Fedora31 Xfce 4.14 xfce4-terminal-0.8.9.1-1.fc31.x86_64 I have the same setup on both computers. On my shop computer, in REPL, the arrow keys do not read correctly: > a todd special booboo^[[D^[[D^[[D^[[D^[[D How do I get my arrow back in REPL on mu shop computer? Many thanks, -T

Re: I need syntax to sub declare return a hash and an array

2020-01-21 Thread Todd Chester via perl6-users
On 2020-01-21 16:09, Todd Chester via perl6-users wrote: 4) A block (that is the { ... } bit) will always 'return' the last expression evaluated. Seems to me I have see the last expression returned even without the {...}.  Maybe I am misremembering. > sub AplusB( $a, $b --> Int ){$a+$b;}

Re: how do you --> two variables?

2020-01-21 Thread Elizabeth Mattijsen
> On 22 Jan 2020, at 01:17, Todd Chester via perl6-users > wrote: > > Hi All, > > What is the syntax for returning two variable from a sub? > > > sub x(--> Int, UInt) { return(-2,4) }; > > ===SORRY!=== Error while compiling: > Malformed return value (return constraints only allowed at the

how do you --> two variables?

2020-01-21 Thread Todd Chester via perl6-users
Hi All, What is the syntax for returning two variable from a sub? > sub x(--> Int, UInt) { return(-2,4) }; ===SORRY!=== Error while compiling: Malformed return value (return constraints only allowed at the end of the signature) --> sub x(--> Int⏏, UInt) { return(-2,4) }; Many thanks, -T

Re: I need syntax to sub declare return a hash and an array

2020-01-21 Thread Todd Chester via perl6-users
On 2020-01-21 14:03, Elizabeth Mattijsen wrote: On 21 Jan 2020, at 22:37, Richard Hainsworth wrote: 2) 'returns' in the declaration (not the part in the block) used to be used, but for some arcane reason that I never really understood, it is deprecated. Not sure it is *the* reason, but

Re: I need syntax to sub declare return a hash and an array

2020-01-21 Thread Todd Chester via perl6-users
> On 21/01/2020 04:09, ToddAndMargo via perl6-users wrote: >> On 2020-01-20 19:55, ToddAndMargo via perl6-users wrote: >>> Hi All, >>> >>> What is the proper way to state that I am returning a >>> hash from a sub? `sub x() returns % {}` >>> >>> And an array? `sub x() returns @ {}` >>> >>> Many

Re: I need syntax to sub declare return a hash and an array

2020-01-21 Thread Elizabeth Mattijsen
> On 21 Jan 2020, at 22:37, Richard Hainsworth wrote: > 2) 'returns' in the declaration (not the part in the block) used to be used, > but for some arcane reason that I never really understood, it is deprecated. Not sure it is *the* reason, but the return type is part of the signature of a

Re: I need syntax to sub declare return a hash and an array

2020-01-21 Thread Richard Hainsworth
sub x( --> Hash) { my %h = A => 'a' } 1) '-->' in the signature is the best way to provide information to the compiler about what the subroutine should return 2) 'returns' in the declaration (not the part in the block) used to be used, but for some arcane reason that I never really

Re: Using raku/perl6 as unix "cat"....

2020-01-21 Thread Andy Bach
" 'while' ...will stop when it encounters a false line--typically an empty line or '0' ". Wasn't that the point of p5's defined while ( defined(my $line = <> ) ) { or (previously lexified '$val'): print "$val\n" while defined($val = pop(@ary)); From: William

Re: Using raku/perl6 as unix "cat"....

2020-01-21 Thread William Michels via perl6-users
Good answers, all. Thanks to everyone for contributing. For anyone who wants a golfed "cat" replacement, command line arguments can give you shorter code: mydir$ perl6 -e '.say for lines' ab_cd.txt a b c d mydir$ perl6 -ne '.say' ab_cd.txt a b c d mydir$ # below two single quotes as empty

Re: My keeper on hashes

2020-01-21 Thread ToddAndMargo via perl6-users
New addition to my hash keeper: "returns" hash on a sub declaration: Note: "Associative" will return a hash or a map or even a pair > sub x() returns Associative { my %h= A=>"a"; return %h} > x {A => a} > sub x(--> Hash) { my %h= A=>"a", B=>"b"; return %h} > x

Re: My Windows Modules

2020-01-21 Thread ToddAndMargo via perl6-users
On 2020-01-21 00:58, Shlomi Fish wrote: Hi ITodd! On Mon, 20 Jan 2020 22:20:29 -0800 ToddAndMargo via perl6-users wrote: Hi All, I have my Win API modules to the point I like them now. I will be a few months before I get them up on GIT. You should already be using version control (git,

Re: I need syntax to sub declare return a hash and an array

2020-01-21 Thread ToddAndMargo via perl6-users
On 2020-01-21 05:00, Tom Browder wrote: The preferred syntax is: sub x(--> Hash) {...} See that in the docs. Larry Wall once warned that the "return..." syntax may be removed at some point. -Tom Hi Tom, Interesting. I have been showing both in my keepers. I currently use "returns "

Re: I need syntax to sub declare return a hash and an array

2020-01-21 Thread Tom Browder
On Mon, Jan 20, 2020 at 22:16 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-01-20 20:09, ToddAndMargo via perl6-users wrote: > > On 2020-01-20 19:55, ToddAndMargo via perl6-users wrote: ... > > I think this is it: > > > > > sub x() returns Associative { my %h= A=>"a";

Re: My Windows Modules

2020-01-21 Thread Shlomi Fish
Hi Todd! On Mon, 20 Jan 2020 22:20:29 -0800 ToddAndMargo via perl6-users wrote: > Hi All, > > I have my Win API modules to the point I > like them now. I will be a few months > before I get them up on GIT. > You should already be using version control (git, likely):