Re: IO::Socket::INET timeout?

2024-01-21 Thread Paul Procacci
-iosocketinet > > I imagine a solution is possible using a Supply, but I haven't gotten > there yet: > > https://docs.raku.org/type/Supply > > Best, Bill. > > > On Jan 8, 2024, at 18:06, Paul Procacci wrote: > > Hey all, > > What's the right way to spe

IO::Socket::INET timeout?

2024-01-08 Thread Paul Procacci
mple of connecting a socket, and reading/writing to that socket with timeouts? Thanks, Paul Procacci -- __ :(){ :|:& };:

Re: Your idea on how to detect random directory names

2023-12-08 Thread Paul Procacci
On Sat, Dec 9, 2023 at 2:06 AM Bruce Gray wrote: > > > > On Dec 9, 2023, at 00:37, ToddAndMargo via perl6-users < > perl6-users@perl.org> wrote: > > > > Hi All, > > > > I am writing a clean up routine to relive my spot back ups > > of junk in Blink browser directories that are meaningless to > >

Re: Benchmark for Scala, Ruby and Perl

2022-01-15 Thread Paul Procacci
On Sat, Jan 15, 2022 at 5:03 AM Jon Smart wrote: > > Thanks Paul. I am surprised that mmap has that huge IO advantages > comparing to the classic way. So ruby take more benefit from this mmap > calling. Just get learned from your case. > > Regards > > It's not always beneficial. There are cases

Re: Benchmark for Scala, Ruby and Perl

2022-01-15 Thread Paul Procacci
Sorry, it's 5:00am here and needless to say it's wy past my bedtime and I'm making mistakes. The comparison should have been between both ruby versions ugh. I'll let you play though. Have a great night. On Sat, Jan 15, 2022 at 4:57 AM Paul Procacci wrote: >

Re: Benchmark for Scala, Ruby and Perl

2022-01-15 Thread Paul Procacci
ke(20).each do |s| puts "#{s[0]} -> #{s[1]}" end On Sat, Jan 15, 2022 at 3:48 AM Paul Procacci wrote: > Hey John, > > On Sat, Jan 15, 2022 at 3:04 AM Jon Smart wrote: > >> >> Hello Paul >> >> Do you mean by undef $/ and with <$fh> we can

Re: Benchmark for Scala, Ruby and Perl

2022-01-15 Thread Paul Procacci
Hey John, On Sat, Jan 15, 2022 at 3:04 AM Jon Smart wrote: > > Hello Paul > > Do you mean by undef $/ and with <$fh> we can read the file into memory > at one time? > In most cases the short answer is yes. I have problems with your wording however given the 'geek' that I am. 'At one time'

Re: Benchmark for Scala, Ruby and Perl

2022-01-14 Thread Paul Procacci
Hey Jon, The most glaringly obvious thing I could recommend is that at least in your perl routine (and probably the other languages) most of your time is context switching reading from the disk. Now, my perl version is indeed faster, but one has to ask themselves, was .015193256 seconds really wor

Re: Grammar Help

2021-12-29 Thread Paul Procacci
some to say the least. Thanks for pointing it out. Thanks, Paul On Sun, Dec 26, 2021 at 5:37 PM Ralph Mellor wrote: > On Sun, Dec 26, 2021 at 6:01 AM Paul Procacci wrote: > > > > Hope everyone had a Merry Christmas and takes likings to corny opening > statements. ;) > >

Re: Grammar Help

2021-12-26 Thread Paul Procacci
/) { make $.made => $.made; } method objectKey($/) { make $.made; } method cstr($/) { make ~$/; } method string($/){ make ~$/; } method number($/){ make ~$/; } method item:sym($/){ make $.made; } meth

Re: Grammar Help

2021-12-26 Thread Paul Procacci
paste from JSON::Tiny w/ just enough changes to account for the differences would be enough, but they are in fact different enough that this was an oversight. At least I learned a bit in the process. Thanks, Paul On Sun, Dec 26, 2021 at 5:37 PM Ralph Mellor wrote: > On Sun, Dec 26, 2021 at 6:

Grammar Help

2021-12-25 Thread Paul Procacci
Hey all, Twas the night of Christmas, when all through the house, not a creature was stirring except Paul w/ his mouse. Hope everyone had a Merry Christmas and takes likings to corny opening statements. ;) I was writing a little something tonight using Grammars and ran into something that I can

Re: why not raku ?

2021-11-19 Thread Paul Procacci
Raku is pretty amazing. I too would use it pretty regularly except it doesn't run on Freebsd properly. Many a times I started a project that would have been a great contribution yet always ran into problems and had to change back to Perl. It's definitely a good language. It's just not suited for

Re: Buf to Str

2021-06-09 Thread Paul Procacci
>> That C null is an int pointer, longer than a single byte. Yep, no arguments there. ;) On Wed, Jun 9, 2021 at 11:06 AM yary wrote: > That C null is an int pointer, longer than a single byte. > > On Wed, Jun 9, 2021 at 11:04 AM Paul Procacci wrote: > >> Not

Re: Buf to Str

2021-06-09 Thread Paul Procacci
That does help some Daniel. I do in fact need to work with C style null terminated strings because when passing a structure to an underlying OS via nativecall, you have no control over what the underlying libraries want. An Example: class myStruct is repr('CStruct') { HAS int8 @.Path[MAX_PATH] i

Re: Buf to Str

2021-06-09 Thread Paul Procacci
(can type it as ctrl-@) it's a control character much like the > others. > > Ctrl-G BEL, it was fun putting you in file names... > > On Wed, Jun 9, 2021, 9:56 AM Paul Procacci wrote: > >> >> But yeah, the Str class in Raku is much more than a C-string. >> &

Re: Buf to Str

2021-06-09 Thread Paul Procacci
>> But yeah, the Str class in Raku is much more than a C-string. Got it. Thanks Elizabeth. On Wed, Jun 9, 2021 at 6:45 AM Elizabeth Mattijsen wrote: > > On 9 Jun 2021, at 06:34, Paul Procacci wrote: > > > > Hopefully a pretty quick question > > > > GI

Buf to Str

2021-06-08 Thread Paul Procacci
Hopefully a pretty quick question GIven the following: my Buf $b .= new([72, 105, 0, 32, 97, 103, 97, 105, 110, 0]); say $b.decode; I would expect this to print 'Hi'. Instead it prints 'Hi again'. https://docs.raku.org/type/Buf#(Blob)_method_decode The decode documentation for Buf only sta

Re: Find Packages with prefix ...

2021-03-07 Thread Paul Procacci
t; the candidate modules that match 'Top::*', along the whole of the linked > list. > > Once I have the list of candidates, I can use '^can' to check it has a > 'on-starting' method, and then call that method. > > If someone could provide a bit of boiler

Find Packages with prefix ...

2021-03-06 Thread Paul Procacci
Hey Gents, I was toying with an idea of writing a program (shocker!) and in the design of said program I wanted to give the ability to other module writers to extend functionality of the base program. The main program would live in bin/ as per normal and claim a namespace of its own. Call it: Su

Re: Extracting 4 wchar_t's from int64

2021-01-14 Thread Paul Procacci
es this, if any? I'm ok with no function existing in which case I'll need to roll my own, but this is the premise for this email. On Thu, Jan 14, 2021 at 11:00 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 1/14/21 7:38 PM, Paul Procacci wrote: > > I

Re: Extracting 4 wchar_t's from int64

2021-01-14 Thread Paul Procacci
perl6-users < perl6-users@perl.org> wrote: > On 1/14/21 4:32 PM, Paul Procacci wrote: > > > https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot > > < > https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-cr

Re: Extracting 4 wchar_t's from int64

2021-01-14 Thread Paul Procacci
https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot On Thu, Jan 14, 2021 at 7:30 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 1/14/21 3:42 PM, Paul Procacci wrote: > > Let me preface this by saying if I were usin

Extracting 4 wchar_t's from int64

2021-01-14 Thread Paul Procacci
Let me preface this by saying if I were using a lower level language (like C) I wouldn't have this problem; as I know how to shift and mask accordingly. On raku however, how to do so *eloquantly* eludes me. I've defined a CStruct as follows: class test is repr('CStruct') { has int64 $.a1;

Re: Nativecall - Callee filled static character array - CArray [repost]

2021-01-03 Thread Paul Procacci
Thanks for that. I did see that but neglected to add my 2 cents. I just have though. ~Paul On Sun, Jan 3, 2021 at 8:40 PM Paul Procacci wrote: > This is a repost from an improperly worded email. > That previous email thread divulged into things it shouldn't have to which > I&

Re: Nativecall - Help with converting wchar_t CArray to something printable

2021-01-03 Thread Paul Procacci
Todd, I know what 'is rw' is for. This isn't at all related to the problem I'm having. On Sun, Jan 3, 2021 at 9:43 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 1/3/21 10:40 AM, Paul Procacci wrote: > > Furthermore you c

Re: Nativecall - Help with converting wchar_t CArray to something printable

2021-01-03 Thread Paul Procacci
No, it doesn't work. The inline statically defined array in Raku never gets filled with any data from the win32 function call. On Sun, Jan 3, 2021 at 9:37 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 1/3/21 12:00 PM, Paul Procacci wrote: > > Todd,

Nativecall - Callee filled static character array - CArray [repost]

2021-01-03 Thread Paul Procacci
This is a repost from an improperly worded email. That previous email thread divulged into things it shouldn't have to which I'm partially to blame. This isn't Windows specific - the problem occurs across platforms. This is simply about the proper way to define an *inline* array of items in a Raku

Re: Nativecall - Help with converting wchar_t CArray to something printable

2021-01-03 Thread Paul Procacci
Todd, I've made a mistake. Raku does ensure a pointer gets passed to the function transparently when referencing a structure and doesn't require one to be explicit. I stand corrected. ~Paul On Sun, Jan 3, 2021 at 1:40 PM Paul Procacci wrote: > Todd, > > Nothing you

Re: Nativecall - Help with converting wchar_t CArray to something printable

2021-01-03 Thread Paul Procacci
a[0]; say $t.b; - Running this yields: # ./test.raku 0 1 What's expected is: # ./test.raku T 1 On Sun, Jan 3, 2021 at 1:29 AM Paul Procacci wrote: > A follow-up to my initial message. > > I think the following is relevant: > > https://github.com/rakudo/r

Re: Nativecall - Help with converting wchar_t CArray to something printable

2021-01-03 Thread Paul Procacci
you'd get it to work properly, show me what version of raku you are using and supply it as it could be a bug in the version I'm running. ~Paul On Sun, Jan 3, 2021 at 5:37 AM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 1/2/21 11:38 PM, Paul Procacci wr

Re: Nativecall - Help with converting wchar_t CArray to something printable

2021-01-03 Thread Paul Procacci
sary. Try this: > > my PROCESSENTRY32 $entry .= new; > say nativesizeof($entry); # output: 556 > > Raku already knows the native size of the CStruct class. > Other than that I can't say anything useful. > > On Sun, Jan 3, 2021 at 8:38 AM Paul Procacci wrote: > >&g

Re: Nativecall - Help with converting wchar_t CArray to something printable

2021-01-02 Thread Paul Procacci
$ptr, nativecast(Pointer, $entry)); -- The output of the above is: 48 48 This is clearly wrong. This is either a) my misunderstanding of these api calls b) raku bug or c) a usage error on my part. ~Paul On Sun, Jan 3, 2021 at 2:12 AM ToddAndMargo via

Re: Nativecall - Help with converting wchar_t CArray to something printable

2021-01-02 Thread Paul Procacci
(tm) v2020.12. Implementing the Raku(tm) programming language v6.d. Built on MoarVM version 2020.12. ~Paul On Sat, Jan 2, 2021 at 11:13 PM Paul Procacci wrote: > Hey gents (again), > > I'm having on awful time with decoding UTF16LE character sequences that > are placed into a Nativecall

Nativecall - Help with converting wchar_t CArray to something printable

2021-01-02 Thread Paul Procacci
Hey gents (again), I'm having on awful time with decoding UTF16LE character sequences that are placed into a Nativecall CArray that I've defined as an interface between Raku and a windows library call. The structure used by the windows function includes a static wchar_t field that's PATH_MAX in l

Re: NativeCall -- size of data structure

2021-01-02 Thread Paul Procacci
nativesizeof is what I was looking for. Thanks, ~Paul On Sat, Jan 2, 2021 at 8:39 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 1/2/21 4:58 PM, Paul Procacci wrote: > > Hey Gents, > > > > Hopefully a simple question that I could not find the a

Re: NativeCall -- size of data structure

2021-01-02 Thread Paul Procacci
Apologies. I just came across it. nativesizeof is the subroutine you're looking for. Again, sorry for the noise. ~Paul On Sat, Jan 2, 2021 at 7:58 PM Paul Procacci wrote: > Hey Gents, > > Hopefully a simple question that I could not find the answer to. > > Given the

NativeCall -- size of data structure

2021-01-02 Thread Paul Procacci
would use sizeof() to provide the size. In raku I could not find the documentation that would provide this information. Thanks, Paul Procacci -- __ :(){ :|:& };:

Re: Sending a string to a subprocess

2020-11-11 Thread Paul Procacci
in directly. ~Paul On Wed, Nov 11, 2020 at 7:41 PM Paul Procacci wrote: > https://docs.raku.org/type/Proc > > my $p = run "cat", "cat - > outfile", :in, :out; > $p.in.say: "Hello,\nworld!"; > > > On Wed, Nov 11, 2020 at 7:15 PM Sean McAfee

Re: Sending a string to a subprocess

2020-11-11 Thread Paul Procacci
https://docs.raku.org/type/Proc my $p = run "cat", "cat - > outfile", :in, :out; $p.in.say: "Hello,\nworld!"; On Wed, Nov 11, 2020 at 7:15 PM Sean McAfee wrote: > I posted this question on Stack Overflow a few days ago: > https://stackoverflow.com/questions/64757138/raku-sending-a-string-to-a-

Re: Subset w/ Inline::Perl5 RE as constraint

2020-11-08 Thread Paul Procacci
t 7:42 PM Bruce Gray wrote: > > On Fri, Nov 6, 2020 at 8:23 AM Paul Procacci > wrote: > > > > > > So two example patterns are: > > > > > > > [\\u0009\\u000A\\u000D\\u0020-\\u007E\\u0085\\u00A0-\\uD7FF\\uE000-\\uFFFD\\u1-\\u10]* > > > [\

Re: Subset w/ Inline::Perl5 RE as constraint

2020-11-08 Thread Paul Procacci
^") > # Errors out because carets don't pass \w check > > > It could probably be cleaned up a little more, but it works. > > > On 11/5/20, Paul Procacci wrote: > > https://github.com/niner/Inline-Perl5 > > > > use Inline::Perl5; > > > &

Re: Subset w/ Inline::Perl5 RE as constraint

2020-11-06 Thread Paul Procacci
s.raku.org/language/regexes#Perl_compatibility_adverb > > Is that what you mean when you say the "perl regex engine [in Raku] is > too old" ? > > Thanks, Bill. > > > > > > On Fri, Nov 6, 2020 at 8:23 AM Paul Procacci wrote: > > > > So

Re: Subset w/ Inline::Perl5 RE as constraint

2020-11-06 Thread Paul Procacci
So two example patterns are: [\\u0009\\u000A\\u000D\\u0020-\\u007E\\u0085\\u00A0-\\uD7FF\\uE000-\\uFFFD\\u1-\\u10]* [\\p{L}\\p{Z}\\p{N}_.:\\/=+\\-@]* To note, the RE's themselves cannot be changed as they are fed externally. Given that I'm stuck with these RE's which I believe are PCRE, I

Subset w/ Inline::Perl5 RE as constraint

2020-11-05 Thread Paul Procacci
https://github.com/niner/Inline-Perl5 use Inline::Perl5; subset test of Str where EVAL "sub {@_[0] ~= m/\w+/}", :lang; Question: Can you pass whatever {*} into eval for use in Inline::Perl5 a la subset? The above example is incomplete, I understand, however I'm looking to find a method of cons

Re: Metamodel parent and return values ...

2020-10-30 Thread Paul Procacci
Well I feel dumb. I haven't tried it yet, but that makes sense. It's what I get for working on this in the w hours of the morning. Thanks, Paul On Fri, Oct 30, 2020 at 7:48 AM Timo Paulssen wrote: > On 30/10/2020 07:58, Paul Procacci wrote: > > Here is what

Metamodel parent and return values ...

2020-10-30 Thread Paul Procacci
e that question. I know it's not doing what I expect it to do, but is this the right method? ... if it is, returning a class which is a child of another class should satisfy the return value requirements and I would expect this to work. Any pointers in the right direction are much appreciated. Thanks in advance, Paul Procacci -- __ :(){ :|:& };:

Re: lines :$nl-in question

2020-08-28 Thread Paul Procacci
:nl-in is a named parameter that defines what the method lines would consider as line endings. It defines "\x0A", "\r\n" as the default. Example: % echo "Hi, Frank." > test.txt ; echo "What's up?" >> test.txt ; echo '"test.txt".IO.lines(:nl-in).say' > test.pl6 ; perl6 ./test.pl6 (Hi, Fr nk. Wh t

Re: I need help with IO.e

2020-05-17 Thread Paul Procacci
rt there on wikipedia or something. On Mon, May 18, 2020 at 1:03 AM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-05-17 21:48, Paul Procacci wrote: > > You can check this yourself by looking at the QAST nodes after the > > static analyzer has had its

Re: I need help with IO.e

2020-05-17 Thread Paul Procacci
via perl6-users < perl6-users@perl.org> wrote: > On 2020-05-17 21:19, ToddAndMargo via perl6-users wrote: > > On 2020-05-17 20:28, Paul Procacci wrote: > >> So tack a .Bool at the end. > >> You are coercing a bool to a bool by doing so and hopefully the > >>

Re: I need help with IO.e

2020-05-17 Thread Paul Procacci
So tack a .Bool at the end. You are coercing a bool to a bool by doing so and hopefully the optimizer is smart enough for people who like to be redundant. ;) On Sun, May 17, 2020 at 6:10 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-05-17 14:43, ToddAndMargo via perl6-

Re: I need help with the copy command

2020-05-01 Thread Paul Procacci
$createonly fails to do a copy when the destination file already exists. An example of shell commands to emulate this is: # echo a > test1 # echo b > test2 # cp -n test2 test1 # cat test1 a As for recursion...you probably need to write a recursive function somewhere (didn't look that hard). On F

Re: sleep 3600 vs task scheduler

2020-04-07 Thread Paul Procacci
What happens when you try it? What impact do you observe? My guess is the impact is exactly the time it takes for your cpu to perform the initial context switch for the syscall, and then another when waking up. On Tue, Apr 7, 2020 at 10:28 PM ToddAndMargo via perl6-users < perl6-users@perl.org> w

Re: Can a sub be released?

2020-04-07 Thread Paul Procacci
https://docs.perl6.org/language/5to6-perlfunc#fork https://docs.perl6.org/type/Thread I haven't tried myself but it's conceivable that you can start a new thread that exec's some external program. On Tue, Apr 7, 2020 at 7:21 AM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > Hi All

Re: qqx with quotes

2020-02-25 Thread Paul Procacci
to be in quotes as it can have > >> spaces in it. > >> > >> > >> The following did not work: > >> > >> \"$FileName\" > >> "$FileName\ > >> $FileName > >> > >> What am I do

Re: qqx with quotes

2020-02-25 Thread Paul Procacci
The following works on FreeBSD: my $fn = "file name"; say qqx { ls -l "$fn" }; Not sure why this would be any different on Windows. On Mon, Feb 24, 2020 at 4:01 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > Hi All, > > Windows 7 > > In the following > > @Result = qqx { C:/Win

Re: irrational nubmer?

2020-02-20 Thread Paul Procacci
returns True to maybe_irrational ... until it isn't. ;) On Thu, Feb 20, 2020 at 2:21 AM Shlomi Fish wrote: > Hi Paul, > > On Thu, 20 Feb 2020 00:22:34 -0500 > Paul Procacci wrote: > > > If you wouldn't mind, please stop referring things as being "magical". >

Re: irrational nubmer?

2020-02-19 Thread Paul Procacci
a complete trivia question. > >> > >> Is there a test to see if a number is irrational, > >> such as the square root of two? > >> > >> And how does Int handle a irrational number? Is > >> there a limit to magic Larry powder? > >>

Re: irrational nubmer?

2020-02-19 Thread Paul Procacci
>> Is there a test to see if a number is irrational There is no such thing as an irrational number in computing. Surely there are "close approximations", but that's the best any computer language can currently do. On Wed, Feb 19, 2020 at 9:58 PM ToddAndMargo via perl6-users < perl6-users@perl.or

Re: PCRE -> Perl 6 RE

2020-02-18 Thread Paul Procacci
ombined with the previous discussed feature. > > /[\p{L}\p{Z}\p{N}_.:/=+\-@]+/ > /<:L + :Z + :N + [_.:/=+\-@] >+/ > > So that is the translation of your regex. > > --- > > It might be considered a bug that you can't just use :P5, as your regex > works just fine i

PCRE -> Perl 6 RE

2020-02-18 Thread Paul Procacci
Hey Guys, I've got a bunch of source files with PCRE's like the following: [\p{L}\p{Z}\p{N}_.:/=+\-@]+ I have a program that generates other perl6 source files, by way of reading the initial source files. It was my intention to simply pass along this regex to the resulting output file for use in

Re: Substr behaviour with CRLF

2020-02-10 Thread Paul Procacci
Unicode conformance requires "\r\n" to be interpreted as \n alone. With that said; no, I don't not know how to turn this off. I personally think I'd consider this a bug. If not a bug, greater documentation efforts that explain this. The display routines (say / print) don't modify the string on ou

Re: printf question

2020-02-10 Thread Paul Procacci
l, etc) have been moved to > the front of regexes. > > Hope that's interesting > - Timo > On 10/02/2020 07:48, Paul Procacci wrote: > > Named parameters must come after all positional parameters. > Your example subroutine is invalid for this reason, while the following

Re: printf question

2020-02-09 Thread Paul Procacci
t;named_a"), :c("named_c")); On Sun, Feb 9, 2020 at 6:24 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-02-09 14:53, Paul Procacci wrote: > > subchdir(IO() $path, :$d=True, :$r, :$w, :$x-->IO::Path:D) > > Hi Paul, > > What I

Re: printf question

2020-02-09 Thread Paul Procacci
know. I believe given your latest comment and this latest example, that would be enough. If not, I'll happily provide another one. ~Paul On Sun, Feb 9, 2020 at 5:20 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-02-08 15:39, Paul Procacci wrote: > >

Re: printf question

2020-02-08 Thread Paul Procacci
-users@perl.org> wrote: > >> On Thu, Feb 6, 2020 at 11:43 AM ToddAndMargo via perl6-users > >> mailto:perl6-users@perl.org>> wrote: > >> > >> On 2020-02-05 20:12, Paul Procacci wrote: > >> > I wasn't going to follow up but deci

Re: printf question

2020-02-06 Thread Paul Procacci
AM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-02-05 20:12, Paul Procacci wrote: > > I wasn't going to follow up but decided to do so since there is a small > > but subtle bug in my original post. > > I wouldn't want to mislead you Todd.

Re: printf question

2020-02-05 Thread Paul Procacci
I wasn't going to follow up but decided to do so since there is a small but subtle bug in my original post. I wouldn't want to mislead you Todd. The \d has been changed to [0..9] as the expected input would only ever be in that range. (\d includes Unicode Characters) I've also included an alignme

Re: printf question

2020-02-04 Thread Paul Procacci
; wrote: > >> > >> On 2020-02-03 13:51, ToddAndMargo via perl6-users wrote: > >> > p6 'my uint8 $u = 84; printf "\$u = <%08s>\n", $u;' > >> > >> Oops, that should have been > >> > >> $ p6 &#

Re: printf question

2020-02-03 Thread Paul Procacci
Here's one way my uint8 $u = 0x4F; say '$u = <0b' ~ '%08b'.sprintf($u).comb(/\d ** 4/).join('_') ~ '>;'; There's probably others as well. On Mon, Feb 3, 2020 at 8:17 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-02-03 13:51, ToddAndMargo via perl6-users wrote: >

Re: Hash Constraints w/in subset's

2020-02-01 Thread Paul Procacci
Thanks for all the answers. This will get me going. I was unaware of the ' Hash[Int, Str]' type of declarative syntax. I knew Hash[Str] was a thing but was unaware of the '[Int,Str]' type of syntax. Thanks for the insight! On Sat, Feb 1, 2020 at 11:16 AM Elizabeth Mattijsen wrote: > subset

Hash Constraints w/in subset's

2020-02-01 Thread Paul Procacci
Hey ladies/gents, How would one go about defining a subset of a Hash who's key's and values are both constrained by something I've read https://docs.perl6.org/type/Hash and it does make mention of constraining keys and values, but not within the context of a subset. Before I go ripping my ha

Re: endian

2020-01-23 Thread Paul Procacci
endianess is dictate by the cpu. If I store the value 4 into some memory address, the storage of and retrieval thereof is controlled by the cpu. On Thu, Jan 23, 2020 at 11:51 AM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > Hi All, > > This is just a trivia question. > > Does anyo

Re: Ping JJ: string literals

2020-01-18 Thread Paul Procacci
; wrote: > On 2020-01-18 21:20, Paul Procacci wrote: > > Perfect. Obviously didn't know that. My assumption that only the first > > byte gets checked was obviously wrong. > > > > Thanks gents. > > > This is the way I dig out the ascii characters &

Re: Ping JJ: string literals

2020-01-18 Thread Paul Procacci
; perl6-users@perl.org> wrote: > >> On 2020-01-18 20:05, Paul Procacci wrote: >> > >> I also found out the >> > >> hard wasy the UTF16 strings need to be terminated with >> > >> a double nul (0x). >> > >> > Not to d

Re: Ping JJ: string literals

2020-01-18 Thread Paul Procacci
>> I also found out the >> hard wasy the UTF16 strings need to be terminated with >> a double nul (0x). Not to doubt you (I don't do anything in UTF-16), but can you show an example of this? I would have thought a single NULL character is enough. The 1st byte of a Unicode character determines

Re: Ping JJ: string literals

2020-01-18 Thread Paul Procacci
Thank you Tobias. This is what I was trying to get at, but wasn't sure _how_ to reach that conclusion. You've done so elegantly. ~Paul On Sat, Jan 18, 2020 at 7:55 AM Tobias Boege wrote: > On Sat, 18 Jan 2020, JJ Merelo wrote: > > The example works perfectly, and it does because it's a string

Re: problems with xor

2020-01-17 Thread Paul Procacci
Apocalypse 3: "*operators are just funny* looking *function* calls" On Sat, Jan 18, 2020 at 12:31 AM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-01-17 20:49, Kevin Pye wrote: > > In Raku, all operators are just functions with a funny syntax > > I like the way you wrote

Re: problems with xor

2020-01-17 Thread Paul Procacci
multi sub infix:<+^>($a, $b --> Int:D) _infix_ here is the keyword for you. my uint8 $z = $x +^ $y; On Fri, Jan 17, 2020 at 11:03 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > Hi All, > > https://docs.raku.org/routine/+$CIRCUMFLEX_ACCENT > > (Operators) infix +^§ > > multi s

Re: Ping JJ: string literals

2020-01-17 Thread Paul Procacci
< perl6-users@perl.org> wrote: > For anyone following along that is not familiar with > C, a BYTE in C is called a Char in C. (Causes > some interesting conversations when UTF16 gets involved.) > > > On 2020-01-17 17:03, Paul Procacci wrote: > > >> Take

Re: Ping JJ: string literals

2020-01-17 Thread Paul Procacci
#x27;s my bread and butter. Quite frankly, I don't need the copy/pastes from outside sources as I know for sure that everything I've stated here is 100% accurate. >> C can not figure out where the end of the string I don't see a string. I only see a Character Array. On Fri

Re: Ping JJ: string literals

2020-01-17 Thread Paul Procacci
Todd (and others), So a few things. 1) JJ's example worked by chance. (sorry JJ). It worked because it just so happens that either his OS zero filled the block he was allocated by the allocator or because he didn't reuse the block that was given to him initially by the allocator. 2) If you assu

Re: bitwise NOT

2020-01-14 Thread Paul Procacci
se(16);' > >> 5A > >> > >> But this does not: > >> > >> $ p6 'my uint8 $c = 0xA5; say (+^$c).base(16);' > >> -A6 > >> > >> 1) who turned it into an negative integer? > >&g

Re: bitwise NOT

2020-01-13 Thread Paul Procacci
If you read the signature for +^, you'll notice it returns an Int. In your first working example, you're taking a uint8 with binary value 10100101, zero extending it to 64 bits via +^, applying a two's compliment, and then assigning bits [0:7] to another uint8 which at that point contains the bin

Re: Bug to report: cardinal called an integer

2020-01-13 Thread Paul Procacci
ct exactly the same. >> >> > Oh, and they are both (generic programming term) unsigned >> integers >> >> > (cardinals) >> >> > >> >> > :-) >> >> > >> >> > -T >> >> >&g

Re: Bug to report: cardinal called an integer

2020-01-13 Thread Paul Procacci
>> trying to find the constraints explanation in the documentation: https://docs.raku.org/language/nativetypes "Raku offers a set of *native* types with a fixed, and known, representation in memory" and "However, these types do not necessarily have the size that is required by the NativeCall

Cannot invoke this object (REPR: Null; VMNull)

2019-12-14 Thread Paul Procacci
method test at /git-repos/test/lib/Loader.pm6 (Loader) line 115 in method load at /git-repos/lib/Loader.pm6 (Loader) line 132 in block at ./test.pl6 line 7 As stated earlier, when I merge the class and the initialization logic into the same source file and run from there, no error occurs. Am I doing this wrong? Thanks, Paul Procacci -- __ :(){ :|:& };:

Re: Quoting issue in Windows

2019-12-03 Thread Paul Procacci
- # php -r "print '\'';" ' # php -r "print '\\';" \ # php -r "print '\a';" \a Example python3.6 **unique**: --- # python3.6 -c "print('\'')"

Re: rmdir question

2019-12-02 Thread Paul Procacci
It seems to me all your questions are answered by the very documentation you referenced. >> Does *@dirs mean I can give it multiple directories as an array? Remove the invocant in sub form of the provided directories in the given list . Example: - # mkdir {

Re: Dynamic export/import of symbols into global namespace

2019-09-20 Thread Paul Procacci
me result > with simply exporting the subset from the module using selective export > with `is export(:tag)`? > > > > Best regards, > > Vadim Belman > > > > On Sep 20, 2019, at 3:32 PM, Paul Procacci wrote: > > > > As the subject suggests, I'd like

Dynamic export/import of symbols into global namespace

2019-09-20 Thread Paul Procacci
As the subject suggests, I'd like to dynamically export/import symbols from a source file into the global scope of the program. How would one accomplish this? Given the below, it yields an error _which I expect_. How do I dynamically pull in the subset 'What'? File: Testing.pm6 ---

Re: Variable character class

2019-09-02 Thread Paul Procacci
][+//」 > > 「19584203」 > 「abcdef」 > ===SORRY!=== Error while compiling ?/EVAL_7 Malformed regex at > ?/EVAL_7:1 --> anon regex { Apple ][+//e} expecting any of: infix > stopper > > HTH, Bill. > > > On Mon, Sep 2, 2019 at 7:54 AM Paul Procacci wrote: > >

Re: Variable character class

2019-09-02 Thread Paul Procacci
Was talking to folks over on the #perl6 IRC channel. It appears the recommended way is: sub matching_chars(Str $chars_to_match, Str $str) { # warnings, treats as string not variable $str ~~ /<$_>/ given "<[$chars_to_match]>"; } ~Paul On Sat, Aug 31, 2019 at 9:54 PM yary wrote: > I fou

Re: Variable character class

2019-09-01 Thread Paul Procacci
;>> I tried the .unique method. Then after a while, I realized that >>> problems like this might best be treated as "Set" problems in Perl6. >>> Note the Set Intersection operator "(&)" below: >>> >>> sub matching_chars(Str $a, Str $b) { &g

Re: Variable character class

2019-08-31 Thread Paul Procacci
I'm not entirely sure if this is the correct answer, but if you define your own custom character class with a 'regex' object, you can use that in the grouping. sub matching_chars(Str $chars_to_match, Str $_) { my regex x { $chars_to_match ** 1 }; m/<[]>/; } The above worked for me in the

Re: How do I use ~ with Regex syntax?

2019-08-30 Thread Paul Procacci
Drop the '~'. $b ~~ s/ .*? "In the year " $a//; ~Paul On Fri, Aug 30, 2019 at 8:26 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > Hi All, > > Yes, I know to just put the variable inside the quote, but > I'd still like to know how to do it outside the quote; > > > $NewPage ) ~

Re: subnet calculator

2019-01-11 Thread Paul Procacci
http://jodies.de/ipcalc Download link at bottom of page. On Fri, Jan 11, 2019 at 3:08 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > Hi All, > > Anyone know if someone has written a program like this > in Perl that will run locally and not require the Internet? > > http://www.s

Re: Need Golf!

2018-11-08 Thread Paul Procacci
loop would make more sense to me. Even the use of *grep > *(or *first*) would be more natural than *map*. > > But that's probably a matter of personal taste. > > Best, > Laurent. > > > > > > Le jeu. 8 nov. 2018 à 23:46, Paul Procacci a écrit : > >>

Re: Need Golf!

2018-11-08 Thread Paul Procacci
$end_y < .start_y || $start_x > .end_x || $start_y > .end_y || $end_x < .start_x }).so; On Thu, Nov 8, 2018 at 4:27 PM Paul Procacci wrote: > I don't like this: > > > for %!panels<>:k { > die Some::Exception.new.throw >unless $start_y > %

Re: need regex help

2018-08-01 Thread Paul Procacci
\d and both match Unicode characters as well. If that's not the intention then it's best to be explicit. die("Horribly") unless "9.b1" ~~ / <[0-9]+> % '.' /; Typing from my phone so unable to test the above*** On Thu, Aug 2, 2018, 12:56 AM ToddAndMargo wrote: > Hi All, > > If there are any l

  1   2   >