Re: run "...", :out forgetting about the exit code?

2016-02-03 Thread Siavash
Nitpick: 'use strict' is the default. On 2016-02-03 03:07:18 IRST, Peter Pentchev wrote: > [roam@straylight ~]$ perl6 -e 'use v6.c; use strict; my $p = run "false"; say > $p.exitcode;'

Re: Finding and fixing Perl 6 bugs

2016-02-03 Thread Siavash
On 2016-02-03 06:47:23 IRST, Tom Browder wrote: > Perl 5 (and I believe 6) uses the weird (to me) rt.perl.org bug system and > I have so far found no instructions on how to use it. There is the program > perlbug for Perl 5 but no reference I can find on using it for Perl 6. I > have an account

Re: importing code

2016-03-11 Thread Siavash
To specify the name indirectly: my $m = 'some-module'; require ::($m); On 2016-03-11 11:17:44 IRST, mt1957 wrote: > Op 10-03-16 om 20:14 schreef yary: >> There's "require" to load a module at runtime >> >> http://docs.perl6.org/syntax/require >> >> The $*REPO object controls how to search for

Re: testing with a "warn"

2016-04-30 Thread Siavash
http://doc.perl6.org/routine/warn "To simply print to $*ERR, please use note instead. warn should be reserved for use in threatening situations when you don't quite want to throw an exception." And for testing, maybe something like this: use Test; my $warning; { warn 'some

Re: perl 6 equivalent of "use warnings"

2017-01-11 Thread Siavash
Hi, >From https://docs.perl6.org/language/5to6-nutshell#warnings "Warnings are now on by default. no warnings is currently NYI, but putting things in a quietly {} block will silence." On 2017-01-12 03:42:22 GMT, ToddAndMargo wrote: > Hi All, > > Is there a perl 6 equivalent of perl 5's

Re: Need dynamic variables help

2017-01-13 Thread Siavash
Hi, `+` is addition operator: https://docs.perl6.org/routine/$PLUS_SIGN#(Operators)_infix_+ String concatenation operator is `~`: https://docs.perl6.org/routine/$TILDE#(Operators)_infix_~ So you should write: print "Perl Version = " ~ $*PERL ~ "\n"; Or use `say` or `put` to add a newline: say

Re: Need dynamic variables help

2017-01-13 Thread Siavash
But in Perl 5 `.` is string concatenation operator, not `+` On 2017-01-13 09:33:10 GMT, Todd Chester wrote: >> >> On Fri, Jan 13, 2017 at 10:01 AM, Todd Chester > > wrote: >> >> Hi All, >> >> I am trying to understand how to read

Re: Array containing only elements that implement a role.

2017-01-03 Thread Siavash
Hi, It's because of the default value of array elements. See the end of this section: https://docs.perl6.org/language/list#Typing my @a; say @a.of.perl; # Mu say @a.default.perl; # Any say @a[0]; # (Any) role Foo {}; my Foo @a; say @a.of.perl; # Foo say @a.default.perl; # Foo say @a[0] # (Foo)

Re: A stricter typed variable

2017-01-07 Thread Siavash
Hi, If you really want to avoid `Array[Str].new`, you can do something like this: sub foo (@a where .all ~~ Str) {...} On 2017-01-07 11:45:55 GMT, Fernando Santagata wrote: > Hello, > > I have a function like this: > > sub test(Str :$format, :@filter) > { > say $format; > say @filter; > }

Re: A stricter typed variable

2017-01-08 Thread Siavash
Note that you can also use subset to create a type: subset ArrayOfStr of Array where .all ~~ Str; sub foo (@a where ArrayOfStr) {...} or: sub foo (ArrayOfStr $a) {...} On 2017-01-08 10:33:36 GMT, Fernando Santagata wrote: > Thank you! > > On Sat, Jan 7, 2017 at 5:23 PM

Re: lazy gather?

2017-03-14 Thread Siavash
Note that you can also use a map: my \approx= fib.rotor(2 => -1).map: { .[1] ÷ .[0] }; On 2017-03-14 09:00:34 GMT, Marc Chantreux wrote: > On Mon, Mar 13, 2017 at 08:33:05PM +0330, Siavash wrote: >> I may be wrong, but I think the code should be: >> my \golden= (1 +

Re: lazy gather?

2017-03-13 Thread Siavash
Hi, 「gather」 should work. What version of Perl 6 are you using? (run perl6 -v) I may be wrong, but I think the code should be: my \golden= (1 + sqrt 5) ÷ 2; my \fib = 1, 1, * + * ... ∞ ; my \approx= gather for fib.rotor(2 => -1) { take .[1] ÷ .[0] }; my \distances = approx.map:

Re: What is my sub?

2018-05-22 Thread Siavash
https://www.nntp.perl.org/group/perl.perl6.users/2017/03/msg3423.html On 2018-05-22 06:04:47 GMT, ToddAndMargo wrote: > Hi All, > > I need to know the name of the subroutine I am in. > > This is the way I use to do it in Perl 5: > > (my $Name = (caller(0))[3] ) ~~ s{.*::}{}; > > How do

Re: How to accomplish a method interpolation?

2017-12-30 Thread Siavash
What you want is `%items{$item}."$attr"()`. But if all you want is removing the show's repetition, maybe there are other ways, for example: for %!items:kv { say $^key.tc, ' ', $^value.amount; } or if you want all items: for %!items { say .key.tc, ' ', .value.amount; } On 2017-12-30

Re: What does ^parents really tell you?

2018-07-31 Thread Siavash
"Returns the list of parent classes. By default it stops at Cool, Any or Mu, which you can suppress by supplying the :all adverb. With :tree, a nested list is returned." https://docs.perl6.org/routine/parents On 2018-07-29 21:57:21 +0430, Joseph Brenner wrote: > If you look at the type

Re: What does ^methods really tell you?

2018-07-31 Thread Siavash
"Returns a list of public methods available on the class (which includes methods from superclasses and roles). By default this stops at the classes Cool, Any or Mu; to really get all methods, use the :all adverb. If :local is set, only methods declared directly in the class are returned."

Re: Using HashBags

2018-04-07 Thread Siavash
Hi, Don't know if there is a better way, but assuming you don't have control over the data, you can do this: my Bag $docents = @rows.map(*.pairup).Bag; On 2018-04-07 10:10:52 GMT, mimosinnet wrote: > Hi all, > > I do not seem to be able to get this done with the Bag or BagHash > type: > > ---

Re: latest rakudo srtar not found

2018-04-16 Thread Siavash
>>> >>> Error downloading remote file: One or more errors occurred. >>> Inner Exception: Remote server returned 404: Not Found >>> >>> Is the file stored at another location perhaps? >>> >>> Regards > > >>> MarcelOn 04/16/20

Re: latest rakudo srtar not found

2018-04-16 Thread Siavash
Hi, Rakudo.org was redesigned, apparently the new URL for you is: https://rakudo.org/latest/star/win64 The new download page: https://rakudo.org/files On 2018-04-16 09:18:13 GMT, Marcel Timmerman wrote: > Hi, > > I was used to download the latest rakudo star install file for testing > on

Re: Strange output on 'say Foo::Bar::<>;'

2018-10-11 Thread Siavash
...' mean? > > >On 10/11/18 9:45 AM, Siavash wrote: >> It means it's returning a Block. >> >> dd Foo::Bar::<> # Block = -> ;; $_? is raw { >#`(Block|94777643161752) ... } >> say Foo::Bar::<>() # zipi > >-- >Richard A Hogaboom >

Re: Could this be any more obscure?

2018-10-01 Thread Siavash
You can read the thread here: https://www.nntp.perl.org/group/perl.perl6.users/2018/09/msg5757.html On 2018-10-01 04:21:43 +0330, ToddAndMargo wrote: > Hi All, > > My "Perl" box got corrupted and in the process of rebuilding > it I lost this thread except for one one message from JJ. > Anyway,

Re: Strange output on 'say Foo::Bar::<>;'

2018-10-11 Thread Siavash
It means it's returning a Block. dd Foo::Bar::<> # Block = -> ;; $_? is raw { #`(Block|94777643161752) ... } say Foo::Bar::<>() # zipi

Re: Could this be any more obscure?

2018-09-30 Thread Siavash
On 2018-09-30 13:01:32 +0330, ToddAndMargo wrote: > On 9/26/18 7:27 PM, Brandon Allbery wrote: >> And again: this is only because you know perl 5. People are not born >> knowing perl 5; to someone who doesn't know it, perldoc raises the >> same kinds of questions you have been asking, and the

Re: Could this be any more obscure?

2018-09-30 Thread Siavash
In the second line of my reply I was referring to the difference in flattening. In the first line I was saying that sub takes a list, but method doesn't, its invocant is a list. On 2018-09-30 14:18:53 +0330, ToddAndMargo wrote: > On 9/30/18 3:02 AM, Siavash wrote: >> Because one is