start of Mathx::Stat

2018-10-14 Thread The Holy Ghost
Hello, I've uploaded Mathx::Stat to cpan's holyghost Perl6 directory. It contains a statistics package. I needed the above for a Markov strategy package for writing prospection in Perl 6 games, e.g. with SDL2::Raw for graphics. This starts from Markov startegies unto Statistical Chaos theory

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
It's redundant for this code. `$foo` means data that's to be treated as either a single item or as a single item container containing a single item. `$$foo` means put the single item in $foo into a single item container containing it. Given that this appears on the right of `=` the single item i

Re: What is |c ?

2018-10-14 Thread Ralph Mellor
|foo in a signature captures all remaining arguments using a local variable called foo. sub foo (|foo) { foo } say foo 42; # \(42) -- raiph On Sun, Oct 14, 2018 at 10:21 AM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > Hi All, > > Over on > > https://docs.perl6.org/routine/s

Re: enc ?

2018-10-14 Thread Ralph Mellor
https://docs.perl6.org/routine/encoding On Sun, Oct 14, 2018 at 10:23 AM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > Hi All, > > Over on > > https://docs.perl6.org/routine/slurp > > # read entire file as Latin1 Str > my $text_contents = slurp "path/to/file", enc

Re: Malformed UTF-8 ???

2018-10-14 Thread Tom Browder
On Sun, Oct 14, 2018 at 5:13 AM Ralph Mellor wrote: > > Almost certainly your problem is elsewhere. What is the meaning of the double dollar sign ($$) in the problem code? -Tom

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
I see no significant difference beyond the inside of your proc and the outside of the code you've shown. The extra `$` in `$$proc` is redundant. (I don't understand why you have it.) The `(...)` is the same as my `: ...`. It can wait until you switch to `slurp`. I wouldn't expect it to make an

Re: Malformed UTF-8 ???

2018-10-14 Thread ToddAndMargo via perl6-users
On 10/14/18 3:08 AM, Ralph Mellor wrote: This code works fine: spurt 'foo', 'bar'; my Str $ReturnStr = ""; $ReturnStr = 'foo'.IO.open.slurp-rest: enc => 'utf8-c8'; say $ReturnStr; # bar Try it with my layout: $ReturnStr = $$proc.out.slurp-rest( enc => 'utf8-c8' );

Re: Malformed UTF-8 ???

2018-10-14 Thread ToddAndMargo via perl6-users
> > > On Sun, Oct 14, 2018 at 11:08 AM Ralph Mellor > wrote: > > Are you sure the error message you showed applies to the line you > showed? > > This code works fine: > > spurt 'foo', 'bar'; > my Str $ReturnStr = ""; > $ReturnStr = 'foo'.IO.

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
Almost certainly your problem is elsewhere. When you refer to a variable as a *value* then you get its *value*. So: return $ReturnStr returns $ReturnStr's *value*, not the variable. Your code returns such a value, which will be an immutable string. So I think the error message you're getting

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
Are you sure the error message you showed applies to the line you showed? This code works fine: spurt 'foo', 'bar'; my Str $ReturnStr = ""; $ReturnStr = 'foo'.IO.open.slurp-rest: enc => 'utf8-c8'; say $ReturnStr; # bar -- raiph On Sun, Oct 14, 2018 at 10:52 AM ToddAndMargo via perl6-users < per

Re: Malformed UTF-8 ???

2018-10-14 Thread ToddAndMargo via perl6-users
On Sun, Oct 14, 2018 at 10:35 AM ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: On 10/14/18 2:29 AM, Ralph Mellor wrote: > In P6 "assign" means use of `=`. > > And "assign to" means to copy into the thing on the left of the `=`. > > And to copy int

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
I just tried slurp-rest with a specified encoding and it worked fine. Are you sure you don't bind $ReturnStr between the declaration you've shiown and the use you've shown? -- raiph On Sun, Oct 14, 2018 at 10:35 AM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > On 10/14/18 2:29 A

Re: Malformed UTF-8 ???

2018-10-14 Thread ToddAndMargo via perl6-users
On 10/14/18 2:29 AM, Ralph Mellor wrote: In P6 "assign" means use of `=`. And "assign to" means to copy into the thing on the left of the `=`. And to copy into something the thing has to be a mutable container. The error message is saying that $ReturnStr is bound to an immutable value (eg a st

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
Couple clarifications about my prior message. > And to copy into something the thing has to be a mutable container. "mutable" and "container" are basically redundant with each other. Mutable means changeable. Container means data that has only one purpose, namely to be changeable. > that's presu

Re: Malformed UTF-8 ???

2018-10-14 Thread ToddAndMargo via perl6-users
On 10/14/18 2:21 AM, Ralph Mellor wrote: OK. That makes sense. So the program that you're running for the $proc is producing malformed UTF8. Why don't you fix that rather than clean up afterwards? -- raiph Hi Raiph, I am reading the contents from a web page through my "curl" interface module

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
In P6 "assign" means use of `=`. And "assign to" means to copy into the thing on the left of the `=`. And to copy into something the thing has to be a mutable container. The error message is saying that $ReturnStr is bound to an immutable value (eg a string) not a container. So that's presumabl

enc ?

2018-10-14 Thread ToddAndMargo via perl6-users
Hi All, Over on https://docs.perl6.org/routine/slurp # read entire file as Latin1 Str my $text_contents = slurp "path/to/file", enc => "latin1"; Where is the list of my options for "enc"? Many thanks, -T

What is |c ?

2018-10-14 Thread ToddAndMargo via perl6-users
Hi All, Over on https://docs.perl6.org/routine/slurp What is |c, as in multi sub slurp(IO::Handle:D $fh = $*ARGFILES, |c) multi sub slurp(IO() $path, |c) Many thanks, -T

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
OK. That makes sense. So the program that you're running for the $proc is producing malformed UTF8. Why don't you fix that rather than clean up afterwards? -- raiph On Sun, Oct 14, 2018 at 3:44 AM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > >> > >> > >> On Sat, Oct 13, 2018 a

Re: Malformed UTF-8 ???

2018-10-14 Thread ToddAndMargo via perl6-users
On 10/13/18 3:02 AM, ToddAndMargo via perl6-users wrote: Hi All, if  $StdOut  { $ReturnStr = $$proc.out.slurp-rest; } gives me Malformed UTF-8 How do I clean up $$proc.out.slurp-rest ?? Many thanks, -T This does not work: if $StdOut { $ReturnStr = $$proc.out.slurp-rest( enc