Re: need native call help

2024-04-18 Thread yary
I did a lot of very deep windows programming in my previous job and reminding me that I would always use the 8.3 short name for file operations! dir /x will get it for you. Must be API called for it also. Probably only works on local volumes not network rounded ones. Just a guess. I've run into

Re: need native call help

2024-04-17 Thread yary
>From unlink's documentation: If the file to be deleted does not exist, the routine treats it as success. So trying to delete a file that isn't there, doesn't have an error, which is kind of neat, but that is a difference from native delete. -y On Wed, Apr 17, 2024 at 8:50 AM yary wr

Re: need native call help

2024-04-17 Thread yary
What does the windows native delete do which you need, that raku's unlink doesn't have? without unlink $FileName { say "Could not delete $FileName:", .exception.message }; -y On Wed, Apr 17, 2024 at 2:29 AM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > On 4/16/24 23:25,

Re: I need sorting help

2024-03-09 Thread yary
Using my quick-intuition, are these methods sorting on the earliest number withing the string, ignoring the non-digits? $ raku -e '.say for .sort: {m/ \d+ /.Int}' $ raku -e '.say for .sort: +*.match: / \d+ /' let's see $ raku -e '.say for .sort: {m/ \d+ /.Int}' it1 does2 not3 matter10 what20

Re: A question on AND

2023-06-30 Thread yary
es: > > unlink "alpha", "beta", "gamma" > or gripe(), next LINE; > > With the C-style operators that would have been written like this: > > unlink("alpha", "beta", "gamma") >

Re: A question on AND

2023-06-30 Thread yary
Most of Richard's parting suggestions I understand & agree with, but not this: " why are you using '&&' and not 'and' " My habit (from Perl 5 days) is to use && || for expressions, and reserve "and" "or" for "do this if assignment/function call without parens succeeds/fails" – is there a

Re: Help with %?RESOURCES variable

2023-04-19 Thread yary
https://docs.raku.org/language/variables says > %?RESOURCES is a compile-time variable available to the code of a > Distribution . > > It contains a hash that provides compile and runtime access to files > associated with the Distribution of the

Re: New doc site

2023-02-27 Thread yary
Really liking the look of the site and responsiveness of the search bar- first impression  -y On Mon, Feb 27, 2023 at 10:54 AM Will Coleda wrote: > Embarrassing! > > Thanks for catching that, thankful she got it right in the weekly! > > > On Mon, Feb 27, 2023 at 8:51 AM Marcel Timmerman

Re: $/ not always set after a regex match?

2023-01-02 Thread yary
I like statement modifiers, though not so much using side-effect variables set by a postfix modifier, I'd like to see the side effect before seeing the variable it sets. Something like / .+ / && put "The root of $_ is $/."; though the discussion is about not setting $/ in the caller's context

Re: What is this handle?

2022-11-21 Thread yary
Handle is a pointer and you can treat it as such. A handle is a pointer to another pointer! it has different uses but basically it is a pointer. Most pointers are a memory address of a value like a number or string, a handle is a memory address of a pointer (another address) to one of those. On

Re: Aw: Rakudo for W7?

2022-10-23 Thread yary
I interpreted the previous email as, here is the last date that we know Windows 7 was supported. And here is an archive that goes way back in time. find the listing in the archive that is close to that date where Windows 7 support ended. That seems like a fair method. On Sat, Oct 22, 2022 at 8:18

Re: author specification

2022-05-06 Thread yary
But I'm understanding from this conversation is that people have different ideas of what the auth field means. 1. It shows who is responsible for this code. It is independent of which home the author chooses, where home is GitHub, gitlab, cpan, zef,p6c etc. 2. It shows who is responsible for this

Re: checking MAIN arguments

2022-04-27 Thread yary
. Haven't looked at the source, I'm guessing. -y On Sat, Apr 16, 2022 at 11:49 AM Luca Ferrari wrote: > On Fri, Apr 15, 2022 at 4:15 PM yary wrote: > > > > Here's how I ended up handling input arg validation, with meaningful > error messages, as part of a Perl Weekly Challen

Re: checking MAIN arguments

2022-04-15 Thread yary
Here's how I ended up handling input arg validation, with meaningful error messages, as part of a Perl Weekly Challenge a couple years ago. It looks almost the same as Luca's original, except mine uses "die" instead of "warn", which means it won't attempt to continue once it encounters a bad arg.

Re: Help with promises, supplies and channels.

2022-04-06 Thread yary
For what it's worth, I'm on a mac, promise_test.raku hangs for me once in a while also. Welcome to Rakudo(tm) v2021.04. Implementing the Raku(tm) programming language v6.d. Built on MoarVM version 2021.04. Trying to reduce it, I would like to find a program that reliably tickles this bug and

Re: junctions with given/when

2021-11-04 Thread yary
and I realize that what I just typed doesn't help a whole lot, what if you have a junction of things and you want to tell if any/one/all/none smartmatch the same thing... OK.. -y On Thu, Nov 4, 2021 at 6:38 PM yary wrote: > Something that helps me reason about this is thinking of how regu

Re: junctions with given/when

2021-11-04 Thread yary
Something that helps me reason about this is thinking of how regular expressions match against strings, to remember that which goes on which side is important... > "this has a Q in it" ~~ / 'Q' / # of course this works 「Q」 > / 'Q' / ~~ "this has a Q in it" # of course this breaks Regex object

Re: Primitive benchmark comparison (parsing LDIF)

2021-10-28 Thread yary
A small thing to begin with in the regex m/ ^ (@attributes) ':' \s (.+) $ /; All the string examples use the literal ': ' colon+space, so how about making the regex more consistent? And also allowing the empty string as a value, which the string examples allow. m/ ^ (@attributes) ': ' (.*) $ /;

Re: [better solution] pairs of separators from a string

2021-09-20 Thread yary
2 3 5 8 13 21 34 55 89) > > > say 1, 1, * + * [...^] ( * >= 100); > (1 1 2 3 5 8 13 21 34 55 89) > > > say (1, 1, * + *) [...^] ( * >= 100); > (1 1 2 3 5 8 13 21 34 55 89) > > From Yary: > >> Ranges also support arbitrary functions, the doc

Re: [better solution] pairs of separators from a string

2021-08-24 Thread yary
Hi Bill, When building a range that's an arithmetic or geometric progression, the sequence operator is a little quicker to type. And thus also more likely to be understood more quickly too. > ('a' .. 'h')[(0..*-1).grep: * %% 2 ] (a c e g) > ('a' .. 'h')[ 0, 2 ... * ] (a c e g) > ('a' ..

Re: (sigils are awesome, they say ...) Re: pairs of separators from a string

2021-08-23 Thread yary
A little more of Vadim's example > my $a = ; say $a.raku; ("a", "b", "c") > my @a = ; say @a.raku; ["a", "b", "c"] > @a[1]='X'; say @a.raku; ["a", "X", "c"] > $a[1]='X' Cannot modify an immutable List ((a b c)) in block at line 1 $a is a scalar container, holds one thing. In this example a

Re: intermixed types and resulting types

2021-08-22 Thread yary
"How would you know what types are compatible for a particular operation?" Operations are functions so the question is the same as "How would you know what types are compatible for a particular function" which gets to inspecting a routine's arguments. This SO page helped me figure that out

Re: pairs of separators from a string

2021-08-21 Thread yary
This reminds me of "the comma rule" which I haven't quite internalized yet. This gets a little closer map { .[0,2…∞], .[1,3…∞] }, ("012345".comb,) (((0 2 4) (1 3 5))) and my instinct is that "map" is adding a layer you don't need or want for this issue, should just be sending the results of comb

Re: Windows tutorial needed (Todd?)

2021-07-11 Thread yary
The link for that issue is https://github.com/Raku/doc/issues/3913 ("doc" not "docs") -y On Sun, Jul 11, 2021 at 5:31 AM Tom Browder wrote: > See https://github.com/Raku/docs issue #3913. > > -Tom (tbrowder) >

Re: Buf to Str

2021-06-09 Thread yary
. > ~Paul > > On Wed, Jun 9, 2021 at 10:20 AM yary wrote: > >> From my early 1980s days learning programming, ASCII CHR 0 is not null, >> it is NUL (can type it as ctrl-@) it's a control character much like the >> others. >> >> Ctrl-G BEL, it was fun putting

Re: Buf to Str

2021-06-09 Thread yary
>From my early 1980s days learning programming, ASCII CHR 0 is not null, it is NUL (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

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

2021-05-31 Thread yary
False here, or is it `~~` and `when` that should coerce Junctions into something that fails against the right side? > 3.ACCEPTS(any(3,4)) any(True, False) > ? (3.ACCEPTS(any(3,4))) True -y On Mon, May 31, 2021 at 6:38 PM Larry Wall wrote: > On Sun, May 30, 2021 at 10:

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

2021-05-31 Thread yary
Nice checking! I opened https://github.com/rakudo/rakudo/issues/4386 -y On Mon, May 31, 2021 at 3:45 AM Bruce Gray wrote: > > > > On May 30, 2021, at 9:18 PM, yary wrote: > > > > This came up in today's Raku study group (my own golfing-) > > > > > ? (an

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

2021-05-30 Thread yary
This came up in today's Raku study group (my own golfing-) > ? (any(4,3) ~~ 3) True > ? (3 ~~ any(4,3)) True > given any(4,3) { when 3 {say '3'}; say 'nope'} nope > given 3 { when any(4,3) {say '3'}; say 'nope'} 3 > given any(4,3) { say .raku } any(4, 3) why does Raku say 'nope' for the example

Re: gather take eager syntax

2021-04-21 Thread yary
a meta-comment, showing values with "dd" or ".raku" often helps alleviate confusion with understanding non-trivial cases. Try "dd" instead of "say"

Re: slurpy hash signatures

2021-04-18 Thread yary
On Sun, Apr 18, 2021 at 3: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

Re: [sf-perl] The SF Perl Raku Study Group, 03/28 at 1pm PDT

2021-03-29 Thread yary
yes, I would guess that the non-greedy matching probably works > here because the following material is effectively pinned at the end > of the document. > > Note that you should be able to run these scripts as written, provided > you also pull copies of these source files: > &g

Re: [sf-perl] The SF Perl Raku Study Group, 03/28 at 1pm PDT

2021-03-29 Thread yary
Hi Joe & other Raku study group attendees, At the time I left, we were looking at a grammar with a speed-memory issue on large-ish files. I had a germ of an idea which I couldn't express, and from the meeting notes I see you have a simple fix *"by changing stuff regex (.\*?) to non-greedy (.\*)*"

Re: Objects, TWEAK and return

2021-03-22 Thread yary
Agreed! -y On Mon, Mar 22, 2021 at 6:45 PM Ralph Mellor wrote: > 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. > > >

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

2021-03-22 Thread yary
Hi all, Thanks Bill for posting your results from my samples. Seems like we both get lots of warnings/errors from our REPL's, me even with 2021.02.01. I suspect there must be something going on with what the REPL is trying to print, after all it does want to display the results of every line. I

Re: Objects, TWEAK and return

2021-03-22 Thread yary
Good to see this investigated down to the details, yet I just realized something that was bothering me about it. Going back to the original post: submethod TWEAK { $!filelist.lines».split(',').map( -> ($a, $b) { @!show.push: ( $a, $b ) }); } It's not good practice to use "map" for side

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

2021-03-19 Thread yary
s inside the interpolations as non-capturing. -y On Thu, Mar 18, 2021 at 6:08 PM Ralph Mellor wrote: > 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. &

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

2021-03-17 Thread yary
Thanks raiph for everything! Including getting me to upgrade my Raku, "Welcome to Rakudo(tm) v2021.02.1. Implementing the Raku(tm) programming language v6.d. Built on MoarVM version 2021.02." As it is I get same kinds of errors in the REPL, perhaps it is MacOS with Linenoise that's mucking

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

2021-03-17 Thread yary
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 https://docs.raku.org/language/regexes#Regex_interpolation > my $string = 'Is this a regex

Re: Please create a Raku community channel

2021-03-14 Thread yary
The Rakudo Weekly blog gives me a sense of what's going on in the Raku world, when I remember to check it! https://rakudoweekly.blog/about-rakudo-weekly/ That site isn't quite what's called for in therms of community discussion and announcements, but is a decent "organic" overview of what's

Re: [sf-perl] The SF Perl Raku Study Group, 03/14 at 1pm PDT

2021-03-12 Thread yary
Or is that a Zen critique ... I think therefore i am not...? On Fri, Mar 12, 2021, 11:21 AM Joseph Brenner wrote: > You'll need to expand on that a bit, I don't get the complaint. > > Do pretentious quotations bug you? > > > On 3/12/21, Tiejun Li wrote: > > Joseph, > > You think you are

Re: dimensions in a multidimensional array

2021-02-05 Thread yary
This got me interested in https://docs.raku.org/language/list#index-entry-Shaped_arrays and I find myself wanting to implement a role "Shaped" and applying it to List, for an immutable shaped list, whose implementation packs its elements for o(1) lookup... on my ever-lengthening to-do list -y

Re: list assignment

2021-01-19 Thread yary
Let's dig in a little my @one = 1,2,3; my @two = 4,5,6; my @both = @one,@two; at this point @both is an array containing two arrays > dd @both Array @both = [[1, 2, 3], [4, 5, 6]] Showing that assigning into an array variable gives an array, each element of which can itself be an array.

Re: LTA documentation page

2021-01-06 Thread yary
In the Perl world, I use perldoc all the time to view the exact documentation for the installed module I’m working with. And on a regular basis, it’s useful for me to inspect the source code of the installed modules. I have been going through quite a few contortions to look at the source code for

Re: Checking for nil return

2020-12-31 Thread yary
ed, Dec 30, 2020 at 10:02 PM yary wrote: > This commit shows where Nil expanded from being "Absence of a value" to, > alternatively, "a benign failure". Unfortunately I haven't found discussion > on "benign failure" – semantics, use case, prior art, example,

Re: for and ^ question

2020-12-30 Thread yary
Look up ..^ which is the long form of ^ when used in ^8 sort of thing https://docs.raku.org/routine/..$CIRCUMFLEX_ACCENT "Constructs a Range from the arguments, excluding the end point." try out these 3 .. 7 3 ..^ 7 3 ^.. 7 3 ^..^ 7 and also see

Re: Checking for nil return

2020-12-30 Thread yary
pairing. > Now I need to think through why it (grumbled that it) is wrong. > (or not wrong: for performance reasons, it is good to support values > that can never be undefined) > > -- Ruud > > > On 2020-12-28 22:35, yary wrote: > > [...] > > Allowing Failure as a return alw

Re: Checking for nil return

2020-12-28 Thread yary
about the reasoning behind it being defined as valid sub a( --> Int:D ) { return Nil } -y On Sun, Dec 20, 2020 at 7:18 PM Brad Gilbert wrote: > Nil is always a valid return value regardless of any check. > > This is because it is the base of all failures. > > On Sat, Dec 19,

Re: Checking for nil return

2020-12-20 Thread yary
mpletely sure due to the nature of Nil being a defined type object. -y On Sun, Dec 20, 2020 at 2:35 PM Joseph Brenner wrote: > yary wrote: > > Is this a known issue, or my misunderstanding? > > > >> subset non-Nil where * !=== Nil; > > (non-Nil) > >> sub o

Checking for nil return

2020-12-19 Thread yary
Is this a known issue, or my misunderstanding? > subset non-Nil where * !=== Nil; (non-Nil) > sub out-check($out) returns non-Nil { return $out } > out-check(44) 44 > out-check(Nil) Nil ^ Huh, I expected an exception on "out-check(Nil)" saying the return value failed the "returns" constraint.

Re: Missing NullPointerException

2020-12-19 Thread yary
Going back to Dec 3rd explanation: "... I had a chain of methods which should do some side effect. It all went fine only the side effect was not there. I then figured out after some time that one of methods returned Nil and somehow silently it did not do what I expected." This looks like an

Re: Junctions wrapped in singleton lists

2020-11-16 Thread yary
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: > 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

Re: Junctions wrapped in singleton lists

2020-11-15 Thread yary
A few more experiments, for what it's worth. I have no answers. > { any(1,2) }.^name Block > any(1,2).^name Junction > (1|-1).^name Junction > ((1|-1) ... *)[^3] ((any(1, -1)) (any(2, 0)) (any(3, 1))) > (1|-1 ... *)[^3] ((any(1, -1)) (any(2, 0)) (any(3, 1))) > 1|-1 ... 3 ((any(1, -1)) (any(2, 0))

Re: Constructing a number from digits in an arbitrary base

2020-10-30 Thread yary
> So you'd basically need a sub that takes a List, and a base factor, and does the necessary arithmetic for you. I don't think that's in core. If that were to exist, would that be an inverse of "polymod"- maybe "polymul"? - with this property @decomposed-num = $some_number.polymod(@a-sequence)

Re: Language Design: 'special casing' of split()? (i.e. .split performs concomitant .join? )

2020-10-12 Thread yary
Here's another way of phrasing these answers- Some routines like "join" operate on strings, and thus coerce their argument to a string. Some routines like "sin" operate on numbers, and thus coerce their argument to a number. Each class defines how it coerces to Str or Num, regardless of what is

Re: Language Design: 'special casing' of split()? (i.e. .split performs concomitant .join? )

2020-10-12 Thread yary
These behave like overwriting > List.^find_method('split').wrap: { $^a.map: *.split($^b) } > List.^find_method('sin').wrap: *.map: *.sin; > but they don't have to, since Aureliano started with "wrap" they can be actual wrappers: sub map-over-arg(\A) {my =nextcallee; A.map:{nextone $_}}

Re: cross reduce operator magic

2020-10-11 Thread yary
-y On Sun, Oct 11, 2020 at 8:32 PM yary wrote: > Since this is a golf exercize, reducing number of characters, why use the > reduction form when infix is shorter? > > squish(sort [X[&({$^a**$^b+$b**$a})]] 2..31,2..31) # from original > squish(sort 2..31 X[&({$^a**

Re: cross reduce operator magic

2020-10-11 Thread yary
Since this is a golf exercize, reducing number of characters, why use the reduction form when infix is shorter? squish(sort [X[&({$^a**$^b+$b**$a})]] 2..31,2..31) # from original squish(sort 2..31 X[&({$^a**$^b+$b**$a})] 2..31) # infix is 2-chars shorter Also I am trying to do a little un-golf

Re: print particular lines question

2020-09-01 Thread yary
context. > Methods .^name, .raku, .gist, or .say can be used to stringify it to > something meaningful. > in block at -e line 1 > ... > AA > > but the named doesn't > raku -e 'for -> $alpha { for (1..14) { state $sv = $alpha; say > $sv; $sv++; printf("d: %

Re: print particular lines question

2020-09-01 Thread yary
6 27 > > ~$ raku -e 'for -> $alpha { for (1..14) { print (BEGIN $ = > $alpha)++ ~ " " } }' > 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 > > Expected? --Bill. > > On Tue, Sep 1, 2020 at 11:44 AM yary wrote: > > > > &g

Re: print particular lines question

2020-09-01 Thread yary
Thanks, that's cool, and shows me something I was wondering about On Tue, Sep 1, 2020 at 11:36 AM Larry Wall wrote: > If you want to re-initialize a state variable, it's probably better to make > it explicit with the state declarator: > > $ raku -e "for { for (1..2) { say (state $ =

Re: print particular lines question

2020-08-31 Thread yary
6-us...@perl.org> wrote: > On 2020-08-31 17:03, yary wrote: > > anonymous variable > > Would be safe thinking it had the same properties as `$_`? >

Re: How to I modify what is a new line in lines?

2020-08-31 Thread yary
a file! Which was the 2nd part of my previous email > dd $_ for 'line0-10.txt'.IO.lines(:nl-in["i","\n"], :!chomp)[0..3]; > "Li" > "ne 0\n" > "Li" > "ne 1\n" -y On Mon, Aug 31, 2020 at 5:12 PM ToddAndMargo via perl6-u

Re: print particular lines question

2020-08-31 Thread yary
I like this better for alpha counter raku -e "for (1..4) { say (BEGIN $ = 'AAA')++ }" with BEGIN, the assignment of AAA happens once. With the earlier ||= it checks each time through the loop. -y On Mon, Aug 31, 2020 at 5:03 PM yary wrote: > Not even a reset- every time there's

Re: print particular lines question

2020-08-31 Thread yary
>> > raku -ne '.say if $++ == 3|2|5' Lines.txt > >>> > > >>> > Brian > >>> > > >>> > > > >>>> Hi Bill, > >>>> > >>>> Works beatifically! And no bash pipe!

Re: print particular lines question

2020-08-31 Thread yary
Hi 1 Hi Hi 2 Hi Hi Hi 3 Hi Hi Hi Hi 4 Hi Hi Hi Hi Hi -y On Mon, Aug 31, 2020 at 4:39 PM Aureliano Guedes wrote: > Basically : > > $ raku -e 'my $a = 1; say ++$a; say $a' > 2 > 2 > $ raku -e 'my $a = 1; say $a++; say $a' > 1 > 2 > > On Mon, Aug 31, 2020 at 8:

Re: print particular lines question

2020-08-31 Thread yary
$ by itself is an anonymous variable, putting ++ after starts it at 0 (hmm or nil?) and increments up. By putting the plus plus first, ++$, it will start at 1, thanks to pre-increment versus post increment On Mon, Aug 31, 2020, 4:20 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote:

Re: print particular lines question

2020-08-31 Thread yary
Aww don't you remember Raku's earliest(?) contribution to Perl? I was so happy when this arrived, and sad over its subsequent neglect perl -ne 'no warnings "experimental"; print if $. ~~ [3,5,11]' line0-10.txt -y On Mon, Aug 31, 2020 at 8:28 AM William Michels via perl6-users <

Re: lines :$nl-in question

2020-08-30 Thread yary
+1 on Matthew's comment Do you agree with that definition, Yary? Brad? Here it is: > "Invocant" > "Caller, the one who calls or invokes. The invocant of a method would > be the object on which that method is being called, or, in some cases, > the class itself. Invocan

Re: lines :$nl-in question

2020-08-30 Thread yary
The Raku glossary has a definition https://docs.raku.org/language/glossary#Invocant suggestion, link to that where the term appears. -y On Sun, Aug 30, 2020 at 9:16 AM William Michels via perl6-users < perl6-us...@perl.org> wrote: > Inline: > > On Sun, Aug 30, 2020 at 12:49 AM Brad Gilbert

Re: How to I modify what is a new line in lines?

2020-08-30 Thread yary
You were close! First, you were looking at the docs for Path's "lines", but you are using a string "lines" and those docs say multi method lines(Str:D: $limit, :$chomp = True) multi method lines(Str:D: :$chomp = True) Files get "nl-in" due to the special case of text files having various line

Re: liens and :chomp question

2020-08-30 Thread yary
Expanding on how to read the docs & signature a bit, from Tobias > You confuse two methods that have the same name "lines". One of them, > which exists in the IO::Path class, has a :chomp argument. The other, > on IO::Handle does not. > "path".IO.lines() <-- calls lines on an IO::Path

Re: lines :$nl-in question

2020-08-30 Thread yary
The :foo syntax is called a "colon pair", and colon pair also describes :quux since it is short for :quux(True) Colon pair also describes :$foo because it is a shorthand using a colon to create the Pair object foo=>$foo Searching raku docs showed

Re: Raku User's Survey 2020 out now....

2020-08-28 Thread yary
control word > before the expression?) > at -e:1 > --> my $x=$_; say $x for $x.lines()[3,2,5] -> > expecting any of: > infix > infix stopper > > What's the correct code? > > Best, Bill. > > > On Thu, Aug 27, 2020 at 2:12 PM y

Re: Extended identifiers in named attributes

2020-08-28 Thread yary
I wonder what was intended with these extended identifiers? https://github.com/Raku/problem-solving/issues/224* - Extended identifiers-why and where, exactly?* -y On Fri, Aug 28, 2020 at 8:26 AM Ralph Mellor wrote: > I don't think you're supposed to be able to have extended identifiers > as

Re: Raku User's Survey 2020 out now....

2020-08-27 Thread yary
You have an extra semicolon in there -" say $x; for" - so what happens is for each line 1. it runs "say $x" and thus prints "Line 0" the first time through, since it had read "Line 0" only 2. Then it runs "say $i" for each of $x.lines()[3,2,5] - but $x is only "Line 0" so it says 3 x "Nil" 3.

Re: Associative class for any key, any value

2020-08-26 Thread yary
Yep that's it, thanks! > my Any %h{ Any }; > %h{ 22 } = "foo"; %h{ "22" } = IO; %h{ IO } = sub { ... }; > %h.kv.raku; (IO, sub { ... }, 22, "foo", "22", IO).Seq -y On Wed, Aug 26, 2020 at 8:04 PM Brad Gilbert wrote: > > On Wed

Associative class for any key, any value

2020-08-26 Thread yary
Map and its descendants like Hash relate "from *string* keys to values of *arbitrary* types" QuantHash and its descendants like Mix, Bag, Set "provide *object* hashes whose values are *limited* in some way" Is there an associative class where both the keys and values are arbitrary? -y

Re: print particular lines question

2020-08-25 Thread yary
> Now, does anyone have a simpler way than using the ".map" above? There were a few in the thread! Here's my golfing, unlike the others, this preserves the order of the lines (which may or may not be desired) raku -ne '.say if $++ == any 6,3,1' line0-10.txt -y On Tue, Aug 25, 2020 at 12:03

Re: Combining multiple "is..." traits into one?

2020-08-11 Thread yary
I played with the "is" trait and I is puzzled. This example code multi trait_mod: (Routine \routine, :$equality!) { trait_mod:(routine, :equiv(:<==>)); } sub is-eq is equality { ... } say 'is-eq ', multi trait_mod: (Routine \routine, :$chainable!) { trait_mod:(routine, :assoc); }

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

2020-08-09 Thread yary
I only superficially read this question–but it does make me think of coercing input types https://docs.raku.org/language/functions.html#Coercion_types https://stackoverflow.com/questions/34874779/what-is-the-point-of-coercions-like-intcool If the methods that do the adding-of-magmas were written

Re: Learning the "ff" (flipflop) infix operator? (was Re: Raku version of "The top 10 tricks... .")

2020-08-03 Thread yary
I opened a Raku ticket https://github.com/rakudo/rakudo/issues/3839 -y On Sun, Aug 2, 2020 at 5:42 PM Eirik Berg Hanssen < eirik-berg.hans...@allverden.no> wrote: > On Sun, Aug 2, 2020 at 11:14 PM yary wrote: > >> Issue golf, ff is always evaluating its RHS >> >>

Re: Learning the "ff" (flipflop) infix operator? (was Re: Raku version of "The top 10 tricks... .")

2020-08-02 Thread yary
Issue golf, ff is always evaluating its RHS $ raku -e 'say "With ff: ";say ( 1..5 ).grep({False ff .say}); say "With fff: ";say ( 1..5 ).grep({False fff .say});' With ff: 1 2 3 4 5 () With fff: () -y On Sun, Aug 2, 2020 at 2:16 PM yary wrote: > tl;dr: is this

Re: Learning the "ff" (flipflop) infix operator? (was Re: Raku version of "The top 10 tricks... .")

2020-08-02 Thread yary
checking - increment to 6 checking hide (+ B C D - + E F -) With fff: checking B checking C checking D checking - increment to 1 checking E checking F checking - increment to 2 (+ B C D - + E F -) Hey gurus, why is the end check in 'ff' running so much more often than the end check of 'fff' ? ps. I had

Re: Learning the "ff" (flipflop) infix operator? (was Re: Raku version of "The top 10 tricks... .")

2020-08-01 Thread yary
This made me want to try a contrived puzzle, use 'fff' to show things between a "start" and 2nd "mark" line. That is, print any line below not marked with "!" at the start $ cat example.txt !ignore me Start hi print me yes! Mark still print me Mark !ignore this line !this line too Start

Re: 2020.07 just hit

2020-08-01 Thread yary
For every Unicode operator, there's a "Texas" ASCII equivalent (==) for ≡ but... none that I can find for ≢ is this an oversight or am I not finding it? -y On Wed, Jul 22, 2020 at 3:06 PM Aureliano Guedes wrote: > Nice, Daniel, > > But, I admit, sometimes I don't like too much some symbols not

Re: delimiters with more than one character? ...

2020-07-17 Thread yary
FYI the original thread is viewable at https://www.mail-archive.com/debian-user@lists.debian.org/msg758713.html and the post has several reasonable answers there. Among the first is a classic Perl one-liner and suggestions along the lines of "what you're doing looks brittle, how about doing the

Re: proto and multi

2020-06-29 Thread yary
It looks like you have spaces in the token { * } can you try it without, using this {*} instead? On Mon, Jun 29, 2020, 1:29 PM Richard Hainsworth wrote: > I have several multi methods. > > All of them have the same first statement, then differ depending on the > signature. > > proto seems to be

Re: interpolating the return from embedded code in a regexp

2020-06-15 Thread yary
Brad: "Note that {} is there to update $/ so that $0 works the way you would expect" I ran into that before & was trying to remember that detail... found it in https://docs.raku.org/language/regexes#Capture_numbers But the example is a bit on the obtuse side: These capture variables are only

Re: interpolating the return from embedded code in a regexp

2020-06-14 Thread yary
take when I wrote it up, but whatever.) > > > > On 6/14/20, Joseph Brenner wrote: > > Well, with the first one it rejects all of my lines, and with the > > second one it passes all of them. > > > > Just to be be clear, my idea is the second line is wrong, and it &

Re: interpolating the return from embedded code in a regexp

2020-06-14 Thread yary
e second line is wrong, and it > should flag that one as a problem > > > > On 6/14/20, yary wrote: > > https://docs.raku.org/language/regexes#Regex_interpolation gave me some > > ideas > > > > Try matching against / (^P\d+) \s+ %products{$0} / > > > > T

Re: interpolating the return from embedded code in a regexp

2020-06-14 Thread yary
https://docs.raku.org/language/regexes#Regex_interpolation gave me some ideas Try matching against / (^P\d+) \s+ %products{$0} / This one also works, in a roundabout way / (^P\d+) \s+ {"%products{$0}"} / -y On Sun, Jun 14, 2020 at 4:44 PM Joseph Brenner wrote: > In part because of the

Re: I need a second pair of eyes

2020-05-26 Thread yary
>From this much 158: Cannot resolve caller index(Str:U: Str:D); none of these signatures match: "index" is being called with the 1st arg undefined, 2nd arg defined. There is no "index" multi handling the 1st undefined arg, is my guess. -y On Tue, May 26, 2020 at 4:41 AM ToddAndMargo via

Re: Raku -npe command line usage

2020-05-08 Thread yary
t; > Presumably the ",lines" tells raku/perl6 to run the preceding code on > input lines? > > TIA, Bill. > > On Fri, May 8, 2020 at 11:03 AM yary wrote: > > > > > perl6 -e 'lines() ==> grep /^WARN/ ==> sort() ==> join("\n") ==> > s

Re: Raku -npe command line usage

2020-05-08 Thread yary
ch breaks the flow. > > OTOH this > > > > raku -e'lines().grep(/^WARN/).sort».say' sample.log > > > > doesn't use the feed operator and this > > > > raku -e'lines() ==> grep(/^WARN/) ==> sort() ==> say()' sample.log > > > > outputs a list on on

Re: Raku -npe command line usage

2020-05-08 Thread yary
Ooops forgot the sort... let's golf with the hyper-operator again... raku -ne'push my @i: $_ if .starts-with: q[WARN]; END @i.sort>>.say' sample.log -y On Fri, May 8, 2020 at 1:10 PM yary wrote: > ooh neat! I didn't know. Indeed this works. Thanks Sean! > > raku

Re: Raku -npe command line usage

2020-05-08 Thread yary
ooh neat! I didn't know. Indeed this works. Thanks Sean! raku -ne'push my @i: $_ if .starts-with: q[WARN]; END .say for @i' sample.log -y On Fri, May 8, 2020 at 1:04 PM Sean McAfee wrote: > On Fri, May 8, 2020 at 6:53 AM Brad Gilbert wrote: > >> So together that would be: >> >> raku

Re: Raku -npe command line usage

2020-05-08 Thread yary
list on one line, not each line on its own. This one works, but > it feels awkward: > > raku -e'lines() ==> grep(/^WARN/) ==> sort() ==> reduce({$^a ~ "\n" ~ > $^b}) ==> say()' sample.log > > On Fri, May 8, 2020 at 5:49 PM yary wrote: > >> All good

Re: Raku -npe command line usage

2020-05-08 Thread yary
All good ideas so far, in the "more than one way to do it" spirit, can use "state" instead of "my", since state only initializes 1st time it's hit. raku -ne 'state @i;@i.push($_) if .starts-with(q[WARN]); END .say for @i.sort' sample.log Or adapting Brad's answer with the feed operator for

Re: I need help with sub MAIN

2020-05-05 Thread yary
t;These", :$are="Are",*%wrong-named) is hidden-from-USAGE {say "$*USAGE\nGot bad args " ~ %wrong-named ~ " "~ @wrong-list}' raku example.raku -these=HIHIHI -foo=BABABA On Tue, May 5, 2020 at 3:20 PM yary wrote: > > Here's something to play with (withou

  1   2   3   4   5   >