Re: buf to integer?

2019-02-08 Thread Kevin Pye
Unpack is very useful if you have multiple items you want to unpack, and if you're familiar with the Perl 5 unpack then there's the P5pack module (which isn't a full implementation of Perl 5's unpack, but is useful for simpler things). If you want to unpack something from the middle of a Buf or Blo

What is a LoweredAwayLexical?

2019-10-22 Thread Kevin Pye
Yesterday I created a new when clause in an existing working program, which worked fine, but today when I came to exercise another previously working when clause it was broken. The golfed version... my $a = 41; given 6 { when 5 { my $a; } when 6 { say $a + 1; } }

Re: problems with xor

2020-01-17 Thread Kevin Pye
As you say, +^ is an infix operator. Why are you trying to use it as a function? Try $z = $x +^ $y. On Sat, 18 Jan 2020 at 15:03, ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > Hi All, > > https://docs.raku.org/routine/+$CIRCUMFLEX_ACCENT > > (Operators) infix +^§ > > multi sub in

Re: problems with xor

2020-01-17 Thread Kevin Pye
In Raku, all operators are just functions with a funny syntax, but if you want to use it as a function, you need the full name. infix:<+^>($x, $y) would probably work just as well. And where is the '$' before the z? On Sat, 18 Jan 2020 at 15:45, ToddAndMargo via perl6-users < perl6-us...@perl.or

Re: problems with xor

2020-01-18 Thread Kevin Pye
As has been explained quite explicitly twice already, you call it as a sub by using the full explicit name of the subroutine: $z = infix:<+^>($x, $y) On Sun, 19 Jan 2020 at 07:22, ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > On 2020-01-18 06:09, Tobias Boege wrote: > > On Fri,

Re: range doc page

2020-01-27 Thread Kevin Pye
There's no need to ask essentially the same question three times. https://docs.raku.org/routine/range is quite clearly the wrong page. That's about a method on the class X::OutOfRange, and not a method on Int. You want https://docs.raku.org/routine/Range, whic

Re: printf question

2020-02-11 Thread Kevin Pye
The "workaround" is well documented: https://docs.raku.org/language/create-cli#%*SUB-MAIN-OPTS It's just a matter of setting named-anywhere option in the %*SUB-MAIN-OPTS hash, which you will also need to create. There's an example in that doc page. Kevin. On Tue, 11 Feb 2020 at 20:07, WFB wrote

Re: Question about Blob and Buf

2020-02-11 Thread Kevin Pye
~ works fine for concatenating Bufs; For example: my $a = Buf.new(1,2,3); my $b = $a ~ Buf.new(4,5,6) will assign correctly to $b. I can't work out what the problem is here, despite trying various combinations. Perhaps socket isn't really returning a Blob? Kevin. On Tue, 11 Feb 2020 at 21:01,

Re: I need help with IO.e

2020-05-16 Thread Kevin Pye
There are three possibilities for the.d test -- the file exists and is a directory, the files exists and is not a directory, and the file does not exist. The test needs to distinguish between these three cases. The documentation for .d states: Returns True if the invocant is a path that exists an

Re: question on pod comments

2020-05-30 Thread Kevin Pye
They're not Pod comments, they're Pod abbreviated blocks: https://docs.raku.org/language/pod Kevin. On Sun, 31 May 2020 at 12:43, ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > Hi All, > > I am somewhat confused about pod comments: > > https://docs.raku.org/language/syntax#Pod_co

Re: question on pod comments

2020-05-30 Thread Kevin Pye
pod > >> > >> I see no "=end xxx" > >> > >> =end head1 NAME > >> =end head1 SYNOPSIS > >> =end head1 DESCRIPTION > >> > >> What am I missing? > >> > >> Many thanks, &

Re: question on pod comments

2020-05-30 Thread Kevin Pye
I see > >> >> > >> >> =begin pod > >> >> =head1 NAME > >> >> =head1 SYNOPSIS > >> >> =head1 DESCRIPTION > >> >> =end pod > >> >&g

Re: for and ^ question

2020-12-31 Thread Kevin Pye
> > ^ note: ^3 means the integer "just before" 3 (zero is presume to be the > start point) > > 3^ means the integer "just after" 3 (an ending point is > required) > No, it does not. Go back and read what Brad wrote; he was quite explicit. Nothing about the range 0 ..^ 3 (for which "^3

Re: for and ^ question

2021-01-01 Thread Kevin Pye
fore" 3 (zero is presume to > be the > >> start point) > >> > >>3^ means the integer "just after" 3 (an ending point is > >> required) > >> > >> > > On 12/31/20 10:15 PM, Kevin Pye wrote: > > N

Re: for and ^ question

2021-01-01 Thread Kevin Pye
t after" 3 (an ending > >> point is > >> >> required) > >> >> > >> >> > >> > >> On 12/31/20 10:15 PM, Kevin Pye wrote: > >> > No, it does not. Go back and read what Brad wrote; h

Re: 'CALL-ME' Math problem?

2021-03-02 Thread Kevin Pye
Just because mathematics allows an implied multiplication doesn't mean Raku does -- in fact I can't think of any programming language which does. You need to stick an explicit multiplication operator ('*' or '×') between the 5 and the left parenthesis. The reason for the error message is that addi

Re: ftp client yet?

2021-10-21 Thread Kevin Pye
Both modules.raku.org and raku.land know about the Net::FTP module, but it appears to be rather limited and may not do what you want. Why not just use the Perl Net::FTP? Kevin. On Fri, 22 Oct 2021, at 15:48, Henrik Peng wrote: > perhaps not from what I had searched for. > > On Fri, Oct 22, 202

Re: ftp client yet?

2021-10-21 Thread Kevin Pye
You can still use the Perl 5 module from Raku without writing any Perl code. It should allow a fairly seamless update to a usable Raku module when one becomes available. On Fri, 22 Oct 2021, at 16:18, ToddAndMargo via perl6-users wrote: > On 10/21/21 22:03, Kevin Pye wrote: >

Re: ftp client yet?

2021-10-22 Thread Kevin Pye
https://raku.land/cpan:NINE/Inline::Perl5 On Fri, 22 Oct 2021, at 18:44, ToddAndMargo via perl6-users wrote: >> On Fri, 22 Oct 2021, at 16:18, ToddAndMargo via perl6-users wrote: >>> On 10/21/21 22:03, Kevin Pye wrote: >>>> Both modules.raku.org and raku.land know abo

Re: I need a better regex with a literal in it

2021-10-23 Thread Kevin Pye
Assuming that all you are trying to do is to delete everything at the start of a line up to and including that string, the first thing I would do is get rid of all the superfluous parts of the regex. Does $NewRev ~~ s/ .* 'Release Notes V' // have the problem? ".*" means any number of characters,

Re: how do I turn a real into and array of Integers?

2021-10-31 Thread Kevin Pye
You don't. sqrt is a function which acts on 64-bit floating point numbers, and there's no more meaningful digits available. If you need more precision you're on your own. On Mon, 1 Nov 2021, at 11:20, ToddAndMargo via perl6-users wrote: > On 10/31/21 16:42, ToddAndMargo via perl6-users wrote: >>

Re: What is `Γäó`?

2022-07-01 Thread Kevin Pye
You need a Unicode terminal. It's a trademark symbol. (And the bit following "Raku" on the next line is a "registered mark" symbol.) Kevin. On Sat, 2 Jul 2022, at 09:34, ToddAndMargo via perl6-users wrote: > Hi All, > > Windows 10 Pro - 21H2 > RakudoMoar-2022.06.01-win-x86_64-msvc.msi > > > ra

Problems with defining a class

2022-08-23 Thread Kevin Pye
Hi, The following fairly simple code works well: class A { has num $!a is required is built; }; dd A.new(a => 1e0); producing "A.new(a => 1e0)". However, if we make a slight change: class A { has num $!a is required is built; }; dd A.new(a => 0e0); (i.e. initiali

Re: Problems with defining a class

2022-08-23 Thread Kevin Pye
a is required is built; > }; > > dd A.new(a => 0e0); > > > #returns: > > A.new(a => 0e0) > > Note, I'm on a fairly old version of Rakudo [moar (2021.06). > > HTH, Bill. > > > On Tue, Aug 23, 2022 at 6:47 PM Kevin Pye wrote: >> >>

Re: Test not working so well

2023-12-10 Thread Kevin Pye
On Mon, 11 Dec 2023, at 07:31, ToddAndMargo via perl6-users wrote: > [0] > my Str $x="abc3defg"; if $x.match( / ^ <[0..9]> ** 8 $ / ) { print > "True\n"; } else { print "False\n" }; > False > > "3" is in the string. Why False? Because you asked for a match with a string consisting entirely o

Re: Test not working so well

2023-12-10 Thread Kevin Pye
On Mon, 11 Dec 2023, at 09:24, ToddAndMargo via perl6-users wrote: > On 12/10/23 14:16, Kevin Pye wrote: >> Because you asked for a match with a string consisting entirely of exactly 8 >> digits. > I am not following. :'( ^beginning of string <[0..9]> a

Re: Test not working so well

2023-12-11 Thread Kevin Pye
Seriously Todd? "What is a digit?" The characters '0' to '9' are digits. (Unicode probably has a whole lot of others, but those will do for the moment.) On Mon, 11 Dec 2023, at 18:22, ToddAndMargo via perl6-users wrote: > On 12/10/23 22:26, William Michels via perl6-users wrote: > If I do not kn

Problem using precompiled Physics::Measure objects

2024-07-30 Thread Kevin Pye
I am trying to build a replacement for the existing Physics::Constants module, but running into problems when loading the pre-compiled version. I want to use code like: unit module Physics::Constants; use Physics::Unit; use Physics::Measure; constant \avogadro-constant is export(:DEFAULT, :fun

Re: Problem using precompiled Physics::Measure objects

2024-07-31 Thread Kevin Pye
On Wed, 31 Jul 2024, at 19:20, Elizabeth Mattijsen wrote: >> On 31 Jul 2024, at 06:10, Kevin Pye wrote: >> >> I am trying to build a replacement for the existing Physics::Constants >> module, but running into problems when loading the pre-compiled version. I

Blobs and IEEE floating point

2016-04-18 Thread Kevin Pye
Hi, I have a several-thousand-line long Perl 5 script which I've been translating to Perl 6 over some time, and it runs fine, although a little slowly :-) There is however one section which I haven't needed to use until recently, and which I've been avoiding translating because it's not all that

Re: Blobs and IEEE floating point

2016-04-27 Thread Kevin Pye
Sorry to be so long replying and thanking you for your help -- I've spent most of the last week in hospital with very limited communications. Thank you -- lots of interesting information. I ended up for the moment with something like (retyping from memory)... method double { $!index += 8; na

Re: Q[] question

2025-01-11 Thread Kevin Pye
On Sun, 12 Jan 2025, at 14:01, ToddAndMargo via perl6-users wrote: > Hi All, > > Is > Q[...] > > the same thing as > <...> > ? No. Q[…] is the bare quoting construct. There'll be no interpolation of variables, no splitting into words, nothing other than creating a bare string. But Q als