Re: interpolating the return from embedded code in a regexp

2020-06-17 Thread Joseph Brenner
cs can be clearer on when to use {} and when it isn't needed, > opened an issue https://github.com/Raku/doc/issues/3478 > > -y > > > On Mon, Jun 15, 2020 at 3:09 PM Brad Gilbert wrote: > >> You don't want to use <{…}>, you want to use "" >> >>

Re: interpolating the return from embedded code in a regexp

2020-06-17 Thread Joseph Brenner
> > Although I would do something like this instead: > > my ($code,$desc) = $line.split( /\s+/, 2 ); > if %products{$code} eq $desc { > > On Sun, Jun 14, 2020 at 6:44 PM Joseph Brenner wrote: > >> In part because of the recent discussion here, I decided to

Re: Code assertions to spy on regexps behavior

2020-06-17 Thread Joseph Brenner
4/20, Vadim Belman wrote: > It doesn't have to be an assertion. Just a code block would do the same. > > Best regards, > Vadim Belman > >> On Jun 14, 2020, at 8:55 PM, Joseph Brenner wrote: >> >> $_ = "Alpha beta gamma"; >> my @matches = m:g/(a) /; > >

Re: interpolating the return from embedded code in a regexp

2020-06-14 Thread Joseph Brenner
istake 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 > should flag that one as a pr

Re: interpolating the return from embedded code in a regexp

2020-06-14 Thread Joseph Brenner
gt; NO: bad line. > ... > Why is it reading with an empty-string $0 in %products{''} > > -y > > > On Sun, Jun 14, 2020 at 5:47 PM Joseph Brenner wrote: > >> Well, with the first one it rejects all of my lines, and with the >> second one it passes all of them. >>

Code assertions to spy on regexps behavior

2020-06-14 Thread Joseph Brenner
By the way, I've been finding code assertions are a fun way of spying on what's going on with your regexps: $_ = "Alpha beta gamma"; my @matches = m:g/(a) /; # 5 # 10 # 13 # 16

Re: interpolating the return from embedded code in a regexp

2020-06-14 Thread Joseph Brenner
ave 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

interpolating the return from embedded code in a regexp

2020-06-14 Thread Joseph Brenner
In part because of the recent discussion here, I decided to play around with using Raku code embedded in a regexp. I came up with a contrived example where I was going to examine a product listing in a text block to see if the product descriptions matched the product codes. The valid associations

Re: just curious to know

2020-06-14 Thread Joseph Brenner
No particular "killer app" has emerged for Raku as of yet, there's no task that's going to make you go "Aha, this is a job for Raku!". But you know, it's not as though the original perl was designed to be the Web 1.0 server-side scripting language or the saviour of the human genome project...

Re: Accidentally closed an issue

2020-05-30 Thread Joseph Brenner
Thanks much. On 5/30/20, JJ Merelo wrote: > Reopened > > El sáb., 30 may. 2020 a las 19:26, Joseph Brenner () > escribió: > >> I was just trying to comment on an issue I opened the other day, and I >> accidentally closed it. I don't see any way for me to re-open it,

Accidentally closed an issue

2020-05-30 Thread Joseph Brenner
I was just trying to comment on an issue I opened the other day, and I accidentally closed it. I don't see any way for me to re-open it, so I would guess I don't have permissions to do so. Could someone re-open this? https://github.com/rakudo/rakudo/issues/3728

Re: Regexps using 'after' and 'before' like ^ and $

2020-05-29 Thread Joseph Brenner
I opened a github issue: https://github.com/rakudo/rakudo/issues/3728 On 5/26/20, Joseph Brenner wrote: > Hey Brad, thanks much for the explication: > >> 「」 should probably also prevent the position from being at the >> end. > >> It does work if you write it differ

Re: Regexps using 'after' and 'before' like ^ and $

2020-05-26 Thread Joseph Brenner
ile the other one is something like: > > / ... / > > (The 「try」 is needed because 「.substr( -1 )」 is a Failure.) > > So then these: > > / ... $ / > / ... > > Would be > > / ... / > / ... / > > --- > > What I think is happenin

Regexps using 'after' and 'before' like ^ and $

2020-05-25 Thread Joseph Brenner
Given this string: my $str = "Romp romp ROMP"; We can match just the first or last by using the usual pinning features, '^' or '$': say $str ~~ m:i:g/^romp/; ## (「Romp」) say $str ~~ m:i:g/romp$/; ## (「ROMP」) Moritz Lenz (Section 3.8 of 'Parsing', p32) makes

Re: Matching subpatterns in any order, conjunctions, negated matches

2020-05-17 Thread Joseph Brenner
hat case the "qu" is just part of the string and fair game to match against, so...) On 5/16/20, Peter Pentchev wrote: > On Sat, May 16, 2020 at 05:53:04PM -0700, Joseph Brenner wrote: >> Peter Pentchev wrote: >> > On Fri, May 15, 2020 at 07:32:50PM -0700, Joseph Br

Re: Matching subpatterns in any order, conjunctions, negated matches

2020-05-16 Thread Joseph Brenner
op of each other. I keep thinking there's an edge case in these before/after tricks that might matter if we weren't matching the one-word-per-line format of the unix dictionaries, but I need to think about that a little more... Peter Pentchev wrote: > On Fri, May 15, 2020 at 07:32:50PM

Re: Matching subpatterns in any order, conjunctions, negated matches

2020-05-16 Thread Joseph Brenner
ations, not just the permutations). On 5/16/20, William Michels wrote: > On Fri, May 15, 2020 at 7:33 PM Joseph Brenner wrote: >> >> Regex engines by their nature care a lot about order, but I >> occasionally want to relax that to match for multiple >> multicharacter s

Matching subpatterns in any order, conjunctions, negated matches

2020-05-15 Thread Joseph Brenner
Regex engines by their nature care a lot about order, but I occasionally want to relax that to match for multiple multicharacter subpatterns where the order of them doesn't matter. Frequently the simplest thing to do is just to just do multiple matches. Let's say you're looking for words that

the state of the build and install instructions

2020-05-14 Thread Joseph Brenner
I'm having trouble doing a build of raku from github. Could it be the INSTALL.txt file is out-of-date? I was trying to build a "bleeding edge" Raku using the instructions here: https://github.com/rakudo/rakudo/blob/master/INSTALL.txt So I thought I'd just need to do this: cd

slurp with enc("utf16") doesn't work

2020-05-13 Thread Joseph Brenner
I just got to look into this one again a little further, and it does seem that reading a utf16 file like this doesn't work: my $contents = slurp( $file, :enc("utf16") ); Though this, however, does work: my $fh = $file.IO.open( :r, :enc("utf16") ); my $contents = $fh.slurp;

Re: readchars, seek back, and readchars again

2020-04-27 Thread Joseph Brenner
kind text you've been reading, not just the number of bytes you've read. Is that making any sense? I posted a later code example that might show the problem more clearly... On 4/26/20, Samantha McVey wrote: > On zaterdag 25 april 2020 21:51:41 CEST Joseph Brenner wrote: >> > Yary ha

Re: Using slurp to read in a utf16 file

2020-04-26 Thread Joseph Brenner
utf16") ); my $huh = $contents.gist; say "contents: $contents";# contents: say "length: ", $contents.chars;# 0 } The output: contents: ሀⶀ䷼ꪪⲤⲎ length: 6 contents: length: 0 The file definitely has something in it, though: wc /tmp/stuff_in

Using slurp to read in a utf16 file

2020-04-26 Thread Joseph Brenner
Looking at the documentation for slurp, it looks as though there's a convenient "enc" option you can use if you're not reading utf8 files. So I thought this would work: my $contents = slurp $file, enc => "utf16"; It's not doing what I expected... Raku acts like there's nothing in $contents.

Re: readchars, seek back, and readchars again

2020-04-26 Thread Joseph Brenner
ETTER E]\c[COMBINING ACUTE ACCENT]" > "é" > > So Rakudo has to read the next codepoint to make sure that it isn't a > combining codepoint. > > It is probably faking up the reads to look right when reading ASCII, but > failing to do that for wider codepoints. >

Re: readchars, seek back, and readchars again

2020-04-25 Thread Joseph Brenner
F-16 encoded > strings: > > https://github.com/rakudo/rakudo/issues/3461 > > I know it might be far-fetched, but what if your UTF-8 issue and > Yary's UTF-16 issue were related? It would be nice to kill two birds > with one stone. > > Best Regards, Bill. > > > > > O

Re: readchars, seek back, and readchars again

2020-04-24 Thread Joseph Brenner
I was just posting that. On 4/24/20, Elizabeth Mattijsen wrote: > > >> On 24 Apr 2020, at 22:03, Joseph Brenner wrote: >> >> Thanks, yes I understand unicode and utf-8 reasonably well. >> >>> So Rakudo has to read the next codepoint to make sure

Re: readchars, seek back, and readchars again

2020-04-24 Thread Joseph Brenner
f I really wanted to intermix readchars and seeks like this... I'd need to check the range of the codepoint to see how far I need to seek to get where I expect to be. On 4/24/20, Joseph Brenner wrote: > Thanks, yes I understand unicode and utf-8 reasonably well. > >> So Rakudo has to r

Re: readchars, seek back, and readchars again

2020-04-24 Thread Joseph Brenner
quot; > > So Rakudo has to read the next codepoint to make sure that it isn't a > combining codepoint. > > It is probably faking up the reads to look right when reading ASCII, but > failing to do that for wider codepoints. > > On Fri, Apr 24, 2020 at 1:34 PM Joseph Brenner wrote: >

readchars, seek back, and readchars again

2020-04-24 Thread Joseph Brenner
I thought that doing a readchars on a filehandle, seeking backwards the width of the char in bytes and then doing another read would always get the same character. That works for ascii-range characters (1-byte in utf-8 encoding) but not multi-byte "wide" characters (commonly 3-bytes in utf-8).

Re: regex objects as hash keys

2020-04-06 Thread Joseph Brenner
> Object hashes currently come with a performance penalty. That's why they are > currently not the default. Thanks, that makes sense. On 4/6/20, Elizabeth Mattijsen wrote: >> On 6 Apr 2020, at 07:19, Joseph Brenner wrote: >>> If you want a Hash which allows any >>

Re: regex objects as hash keys

2020-04-05 Thread Joseph Brenner
behavior wasn't the default. Thanks much. On 4/5/20, Tobias Boege wrote: > On Sun, 05 Apr 2020, Joseph Brenner wrote: >> I find in Raku that (as expected) I can use an object as a hash key: >> >> class Rutabaga { method color { say "purple (and white)"; } } >&

regex objects as hash keys

2020-04-05 Thread Joseph Brenner
I find in Raku that (as expected) I can use an object as a hash key: class Rutabaga { method color { say "purple (and white)"; } } my $obj = Rutabaga.new my %vegeout; %vegeout{ $obj } = "this works"; And for something I was doing I wanted to save up data about matches for

Re: stashing an array in a hash and yanking it back out

2020-03-17 Thread Joseph Brenner
or two. Sometimes it's about readability, > sometimes about elegance. Overuse is surely bad, but overuse of anything is > bad, for that matter. :) > > Best regards, > Vadim Belman > >> On Mar 17, 2020, at 1:09 PM, Joseph Brenner wrote: >> >>> Though I've no

Re: stashing an array in a hash and yanking it back out

2020-03-17 Thread Joseph Brenner
ce blob fingfangfoom tingler], rocks => > [marble sandstone granite chert pumice limestone]} > > Though I've no idea what those colons are/are not doing. And we can get to > those "inner" array elements via >> say %stash[1] > sandstone > > > >

Re: stashing an array in a hash and yanking it back out

2020-03-17 Thread Joseph Brenner
gt; my %stash = monsters => @monsters >>>>> {monsters => [godzilla grendel wormface blob fingfangfoom tingler]} >>>>> > %stash.append: (rocks => @rocks); >>>>> {monsters => [godzilla grendel wormface blob fingfangfoom tingler], >>

Fwd: stashing an array in a hash and yanking it back out

2020-03-17 Thread Joseph Brenner
'}= @greek; %stash.append: (:greek(@greek)); -- Forwarded message -- From: Joseph Brenner Date: Mon, 16 Mar 2020 14:10:01 -0700 Subject: Re: stashing an array in a hash and yanking it back out To: Vadim Belman Vadim Belman wrote: > So, you basically needed: > > my

Re: stashing an array in a hash and yanking it back out

2020-03-05 Thread Joseph Brenner
William Michels wrote: > Yes, since I was working in the REPL, I tried compacting Joe's code by > eliminating the "my %stash" line at the top, and adding "my" to the third > line. I noticed the additional "my" in there, but I wouldn't have been able to tell you why it was behaving like it

Re: stashing an array in a hash and yanking it back out

2020-03-05 Thread Joseph Brenner
Timo Paulssen wrote: > The reason for that is that `my %foo{Bar}` is syntax for restricting > the keys of the hash to a specific type (by default it's `Str(Any)`) Hm.. That's certainly useful, I hadn't even gotten to wondering how to do that yet. > and giving a string instance ("monsters"

stashing an array in a hash and yanking it back out

2020-03-04 Thread Joseph Brenner
There might not be much to say about this, I just though I'd mention that I keep getting re-surprised by basics with Raku, like this one, where first I stash an array away in a hash and later try to pull the array out again: my %stash; my @monsters = << godzilla grendel wormface

Re: weirdness with subset on has

2020-01-13 Thread Joseph Brenner
ho_grk(); >> >> my $obj2 = HasSubset.new( grk => << alpha beta gamma >> ); >> $obj2.echo_grk(); >> >> my $obj3 = HasSubset.new( grk => << alpha beta rutabaga >> ); >> $obj3.echo_grk(); >> # value 'rutabaga' fails as expect

Re: weirdness with subset on has

2020-01-12 Thread Joseph Brenner
t; ); $obj3.echo_grk(); # value 'rutabaga' fails as expected: # Type check failed in assignment to @!grk; expected HasSubset::Allowed but got Str ("rutabaga") On 1/12/20, Joseph Brenner wrote: > Here's a code snippet that tries to use a subset to constrain the > values of an

weirdness with subset on has

2020-01-12 Thread Joseph Brenner
Here's a code snippet that tries to use a subset to constrain the values of an object field (i.e. declared with has). As written, this code works, but only when there's what looks like an irrelevant experimental line in it (labeled "WEIRD ONE"), when that line is commented out it throws an

Re: int and Str in sub declaration question

2020-01-12 Thread Joseph Brenner
This can be done with an explicit, named subset if you like: subset StrOrInt where Str | Int; sub do_stuff ( StrOrInt $item ) { say "$item is a " ~ $item.^name; } On 1/9/20, ToddAndMargo via perl6-users wrote: mailto:perl6-users@perl.org>> wrote: Hi

Changing the error message from subset type violation

2020-01-12 Thread Joseph Brenner
I was just playing around with using a "subset" to restrict a string to a set of allowed values: subset Monster of Str where * eq any( << godzilla mothera blob tingler grendel minotaur >> ); my Monster $thingie; $thingie = 'grendel'; # accepts this as expected $thingie = 'nada'; #

Re: Fwd: Raku, docs, help [was: Re: vulgar?]

2019-12-11 Thread Joseph Brenner
Joseph Brenner wrote: > The signatures in the documentation are certainly helpful, but they're > no substitute for code examples. I'd go after adding more code > examples, rather than removing other stuff. But then, maybe I'm coming into this discussion in the middle-- is the topic he

Re: Fwd: Raku, docs, help [was: Re: vulgar?]

2019-12-11 Thread Joseph Brenner
The signatures in the documentation are certainly helpful, but they're no substitute for code examples. I'd go after adding more code examples, rather than removing other stuff.

Re: pass by reference

2019-12-08 Thread Joseph Brenner
} > > my @deck = 1..10; > say pop-random @deck; # 7 > say @deck; # [1 2 3 4 5 6 8 9 10] > > > On Sun, Dec 8, 2019 at 1:26 PM Joseph Brenner wrote: > >> What's the sub signature incantation to >> pass-by-reference do you can act directly >>

pass by reference

2019-12-08 Thread Joseph Brenner
What's the sub signature incantation to pass-by-reference do you can act directly on the structure passed in without juggling an alias yourself? # deal from middle my $card = pop_random( @deck );

Re: getting comb to return match objects

2019-11-17 Thread Joseph Brenner
Oh, you know, think I've spotted a source of confusion in this thread... Liz-- I think my accident-- replied to me directly, and we kept going talking about this without cc-ing the list. So yeah, I pointed out there was a bug with the routine form of comb that wasn't in the Str method, and she

Re: getting comb to return match objects

2019-11-16 Thread Joseph Brenner
expected 2 or 3 arguments but got 4 > in block at line 1 > >> say comb(/\w+/, "a;b;c", 2, :True).perl; > Unexpected named argument 'True' passed > in block at line 1 > >> $*VM > moar (2019.07.1) > > Any help appreciated, Bill. > > >

Re: getting comb to return match objects

2019-11-10 Thread Joseph Brenner
.comb(/./, :g, :match); > (「f」 「o」 「o」 「b」 「a」 「r」) > >> On 10 Nov 2019, at 23:46, Joseph Brenner wrote: >> >> Can someone give me an example of how to use the comb routine to >> return a list of match objects? >> >> The documentation here: >> >> ht

getting comb to return match objects

2019-11-10 Thread Joseph Brenner
Can someone give me an example of how to use the comb routine to return a list of match objects? The documentation here: https://docs.perl6.org/type/Str#routine_comb Mentions a boolean option to get match objects: > If $matcher is a Regex, each Match object is > converted to a Str, unless

Re: processing a file in chunks

2019-10-20 Thread Joseph Brenner
Thanks, that looks good. At the moment I was thinking about cases where there's no need division by lines or words (like say, hypothetically bioinformatics data: very long strings no line breaks). On 10/20/19, Elizabeth Mattijsen wrote: >> On 20 Oct 2019, at 23:38, Joseph Brenner wrote

Re: processing a file in chunks

2019-10-20 Thread Joseph Brenner
is a text file, it would be `.comb(512)` > > On Sun, Oct 20, 2019 at 4:39 PM Joseph Brenner wrote: > >> I was just thinking about the case of processing a large file in >> chunks of an arbitrary size (where "lines" or "words" don't really >> work). I

Re: processing a file in chunks

2019-10-20 Thread Joseph Brenner
Thanks, I'll take a look at that. Brad Gilbert wrote: > Assuming it is a text file, it would be `.comb(512)` > > On Sun, Oct 20, 2019 at 4:39 PM Joseph Brenner wrote: > >> I was just thinking about the case of processing a large file in >> chunks of an arbitrary size

processing a file in chunks

2019-10-20 Thread Joseph Brenner
I was just thinking about the case of processing a large file in chunks of an arbitrary size (where "lines" or "words" don't really work). I can think of a few approaches that would seem kind-of rakuish, but don't seem to be built-in anywhere... something like a variant of "slurp" with an

Re: Perl6 -> Raku? whats the scope?

2019-10-16 Thread Joseph Brenner
Last I looked, raku.org redirects to perl6.org already. On 10/15/19, Darren Duncan wrote: > One of the earliest steps that I hope gets implemented as soon as possible > is > that the previous official web domain for Perl 6 which is *.perl6.org gets > an > official replacement such as *.raku.org

Re: Perl6 -> Raku? whats the scope?

2019-10-15 Thread Joseph Brenner
Just as a practical matter, I would expect it will be "Raku (the language-formerly-known-as-Perl 6)" for some time. I would call the vote among core developers "official", and Larry Wall's approval makes it as solid as it can get. On 10/15/19, JJ Merelo wrote: > There's no such thing as a Raku

Re: anything faster than say [+] lines?

2019-09-26 Thread Joseph Brenner
ng Perl 6.c. >> > >> > I'm a little puzzled, I'd've thought the loop around the 'my Int $y' >> would redeclare a local $y each time. Instead it behaves like: >> > $ time perl6 -e 'my Int $y = 0;for ( 1 .. 100) { $y += $_} ; say >> $y; ' >> > >> > (which

Re: anything faster than say [+] lines?

2019-09-26 Thread Joseph Brenner
me perl6 -e 'my Int $y = 0;for ( 1 .. 100) { $y += $_} ; say $y; ' > > (which is signficantly faster ;-) > 5050 > real 0m1.229s > user 0m1.254s > sys 0m0.040s > > ) > > From: Joseph Brenner > Sent: Wednesday, September 25, 2019 1

Re: anything faster than say [+] lines?

2019-09-25 Thread Joseph Brenner
ps On 9/25/19, Joseph Brenner wrote: > I just gave that one-liner a try, but I didn't see that error: > >> seq 100 | time perl6 -e 'say [+] lines' > 5050 > 28.70user 0.07system 0:28.29elapsed 101%CPU (0avgtext+0avgdata > 74188maxresident)k > 63424inputs+0outp

Re: anything faster than say [+] lines?

2019-09-25 Thread Joseph Brenner
I just gave that one-liner a try, but I didn't see that error: > seq 100 | time perl6 -e 'say [+] lines' 5050 28.70user 0.07system 0:28.29elapsed 101%CPU (0avgtext+0avgdata 74188maxresident)k 63424inputs+0outputs (32major+15409minor)pagefaults 0swaps perl6 --version This is Rakudo

Re: Variable character class

2019-09-02 Thread Joseph Brenner
wrote: > On Mon, Sep 2, 2019 at 1:12 AM Joseph Brenner wrote: > >> I was just trying to run Simon Proctor's solution, and I see it >> working for Yary's first case, but not his more complex one with >> problem characters like brackets included in the list of characters.

Re: Variable character class

2019-09-01 Thread Joseph Brenner
I was just trying to run Simon Proctor's solution, and I see it working for Yary's first case, but not his more complex one with problem characters like brackets included in the list of characters. I don't really see how to fix it, in part because I'm not that clear on what it's actually doing...

Re: perl6's new name?

2019-08-12 Thread Joseph Brenner
> If Perl had worked harder to stay in the public eye in a good way (rather than being viewed as dieing), there wouldn't have been a perceived need for Python. As I remember it, there was a concerted attack on perl with Python being held up as the-anti-perl. There wasn't (yet) any question of

Re: perl6's new name?

2019-08-12 Thread Joseph Brenner
I think: (1) For a rename to happen, Larry Wall really has to sign off on it: this is just a social reality of the perl world. (2) The rename really has to be an announced, offical rename. It can't be just an alias or a knickname or anything like that. I find I like the name Camelia in part

Re: while(<>){...} analog?

2019-07-29 Thread Joseph Brenner
ful: No such method 'lines' for invocant of type 'IO::Special' On 7/28/19, Bruce Gray wrote: > > >> On Jul 28, 2019, at 6:20 PM, Joseph Brenner wrote: >> >> I was just wondering if there's some direct analog in perl6 to the >> perl5 construct: >> >&g

while(<>){...} analog?

2019-07-28 Thread Joseph Brenner
I was just wondering if there's some direct analog in perl6 to the perl5 construct: while(<>){ ... } If I'm planning on passing a filename on the command-line, I can just get it out of $*ARGFILES easily enough, but what if I also wanted it to work on lines passed in via standard input?

Re: Why so slow

2019-04-28 Thread Joseph Brenner
Brad Gilbert wrote: > For one it has the following line: > > use lib 'lib'; > > That is going to slow everything down if you have anything in the > `lib` directory. > The more things in that directory, the slower it will get. I've been seeing some pretty slow perl6 one-line invocations,

Re: Why so slow

2019-04-28 Thread Joseph Brenner
ToddAndMargo via perl6-users wrote: > David Christensen wrote: >> We discussed this at our San Francisco Perl Mongers meeting today: > > Any Perl 5 guys there? And did they get "grouchy" with you > for using Perl 6? We've been doing an "Informal Perl6 Study Group" over at the Oakland Museum

Re: push() practice: misplaced semicolon creates list elements within array?

2019-04-14 Thread Joseph Brenner
Just in case it wasn't clear from Bill's discussion, I think the reason this case seems weird is normally we expect trailing separators to be ignored, as with the extra comma here: > my @monsters = ('ghidora', 'mothera', 'wolfman', 'zuckerberg',); [ghidora mothera wolfman zuckerberg] If you

Re: push() practice: misplaced semicolon creates list elements within array?

2019-04-14 Thread Joseph Brenner
. > > -y > > > On Sun, Apr 14, 2019 at 10:29 AM Joseph Brenner wrote: > >> Richard Hainsworth wrote: >> > A semicolon is the syntax used for multidimensional arrays. >> > >> > See https://docs.perl6.org/language/subscripts#Multiple_dimensions &g

detecting running under the repl

2018-11-06 Thread Joseph Brenner
How do you write code that detects whether it's running under the repl?

Re: an alternate to ^methods

2018-11-04 Thread Joseph Brenner
uot; (does an augment on Any) ^ | Augment::Util-- "recompose_core": propagate changes from an augment ^ | Symbol::Scan -- "list_core_type_objects": find everything in core On 11/4/18, Joseph Brenner wrote: > I pushed out the perl6 code I've been working on to git

an alternate to ^methods

2018-11-04 Thread Joseph Brenner
I pushed out the perl6 code I've been working on to github and CPAN. I sub-divided it into four parts with a dependency tree like so: Symbol::Scan | Object::Examine Augment::Util || |/ |

a necessary no-op

2018-10-29 Thread Joseph Brenner
I've got a weird one here... a line that looks like it does nothing significant is needed for the code to work. If the line below marked "The Mystery Line" is commented out, you just get the error: ===SORRY!=== Cannot look up attributes in a VMNull type object Augment::Util: class

Re: Exception Handling, DivideByZero

2018-10-29 Thread Joseph Brenner
yZero Thanks. I didn't get that the behavior of WHAT and ^name were that different. > On Mon, Oct 29, 2018 at 1:04 PM Joseph Brenner wrote: > >> I was just looking into doing some finer-grained exception handling, >> so I tried this: >> >>use v6; >>

Exception Handling, DivideByZero

2018-10-29 Thread Joseph Brenner
I was just looking into doing some finer-grained exception handling, so I tried this: use v6; try { my $result = 4/0; say "result: $result"; CATCH { #when DivideByZero { say "Oh, you know."; } default { say .WHAT; .Str.say } # (DivideByZero)

Re: augment again

2018-10-20 Thread Joseph Brenner
By the way, I'd really like to know what the vertical bar is here in front of "CORE": > for (|CORE::) .grep({ .key eq .value.^name }) .map( *.value ) -> $class { It's not the "any" junction, is it? How would that make sense here? On 10/19/18, Joseph Brenner

Re: augment again

2018-10-20 Thread Joseph Brenner
e cases where it does matter (although I can’t > think of one right now). > > > Liz > >> On 19 Oct 2018, at 21:14, Joseph Brenner wrote: >> >> Okay, good enough... if I can't slip my changes in ahead of >> everything then reinitializing everything viz ^compose

Re: augment again

2018-10-19 Thread Joseph Brenner
jsen wrote: > See also: > https://stackoverflow.com/questions/52718499/how-to-correctly-augment-any > >> On 19 Oct 2018, at 03:52, Joseph Brenner wrote: >> >> I've got another question about aug--yes, I know--ment. >> >> I've got a module ides_of_augment.pm6: &g

augment again

2018-10-18 Thread Joseph Brenner
I've got another question about aug--yes, I know--ment. I've got a module ides_of_augment.pm6: use MONKEY-TYPING; augment class Any { method hiccup { say "hic!"; } } I would've thought it could be used in the repl like this: perl6 -Mides_of_augment >

Re: zef installs not working

2018-10-17 Thread Joseph Brenner
not with "zef install ". Maybe some sort of permissions issue with a LTA error message? On 10/16/18, Todd Chester via perl6-users wrote: > On 10/16/18 8:20 PM, Joseph Brenner wrote: >> Lately zef hasn't been working for me to do module installation. >> I can do thin

zef installs not working

2018-10-16 Thread Joseph Brenner
Lately zef hasn't been working for me to do module installation. I can do things like "zef --list" to get a list of available modules but when I actually try to do the installation I see things like this: zef install Array::Agnostic ===> Searching for: Array::Agnostic ===> Testing:

Re: websearches on "perl6"

2018-10-08 Thread Joseph Brenner
Elizabeth Mattijsen wrote: >> Joseph Brenner wrote: >> Would anyone happen to know if there's a duckduckgo trick to get just >> perl6 links and not perl5? >> >> If you just append "perl6" it'll be mostly perl6 info in the top ten, >> but th

websearches on "perl6"

2018-10-07 Thread Joseph Brenner
Would anyone happen to know if there's a duckduckgo trick to get just perl6 links and not perl5? If you just append "perl6" it'll be mostly perl6 info in the top ten, but there tends to be at least some perl5 intermixed in it.

Re: extending built-in classes

2018-09-24 Thread Joseph Brenner
Thanks, yes that's one of the first approaches I looked at, but there's still that extra "does" step before you can say $x.tellall; On Sat, Sep 22, 2018 at 2:39 PM, Curt Tilmes wrote: > On Sat, Sep 22, 2018 at 5:30 PM Larry Wall wrote: > >> On Sat, Sep 22, 2018 at 11

Re: extending built-in classes

2018-09-24 Thread Joseph Brenner
Larry Wall wrote: > Joseph Brenner wrote: >> Sounds good, thanks. > Well, yes, *sounds* good. :-) > Monkey patching is allowed but discouraged in Perl 6, because Ruby. But I *like* being evil. But as I was trying to make clear, it's not something I'm planning on usin

Re: extending built-in classes

2018-09-22 Thread Joseph Brenner
gt; org/syntax/augment.html > > On Sat, Sep 22, 2018 at 2:33 PM Joseph Brenner wrote: > >> I was just wondering if there's any way to extend an existing >> class in perl 6. I'd like to be able to do things like drop >> a custom debugging method in Any that would

extending built-in classes

2018-09-22 Thread Joseph Brenner
I was just wondering if there's any way to extend an existing class in perl 6. I'd like to be able to do things like drop a custom debugging method in Any that would then be available on everything. Note: I'm talking about adding something to an existing class ("monkeypatching") as opposed to

Re: Functions and subroutines?

2018-09-12 Thread Joseph Brenner
> they were all just subs. With perl5 code, I've gravitated to talking about "routines" when I don't want to worry about whether something is technically a function or a method. It doesn't seem to confuse anyone. (On the other hand, I've had people make fun of me for using the word

Re: What does ^methods really tell you?

2018-07-31 Thread Joseph Brenner
t; > https://docs.perl6.org/routine/methods > > On 2018-07-31 06:56:07 +0430, Joseph Brenner wrote: >> I originally thought that $var.^methods gave you a list of all >> available methods on $var, but it looks like it doesn't (always?) >> report on inherited methods. >>

What does ^methods really tell you?

2018-07-30 Thread Joseph Brenner
I originally thought that $var.^methods gave you a list of all available methods on $var, but it looks like it doesn't (always?) report on inherited methods. my $stringy = '3.14159'; say $stringy.^name; # Str say $stringy.^mro; # ((Str) (Cool) (Any) (Mu)) The list returned from checking

Re: What does ^parents really tell you?

2018-07-30 Thread Joseph Brenner
) (Mu)) On Sun, Jul 29, 2018 at 10:42 AM, Laurent Rosenfeld wrote: > Hi, > > Try this: > > > my $stringy = "abc"; > say $stringy.^parents(:all); > > This should display: > > ((Cool) (Any) (Mu)) > > Cheers, > Laurent. > > 2018-07-29 19:2

What does ^parents really tell you?

2018-07-29 Thread Joseph Brenner
If you look at the type diagram: https://docs.perl6.org/type/Str#___top You can see that: Str is Cool is Any is Mu But if you use the ^parents method on a string, you don't get "Cool", instead you get "()": my $stringy = "abc"; say $stringy.^name; # Str say

Re: mixin syntax: does vs but

2018-06-12 Thread Joseph Brenner
ns out that the list ".^methods" gives you is bizarre: hard to read, has many duplicates, unsorted, full of odd entries that look like internal use only widgets I don't care about just now...) On Tue, Jun 12, 2018 at 11:34 AM, Brad Gilbert wrote: > On Tue, Jun 12, 2018 at 12:55 PM, Jos

stackoverflow vs the world (and perl6-users)

2018-06-12 Thread Joseph Brenner
Attention conservation: it's unlikely I'm going to say something interesting you haven't thought of already. A side-discussion that came up here: should you ask questions here, or at stackoverflow (or both here *and* at stackoverflow). I understand the argument that it's better to talk about

Re: mixin syntax: does vs but

2018-06-12 Thread Joseph Brenner
of "but" in the objects docs to be tremendously confusing at first: it looks like some sort of conditional check, like "unless". On Tue, Jun 12, 2018 at 1:01 AM, Elizabeth Mattijsen wrote: >> On 12 Jun 2018, at 09:06, Joseph Brenner wrote: >> >> I thought this would work

Re: mixin syntax: does vs but

2018-06-12 Thread Joseph Brenner
12, 2018 at 12:09 AM, JJ Merelo wrote: > Use binding: > > my @x= <1 2 3>; my @y := @x but Iterable; say @y.^name; # OUTPUT: > «Array+{Iterable}␤» > > El mar., 12 jun. 2018 a las 9:06, Joseph Brenner () > escribió: >> >> I thought this would work to make a cop

mixin syntax: does vs but

2018-06-12 Thread Joseph Brenner
I thought this would work to make a copy of @x but with the role "LookInside" attached to it: my @y = @x but LookInside; But that didn't add the role to @y. E.g. say @y.^WHAT Would just report (Array), not (Array+{LookInside}). I found that this would do what I was trying to do though:

<    1   2   3   4   >