Re: append to Bug question
Typo. Should have been: append to Buf question And in my Keeper, I keep typing "bugger" instead of "buffer". Can't win.
Re: append to Bug question
On 6/18/22 22:58, Bruce Gray wrote: If all you want is to append 0xBB to $y, either of these will work: $y ~= Buf.new(0xBB); $y.append(0xBB); Did not realize I could use buf new like that. Thank you! Append numbers to a buffer: > $x Buf:0x<41 42 43 44> > $x.append( 0xDD ); Buf:0x<41 42 43 44 DD> > $x.append( 0xEE..0xF1 ); Buf:0x<41 42 43 44 DD EE EF F0 F1> > $x.append( 0xA1, 0xA3, 0xA5 ); Buf:0x<41 42 43 44 DD EE EF F0 F1 A1 A3 A5> $x ~= buf8.new( 0xBB, 0xBC ); Buf:0x<41 42 43 44 DD EE EF F0 F1 A1 A3 A5 BB BC>
Re: append to Bug question
On 6/18/22 22:58, Bruce Gray wrote: From just looking at your code, I am not clear on what you are trying to do. I am updating my Keeper on buffers. I have four of them that are a mess and I an going to consolidate them into a single .ODT (open document text) file with an index.
Re: append to Bug question
> On Jun 18, 2022, at 11:13 PM, ToddAndMargo via perl6-users > wrote: > > Hi All, > > What am I doing wrong here: From just looking at your code, I am not clear on what you are trying to do. > > my Buf $y = Buf.new( 0xFA xx 10); > Buf:0x > > > $y ~= 0xBB.encode.Buf; > Buf:0x > > I got three entries (31 38 37) instead of one (0xBB) Yes, because: raku -e 'say 0xBB.encode;' utf8:0x<31 38 37> > Some more goofing around: > > $y ~= 0xBB; > Stringification of a Buf is not done with 'Str'. The 'decode' method should > be used to convert a Buf to a Str. > [10] > $y += 0xBB; > Type check failed in assignment to $y; expected Buf but got Int (201) --snip-- If all you want is to append 0xBB to $y, either of these will work: $y ~= Buf.new(0xBB); $y.append(0xBB); -- Hope this helps, Bruce Gray (Util of PerlMonks)
Re: append to Bug question
On 6/18/22 21:13, ToddAndMargo via perl6-users wrote: Hi All, What am I doing wrong here: > my Buf $y = Buf.new( 0xFA xx 10); Buf:0x > $y ~= 0xBB.encode.Buf; Buf:0x I got three entries (31 38 37) instead of one (0xBB) Some more goofing around: > $y ~= 0xBB; Stringification of a Buf is not done with 'Str'. The 'decode' method should be used to convert a Buf to a Str. in block at line 1 [10] > $y += 0xBB; Type check failed in assignment to $y; expected Buf but got Int (201) in block at line 1 Many thanks, -T Figured it out. Use `append`: > $x Buf:0x<41 42 43 44> > $x.append( 0xDD ); Buf:0x<41 42 43 44 DD> > $x.append( 0xEE..0xF1 ); Buf:0x<41 42 43 44 DD EE EF F0 F1> > $x.append( 0xA1, 0xA3, 0xA5 ); Buf:0x<41 42 43 44 DD EE EF F0 F1 A1 A3 A5>
Re: append to Bug question
On 6/18/22 22:12, ToddAndMargo via perl6-users wrote: What am I doing wrong here too? my $d = buf8.new( 0xDE..0xDB ); Buf[uint8]:0x<> Not sure why the above did not work, but this does: Presalt with swept entries: > my buf8 $e = buf8.new(0x5..0x8); Buf[uint8]:0x<05 06 07 08> > my buf8 $e = buf8.new(0x5A..0x5D); Buf[uint8]:0x<5A 5B 5C 5D>
Re: append to Bug question
What am I doing wrong here too? my $d = buf8.new( 0xDE..0xDB ); Buf[uint8]:0x<> -- ~~ Computers are like air conditioners. They malfunction when you open windows ~~
append to Bug question
Hi All, What am I doing wrong here: > my Buf $y = Buf.new( 0xFA xx 10); Buf:0x > $y ~= 0xBB.encode.Buf; Buf:0x I got three entries (31 38 37) instead of one (0xBB) Some more goofing around: > $y ~= 0xBB; Stringification of a Buf is not done with 'Str'. The 'decode' method should be used to convert a Buf to a Str. in block at line 1 [10] > $y += 0xBB; Type check failed in assignment to $y; expected Buf but got Int (201) in block at line 1 Many thanks, -T -- ~ When we ask for advice, we are usually looking for an accomplice. -- Charles Varlet de La Grange ~