Re: Help converting CArray[uint8] to Blob

2020-06-16 Thread Ralph Mellor
> my Data $ed = await $yenc_promise; The promise must initialize each element of the CArray[uint]. It looks pretty quick; I'm guessing it's low-level code doing that. > my uint8 @data = $ed.data[0..$ed.data_size-1].Array; > my Blob $bindata = Blob[uint8].new(@data); Afaict that's a total of five

Re: Help converting CArray[uint8] to Blob

2020-06-17 Thread Ralph Mellor
> Unfortunately, i get the error "Error > X::AdHoc+{X::Await::Died}+{X::React::Died}: Don't know how many elements a C array returned from a library" I googled the error message and got a bunch of matches including this: https://stackoverflow.com/questions/51081475/getting-data-out-of-native-poi

Re: Help converting CArray[uint8] to Blob

2020-06-18 Thread Ralph Mellor
> from approx 1.1 to 0.0006 secs. That's quite an improvement! :) Be aware of the stop gap nature of the module, and its WARNING: > At some point, these problems will be addressed in core, but in the > meantime... > This module depends on internal details of the REPRs > of the involved types i

Re: interpolating the return from embedded code in a regexp

2020-06-18 Thread Ralph Mellor
cf: https://stackoverflow.com/questions/56393888/why-how-is-an-additional-variable-needed-in-matching-repeated-arbitary-character https://stackoverflow.com/questions/51408141/perl6-grammar-not-sure-about-some-syntax-in-an-example

Re: root cubic

2020-07-09 Thread Ralph Mellor
You have several useful answers. I want to summarize what they saButy, and add a couple resources. * You probably meant 9 ** <1/2>. Which will display 3. But it's a Num. It's not the right type if you care about accuracy. * A solution to get rationals right is built into Raku. See https:/

Re: perl streaming framework

2020-07-14 Thread Ralph Mellor
I second Brad's comment -- perlmonks.org is a great place to ask. Use the following link for a quick start. The user interface is something out of the dark ages but you'll generally get outstandingly good replies, especially if you explicitly add something like "Thank you for considering my questi

Re: Baby steps to create a dataframe structure

2020-07-29 Thread Ralph Mellor
The first half of this email is some StackOverflow links and commentary. The second half is some specific responses to your questions. https://stackoverflow.com/questions/tagged/raku+r https://stackoverflow.com/search?q=%5Braku%5D+%22data+structures%22 https://stackoverflow.com/search?q=%5Br

Re: Avoiding monkey typing for custom roles on built-in types...

2020-08-09 Thread Ralph Mellor
> Would a better approach be to create custom subtypes of the built-in numeric types that mixin the algebraic roles? It could maybe work out better to mix roles into numeric instances: role G { has Numeric $numeric handles *; has ThreeDObject[:Rotation] $threedobject-rotation handles *; met

Re: Re-exporting modules that export operators...

2020-08-15 Thread Ralph Mellor
The SO you quote includes an operator. So that's not the problem. The SO is written by jnthn. It doesn't get more authoritative than that. "Cannot import symbol '%?LANG' from 'Graphics::Shapes', because it already exists in this lexical scope." Your export code is attempting to export `%?LANG`,

Re: Readline package

2020-08-28 Thread Ralph Mellor
> You can alter to whatever (it just needs to be a string... Larry may comment, but in case not, or, if he does, to save him some time and give him something to correct, here's my take on what he specified^H^H^H^H^Hulated. @Larry defined the auth to be a URI. Quoting https://en.wikipedia.org/wi

Re: Extended identifiers in named attributes

2020-08-28 Thread Ralph Mellor
I don't think you're supposed to be able to have extended identifiers as named parameter/argument identifiers. They are meant for a few specific scenarios where there's special value in having adverbs aka pairs embedded in identifiers: * Alternations in grammars. Typically of form `foo:sym`. * Ap

Re: Junctions wrapped in singleton lists

2020-11-16 Thread Ralph Mellor
say $*PERL.version; # v6.d say $*PERL.compiler.version; # v2018.12 say ({ 1 | -1 } ... *)[^3]; # (any(1, -1) any(1, -1) any(1, -1)) say $*PERL.version; # v6.d say $*PERL.compiler.version; # v2020.07 say ({ 1 | -1 } ... *)[^3]; # ((any(1, -1)) (any(1, -1)) (any(1, -1)))

Re: Junctions wrapped in singleton lists

2020-11-17 Thread Ralph Mellor
https://github.com/rakudo/rakudo/issues/4039 On Tue, Nov 17, 2020 at 3:12 AM yary wrote: > > Open a bug report at https://github.com/rakudo/rakudo/issues/ showing the > change in behavior > > -y > > > On Mon, Nov 16, 2020 at 4:39 PM Ralph Mellor wrote: >> >&g

Re: The ,= operator

2020-11-27 Thread Ralph Mellor
@r ,= 'd'; The above expands to: @r = @r , 'd'; That in turn passes a list of two values to the LHS receiver. That receiver is `@r`, an array, and what arrays do with `=` is to empty themselves and then assign the list of elements on the RHS of the `=` into corresponding `Scalar`s stored in eac

Fwd: The ,= operator

2020-11-27 Thread Ralph Mellor
I accidentally sent this privately. -- Forwarded message - From: Ralph Mellor Date: Fri, Nov 27, 2020 at 6:06 PM Subject: Re: The ,= operator To: William Michels > I can reproduce your results on Rakudo_2020.10, but I'm afraid I don't > have much more

Re: The ,= operator

2020-11-28 Thread Ralph Mellor
> > @r = @r , 'd'; > > Okay, that makes sense. So the circular reference I thought I > was seeing is really there, and it's working as designed. > > There isn't anything very useful in this behavior though, is there? Yes. Here are some relevant results from a search for "self referential" in the

Re: The ,= operator

2020-11-29 Thread Ralph Mellor
> Zen slicing as a possible way of 'de-containerizing' : > https://docs.raku.org/language/subscripts#index-entry-Zen_slices A zen-slice only affects the single reference it's applied to. And it is a no op when applied to anything other than a `Scalar`. So it'll have no effect when applied direct

Re: The ,= operator

2020-11-29 Thread Ralph Mellor
> Ralph Mellor wrote: > >> > @r = @r , 'd'; > >> > >> There isn't anything very useful in this behavior though, is there? > > Just to be clear, I wasn't saying I didn't think circular references > should be forbidden, I just spe

Re: Missing NullPointerException

2020-12-02 Thread Ralph Mellor
On Wed, Dec 2, 2020 at 7:08 AM Patrick R. Michaud wrote: > Nil.any_non_existent method always seems to return Nil. I'm not sure where > this is documented It's near the top of the `Nil` doc page you linked: > Any method call on `Nil` of a method that does not exist ... will succeed and > retu

Re: Missing NullPointerException

2020-12-05 Thread Ralph Mellor
On Thu, Dec 3, 2020 at 10:20 PM Konrad Bucheli via perl6-users wrote: > > What is actually the rationale for such a behaviour? Ergonomically sound null safety. First, consider what other languages have. Quoting https://en.wikipedia.org/wiki/Safe_navigation_operator: > In object-oriented program

Re: The ,= operator

2020-12-07 Thread Ralph Mellor
> > @fib[1, 5, 10..15, 20] > (1 8 (89 144 233 377 610 987) 10946) > ^ > > Why??? As Joe noted in his last email: > remember, back in perl-land the default behavior is to flatten, > in raku ... by default [raku is] oriented toward building up > complex structures like

Re: Missing NullPointerException

2020-12-17 Thread Ralph Mellor
On Wed, Dec 16, 2020 at 5:10 AM Konrad Bucheli ... wrote: > there is surely a way to make sure that my Nil > explodes in my code. Is there a `use FailingNil`? I'd +1 a `use fatal :Nil;`. In the meantime, this appears to work: ``` engine.?Raptor::start ``` Might be a bug because an *unqua

Re: Is the cosine page wrong?

2020-12-23 Thread Ralph Mellor
If a method does not explicitly specify its invocant type, it is set to the type of the enclosing class. The `cos` method is declared in the `Cool` class, so that is its invocant type. The doc shows that it's declared in the `Cool` class. So, the doc is fine as is for the invocant. The returned

Re: I need help understanding ".contains" method construction

2020-12-23 Thread Ralph Mellor
>1) why is it "$needle" and not "$!needle" on line 338? >Is this because it is an internal variable and not >a variable from the class declaration? It's a parameter from line 337. If that's what you mean by "an internal variable", then yes. :) >2) where is variable ".value" defined on lin

Re: Is the cosine page wrong?

2020-12-25 Thread Ralph Mellor
> On 12/23/20 4:28 PM, Ralph Mellor wrote: > > If a method does not explicitly specify its invocant type, it is set > > to the type of the enclosing class. > > But it does not specify an invocant. It just leaves it blank This is how it works in Raku source code. If there&

Re: Practical Raku projects

2020-12-25 Thread Ralph Mellor
Have you tried: ``` use DBIx::Class:from; ``` ? On Thu, Dec 24, 2020 at 11:24 AM Matthias Peng wrote: > > Do you know if there is any for Perl6’s DBIx::Class the ORM library? Regards > >> >> Hi, >> >> El jue, 24 dic 2020 a las 3:55, Matthias Peng () >> escribió: >>> >>> May I ask if there is any

Re: I need help understanding ".contains" method construction

2020-12-26 Thread Ralph Mellor
> >> What kind of variable is .value? > > > > I don't see a `.value`, only a `$!value`. > > Is this .self with a better name? No. I know you've been progressing in your understanding of OO in general, and Raku's in particular, since you wrote this email. So I won't explain it for now, but rat

Re: LTA documentation page

2021-01-05 Thread Ralph Mellor
I googled rakudoc and that led to: https://github.com/Raku/rakudoc which says it's forked from: https://github.com/noisegul/perl6-p6doc So I tried that in m.r.o and it's listed: https://modules.raku.org/search/?q=p6doc So, perhaps you can zef install p6doc? Maybe the doc you read mentioning

Re: surprise with start

2021-01-05 Thread Ralph Mellor
Sounds to me like it's time to raise a doc issue. Also, does anyone know if doc examples are tested? Not just when first published, but as part of blinning? On Tue, Jan 5, 2021 at 1:30 PM Theo van den Heuvel wrote: > > Hi gurus, > > The first example in the documentation on the start control

Re: list assignment

2021-01-19 Thread Ralph Mellor
Food for thought... Python: one = 1,2,3 two = 4,5,6 both = one,two first = both[0] print(one) # (1, 2, 3) print(first) # (1, 2, 3) Python's `=` operator is like Raku's `:=`. my @one := 1,2,3; my @two := 4,5,6; my @both := @one,@two; my @first := @both[0]; say @one.raku; # (1, 2, 3) say

Re: My OOP keeper

2021-02-14 Thread Ralph Mellor
This email is a reaction to this paragraph: > Object Oriented Programming (OOP) is an elegant system > of declaring data structures (classes) .. I view that as misleading to: * Yourself (if you think it's true as written, rather than a dubious lie-to-children); * Other readers (who might think

Re: My OOP keeper

2021-02-14 Thread Ralph Mellor
> > Raku's OOP was designed to support proto-type programming > > and method delegation straight out-of-the-box. > > Can you give us a pointer to some code examples on how to use > Raku for prototype-style OOP? I can think of ways to do it, but I > don't know that I see any advantage in it. Depen

Re: My OOP keeper

2021-02-15 Thread Ralph Mellor
On Mon, Feb 15, 2021 at 2:32 AM ToddAndMargo via perl6-users wrote: > On 2/14/21 9:10 AM, Ralph Mellor wrote: > > I elaborate on each of those three points later. > > AWESOME! I look forward to it. By "later" I meant a few lines later, in the same email. If you took th

Re: My OOP keeper

2021-02-15 Thread Ralph Mellor
> Hope spring eternal. Indeed. First, let's get prototype-based OOP off the agenda. Both you and Joseph appear to have focused on that one small part of what I wrote. I think that focus isn't helpful. So I'm not going to discuss prototype-based OOP further. The only other thing I'll do in

Re: My OOP keeper

2021-02-16 Thread Ralph Mellor
or try to figure out and share with me what is confusing you; or find some other way for us to continue in a way that would be useful to you. Thanks. -- love, ralph On Tue, Feb 16, 2021 at 4:12 AM ToddAndMargo via perl6-users wrote: > > On 2/15/21 6:00 PM, Ralph Mellor wrote: >

Re: Find Packages with prefix ...

2021-03-07 Thread Ralph Mellor
Afaik, existing mechanisms (`use`, `zef`, `-I`) support the following: > Within this namespace, I would ideally designate > SuperDuperProgram::Modules to be the namespace > that modules would live under. > These modules would have their own git repos and > depend on SuperDuperProgram being instal

Re: "rule" declarator: Different results for 'unadorned' match vs unnamed/named captures? (in re Grammars...).

2021-03-12 Thread Ralph Mellor
On Thu, Mar 11, 2021 at 8:53 PM William Michels wrote: > > I think there's something going on with the examples below, as I'm > seeing different results when comparing a basic "rule" match vs either > unnamed or named "rule" captures. All your examples are correct according to my current understa

Re: Objects, TWEAK and return

2021-03-13 Thread Ralph Mellor
Here's a golf: class { submethod TWEAK { Any.map: {say 99} } }.new; # class { submethod TWEAK { Any.map: {say 99}; 42 } }.new; # 99 class { submethod TWEAK (--> 42) { Any.map: {say 99} } }.new; # 99 The last line in a `BUILD` or `TWEAK` submethod is not eagerly evaluated

Re: Objects, TWEAK and return

2021-03-14 Thread Ralph Mellor
On Sun, Mar 14, 2021 at 2:12 AM Brad Gilbert wrote: > > Ralph, the last value in all functions are not sunk by default, > so of course the last one in `TWEAK` is not sunk by default. Right. Thanks for correcting this misleading part of my explanation. > The bug is that the calling code is not si

Re: Working with a regex using positional captures stored in a variable

2021-03-17 Thread Ralph Mellor
Works for me in Rakudo 2020.12. On Wed, Mar 17, 2021 at 9:33 PM yary wrote: > > The "Interpolation" section of the raku docs use strings as the elements of > building up a larger regex from smaller pieces, but the example that looks > fruitful isn't working in my raku. This is taken from > htt

Re: Working with a regex using positional captures stored in a variable

2021-03-17 Thread Ralph Mellor
Er, by wfm I mean it matches 「Is」 as the code suggests. On Wed, Mar 17, 2021 at 10:32 PM Ralph Mellor wrote: > > Works for me in Rakudo 2020.12. > > On Wed, Mar 17, 2021 at 9:33 PM yary wrote: > > > > The "Interpolation" section of the raku docs use strings as

Re: Working with a regex using positional captures stored in a variable

2021-03-17 Thread Ralph Mellor
And when I cut/paste from the doc, the number example works too, in both script and repl. On Wed, Mar 17, 2021 at 10:33 PM Ralph Mellor wrote: > > Er, by wfm I mean it matches 「Is」 as the code suggests. > > On Wed, Mar 17, 2021 at 10:32 PM Ralph Mellor wrote: > > > >

Re: Working with a regex using positional captures stored in a variable

2021-03-17 Thread Ralph Mellor
> 1. The list you posted is fantastic ("If the first character inside is > anything other > than an alpha it doesn't capture"). It should be added to the Raku Docs ASAP. Not the list, right? Just the rule. (There are dozens of kinds of assertions. No one is going to remember the list.) If you wer

Re: Working with a regex using positional captures stored in a variable

2021-03-18 Thread Ralph Mellor
On Thu, Mar 18, 2021 at 12:59 AM yary wrote: > > As it is I get same kinds of errors in the REPL, perhaps it is MacOS > with Linenoise that's mucking that up. I can confirm your new test code also works fine in both program and repl forms in 2020.12. Though obviously the case you mark as "intere

Re: Working with a regex using positional captures stored in a variable

2021-03-19 Thread Ralph Mellor
On Fri, Mar 19, 2021 at 6:12 PM yary wrote: > > I don't know how to get the result. > DB<1> $word = qr/(\w+)/; > DB<2> $AwithB = qr/$word with $word/ > DB<3> $_ = 'Interpolating regexes with arbitrary captures is fun!' > DB<4> x /$AwithB.*is $word/ A Raku equivalent: my $word = '(\w+)'; my $Awi

Re: Working with a regex using positional captures stored in a variable

2021-03-20 Thread Ralph Mellor
On Wed, Mar 17, 2021 at 7:17 PM William Michels via perl6-users wrote: > > ("If the first character inside is anything other than an alpha it doesn't > capture"). > It should be added to the Raku Docs ASAP. Fyi, here's how Larry Wall expressed it 15-18 years ago: > A leading alphabetic characte

Re: Objects, TWEAK and return

2021-03-21 Thread Ralph Mellor
On Sun, Mar 21, 2021 at 9:47 PM wrote: > > Waw! :) Following your examples and suggestions, these work: > > > class { submethod TWEAK(-->Nil) { Any.map: {say 99} } }.new; > > class { submethod TWEAK { sink Any.map: {say 99} } }.new; > > class { submethod TWEAK { eager Any.map: {say 99} } }.new;

Re: Working with a regex using positional captures stored in a variable

2021-03-22 Thread Ralph Mellor
On Mon, Mar 22, 2021 at 2:50 PM yary wrote: > > how to get all nested captures worked for me ... not sure I agree with the > design I think the current flattening aspect is awkward in a couple ways: * Having to specify ``. I half like Brad's suggestion. * Having to write `.pairs` to extract th

Re: Objects, TWEAK and return

2021-03-22 Thread Ralph Mellor
On Mon, Mar 22, 2021 at 2:12 PM yary wrote: > > It's not good practice to use "map" for side effects only, discarding > the returned value–which happens here I agree. > Would [using `for`] also work-around the lack of sink context in TWEAK? Yes. > I think it is a cause of the unexpected behavi

Re: Accurate conversion of Num to Rat (and comparing Num and Rat)

2021-04-06 Thread Ralph Mellor
On Tue, Apr 6, 2021 at 11:54 AM sisyphus wrote: > 1/10 == 1e1 # True Aiui this is correct (and to me intuitive) behaviour described here: https://docs.raku.org/language/numerics#Numeric_infectiousness So if there's a `Num` (float) in a numeric operation (like `==`) then any other number t

Re: Accurate conversion of Num to Rat (and comparing Num and Rat)

2021-04-06 Thread Ralph Mellor
> 1/10 == 1e1 # True > > Aiui this is correct (and to me intuitive) behaviour described here: Except A) that's not what the doc says, and B) how does one compare numbers *without* infection, if that's what's going on? So it probably makes sense to ignore at least that part of my previous email. M

Re: Accurate conversion of Num to Rat (and comparing Num and Rat)

2021-04-07 Thread Ralph Mellor
On Wed, Apr 7, 2021 at 3:29 PM Simon Proctor wrote: > > Would =~= be what you're looking for? To quote Wikipedia, "A floating-point number is a rational number". Rob wants to compare a float with its exact equivalent rational and get True if they're exactly the same and False otherwise. -- raip

Re: Accurate conversion of Num to Rat (and comparing Num and Rat)

2021-04-07 Thread Ralph Mellor
On Wed, Apr 7, 2021 at 2:12 PM sisyphus wrote: > > I think the important flaw is raku's incapacity to convert a Num > to its exact Rat/FatRat expression. My 2c is that I agree that that needs to be addressed. I currently see that as something to first address via sprintf. Do you agree? I get th

Re: Accurate conversion of Num to Rat (and comparing Num and Rat)

2021-04-08 Thread Ralph Mellor
On Thu, Apr 8, 2021 at 3:25 AM Ralph Mellor wrote: > > On Wed, Apr 7, 2021 at 2:12 PM sisyphus wrote: > > > I also stick to my view that the latter should be the default > > behaviour, as is the case with python3 > ... > I can't imagine making an exception for co

Re: Accurate conversion of Num to Rat (and comparing Num and Rat)

2021-04-08 Thread Ralph Mellor
On Thu, Apr 8, 2021 at 3:25 AM Ralph Mellor wrote: > > On Wed, Apr 7, 2021 at 2:12 PM sisyphus wrote: > > > 2) Update Issue 5013 to better reflect the current state of > > the bugginess of "%.*g" formatting. > > Yeah. I'm focusing on 5519 ("sprint

Re: Accurate conversion of Num to Rat (and comparing Num and Rat)

2021-04-08 Thread Ralph Mellor
Another thing I've bumped into in my travels: > From: Zefram > Sent: Thursday, February 18, 2016 4:08 AM > To: perl5-port...@perl.org > Subject: Re: [perl #127182] One digit short to correctly stringify a double >> To have different NVs stringify identically is surprising; to have the >> closest

Re: Accurate conversion of Num to Rat (and comparing Num and Rat)

2021-04-08 Thread Ralph Mellor
One last final piece I want to add in while we prepare to document what is worth documenting in issues is what I was trying to get at in this comment: https://www.reddit.com/r/perl/comments/93dabg/perl_6_small_stuff_4_why_perl_isnt_cobol_nor/e3etgvf/ Reviewing it I think I got a couple things wro

Re: Comparing Int and Num

2021-04-15 Thread Ralph Mellor
On Wed, Apr 14, 2021 at 3:10 AM sisyphus wrote: > > Is this a bug that I ought to report ? I'm not yet convinced the issues you showed are classifiable as bugs. Part of my reasoning for my conservatism is per the guidance Larry provided in the design docs. In particular, per design doc S02: > n

Re: slurpy hash signatures

2021-04-18 Thread Ralph Mellor
On Sun, Apr 18, 2021 at 8:00 PM Joseph Brenner wrote: > > Before I get started here, a small point about defining hashes. > There are various ways that work: > >my %h1 = ( 'ha' => 1, 'ho' => 2, 'hum' => 3 ); >my %h2 = ( ha => 1, ho => 2, hum => 3 ); >my %h3 = ha => 1, ho => 2, h

Re: slurpy hash signatures

2021-04-19 Thread Ralph Mellor
On Mon, Apr 19, 2021 at 4:03 PM Andy Bach wrote: > > Very impressive and complete explanation, thanks! Thanks for that feedback, it's very helpful. I enjoy trying to help, but it's hard to ensure I've conveyed a tone of respect for whoever I'm replying to, at the same time as trying to keep thing

Re: slurpy hash signatures

2021-04-19 Thread Ralph Mellor
Btw, I had misunderstood ERN when, in 2018, I wrote the email message I linked in the Note section of my previous email. ERN is an intuitive sense that some movement you are initiating is in some way a mistake. For example, quoting keys of a pair. It's often unconscious, and, aiui, ignoring it ent

Re: gather take eager syntax

2021-04-20 Thread Ralph Mellor
You've gotten a pile of great answers. :) I'll add another to the pile, but omit explanation. say % = ["foo" => "bar"], "baz" => 42; # {foo bar => baz => 42} say % = ["foo" => "bar"]; # {foo => bar} say % = ["foo" => "bar"],; # Odd number ... Only saw: $[:foo("bar")

Re: slurpy hash signatures

2021-04-23 Thread Ralph Mellor
On Wed, Apr 21, 2021 at 2:17 AM Joseph Brenner wrote: > Ralph Mellor wrote: > > [ list of idioms ] > > > Learn to use the right idioms as soon as possible. > > Okay. Where's the list of preferred idioms? The list you presented. If you had or have chosen %h3 as

Re: Comparing Int and Num

2021-04-24 Thread Ralph Mellor
On Fri, Apr 16, 2021 at 7:22 AM sisyphus wrote: >> > The conversion from int to num looks sane. Sounds good. :) So presumably our early tentative conclusion of what we hope will pan out is that if one wants precise IEEE float behaviour, one uses `num` instead of `Num`. Right? > However, the se

Re: File::Find using a junction with exclude

2021-05-21 Thread Ralph Mellor
Your results are what I would expect. The hand crafted regex puts the exclusion logic in the *single* regex that's applied by the *single* call to the `find` function. The `any` value results in calling the `find` function *twice*, with 'mothera' excluded one time, and 'camel' excluded the second

Re: File::Find using a junction with exclude

2021-05-21 Thread Ralph Mellor
On Fri, May 21, 2021 at 9:39 PM Joseph Brenner wrote: > > Thanks, yes the actual result is certainly consistent with the > junction applied at the top level, and not internally, which is > what I was expecting. A junction passed as an argument is immediately expanded unless a function is specific

Re: File::Find using a junction with exclude

2021-05-23 Thread Ralph Mellor
On Sun, May 23, 2021 at 3:22 AM Joseph Brenner wrote: > > > That is a large part of the beauty of the junction design. All functions > > (and thus all operators) automatically get a very useful and powerful > > junctional behavior for free. They don't even know junctions exist. > > I can see the p

Re: File::Find using a junction with exclude

2021-05-23 Thread Ralph Mellor
On Sun, May 23, 2021 at 9:12 PM Joseph Brenner wrote: > > my impression was that junctions, by design aren't supposed to be > treated as compound data structures, they're a *single* thing but > with multiple values that co-exist with each other in "superposition". That's correct. Until they're e

Re: File::Find using a junction with exclude

2021-05-23 Thread Ralph Mellor
On Sun, May 23, 2021 at 9:15 PM Joseph Brenner wrote: > > Junctions continue to surprise me: That must be either that your mental model doesn't match the default design, or you're being tripped up by DWIMs, or WATs that can't be removed due to the overall DWIM of junctions (which usually work gre

Re: In regexes with :P5 compatibility turned-on, do embedded modifiers work?

2021-05-23 Thread Ralph Mellor
> It's looking to me like perl5's embedded pattern modifiers don't work > when used with raku's :P5 compatibility modifier... The `:P5` modifier only supports a small subset of P5 regexes. I don't think there's any champion who wishes to push it further. (There's been talk of deprecating it thou

Re: File::Find using a junction with exclude

2021-06-01 Thread Ralph Mellor
On Fri, May 21, 2021 at 4:36 PM Ralph Mellor wrote: > > * Things multiply. If *two* function arguments are junctions, and > each junction has, say, three elements, the function is set to be > called *six* times. That should have been *nine* times. > * The combinatio

Re: What's going on with "given (junction) {when (value)...}"

2021-06-01 Thread Ralph Mellor
On Tue, Jun 1, 2021 at 4:02 AM Larry Wall wrote: > > In my opinion, the most consistent approach is to disallow any > autothreading of the argument to .ACCEPTS That sounds like a really appropriate simplification as I write this. > All those other smartmatches are sugar for .ACCEPTS, and > shoul

Re: What's going on with "given (junction) {when (value)...}"

2021-06-01 Thread Ralph Mellor
Curiously, it works for postfix `when`: ``` $_ := any(4,3); {say 'postfix when'} when 3; # 3 when 3 { say 'prefix when' } # (no output) ``` -- love, raiph

Re: What's going on with "given (junction) {when (value)...}"

2021-06-04 Thread Ralph Mellor
On Wed, Jun 2, 2021 at 11:57 AM William Michels wrote: > > Hi Ralph, Both prefix/postfix 'when' look okay on my Rakudo_2020.10 install: Only postfix in 2021.03: https://replit.com/@RalphMellor/FooACCEPT-junction#main.raku

Re: intermixed types and resulting types

2021-08-30 Thread Ralph Mellor
On Sun, Aug 22, 2021 at 4:59 PM yary wrote: > > "How would you know what types are compatible for a particular operation?" > > inspecting a routine's arguments. Bingo. > The first couple candidates raise questions for me > > multi($x = 0) - how is there a single-arg candidate for an infix operat

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

2021-10-24 Thread Ralph Mellor
> Wish I had a Q[;;;] expression inside a regex You can put any Raku code that produces a string into a regex by using the syntax `$(code)`. So this displays `True`: ``` say so Q[ / ;;; ^&%%$$ ] ~~ / $( Q[ / ;;; ^&%%$$ ] ) / ``` as does: ``` my $string = Q[ / ;;; ^&%%$$ ]; say so $string ~~ /

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

2021-10-25 Thread Ralph Mellor
> > You can put any Raku code that produces a string > > into a regex by using the syntax `$(code)`. > > > > my $x ~~ s/ Q[;";] //; > ===SORRY!=== > Unrecognized regex metacharacter ; (must be quoted to match literally) You didn't use the syntax I showed. You need to put your code (in your case

Re: ftp client yet?

2021-10-25 Thread Ralph Mellor
On Fri, Oct 22, 2021 at 8:45 AM ToddAndMargo via perl6-users wrote: > > >> On 10/21/21 22:03, Kevin Pye wrote: > >>> > >>> Why not just use the Perl Net::FTP? > >> > >> I use that in Perl 5. > >> I am trying to divorce myself of Perl 5. Please consider not divorcing yourself from Perl stuff you k

Re: ftp client yet?

2021-10-25 Thread Ralph Mellor
> This is what the more complicated stuff I am doing. You can also use *your* Perl code in your Raku code. Just turn your Perl code into a module, making sure to make "public" whatever the module should make public, then `use` it in your Raku code. You should be aiming to end up being able to wr

Re: ftp client yet?

2021-10-27 Thread Ralph Mellor
> On 10/25/21 22:21, Ralph Mellor wrote: > > > > You should be aiming to end up being able to write > > something like the following three line Raku program: > > > > use lib:from 'dir-where-your-new-module-is'; > > use your-new-module:from; > &

Re: ftp client yet?

2021-10-28 Thread Ralph Mellor
On Thu, Oct 28, 2021 at 7:40 PM ToddAndMargo via perl6-users wrote: > > You would not happen to know how I could directly > write to FTP myself with Raku? Yes. 1. Install a library that implements FTP. 2. Use it. > The RFC for FTP is pretty easy to follow. It's *much* easier to write a `use`

Re: ftp client yet?

2021-10-29 Thread Ralph Mellor
On Fri, Oct 29, 2021 at 7:11 AM ToddAndMargo via perl6-users wrote: > > Which gets back to my original question, which was > is there good FTP support from Raku yet? The answer you got from me was: 1. Install Perl's Net::FTP. 2. Write `use Net::FTP:from;` in your Raku program. In other words, j

Re: ftp client yet?

2021-10-30 Thread Ralph Mellor
On Sat, Oct 30, 2021 at 5:03 AM ToddAndMargo via perl6-users wrote: > > I was trying to get the whole thing in Raku. Why are you rejecting the "whole Raku" solutions that have been suggested to you in this thread? Your original questions were: * ftp client yet? * Do we have a working ftp modul

Re: ftp client yet?

2021-10-30 Thread Ralph Mellor
Damn but I'm a sucker for punishment. :) On Sun, Oct 31, 2021 at 12:14 AM ToddAndMargo via perl6-users wrote: > > I think you misunderstand. Fwiw I think you misunderstand. If the penny doesn't begin to drop with this email I think my head will explode. Or maybe my tail. > The code I want to c

Re: A nice touch

2021-10-30 Thread Ralph Mellor
On Sat, Oct 30, 2021 at 8:38 PM Sean McAfee wrote: > > It worked! But I couldn't quite see how. > > Anyway, pretty cool! I agree it's cool, at least in a golfing sense. But is your explanation right? The *range* operator (`..`), if the rhs is less than the left, yields an empty list rather tha

Re: A nice touch

2021-10-31 Thread Ralph Mellor
On Sun, Oct 31, 2021 at 6:10 PM Sean McAfee wrote: > > the main point of my message was about the R metaoperator and the > associativity of the operator it creates. OK. Fwiw this was something I didn't know, or had forgotten, and I find it delightful. The main point of *my* comment was that I d

Re: A nice touch

2021-10-31 Thread Ralph Mellor
On Mon, Nov 1, 2021 at 2:38 AM Ralph Mellor wrote: > > `R` reverses associativity, which is *another* way that `R` is a > nicely designed metaoperator, though this latter aspect is not > relevant to why it worked for the solution you came up with? Ah no. Of course it has to do the re

Re: junctions with given/when

2021-11-04 Thread Ralph Mellor
Aiui, we discussed this issue in May and Larry explained that this would happen. Larry doesn't speak up much, and I realized a few months later that it seemed no one had done anything about what he had said. So I filed an issue: https://github.com/Raku/problem-solving/issues/297 Aiui, until we l

Re: junctions with given/when

2021-11-04 Thread Ralph Mellor
On Thu, Nov 4, 2021 at 6:34 PM Ralph Mellor wrote: > > Aiui, until we listen to Larry, accept he's right, and fix Rakudo, > the results when the topic of a smart match is a Junction will > randomly depend on which version of Rakudo you're using. Further, aiui, when we do, t

Re: junctions with given/when

2021-11-06 Thread Ralph Mellor
On Thu, Nov 4, 2021 at 7:27 PM Joseph Brenner wrote: > > Yes, thanks, I'd managed to forget that we had a go-round OK. Cool. I wasn't sure if it was the same issue (hence my aiui qualification). It's helpful to hear confirmation you consider this to be the same issue. Btw, I'd say it was not onl

Re: can't make from a S/// ?

2021-11-18 Thread Ralph Mellor
On Fri, Nov 19, 2021 at 1:19 AM Marc Chantreux wrote: > > method col:sym ($/) { make S:g/'""'/'"'/ with ~$/ } > > Cannot assign to a readonly variable or a value > > why isn't it working? 1. Even though `S` politely leaves "the current topic" (`$_`) alone, it still generates a match objec

Re: can't make from a S/// ?

2021-11-21 Thread Ralph Mellor
On Fri, Nov 19, 2021 at 8:32 AM Marc Chantreux wrote: > > [switch `($/)` signature to `($_)` and `make` to `.make:`] > > i dug around it but missed it! arggh ... I've been digging around online doc etc and spotted that this is covered on the Traps page of the official doc: https://docs.raku.org/

Re: why not raku ?

2021-11-21 Thread Ralph Mellor
My 2c: On Fri, Nov 19, 2021 at 9:45 AM Marc Chantreux wrote: > > > I like ruby and perl > > so do I but raku is by far my prefered interpreted langage now. Nit. It's compiled, in the same way Java or C# is compiled. Consider: ``` say 42; constant foo = die; ``` If it were interpreted, the `42`

Re: why not raku ?

2021-11-22 Thread Ralph Mellor
On Mon, Nov 22, 2021 at 3:33 AM Clifton Wood wrote: > > It has two compelling use cases, and it's the ones that > brought me to Raku in the first place: It has compelling use cases for me too, and I agree that grammars and nativecall are both contenders. :) But, fwiw, I didn't say just "compelli

Re: Subscripting, semicolons, and adverbs

2021-12-11 Thread Ralph Mellor
TL;DR Raku does not treat a negative index as valid. To specify the index of the last element, write `*-1`. What you're seeing is Raku trying to inform you that you are using invalid indices. On Fri, Dec 10, 2021 at 9:49 PM Sean McAfee wrote: > > @array[-1]:exists is a syntax error, even though

Re: Grammar Help

2021-12-26 Thread Ralph Mellor
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. ;) I love me some corn but it's especially appropriate to share some in winter if you've got hungry mice. :) As others have noted, you need `%%` instead

Re: Greeting Larry Wall: I will learn to love you new language.

2021-12-26 Thread Ralph Mellor
On Sat, Dec 25, 2021 at 4:31 PM Maneesh Sud via perl6-users wrote: > > Merry Christmas and a Happy New Year. Hi. Happy holidays to you too. > Does perl6 or moarvm run on risc-v 32-bit processors. I think a key piece is dyncall/libffi support. Googling suggests dyncall doesn't support risc-v but

Re: is 'use v6' still a thing?

2021-12-28 Thread Ralph Mellor
On Tue, Dec 28, 2021 at 5:00 PM Marc Chantreux wrote: > > long time ago, there was this 'use v6' line ... Does it still make sense? I think it depends. Let's first ignore Perl. Also, let's first assume your code is not visible online. Imo *not* including a language version statemen

Re: Grammar Help

2021-12-29 Thread Ralph Mellor
On Wed, Dec 29, 2021 at 5:10 PM Paul Procacci wrote: > > Ralph, > > So Ijust tried comma w/ grammar live view ... and I must say, > I'm blown away. \o/ > This really should be in the docs (it may be, but I didn't go looking for it). I just looked using googles such as: https://www.google.com/s

Re: about binary protocol porting

2021-12-29 Thread Ralph Mellor
On Wed, Dec 29, 2021 at 1:32 AM Jon Smart wrote: > > I plan to port a binary protocol client to perl6/raku. > I have zero experience on this. Where should I get started? How well do you know programming, and Raku, and is the protocol a standard one you can link to with several existing implementa

  1   2   >