> On Sat, Feb 2, 2019 at 9:02 PM ToddAndMargo via perl6-users
> wrote:
>>
>> On 2/2/19 3:16 AM, Shlomi Fish wrote:
>>> On Sat, 2 Feb 2019 01:08:39 -0800
>>> ToddAndMargo via perl6-users wrote:
>>>
Hi All,
Is there a way to modify this to start reading at
a specific index? An
Hi All,
Was the subroutine "index" written Perl6? If so,
where can I view the source code?
Many thanks,
-T
> On Sat, Feb 2, 2019 at 10:05 PM ToddAndMargo via perl6-users
> wrote:
>>
>> On 2/2/19 6:09 AM, Brad Gilbert wrote:
>>> sub buf-index ( Buf $buf, +@match ) {
>>> my $elems = @match.elems;
>>> $buf.rotor( $elems => 1 - $elems ).first(* eqv
@match.List, :k)
>>> }
>
> On Sat, Feb 2, 2019 at 9:23 PM ToddAndMargo via perl6-users
> wrote:
>>
>> Hi All,
>>
>> I need to read a file into a buffer (NO CONVERSIONS!)
>> and then convert it to a string (again with no
>> conversions).
>>
>> I have been doing this:
>>
>> for ( @$BinaryFile ) -> $Char { $StrFile ~
This:
for ( @$BinaryFile ) -> $Char { $StrFile ~= chr($Char); }
is better written as
my $StrFile = $BinaryFile.map(*.chr).reduce(* ~ *);
It is also exactly equivalent to just e
# if $BinaryFile is a Buf
my $StrFile = $BinaryFile.decode('latin1');
# if it isn't
my $StrF
Subs do not need to have a `return` statement if it is returning the last value.
You also broke the return value of the subroutine that I wrote by
assigning it to a variable.
What I wrote would return `Nil` if it failed to find a match, yours
will return an undefined `Int`.
It should return `Nil`
`$whence` means “whence”
adverb
1.
from what place or source.
So it should be one of the values of the `SeekType` enum
say SeekType.enums.keys
# (SeekFromCurrent SeekFromBeginning SeekFromEnd)
- `SeekFromCurrent` means it is relative to where it is currently (go
forward/ba
On 2/2/19 6:09 AM, Brad Gilbert wrote:
sub buf-index ( Buf $buf, +@match ) {
my $elems = @match.elems;
$buf.rotor( $elems => 1 - $elems ).first(* eqv @match.List, :k)
}
my $buf = Buf[uint8].new(0x4D, 0x5A, 0x90, 0x00, 0x03);
say buf-index( $buf, (0x90, 0x00
Hi All,
I need to read a file into a buffer (NO CONVERSIONS!)
and then convert it to a string (again with no
conversions).
I have been doing this:
for ( @$BinaryFile ) -> $Char { $StrFile ~= chr($Char); }
But it takes a bit of time. What is the fastest way to do this?
I guess there is not
Hi All,
I need to read a file into a buffer (NO CONVERSIONS!)
and then convert it to a string (again with no
conversions).
I have been doing this:
for ( @$BinaryFile ) -> $Char { $StrFile ~= chr($Char); }
But it takes a bit of time. What is the fastest way to do this?
I guess there is not
> On Fri, Feb 1, 2019 at 11:02 PM ToddAndMargo via perl6-users>
wrote:
>>
>> On 2/1/19 8:26 PM, ToddAndMargo via perl6-users wrote:
>>> On 2/1/19 8:07 PM, ToddAndMargo via perl6-users wrote:
On 2/1/19 8:03 PM, ToddAndMargo via perl6-users wrote:
> > On Fri, Feb 1, 2019 at 9:37 PM Todd
On 2/2/19 3:16 AM, Shlomi Fish wrote:
On Sat, 2 Feb 2019 01:08:39 -0800
ToddAndMargo via perl6-users wrote:
Hi All,
Is there a way to modify this to start reading at
a specific index? And include how many bytes (300)
to read as well?
my $FileHandle = open( $FileName, :bin, :r
On 2/2/19 6:21 AM, Brad Gilbert wrote:
`.index` is going to be the fastest because it is directly using NQP
ops which are built into the VM.
'abcdefg'.index('de'); # 3
If you want all of the indexes, use `.indices`
'abcdefabc'.indices('abc'); # 0, 6
`.index` will return `Nil` if it
`.index` is going to be the fastest because it is directly using NQP
ops which are built into the VM.
'abcdefg'.index('de'); # 3
If you want all of the indexes, use `.indices`
'abcdefabc'.indices('abc'); # 0, 6
`.index` will return `Nil` if it doesn't find anything, and `.indices`
will
sub buf-index ( Buf $buf, +@match ) {
my $elems = @match.elems;
$buf.rotor( $elems => 1 - $elems ).first(* eqv @match.List, :k)
}
my $buf = Buf[uint8].new(0x4D, 0x5A, 0x90, 0x00, 0x03);
say buf-index( $buf, (0x90, 0x00, 0x03)); # 2
On Fri, Feb 1, 2019 at 11:02 PM
On Sat, 2 Feb 2019 01:08:39 -0800
ToddAndMargo via perl6-users wrote:
> Hi All,
>
> Is there a way to modify this to start reading at
> a specific index? And include how many bytes (300)
> to read as well?
>
> my $FileHandle = open( $FileName, :bin, :ro );
> my Buf $BinaryF
Hi All,
What is the fastest way to find the index of
a sub string in a string?
-T
Hi All,
Is there a way to modify this to start reading at
a specific index? And include how many bytes (300)
to read as well?
my $FileHandle = open( $FileName, :bin, :ro );
my Buf $BinaryFile = $FileHandle.read( 300 );
Many thanks,
-T
On 2/1/19 11:32 PM, JJ Merelo wrote:
Hi,
El sáb., 2 feb. 2019 a las 7:48, ToddAndMargo via perl6-users
(mailto:perl6-us...@perl.org>>) escribió:
Hi All,
How do I use chr inside a regex. In the below, how
do I get rid of $y?
$ p6 'my Str $x=chr(0x66)~chr(0x77); my Str $y=chr
19 matches
Mail list logo