On Tue, Mar 2, 2021 at 11:13 AM Tom Browder wrote:
> On Tue, Mar 2, 2021 at 08:42 Daniel Sockwell
> wrote:
>
>> Richard Hainsworth wrote:
>> > My suggestion is that some formal decision is made about documentation
>> for Raku modules, that some
>> > documentation good practices are put together
On Wed, Dec 30, 2020 at 8:40 PM ToddAndMargo via perl6-users
wrote:
> In the following for loop:
>
> for ^$nCount -> $i {
>
> What is the ^ doing?
https://docs.raku.org/type/Range About the third paragraph from the top:
The caret is also a prefix operator for constructing numeric ranges
s
On Tue, Dec 8, 2020 at 7:05 PM ToddAndMargo via perl6-users
wrote:
> I guess what I am missing is how
>
> int cupsEnumDests(unsigned flags, int msec, int *cancel, cups_ptype_t
> type, cups_ptype_t mask, cups_dest_cb_t cb, void *user_data);
>
> matches up with
>
> class CupsDest is repr('CStruct'
On Fri, Dec 4, 2020 at 10:52 PM ToddAndMargo via perl6-users
wrote:
> This is the C way, although it shows deleted printers as well:
>
> #include
> #include
>
> int main() {
> cups_dest_t* dests;
> int nCount = cupsGetDests2(CUPS_HTTP_DEFAULT, &dests);
>
> for (int i = 0; i < nCount; i++) {
> c
On Sat, Nov 14, 2020 at 2:03 PM ToddAndMargo via perl6-users
wrote:
> Just out of curiosity, why is the \n printed out literally here?
> p6 'my @x = <"aaa\n","bbb\n","ccc\n">; for @x {print @_};'
Your 'word quoting' <> is sort of like single quotes -- it keeps the
literal stuff. You could
use <<
On Fri, Nov 13, 2020 at 9:03 PM ToddAndMargo via perl6-users
wrote:
> Fedora 33
>
> I know I can get this information from a system
> call to "ps", but is there a way to tell if a
> program in running from Raku?
Running ps is probably as good as anything, but in linux you could
always just poke a
$ cat Lines.txt | raku -e '.say for lines()[3,2,5]'
On Mon, Aug 24, 2020 at 11:08 PM ToddAndMargo via perl6-users
wrote:
>
> On 2020-08-24 19:35, ToddAndMargo via perl6-users wrote:
> > Hi All,
> >
> > I seems I should know how to do this, but
> > I am drawing a blank.
> >
> > $ cat Lines.txt | r
Sorry things broke for you.
I filed an issue on GitHub
(https://github.com/CurtTilmes/raku-libcurl/issues/16) and copied the
emails there.
I published a new version 1.1 that will hopefully fix this. Please
let me know (either in that issue, or file new issues) for anything
broken.
Curt
On Sat,
On Tue, Jun 16, 2020 at 5:18 PM David Santiago wrote:
> my uint8 @data = $ed.data[0..$ed.data_size-1].Array;
> my Blob $bindata = Blob[uint8].new(@data);
Not absolutely sure, but it seems like you are copying the data twice.
Try just
my $bindata = Blob.new($ed.data[^$ed.data_size]);
On Fri, May 8, 2020 at 8:49 AM David Santiago wrote:
> EncodedData* ed = malloc(sizeof(EncodedData));
> ed->data = encbuffer;
> ed->crc32 = crc32;
> return ed;
You're returning a pointer to encbuffer -- make sure the storage for
that is kept around
somewhere. If it is passed in from Raku, you'l
On Fri, May 8, 2020 at 6:44 AM David Santiago wrote:
>
> I'm porting some personal perl5 scripts to Raku, and one of those
> scripts is using Inline::C.
> [...]
> Why? How do i fix it?
I haven't tried all of this, but the first thing that leaps out is
that repr('CStruct') is
not a struct -- it
I blame the English language for some of this. The docs and error messages
are actually quite precise and correct as far as they go.
The problem comes in my head, when I see the words "Blah type object", I
think "an object of type Blah", which I think is a reasonable decoding
given the way Englis
On Sat, Jan 18, 2020, 3:39 PM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
>
> 4) infix:<+> means you can call it as a sub that
> gives you back the wrong answer.
>
> $c = +($a, $b)
> $c = +^($a, $b)
>
You left off the infix:<> part of the sub's name.
On Mon, Dec 9, 2019 at 10:29 AM Simon Proctor
wrote:
> I think this does highlight something we probably should document more.
>
> How to read signatures. Because it's a *very* powerful part of the
> language that if you don't understand you're only using it at half strength.
>
> multi method con
On Mon, Dec 9, 2019 at 10:08 AM Simon Proctor
wrote:
> I find both the implications of "guard dog" and "gatekeeper" unfair ways
> to talk about anyone on the community especially JJ.
>
I understand that the intent was derogatory, but I would encourage JJ to
take it as a compliment.
He is a belo
On Mon, Dec 9, 2019 at 10:07 AM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
> On 2019-12-09 02:00, JJ Merelo wrote:
> > Other than that, it's clear from the context that it returns a Boolean
> You still need to change the target audience of the docs
> from the Developers to the Rak
On Wed, Feb 13, 2019 at 7:30 AM Mikkel wrote:
>
> > for $files -> Str $f {.say}
> Type check failed in binding to parameter '$f'; expected Str but got
> Array[Str] (Array[Str].new("Test", "Test 2"))
> in block at line 1
>
Try either 'for @$files' or ' for $files.list'.
On Thu, Feb 7, 2019 at 2:14 PM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
> What is the easiest way to get both print and say to print $i below in Hex?
>
> $ p6 'my Buf $x=Buf.new(0xAE,0x5D); my int16 $i=0x5DAE; say $x; say $i;'
>
> Buf:0x
> 23982
say $i.base(16)
If you have glibc (probably yes for Linux or Mac, probably no for Windows),
you can call memmem():
use NativeCall;
sub memmem(Blob $haystack, size_t $haystacklen,
Blob $needle, size_t $needlelen --> Pointer) is native {}
sub buf-index(Blob $buffer, Blob $needle) {
(memmem($buffe
On Mon, Oct 15, 2018 at 9:44 PM Brandon Allbery wrote:
> Isn't the point that it's $ReturnStr that's throwing the immutable error,
> not $RunString? That's what I see in the thread history
>
You're right. My thinko. Sorry.
> On Mon, Oct 15, 2018 at 9:40
On Mon, Oct 15, 2018 at 9:34 PM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
> On 10/15/18 9:04 AM, Larry Wall wrote:
> > This almost certainly means that $ReturnStr is a read-only paramater to
> > a routine. Add "is copy" to the declaration if you want to modify it.
>
> I am not s
On Fri, Oct 12, 2018 at 6:23 PM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
> Is there any way to say I am return two things: a string and an integer?
>
You can only return one thing, but that one thing can be a List that has a
string and an integer in it.
On Fri, Oct 12, 2018 at 5:08 PM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
> >> On 10/12/18 12:52 PM, Curt Tilmes wrote:
> >> > You could make a subset for the List your're trying to return:
> >> >
> >>
On Fri, Oct 12, 2018 at 3:32 PM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
>
> But this does not?
>
> $ p6 'sub RtnOrd( Str $Char --> Str, Int ){return $Char,
> ord($Char)}; say RtnOrd "A";'
>
> ===SORRY!=== Error while compiling -e
> Malformed return value (return
On Fri, Oct 12, 2018 at 8:46 AM Simon Proctor
wrote:
> What if something could return an Int or a Rat? Or an single item or an
> Array? Having Mu or Any as the listed return type isn't very useful.
>
> Maybe better to define a subset for it. Or just leave it empty and
> document it.
>
For an Int
On Fri, Oct 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 differentiate those
from
the one
On Fri, Oct 12, 2018 at 7:31 AM Todd Chester via perl6-users <
perl6-us...@perl.org> wrote:
> I was asking because sometimes the documentation for routines does
> not give a --> and I find having to dig around to figure out what
> the return is to be time consuming and confusing.
>
> Based on what
On Fri, Oct 12, 2018 at 6:08 AM Todd Chester via perl6-users <
perl6-us...@perl.org> wrote:
> > If nothing is being returned, it should really be indicated with --> Nil
> > since that can enable certain optimizations. Similarly, if a routine
> always
> > returns true upon success, that can be ind
On Tue, Oct 9, 2018 at 9:27 AM Laurent Rosenfeld via perl6-users <
perl6-us...@perl.org> wrote:
> This:
> my $f = $fh.lines;
> will slurp all the lines into $f (but you can still access the individual
> items with something like $f[4]).
>
Is that true? I supposed that it would hold the Seq as a
On Tue, Oct 9, 2018 at 9:21 AM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
>
> Yes, I know there are other ways to read a file. I
> have a specific reason for using `read`.
>
> How do I properly turn a Buf into a Str (all the bytes will
> have been tested to make sure they are pri
On Tue, Oct 9, 2018 at 8:49 AM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
>
> I am not getting anywhere with `.lines`. Read the whole thing in the
> first line.
>
> $ p6 'my $fh=open "/home/linuxutil/WhoIsMySub.pl6", :r; while my $f =
> $fh.lines { say "$f\n"}; $fh.close;'
>
.l
On Mon, Oct 8, 2018 at 7:53 AM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
> I take it that `Buf` is a special type of array that the normal
> rules do not apply to.
>
I would say rather than each of them (Buf and Array) are special types of
Positional -- they 'do' the Positional
On Mon, Oct 8, 2018 at 7:06 AM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
> $ p6 'my $fh=open "/home/linuxutil/To", :r; my Buf $f = $fh.read( 10 );
> $fh.close; dd $f; for $f[0..*] -> $Byte { if $Byte == 0b00 {say
> "Binary"; last;}else{say $Byte}}'
>
> Buf[uint8] $f = Buf[uint8].
On Sun, Oct 7, 2018 at 7:42 PM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
> I use `slurp` all the time, so of course, I can't
> make heads or tails out of
>
> https://docs.perl6.org/routine/slurp
>
> I want to slurp the first 400 characters of
> a file and close the handle.
On Tue, Oct 2, 2018 at 9:04 PM ToddAndMargo wrote:
> Not to put the cart before the horse, having not read those
> references yet, but did the crypto line forget the --> return?
>
https://docs.perl6.org/type/Signature#Constraining_return_types
On Tue, Oct 2, 2018 at 8:46 PM ToddAndMargo wrote:
> On 10/2/18 5:31 PM, Curt Tilmes wrote:
> >
> > On Tue, Oct 2, 2018 at 8:28 PM ToddAndMargo > <mailto:toddandma...@zoho.com>> wrote:
> >
> > Question: in Perl syntaxland, is "postfix" sh
On Tue, Oct 2, 2018 at 8:28 PM ToddAndMargo wrote:
> Question: in Perl syntaxland, is "postfix" short
> for "postcircumfix"?
>
Nope. Each are different types of oeprator. Here is the list:
https://docs.perl6.org/language/operators#Operator_classification
Remember within the few days people sent you links to read more about
signatures? Go read them, then re-ask any remaining questions.
I can cut/paste bits from them them under each of your questions, but it
would really be better for you to just read the existing docs and try to
understand signatu
On Fri, Sep 28, 2018 at 7:23 PM ToddAndMargo wrote:
> How about just:
>
> When used as an argument, the value Inf (Infinity)
> represents "without bound" or "no limit".
>
> That would have certainly tipped me off
>
I think you are trying to tie its meaning as an argument to the value
On Fri, Sep 28, 2018 at 6:49 PM ToddAndMargo wrote:
> On 9/28/18 3:45 PM, ToddAndMargo wrote:
> >
> > The value Inf (Infinity) represents "without bound" or
> > "no limit" (meaning "all possible values") when used
> > as an argument.
>
>
> Better written would be:
>
> Wh
On Fri, Sep 28, 2018 at 2:57 PM ToddAndMargo wrote:
> On 9/28/18 10:42 AM, Curt Tilmes wrote:
> > Indeed we do, we have a special value just for that -- Inf or ∞.
>
> Inf or ∞ still means (to me) a number too large to represent.
> But, I can't think of another way to say
On Fri, Sep 28, 2018 at 1:32 PM ToddAndMargo wrote:
> So how am I suppose to enter that as a value?
You can enter it as just plain Inf, or, if you are up to it, my preferred
form: ∞
> What it really means is "all of them".
It means infinite.
For the .words() method, you can pass in an op
On Wed, Sep 26, 2018 at 10:30 PM ToddAndMargo wrote:
>
> > You can also call .elems to see how many elements there are and
> > .AT-POS() (same as []), .EXISTS-POS() to see if an element exists, etc.
>
One small correction before the nit-pickers jump on me...
.AT-POS() isn't *really* the same as
On Wed, Sep 26, 2018 at 9:40 PM ToddAndMargo wrote:
> Would you take a swipe at "$limit = Inf"
>
In the signature like that it is just a default. If you pass in a $limit
parameter, that gets used like
"a b c d e".words(3) sets $limit to 3, limiting words() to 3 words.
If you don't pass anythi
For each instance you are using [], it is the same as assigning to a
variable, then calling [] on it.
$ p6 '"a b c d e".words(3).say;'
(a b c)
same as
my @x = "a b c d e".words(3);
@x.say
$ p6 '"a b c d e".words(3)[ 2, 4 ].say;'
(c Nil)
same as
my @x = '"a b c d e".words(3); # same as @x = '
On Wed, Sep 26, 2018 at 6:13 PM Brandon Allbery wrote:
> On Wed, Sep 26, 2018 at 6:09 PM ToddAndMargo
> wrote:
>
>> multi method words(Str:D $input: $limit = Inf --> Positional)
>>
>
"a b c d".words(3);
(a b c)
passing the $limit parameter in with 3, limits the number of words returned
to 3.
"a
On Sat, Sep 22, 2018 at 5:30 PM Larry Wall wrote:
> On Sat, Sep 22, 2018 at 11:40:13AM -0700, Joseph Brenner wrote:
> : Sounds good, thanks.
>
> Well, yes, *sounds* good. :-)
>
> Monkey patching is allowed but discouraged in Perl 6, because Ruby.
>
Mixed in roles:
https://docs.perl6.org/lan
I haven't seen many responses to this yet. I am by no means a
MoarVM/NQP/Rakudo internals expert, speaking only as a developer on top of
those things, not inside them.
On Sun, Sep 16, 2018 at 8:12 AM Fernando Santagata <
nando.santag...@gmail.com> wrote:
> I'm developing an interface to libfftw3
Rat is a type (a 'class').
It is also a method on class Numeric. You can take anything Numeric, and
call .Rat() on it to get an equivalent Rat (well, within $epsilon)
You can't, for example, say
my Rat $x = pi;
Since pi is not rational -- it won't fit in that box.
You can, however, ask pi to tur
of;# (Real) -- The box can hold anything that is Real
(which includes Rats)
On Sun, Sep 16, 2018 at 10:20 PM ToddAndMargo wrote:
> >> On Sun, Sep 16, 2018 at 10:07 PM ToddAndMargo >> <mailto:toddandma...@zoho.com>> wrote:
> >>
> >> On 09/16/2018 06
s the 'Real' role).
You can still stick some other Real in the box, and you still can't stick
anything that isn't a Real in the box.
On Sun, Sep 16, 2018 at 10:07 PM ToddAndMargo wrote:
> On 09/16/2018 06:50 PM, Curt Tilmes wrote:
> > Note that an object that is a R
Note that an object that is a Rat also does Real (see
https://docs.perl6.org/type/Rat#Type_Graph)
say Rat ~~ Real
True
Your're making a box that takes a Real, then putting a Rat (that also
does Real) into that box.
It then says "yes, you've got a Rat in there".
On Sun, Sep 16, 2018 at 9:35 P
Read this:
https://perl6advent.wordpress.com/2017/12/02/perl-6-sigils-variables-and-containers/
Then go back and read it again. It took me several times, and I'm still
not sure I get it all :)
On Sun, Sep 16, 2018 at 8:49 PM ToddAndMargo wrote:
> On 09/14/2018 08:07 PM, ToddAndMargo wrote:
>
On Fri, Sep 14, 2018 at 10:52 PM Curt Tilmes wrote:
>
>
> On Fri, Sep 14, 2018 at 10:42 PM ToddAndMargo
> wrote:
>
>> When I said "yet", I presumed the a variable can be
>> redefined at will:
>>
>> $ p6 'my $x; say $x.perl;
>>
On Fri, Sep 14, 2018 at 10:42 PM ToddAndMargo wrote:
> When I said "yet", I presumed the a variable can be
> redefined at will:
>
> $ p6 'my $x; say $x.perl;
> $x="abc"; say $x.perl;
> $x=Nil; say $x.perl;'
> Any
> "abc"
> Any
>
> And that the receiving method only cares what
See
https://docs.perl6.org/type/Signature#Constraining_defined_and_undefined_values
If I say "my Int $x",
$x is now an Int, but an undefined Int.
If I say "my Int $x = 42",
$x is an Int, but set to a defined value, 42.
Both are Int:
say 42 ~~ Int; # OUTPUT: «True»
say Int ~~ Int; # OUTPUT
There's a talk for that too:
https://www.youtube.com/watch?v=7mkmZVIizFY 2016 - Basic OO in Perl 6 -
Dave Rolsky
On Tue, Sep 11, 2018 at 1:42 PM Brandon Allbery wrote:
> I'd like to point out that Todd is from Perl 5, which doesn't distinguish
> between subs and methods because its built-in OO
On Tue, Sep 11, 2018 at 6:27 AM ToddAndMargo wrote:
> method ($a: @b, %c) {}; # first argument is the invocant
>
I might say rather that $a is a parameter for the invocant. The @b
parameter holds all the positional arguments, %c holds the named arguments.
> class Foo {
> method who
On Fri, Sep 7, 2018 at 8:58 PM ToddAndMargo wrote:
> My big gripe with the documentation is that it is written as
> a refresher for those that already know what they are doing.
> This is why I am such a good case for spotting things that
> do not resonate with beginners.
>
> I am clueless, until
>
> >>> >> On 3 Sep 2018, at 18:41, Parrot Raiser <1parr...@gmail.com> wrote:
>> >>> >> In Perl 5, a program can hand over control to another with exec:
>> >>> >> https://perldoc.perl.org/functions/exec.html
>> >>> >> e.g perl -e 'exec vim' opens up vim
>> >>> >>
>> >>> >> What's the Perl 6 equiv
On Mon, Sep 3, 2018 at 4:28 PM Parrot Raiser <1parr...@gmail.com> wrote:
> If I understand that correctly, "die" needs to be documented as always
> outputting the line number, and that for user-oriented messages, one
> of the other techniques should be used.
>
die throws the Exception -- you can
On Mon, Aug 6, 2018 at 4:40 PM ToddAndMargo wrote:
> Is there a way to force all the members of an array
> to be integers and to error out is a non-integer
> is written to one of its cells?
>
Sure, from the examples in the docs:
https://docs.perl6.org/language/list#Typing
my Int @a = 1, 2, 3;
On Thu, Aug 2, 2018 at 8:18 AM Timo Paulssen wrote:
> Is this what you want?
>
> perl6 -e 'say "12345" ~~ /^<+alnum -alpha>+$/'
> 「12345」
>
> perl6 -e 'say "123a45" ~~ /^<+alnum -alpha>+$/'
> Nil
On Sun, Aug 5, 2018 at 6:41 PM Arthur Ramos Jr.
wrote:
> my $x = "9.0v1"; die "Horribly" if $x =~
On Tue, Jun 12, 2018 at 12:56 PM Brandon Allbery
wrote:
> Which doesn't change the fact that there's what amounts to an
> accessibility issue.
>
> Do you *really* want to tell some percentage of people that they must be
> willing to use the One True Web Site, or else go away because they're not
>
>
> On Fri, Jun 8, 2018 at 5:15 PM, ToddAndMargo
> wrote:
>>
>> How do I fix this?
>>
>> $ ls | perl6 -e 'my @x=slurp(); say @x.sort'
>> (log.06-08-2018_16:07:39.zip
>> log.06-08-2018_17:07:39.zip
>> log.07-08-2018_06:07:39.zip
>> log.07-08-2018_16:07:39.zip
>> log.12-08-2016_06:07:39.zip
>> )
>>
I built a bit on Richard's work..
On Sat, Mar 3, 2018 at 2:12 AM, Richard Hainsworth
wrote:
> In addition, I have not figured out how to access CStruct variables yet.
They are mostly like normal classes, but unpacking native C bits isn't always
straightforward.
In this particular case, ToddAndM
I also see another bug:
method flags {
do for AddrInfo-Flags.enums { .key if $!ai_flags +| .value }
}
should be
method flags {
do for AddrInfo-Flags.enums { .key if $!ai_flags +& .value }
}
Though you probably don't even need the flags..
Curt
On Sat, Mar 3, 2018 at 10:58 PM, Richard Hainsworth
wrote:
> I realised from the C documentation that a fixed 14 byte variable was
> required, but I could not find a mention about how to map that into Perl6.
> Suppose it was necessary to create a structure, how would this be done?
There isn't (cu
68 matches
Mail list logo