Re: trouble returning a value from sub

2022-06-17 Thread Simon Proctor
(*.is-prime); take $f; $n = $n div $f } } } On Fri, 17 Jun 2022 at 03:51, Simon Proctor wrote: > This is because if there isn't an explicit return the last statement > evaluated is the implied return value. > > So the last call (which returns N

Re: trouble returning a value from sub

2022-06-16 Thread Simon Proctor
ve not called a recursion > > from anywhere other than the end of a routine, so haven't run into this > > issue before. Learned something today! > > > > Thanks to Simon, William and Andinus for your assistance! > > > > - Rick > > > > On 6/16/22 11:07

Re: trouble returning a value from sub

2022-06-16 Thread Simon Proctor
I think, and I don't have my computer to hand to double check but I think you want a return before your recursive.call to factors passing in @f. When dealing with recursive functions you need to make sure what you're returning back up the stack. On Thu, 16 Jun 2022, 18:10 Rick Bychowski, wrote

Re: Easier way to load a buffer?

2022-06-10 Thread Simon Proctor
Buf.new(0x2A, 0x54, 0xFF, 0x53); > Buf:0x<2A 54 FF 53> > > I would like to do it on one big blast: > > my Buf $b=Buf.new(0x2A54FF53A5F1D36F1CEA7E61FC37A20D54A77FE7B78); > Cannot unbox 170 bit wide bigint into native integer > > But do not know the proper syntax. &

Re: Removing ' characters

2022-01-10 Thread Simon Proctor
message (which is a bit LTA) refers to the `$0`. As > > https://docs.raku.org/routine/subst#Callable shows, you need to write: > > > > $s.subst( / \' ~ \' (.+) /, { $0 }) > > > >> > my $t = '{}' > >> {} > >> >

Re: Grammar Help

2021-12-26 Thread Simon Proctor
Still waking up but I think the issue is your pairlist has a semi colon divider but this should be after each pair. So the trailing semi colon after b is causing it to fail. On Sun, 26 Dec 2021, 06:01 Paul Procacci, wrote: > Hey all, > > Twas the night of Christmas, when all through the house,

Re: hope we have the distributed computing perl6

2021-11-28 Thread Simon Proctor
also use R, which has the similar usage. >> > When we face very large data, we change to Apache Spark for distributed >> computing. >> > Spark's interface languages (python, scala, even ruby) are not >> flexible, but their computing capability is amazing, due to the whole >> cluster contributing the computing powers. >> > Yes I know perl5 is somewhat old, but in perl6 why won't we make that a >> distributed computing framework like Spark? Then it will help a lot to the >> data programmer who already knows perl. >> > I expect a lot from this project. >> > >> > Thanks. >> > Piper >> > -- Simon Proctor Cognoscite aliquid novum cotidie http://www.khanate.co.uk/

Re: What're native (i.e. high-machine-performance) hybrid development options with Raku?

2021-09-29 Thread Simon Proctor
hon process and set > breakpoints on the C++ code, then step through the suspicious code path. > > Haskell is far from on par w.r.t. stepping debuggers, but bugs are > interestingly less with it, for unutterable reasons. > > Best regards, > Compl > > -- Simon Proctor Cognoscite aliquid novum cotidie http://www.khanate.co.uk/

Re: Accurate conversion of Num to Rat (and comparing Num and Rat)

2021-04-07 Thread Simon Proctor
>raku -e "say 3602879701896397/36028797018963968*1e0 eqv 0.1e0" > True > > C:\>raku -e "say 1/10*1e0 eqv 0.1e0" > True > > seems to be essentially the same as doing: > C:\_32>raku -e "say 3602879701896397/36028797018963968 == 0.1e0" > True > > C:\_32>raku -e "say 1/10 == 0.1e0" > True > > Cheers, > Rob > > > > > -- Simon Proctor Cognoscite aliquid novum cotidie http://www.khanate.co.uk/

Re: I need help with sub MAIN

2020-05-05 Thread Simon Proctor
I would suggest starting by reading this page in the docs : https://docs.raku.org/language/create-cli Covers how $*USAGE is created and the various options you have for providing help data. On Tue, 5 May 2020, 06:46 ToddAndMargo via perl6-users, < perl6-us...@perl.org> wrote: > Hi All, > > Just

Re: How to read a particular environmental variable?

2020-04-08 Thread Simon Proctor
environmental variables are not case sensitive in > >> Windows. And I do not know how Raku interacts with > >> them. > >> > >> >echo %WINDIR% > >> C:\WINDOWS > >> > >> >echo %windir% > >> C:\WIN

Re: How to read a particular environmental variable?

2020-04-07 Thread Simon Proctor
You might want to take a look at Trait::Env, partly because I've not tested it in Windows and I'd be interested to know if it works well. On Wed, 8 Apr 2020, 03:25 ToddAndMargo via perl6-users, < perl6-us...@perl.org> wrote: > On 2020-04-07 18:25, Brad Gilbert wrote: > > Of course %*ENV is case

Re: Dropbox and IO?

2020-04-07 Thread Simon Proctor
Ok I don't have access to my windows box until this evening. I'm mostly used to using Dropbox on a Linux box where it's just a folder. Sorry for my mistake. On Tue, 7 Apr 2020 at 07:51, Shlomi Fish wrote: > Hi Simon, > > On Tue, 7 Apr 2020 06:55:00 +0100 > Simon Proc

Re: Dropbox and IO?

2020-04-06 Thread Simon Proctor
Don't see why not, Dropbox is just a folder that you should be able to access as normal. On Tue, 7 Apr 2020, 02:22 ToddAndMargo via perl6-users, < perl6-us...@perl.org> wrote: > Hi All, > > Do any of you using Windows and Dropbox know > if Raku's file IO utilities can both read > and write to a D

Re: variable as subroutine?

2020-02-11 Thread Simon Proctor
f the object needs to be stored in a > &-sigiled container, is has to implement Callable. > > class A does Callable { > submethod CALL-ME(|c){ 'called' } > } > my &a = A; > say a(); # OUTPUT: «called␤» > > That second "postfix" operator, means &g

Re: Question about Blob and Buf

2020-02-11 Thread Simon Proctor
Ok I 100% don't know after trying this out : my Buf $a = Buf.new(1,2,3); my Blob $b = Blob.new(4,5,6); $a ~= $b; say $a And it worked fine so... I dunno. On Tue, 11 Feb 2020 at 11:00, Simon Proctor wrote: > I think the problem is IO::Socket.read() returns a Blob not a Buf. > &g

Re: Question about Blob and Buf

2020-02-11 Thread Simon Proctor
s also doesn't work: >>> > >>> >my Buf $read; >>> >$read ~= $socket.read(1024); >>> > >>> >Dies with the same error as above. >>> > >>> > >>> >But this works? >>> > >>> >my Blob $read = Buf.new; >>> >$read ~= $socket.read(1024); >>> > >>> > >>> >Best regards, >>> >David Santiago >>> >>> >>> Hi! >>> >>> Can someone explain me why this doesn't work: >>> >>> my Blob $read; >>> $read ~= $socket.read(1024); >>> >>> Dies with error: >>> >>> X::Buf::AsStr: Cannot use a Buf as a string, but you called the Stringy >>> method on it >>> >>> This also doesn't work: >>> >>> my Buf $read; >>> $read ~= $socket.read(1024); >>> >>> Dies with the same error as above. >>> >>> >>> But this works? >>> >>> my Blob $read = Buf.new; >>> $read ~= $socket.read(1024); >>> >>> >>> Best regards, >>> David Santiago >>> >>> -- >>> Sent from my Android device with K-9 Mail. Please excuse my brevity. >>> >> >> >> -- >> JJ >> > -- Simon Proctor Cognoscite aliquid novum cotidie http://www.khanate.co.uk/

Re: variable as subroutine?

2020-02-11 Thread Simon Proctor
ndMargo via perl6-users < perl6-us...@perl.org> wrote: > Hi All, > > Is Larry using his magic powder again? > > Can I declare a subroutine as a variable? > > my $abc = my sub (UInt $u, Str $s, Int $I) { > > How would I use it? > > And why would do such

Range on Subsets

2020-01-28 Thread Simon Proctor
{ not .defined or 1 <= $_ <= 10 }; say OneToTen.Range; And it gives ... -Inf^..^Inf And now I'm a bit confused. The Docs say the UInt is just a subset https://docs.raku.org/type/UInt So how does it have it's own Range? -- Simon Proctor Cognoscite aliquid novum cotidie http://www.khanate.co.uk/

Re: OT: Git Hub repositories

2020-01-04 Thread Simon Proctor
I go with one repository per module. On Sat, 4 Jan 2020, 21:16 ToddAndMargo via perl6-users, < perl6-us...@perl.org> wrote: > Hi All, > > Over in Git Hub land, would you create a repository > for each module you place on Git? Or like my modules, > the all support/import each other, would you pla

Re: square root question

2019-12-15 Thread Simon Proctor
https://docs.raku.org/language/optut This should cover it. On Sun, 15 Dec 2019, 20:17 ToddAndMargo via perl6-users, < perl6-us...@perl.org> wrote: > On 2019-12-15 02:56, Tobias Boege wrote: > > On Sat, 14 Dec 2019, ToddAndMargo wrote: > >> What am I doing wrong here? > >> > >>> multi prefix:<√>

Re: Cannot invoke this object (REPR: Null; VMNull)

2019-12-14 Thread Simon Proctor
I saw this issue when I was building Trait::Env, the closest I got to figuring it out was closure's in phasers in modules seem to get lost in the compilation process. But I never figured out a solution I'm afraid. On Sat, 14 Dec 2019, 22:35 Paul Procacci, wrote: > Ladies/Gents, > > I'm perplexe

Re: Fwd: Raku, docs, help [was: Re: vulgar?]

2019-12-11 Thread Simon Proctor
I would argue that signatures are great for any command line script because you can use them with MAIN to get input checking. On Wed, 11 Dec 2019, 18:07 Veesh Goldman, wrote: > I believe there's a disparity here between the needs of a sysadmin and > people who program hardcore with Raku. That's

Re: Fwd: Raku, docs, help [was: Re: vulgar?]

2019-12-10 Thread Simon Proctor
On Tue, 10 Dec 2019 at 02:40, ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > On 2019-12-09 07:21, Simon Proctor wrote: > > I think this does highlight something we probably should document more. > > > > How to read signatures. Because it's a *very* p

Re: Fwd: Raku, docs, help [was: Re: vulgar?]

2019-12-09 Thread Simon Proctor
contains(Str:D: Cool:D $needle, Cool:D $pos --> Bool:D) > > In the above, it is not real obvious to the Riff-Raff > (me), who is not have developer level ledge, that the > "Str:D" in inside the parenthesis, but instead feeding > the method. You have to get use to the c

Re: A grand idea on the documentation

2019-12-09 Thread Simon Proctor
I find both the implications of "guard dog" and "gatekeeper" unfair ways to talk about anyone on the community especially JJ. On Mon, 9 Dec 2019, 14:38 ToddAndMargo via perl6-users, < perl6-us...@perl.org> wrote: > On 2019-12-09 03:47, Elizabeth Mattijsen wrote: > >> On 9 Dec 2019, at 10:32, Tod

Re: modules and constants

2019-12-06 Thread Simon Proctor
, > > > > AFAIK Perl’s culture is not to use so many constants in actual > > programming. :) > > > > Tom > > > > Is there a way to make constants universal inside a module, or > do I have to declare them inside every sub? > -- Simon Proctor Cognoscite aliquid novum cotidie http://www.khanate.co.uk/

Re: where is my map typo?

2019-12-04 Thread Simon Proctor
quot;my $map = Map.new('a', 1, 'b', 2); say $map{'a'}; say $map{ 'a', > 'b' };" > ===SORRY!=== Error while compiling -e > Malformed my > at -e:1 > --> my⏏ = Map.new('a', 1, 'b', 2); say {'a'

Re: restricted value passed to a sub question

2019-12-04 Thread Simon Proctor
top pass a value to a sub, but I > want to restrict what those values are. > > For instance, things like > > AbortRetryIgnore > CancelRetryContinue > Help > YesNo > Maybe > > And so on and so forth. > > If the wrong value is passed, I want the checke

Fwd: for by 3?

2019-11-26 Thread Simon Proctor
Forgot to reply all this to the list. In my defence it's first thing in the morning for me. -- Forwarded message - From: Simon Proctor Date: Wed, 27 Nov 2019, 06:59 Subject: Re: for by 3? To: William Michels Sorry Bill I was typing that on my phone and didn't ful

Re: for by 3?

2019-11-23 Thread Simon Proctor
If you want to read you lines in groups of 3 then you want batch : for @x.lines.batch(3) -> @b If you just want the third line and throw away the first I'd probably do a tail on that. for @x.lines.batch(3).map( *.tail ) -> $l Note you need to map the tail on each batch of three not slap it on t

Re: Variable character class

2019-09-01 Thread Simon Proctor
Using a set would be good but it doesn't give you the matching string from the original (which is what I thought was required) otherwise Sets would be my first thought. On Sun, 1 Sep 2019, 17:57 William Michels, wrote: > Hi Yary and Paul and Simon, > > I ran into the same difficulties as Yary wi

Re: Variable character class

2019-09-01 Thread Simon Proctor
>> From http://docs.perl6.org/language/regexes#Regex_interpolation I'd >> think that Rakudo would use the literal contents of $chars_to_match, >> instead it's using the literal chars "$ c h a r s _ t o _ m a t c h" and >> warning about repeated c, underscore, etc. >> >> -y >> > > > -- > __ > > :(){ :|:& };: > -- Simon Proctor Cognoscite aliquid novum cotidie http://www.khanate.co.uk/

Re: Checking If a certain object is present in Array

2019-08-15 Thread Simon Proctor
Int, (with any given value) were > among the values? > > Best regards > Mikkel > > On Thu, 15 Aug 2019 at 16:38, Simon Proctor > wrote: > >> The easiest option would be use the set operators. In this case (elem) >> (or ∈) will coerce your array to a Set and then check

Re: Checking If a certain object is present in Array

2019-08-15 Thread Simon Proctor
@objects = [1, True, "string", 5, Str.new]; > Containing different kind of objects. It could be Ints, Strs and Bools. > Is there a nice way of determining if for example a Bool is present in the > array, returning True or False whether the given object is present or not? >

Re: Short term Zef fix

2019-04-30 Thread Simon Proctor
Not tried that On Tue, 30 Apr 2019 at 12:35, Timo Paulssen wrote: > Doesn't updating zef to the latest version fix everything up nicely? > - Timo > On 30/04/2019 12:06, Simon Proctor wrote: > > Until the p6c system is fixed here's a short term fix that will at least

Re: Short term Zef fix

2019-04-30 Thread Simon Proctor
ne of them. It's probably > better to lower the timeout... > > El mar., 30 abr. 2019 a las 12:07, Simon Proctor () > escribió: > >> Until the p6c system is fixed here's a short term fix that will at least >> let zef install modules from cpan. >> >> zef

Short term Zef fix

2019-04-30 Thread Simon Proctor
stop trying to access the ecosystem modules. It's not perfect as not everything is in CPAN but it should help. -- Simon Proctor Cognoscite aliquid novum cotidie http://www.khanate.co.uk/

Re: I need help with "lines"

2019-03-15 Thread Simon Proctor
> The result I want is 13908 > >> > > >> > Many thanks, > >> > -T > >> > >> And why do I have a broken pipe here? > >> > >> $ ps ax | grep [f]irefox | perl6 -ne 'say > >> $_.lines.sort.reverse.words

Re: I need help with "lines"

2019-03-14 Thread Simon Proctor
6am here and I'm not at a computer but I think your problem is trying to use both -n which runs your code on each line of STDIN and lines. Try one or the other see what happens. Once I'm ambulant and at a computer I'll poke at it myself. On Fri, 15 Mar 2019, 05:34 Todd Chester via perl6-users, <

Re: buf to integer?

2019-02-08 Thread Simon Proctor
Ooo. Nice. On Fri, 8 Feb 2019, 17:55 Brad Gilbert If you have a new enough version of Rakudo: > > my Buf $x=Buf.new(0xAE,0x5D,0x5C,0x72); > > my int32 $i = $x.read-int32(0,LittleEndian); > > say $i.base(16); > # 725C5DAE > > On Fri, Feb 8, 2019 at 12:35 AM Todd Chester via per

Re: buf to integer?

2019-02-08 Thread Simon Proctor
mber in a buffer to and integer > > $ p6 'my Buf $x=Buf.new(0xAE,0x5D,0x5C,0x72); my int32 $i=$x[3] +< 0x18 > + $x[2] +< 0x10 + $x[1] +< 0x08 + $x[0]; say $x; say $i.base(0x10);' > > Buf:0x > 725C5DAE > > > Is there a more "elegant&

Re: Roles are fundamentally broken?

2019-01-29 Thread Simon Proctor
I think part of the issue is that fundamentally Roles are intended to be a way of doing non inheritance based classes. So composing Roles from other Roles is an anti pattern. On Tue, 29 Jan 2019, 06:32 yary https://github.com/rakudo/rakudo/issues/2657 - looks like an outright > bug, to me. > > I

Re: Bad syntax check

2019-01-02 Thread Simon Proctor
Have you tried defining your return values in the signature? sub AddThree( Int $a, Int $b, Int $c --> Int) {...} With this the compiler knows what your function is supposed to return and can earn you in advance. On Wed, 2 Jan 2019, 20:04 ToddAndMargo via perl6-users Dear Perl 6 Developers, > >

Re: Perl 6 Advent calendar open for contributions

2018-11-16 Thread Simon Proctor
; https://github.com/perl6/mu/blob/master/misc/perl6advent-2018/schedule > > ... Please! > > Cheers > > -- > JJ > -- Simon Proctor Cognoscite aliquid novum cotidie http://www.khanate.co.uk/

Re: routine declaration line question

2018-10-12 Thread Simon Proctor
ct 12, 2018 at 7:46 AM Simon Proctor > wrote: > >> Only if the routine has an easily defined return Type. Many do not. >> > > Is there not always a common root, even if it is Mu? Why not explicitly > mark those > as Mu for documentation purposes at least? That would d

Re: routine declaration line question

2018-10-12 Thread Simon Proctor
. This was >> my question, not whether or not I should write a definition >> line for my own subs. >> > > I agree. The documentation should always describe the routine with a --> > > Curt > > -- Simon Proctor Cognoscite aliquid novum cotidie http://www.khanate.co.uk/

Re: Use of the --output flag

2018-10-09 Thread Simon Proctor
rg_count: 0 > Callsite_1 : > > > Most of the compilation stages don't work with --output, which could be a > bug. However, --output isn't supposed to change what $*OUT is set to in the > script. > > Hope that helps > - Timo > > > On 09/10/2018 15:18,

Re: Use of the --output flag

2018-10-09 Thread Simon Proctor
e code. > On Tue, Oct 9, 2018 at 8:18 AM Simon Proctor > wrote: > > > > So... I'm working through some notes for a talk on Thursday and I am > trying to work out how the --output flag is supposed to work. > > > > I would expect this to create a file called t

Use of the --output flag

2018-10-09 Thread Simon Proctor
printed to the command line and an error : Use of Nil in string context in any print at gen/moar/stage2/NQPCORE.setting line 850 Trying use it on a sime file (say "Hi") and it also doesn't do that. (Note that the test file is created but it's empty). Any ideas? -

Re: Could this be any more obscure?

2018-10-02 Thread Simon Proctor
on Perl 6. If you had made a real effort to read > > such introductory material, you would probably not have needed to ask > > about 90% of the questions you asked lately. Do yourself a favor: read > > good introductory material (tutorials or books). > > > > HTH, > > Laurent. > > > > > > Hi Laurent, > > You already know what to expect. You are an advanced user. > And I would have to tentatively agree with you. The documentation > does "seem" to be extraordinarily well written for advanced > developer level users. Just the sort of reader that does not > need to use it as they already know what is going on. > > When you know how to use a function but can't reverse > engineer how to do it from the documentation, then you > are in real trouble. > > I am thinking of doing an RFE to place at the front > of the routines documentation that introduces the reader > on how to read THAT line in the documentation -- what > the abbreviations and symbols and the like mean. > > If I do, I will post it here first for criticism. > > Your thoughts? > > -T > -- Simon Proctor Cognoscite aliquid novum cotidie http://www.khanate.co.uk/

Re: join questions

2018-09-30 Thread Simon Proctor
On Sun, 30 Sep 2018, 12:05 ToddAndMargo, wrote: > Hi All, > > https://docs.perl6.org/routine/join#(List)_routine_join > > method join(List:D: $separator --> Str:D) > > $ p6 'say (1, ).join("|");' > 1|a b c > > > In this instance you have passed in two objects the Int 1 and a list of > Str's (<>

Re: .kv ?

2018-09-14 Thread Simon Proctor
Just look at Curt's explanation. On Fri, 14 Sep 2018, 12:22 Todd Chester, wrote: > > > On 09/14/2018 04:18 AM, Simon Proctor wrote: > > Assigned, created or defined. > > > > Basically the object has a value. > > Not following. Are there three of them? >

Re: .kv ?

2018-09-14 Thread Simon Proctor
Assigned, created or defined. Basically the object has a value. On Fri, 14 Sep 2018, 12:08 Todd Chester, wrote: > > > On 09/14/2018 04:01 AM, Simon Proctor wrote: > > :D is a type constraint requiring an instantiated (or defined) object of > > the given type (or a subtype

Re: .kv ?

2018-09-14 Thread Simon Proctor
gt; >> > >> The second ":" is the delimiter for what goes in front of the .foo, > >> meaning it has finished its declaration of what that in front is. > >> Kind of like a comma. > >> > >> "-->List" mean somethi

Re: .new?

2018-09-14 Thread Simon Proctor
I think the docs of objects (sorry on my phone no link) describe object creation and the default new quite well. Do a search for objects. On Fri, 14 Sep 2018, 11:30 Todd Chester, wrote: > Hi All, > > What exactly is going on with .new? > >https://docs.perl6.org/routine/new >method new(T

Re: .kv ?

2018-09-14 Thread Simon Proctor
:D means a defined value. So it's when you have an instance. :U is undefined so it's when you call kv as a classethod. Pair.kv would be :U. (A => "b").kv would be :D On Fri, 14 Sep 2018, 11:22 Todd Chester, wrote: > Hi All, > > I adore the "kv" method: > > $ p6 'for "abc\n23\n4.56".lines.kv ->

Re: Nil ?

2018-09-12 Thread Simon Proctor
O learn something new everyday :) On Wed, 12 Sep 2018 at 08:46 Elizabeth Mattijsen wrote: > Also: > > my $a is default(Nil); > > > On 12 Sep 2018, at 09:25, Simon Proctor wrote: > > > > If you don't define the type of a Scalar and don't assign t

Re: Nil ?

2018-09-12 Thread Simon Proctor
Nil; if $x =:= Nil { say "Nil" } else { say "Not Nil"; };' > Not Nil > -- Simon Proctor Cognoscite aliquid novum cotidie

Re: Please explain this to me

2018-09-12 Thread Simon Proctor
) $pos > Why "Int(Cool:D)"? Why is type Int being redefined > as type "Cool" (number or any type or a string). > > $pos is the starting position to check for a match, > start at zero. > > Foul! > $pos is optional. But there is a "D" in its

Re: A comparison between P5 docs and p6 docs

2018-09-11 Thread Simon Proctor
> 2 : to achieve by force or threat >> coerce compliance >> coerce obedience >> >> 3 : to restrain or dominate by force >> >> And what the heck is a "multi sub" and a "multi method" anyway? >> AND WHY DO I EVEN CARE? I just what to know how to use the >> stinking thing! Geepers Creapers !!! (I am trying to avoid >> swearing.) >> >> Perl 5's perldoc just tells you what you need to know to use the >> stinker. It is concise and to the point. Perl 6 is a nightmare >> to understand. >> >> Thank for putting up with my frustration. >> >> -T >> > -- Simon Proctor Cognoscite aliquid novum cotidie

Re: Functions and subroutines?

2018-09-11 Thread Simon Proctor
>>> >>> Sort of like >>> function: sub add($a, $b){return $a+$b} >>> routine:sub add($a, $b, rw $c){$c = $a+$b} >>> >>> In Perl, what is the proper terminology? >>> >>> Many thanks, >>> -T >>> >>> I no longer use "rw $c". I always use "return". >>> The guys told me this was the best way on the >>> chat line, so I adopted it. >>> >> >> > -- Simon Proctor Cognoscite aliquid novum cotidie

Re: Please explain this to me

2018-09-11 Thread Simon Proctor
this helps. Simon On Tue, 11 Sep 2018 at 13:05 Simon Proctor wrote: > 1) why is it a "method" and not a "function"? > > methods are all on instance of a Class (or Role) they can locally access > the instances data via self or $ or ... see below. > > 1-1/2) wh

Re: Please explain this to me

2018-09-11 Thread Simon Proctor
i($me:) { > > 6) where is @b and %c? > > >"Well I'm class $me.^name(), of course!" > > 7) why is there a caret in front of "name"? > > >} > > } > > > > > > say Foo.whoami; # OUTPUT: «Well I'm class Foo, of course!␤» > > 8) no clue how they got there > > > JJ, have you ever used Perl 5's perldocs? They are a bazillion > times easier to understand than Perl 6's. > > Thank you for the help with this? > > -T > -- Simon Proctor Cognoscite aliquid novum cotidie

Re: how do I do this index in p6?

2018-09-11 Thread Simon Proctor
(more logical than -1) > https://docs.perl6.org/routine/index; it's a constant, so you have to use > =:= to check for equality. https://docs.perl6.org/routine/=:= > ??!! is the ternary operator in Perl 6 > https://docs.perl6.org/language/operators#index-entry-operator_ternary-ternary_operator > > > JJ > PS: ObStackOverflow plug. > -- Simon Proctor Cognoscite aliquid novum cotidie

Re: use Moo:from;

2018-09-06 Thread Simon Proctor
But potential issues are possible > as it seems that the bug is not only related to method inheritance. > > > Oops, correction: "get_value() is unlikely to be inherited". Sorry. > > Best regards, > Vadim Belman > > -- Simon Proctor Cognoscite aliquid novum cotidie

Re: use Moo:from;

2018-09-06 Thread Simon Proctor
set to a value at build and if > not call a block it's given when first read from. This gets round the issue > of if we want to set it to Any. > > > > I *think* this will work. The stuff I've been doing with Trait::Env > would point that way. > > > > Best regards, > Vadim Belman > > -- Simon Proctor Cognoscite aliquid novum cotidie

Re: use Moo:from;

2018-09-05 Thread Simon Proctor
le* about your view of it in this > sub-thread.) > > > > If you haven't tried :from I can't help but wonder if perhaps we > let you down by not advocating strongly enough for you to explore it. > > > > If you have, I can't help but wonder what you made of it and why you > ruled out using Moo features in P6 via :from. > > > > So in summary I'm anxious to hear whether you tried :from and > found it wanting; or we just failed to adequately bring your attention to > it; or you rejected it from the get go based on your understanding of its > relevance (or rather irrelevance) to your situation. > > > > -- > > raiph > > Best regards, > Vadim Belman > -- Simon Proctor Cognoscite aliquid novum cotidie

Re: Introducing P6 into a P5 user environment

2018-09-05 Thread Simon Proctor
al to > her vision as P6. > > In summary, I believe that if you keep a positive, practical and > persistent (multi year) focus on bringing P6 into the mix with a P5 > environment, P6 leaders will or at least should have your back. > > I'm curious to hear whether this is of interest to you or others. > > -- > raiph > -- Simon Proctor Cognoscite aliquid novum cotidie

Re: curious effects in debugging

2018-08-16 Thread Simon Proctor
expecting any of: > infix > infix stopper > postfix > statement end > statement modifier > statement modifier loop > > > thanks, > > > -- > Theo van den Heuvel > -- Simon Proctor Cognoscite aliquid novum cotidie

Re: is there a limit to a s/ ?

2018-08-11 Thread Simon Proctor
> Version:* > > > > > > > > > >9.2.0.92978.3.6.35572 > > > > > > > > > > > > $WebPage ~~ s/ . * ''//; > > $WebPage ~~ s/ '' .* //; > > > > > > Then > > > > ( $NewRev = $Webpage ) ~~ s/ .*? ' > > > I may have to fuss with the escapes. > > > > I do so adore Perl! > > > > :-) > > > > -T > > > I have done this with two web pages already. Perl 6 > eat its lunch! > > -- > ~~ > Computers are like air conditioners. > They malfunction when you open windows > ~~ > -- Simon Proctor Cognoscite aliquid novum cotidie

Re: is there a limit to a s/ ?

2018-08-10 Thread Simon Proctor
It's 5am and I should be asleep but I think this is a perfect case for ff then. Check out the docs for it. On Sat, 11 Aug 2018, 05:01 ToddAndMargo, wrote: > On 08/10/2018 08:56 PM, Simon Proctor wrote: > > If all you are wanting to do is print the lines after a certain point i

Re: Why use dd to convert a string to an integer?

2018-08-07 Thread Simon Proctor
initialized value, when all > >> I did was add quotes around $y, as in the above line. > >> > >> $ p6 'my Str $x = "5"; my Int $y = dd +$x; say "$y";' > >> 5 > >> Use of uninitialized value $y of

Re: Why use dd to convert a string to an integer?

2018-08-07 Thread Simon Proctor
$ p6 'my Str $x = "5"; my Int $y = dd +$x; say "$y";' > 5 > Use of uninitialized value $y of type Int in string context. > Methods .^name, .perl, .gist, or .say can be used to stringify > it to something meaningful. > > > Why would I want to use "dd"? > > Many thanks, > -T > -- Simon Proctor Cognoscite aliquid novum cotidie

Re: start up delay?

2018-08-06 Thread Simon Proctor
6 Aug 2018 at 10:38 ToddAndMargo wrote: > On 08/06/2018 02:07 AM, ToddAndMargo wrote: > > On 08/06/2018 01:02 AM, Simon Proctor wrote: > >> Sorry I wrote my earlier email on my phone without a computer to hand. > >> Here's a quick rundown on what I'm talking about. &

Re: start up delay?

2018-08-06 Thread Simon Proctor
then you’re probably doing a lot of grammar changes to Perl 6. But > >> without the actual code, this remains guessing. > >> > >> > >> > Any workaround for this, or is this just growing pains for Perl > 6? > >> > >> Not sure :-) > &g

Re: start up delay?

2018-08-05 Thread Simon Proctor
r changes to Perl 6. But without the > actual code, this remains guessing. > > > > Any workaround for this, or is this just growing pains for Perl 6? > > Not sure :-) > > > > Liz -- Simon Proctor Cognoscite aliquid novum cotidie

Re: Catching exceptions in expressions

2018-08-03 Thread Simon Proctor
> sub divide($a, $b) { (EA, EB).pick.new.throw if $b == 0; $a / $b } > > my $quotient = do { my $q; { $q = divide($a, $b); CATCH { when EA { $q > = -1 }; when EB { $q = -2 } } }; $q }; > > > [1] > https://stackoverflow.com/questions/51644197/returning-values-from-exception-handlers-in-perl-6/51670573 > -- Simon Proctor Cognoscite aliquid novum cotidie

Re: -c bug to report

2018-07-25 Thread Simon Proctor
les in it header, not five: > > sub IsCurrentRevNewer( > $Caller, # who called this function > $LatestRev, # Latest Revision > $OldRev ) { # Old Revision > > > -T > -- Simon Proctor Cognoscite aliquid novum cotidie

Re: using run

2018-06-20 Thread Simon Proctor
If you're wanting to run a command and have the output go directly to a file you might want to look at shell? https://docs.perl6.org/routine/shell You can still get back a Proc object and specify if you want access to the input, output of error handles. So if you wanted to call an external comman

Re: need s/ help

2018-05-01 Thread Simon Proctor
So what you what to match is a followed by zero or more not a's and then the end of the string. <[a]> is the perl6 regex for a range comprising of a alone you can negate that like so <-[a]> Giving us perl6 -e 'my $x="abcabcabc"; $x ~~ s/a <-[a]>* $/xyz/; say $x;' (There's probably a better way,

Re: how do I do an integer divide?

2018-04-13 Thread Simon Proctor
It's div (lowercase) so 21 div 4 = 5 :) On Fri, 13 Apr 2018 at 11:07 ToddAndMargo wrote: > Hi All, > > How do I do and integer divide? > > By that I mean I want only the whole number and > not the decimal point or the fraction. > > 21 DIV 4 = 5 (not 5.25) > 21 % 4 = 1 (remainder = 1) > > >

Re: [perl #133057] Odd interaction of HTTP::UserAgent and Promises

2018-04-04 Thread Simon Proctor via RT
There are also issues with libssl (which I think the IO::Socket::SSL module calls using Native Call) and threads. At the moment the only threads safe https client is the Cro one, I believe. Sorry I can't be more help, 2am insomnia should really be sleeping. On Wed, 4 Apr 2018, 2:30 am

Re: [perl #133057] Odd interaction of HTTP::UserAgent and Promises

2018-04-04 Thread Simon Proctor via RT
Looks to me like one of the sites is redirecting to an https page and you don't have IO::Socket::SSL installed. On Wed, 4 Apr 2018, 1:42 am brian d foy, wrote: > # New Ticket Created by "brian d foy" > # Please include the string: [perl #133057] > # in the subject line of all future correspo

Re: [perl #133057] Odd interaction of HTTP::UserAgent and Promises

2018-04-03 Thread Simon Proctor
There are also issues with libssl (which I think the IO::Socket::SSL module calls using Native Call) and threads. At the moment the only threads safe https client is the Cro one, I believe. Sorry I can't be more help, 2am insomnia should really be sleeping. On Wed, 4 Apr 2018, 2:30 am

Re: [perl #133057] Odd interaction of HTTP::UserAgent and Promises

2018-04-03 Thread Simon Proctor
Looks to me like one of the sites is redirecting to an https page and you don't have IO::Socket::SSL installed. On Wed, 4 Apr 2018, 1:42 am brian d foy, wrote: > # New Ticket Created by "brian d foy" > # Please include the string: [perl #133057] > # in the subject line of all future correspo

Re: Module wishlist priorities

2017-12-29 Thread Simon Proctor
Where is the wishlist? On Fri, 29 Dec 2017 at 20:12 Michael Stemle wrote: > I just finished a module from the wishlist. I’d like to pick up another. > Is this a good place to discuss priorities for the existing wishlist, or in > general? > > I didn’t see an obvious list for this topic. > > Many

Re: Forcing a Positional role

2017-10-28 Thread Simon Proctor
t know why they designed that data container that > way) > > On Sat, Oct 28, 2017 at 9:47 PM, Simon Proctor > wrote: > >> Ahhh.. H. Even with the array as a private variable? >> >> On Sat, 28 Oct 2017, 8:41 pm Fernando Santagata, < >> nando.santag...@g

Re: Forcing a Positional role

2017-10-28 Thread Simon Proctor
just a CArray. > Anyway I couldn't add a CArray to the class, because it would change its > size and I need to pass the reference to that class to a C function. > > On Sat, Oct 28, 2017 at 1:58 PM, Simon Proctor > wrote: > >> Here's my very naive way of doing

Re: Forcing a Positional role

2017-10-28 Thread Simon Proctor
Here's my very naive way of doing it. class A does Positional { has $.a0 is rw; has $.a1 is rw; has $.a2 is rw; has $.a3 is rw; has $.a4 is rw; has $.a5 is rw; has @!arr; method TWEAK { @!arr[0] := $.a0; @!arr[1] := $.a1; @!a

Re: -f ???

2017-09-28 Thread Simon Proctor
So $f = so "eraseme.txt".IO.f; Would do the trick? On Fri, 29 Sep 2017, 6:56 am Norman Gaywood, wrote: > On 29 September 2017 at 15:10, Brandon Allbery > wrote: > >> >> (And, Norman? It produces a Failure, not a hard exception. You can >> introspect Failures to keep them from getting thrown.)

User defined infix operators and whitespace

2017-08-10 Thread Simon Proctor
So I had a crazy little idea. I've played the odd bit of roleplaying in my time and wanted to created a 'd' operator. Quite simple really. sub infix: ( Int $num, Int $size ) { [+] (1..$size).roll($num) }; sub prefix: ( Int $size ) { 1 d $size } Gives us 3 d 6 to roll 3 six sided dice or a prefi

Re: how do you pipe to perl6?

2017-08-04 Thread Simon Proctor
>From the perl6 -h response you have the standard Perl command line switches -e program one line of program, strict is enabled by default With this case $*IN has the content from the pipe going into it. Personally I combine -e with one of the next two -n run program

Re: Version of a Module

2017-06-28 Thread Simon Proctor
See I'm using mi6 to generate my META6.json file from the report and it picks the version up from the module file. Other options like that seem sensible to me. Simon On Wed, 28 Jun 2017, 13:01 Martin Barth, wrote: > Hello, > > but your approach means you have to state the version in the META6.j

Re: Possible zef addition

2017-05-25 Thread Simon Proctor
directory auto-cleanup mechanism? > > > https://metacpan.org/pod/distribution/App-cpanminus/lib/App/cpanminus/fatscript.pm#-auto-cleanup > > On Thu, May 25, 2017 at 7:20 AM, Simon Proctor > wrote: > >> So I'm playing around with Docker files (Perl 5 ATM) and one thing I&#

Possible zef addition

2017-05-24 Thread Simon Proctor
So I'm playing around with Docker files (Perl 5 ATM) and one thing I'm getting quite into is trying to keep them small. An important part of this is deleting any extraneous caching info built up during the build, preferably as part of the RUN step to get intermediate layers small. (So with Perl5 a

Re: How to I create a file?

2017-03-21 Thread Simon Proctor
It's a logical test but I'd probably use || instead. See : https://docs.perl6.org/language/traps#Loose_boolean_operators On Tue, 21 Mar 2017 at 10:56 ToddAndMargo wrote: > On 03/21/2017 03:07 AM, Brent Laabs wrote: > > $PathAndName.IO.f or $PathAndName.IO.open(:w).close; > > Is that a coding "

Re: How to I create a file?

2017-03-21 Thread Simon Proctor
.e checks a path exists. .f checks it exists AND is a file. .d checks it exists AND is a directory. (Perl 5 was the -e, -f and -d tests) On Tue, 21 Mar 2017 at 10:19 ToddAndMargo wrote: > On 03/21/2017 03:07 AM, Brent Laabs wrote: > > You can create a file by opening a filehandle for writing. >

Re: Is this file check backwards?

2017-03-21 Thread Simon Proctor
Just because the file is called "nonexistent_file" doesn't mean is doesn't exist. It's a poorly written example really. if "possibly_existing_file".IO.e { say "file exists"; } else { say "file doesn't exist"; } Is more intuitive I would say. On Tue, 21 Mar 2017 at 09:53 ToddAndMargo

Perl6 JVM builds OK fails to run

2017-02-22 Thread Simon Proctor
Built the JVM Perl6 using rakudobrew and the 2017.02 branch. It builds OK but gives : java.nio.file.NoSuchFileException: blib/Perl6/BOOTSTRAP.jar in (gen/jvm/ModuleLoader.nqp:88) (And a bunch more stack trace) Any idea how I can fix it? Simon

  1   2   >