Re: How to find if a drive letter exists?

2020-05-17 Thread Brad Gilbert
Why do you have `.Bool` on all of the `.e` tests? A file or directory either exists or it doesn't. So `.e` always returns a Bool. So there is zero reason to try to coerce it to a Bool. You can look at the return value of `.e`. > say '.'.IO.can('e').head.signature (IO::Path:D: *%_ --> Boo

Re: Different return values with "say" vs "put" (Nil representation... )

2020-05-18 Thread Brad Gilbert
You are misunderstanding what `put` does. It does not print the internal representation. What it does do is turn the value into a `Str` object, then print it with a trailing newline. It just so happens that objects will by default return something that looks like an internal representation when

Re: I do not understand method":"

2020-05-25 Thread Brad Gilbert
In the following the 「:」 makes it so you don't need parenthesis (…).sort: … (…).sort(…) The reason there needs to be a space is so it isn't confused for an adverb. 「*.Version」 is a method call turned into a lambda. Basically it creates a lambda where the only thing it does is call a met

Re: I do not understand method":"

2020-05-25 Thread Brad Gilbert
a2.3 > >> a5.1 > >> b1a23 > >> > >> Other than not quite getting the alpha, beta, and > >> release candidate thing down, I do not understand: > >> > >> .sort: *.Version > >> > >> 1) What does

Re: I need help testing for Nil

2020-05-26 Thread Brad Gilbert
Generally you don't need to test for 「Nil」. You can just test for defined-ness. $ raku -e 'my $x="abc"; with $x.index( "q" ) {say "Exists"} else {say "Nil";}' Also 「Nil」 is not a 「Str」, so why would you use 「eq」? $ raku -e 'Nil.Str' Use of Nil in string context If you really need to

Re: I need a second pair of eyes

2020-05-26 Thread Brad Gilbert
This is more of how I would structure it with %CommandLine { .say; # if /^ '[' .*? ']' / { if .starts-with('[') && .contains(']') { ... } } else { say 'no backup path given' } We can skip checking 「.starts-with」 and 「.contains」 if th

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

2020-05-26 Thread Brad Gilbert
I'm not sure that is the best way to look at 「」 and 「」. > 'abcd123abcd' ~~ / > .+ > / 「123」 In the above code 「>」 makes sure that the first thing that 「.+」 matches is a 「」 And 「>」 makes sure that the last thing 「.+」 matches is also a 「」 The 「>」 is written in front of the 「.+」 so it start

Re: I need help testing for Nil

2020-05-26 Thread Brad Gilbert
gt;> > >> into a test? > >> > >> $ raku -e 'my $x="abc"; if $x.index( "q" ) eq Nil {say > "Nil"}else{say > >> "Exists";}' > >> Use of Nil in string context > >> in block

Re: I need a second pair of eyes

2020-05-27 Thread Brad Gilbert
The point was that 「say」 will print undefined values without complaining. Really debug statements should be more like: $*STDERR.put: 「%CommandLine = 」, %CommandLine; Or more succinctly: dd %CommandLine; On Wed, May 27, 2020 at 1:39 AM Peter Pentchev wrote: > On Tue, May 26, 2020 at 0

Re: question about the multi in method

2020-06-07 Thread Brad Gilbert
There are four different types of a function. (both method and sub) - `multi` - `proto` - `only` - `anon` A `proto` function is mainly just to declare there will be multiple functions with same name. `multi` is short for "multiple", meaning more than one. `only` is the default, it means there is

Re: regex interpolation of array

2020-06-13 Thread Brad Gilbert
Inside of a regex `{…}` will just run some regular Raku code. Code inside of it will most likely have no effect on what the regex matches. What you should have written was: $ = "@W[3]" The thing you were thinking of was: $ = <{ @W[3] }> Which could have been written as: --- To

Re: regex interpolation of array

2020-06-13 Thread Brad Gilbert
atures > match: > (Match: Associative:D, $, $, $, $, $, *%_) > (Match: Iterable:D \var, int \im, int \monkey, int \s, $, \context, > *%_) > (Match: Mu:D \var, int \im, int \monkey, $, $, \context, *%_) > in block at line 1 > > > 'TrueFalse' ~

Re: regex interpolation of array

2020-06-13 Thread Brad Gilbert
On Sat, Jun 13, 2020 at 1:27 PM Sean McAfee wrote: > On Sat, Jun 13, 2020 at 10:21 AM Brad Gilbert wrote: > >> That was just a dumb example. >> An incredibly dumb example. >> >> So what happens is that `Bool.pick` chooses The Bool values of either >> `True`

Re: interpolating the return from embedded code in a regexp

2020-06-15 Thread Brad Gilbert
You don't want to use <{…}>, you want to use "" if $line ~~ / (^P\d+) \s+ {} "%products{$0}" / { Note that {} is there to update $/ so that $0 works the way you would expect Although I would do something like this instead: my ($code,$desc) = $line.split( /\s+/, 2 ); if %products{$co

Re: junctions and parenthesis

2020-06-24 Thread Brad Gilbert
It does actually make sense to call any on any say (1, 2, 3).any + (4, 5, 6).any # any(any(5, 6, 7), any(6, 7, 8), any(7, 8, 9)) On Wed, Jun 24, 2020 at 6:22 PM William Michels via perl6-users < perl6-users@perl.org> wrote: > I evaluated Joe's code using Patrick's explanation of parenthe

Re: Playing with protos and phasers

2020-06-25 Thread Brad Gilbert
{*} is specially handled by the compiler as a term. Let's say you have a class named Foo: class Foo {…} You wouldn't expect to be able to use it like this: F o o.new() It is the same thing with {*}. The only difference is that {*} is meant to look like a Block { } combined with a Whate

Re: Playing with protos and phasers

2020-06-25 Thread Brad Gilbert
gmail.com> wrote: > On Thu, Jun 25, 2020 at 8:10 PM Brad Gilbert wrote: > >> {*} is specially handled by the compiler as a term. >> > > Thank you! > > I guess that handling is peculiar to proto, and maybe it's worth > documenting it. > > -- > Fernando Santagata >

Re: an error I don't understand

2020-06-27 Thread Brad Gilbert
I don't know why you are getting an error. But I think that this is one case where you should be writing `BUILD` instead of `TWEAK`. Note though that you can only have one `BUILD` or `TWEAK` per class. --- Or maybe you want a multi method `new` instead? multi method new ( :$native-object! )

Re: cannot create an instance of subset type

2020-07-10 Thread Brad Gilbert
Subset types are not object types. A subset is basically a bit of checking code and base type associated with a new type name. In something like: my ABC $a .= new; That is exactly the same as: my ABC $a = ABC.new; Well there is no functional `.new` method on any subset types, so `DEF.

Re: perl streaming framework

2020-07-14 Thread Brad Gilbert
If you really want a streaming framework for Perl, the mailing list for Raku users might not be the best place to ask. (Raku used to be known as Perl6, and we haven't done anything to change the name of this mailing list.) Raku has a very similar syntax to Perl. (It used to be called Perl6 after a

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

2020-07-25 Thread Brad Gilbert
There's the ff operator and the fff operator. The ff operator allows both endpoints to match at the same time. The fff operator doesn't. On Sat, Jul 25, 2020 at 3:16 PM William Michels via perl6-users < perl6-users@perl.org> wrote: > Hello, > > I'm trying to learn the "ff" (flipflop) infix opera

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

2020-07-28 Thread Brad Gilbert
tli > startlin > startling > user@mbook:~$ raku -ne '.put if "star" ff "start" ;' startling.txt > star > start > user@mbook:~$ raku -ne '.put if /"star"/ ff /"start"/ ;' startling.txt > star > start > startl > star

Re: 2020.07 just hit

2020-08-01 Thread Brad Gilbert
There doesn't need to be an ASCII equivalent of ≢, because you can combine (==) with the ! metaop to come up with !(==) On Sat, Aug 1, 2020 at 4:58 PM yary wrote: > For every Unicode operator, there's a "Texas" ASCII equivalent > (==) for ≡ > but... none that I can find for ≢ > is this an overs

Re: Extended identifiers in named attributes

2020-08-26 Thread Brad Gilbert
The problem is that often adverbs are chained without a comma. my %h = (a => 1); %h{'a'}:exists:delete # True say %h.keys; # () --- my %h = (a => 1); postcircumfix:< { } >( %h{'a'}, :exists:delete ) # True say %h.keys; # () On Wed, Aug 26, 2020 at 7:31 AM Marcel Timmer

Re: Associative class for any key, any value

2020-08-26 Thread Brad Gilbert
On Wed, Aug 26, 2020 at 9:56 PM yary wrote: > 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 wher

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

2020-08-28 Thread Brad Gilbert
Daniel, the thing about Todd is that his brain doesn't process the written word the way most people do. That is according to him by the way. He is under the assumption that it is because of how he was taught to read. I think the issue is different. I think that he might be on the Autistic Spectru

Re: lines :$nl-in question

2020-08-30 Thread Brad Gilbert
There are no variables that begin with : There are variable declarations in signatures that begin with : :$foo is exactly the same as :foo($foo) sub bar ( :$foo ) {…} sub bar ( :foo($foo) ){…} :$foo in a signature is a shortcut for declaring a named argument :foo() and a variable with t

Re: lines :$nl-in question

2020-08-30 Thread Brad Gilbert
Invocant is in the dictionary though. In fact it is from Latin. Origin & history: Derived from in- + vocō ("I call"). Verb: I invoke I call (by name) In fact that is pretty close to the same meaning as it is used in the Raku docs. It is the object that we are calling (aka invoking) a met

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

2020-08-30 Thread Brad Gilbert
$file.IO.lines( :nl-in(…), :chomp, … ) is actually short for $file.IO.open( :nl-in(…), :chomp ).lines( … ) On Sun, Aug 30, 2020 at 10:43 AM yary wrote: > 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

Re: "ICU - International Components for Unicode"

2020-09-24 Thread Brad Gilbert
Rakudo does not use ICU It used to though. Rakudo used to run on Parrot. Parrot used ICU for its Unicode features. (Well maybe the JVM backend does currently, I don't actually know.) MoarVM just has Unicode as one of its features. Basically it has something similar to ICU already. --- The pur

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

2020-10-10 Thread Brad Gilbert
Functions in Raku tend to have one job and one job only. `split` splits a string. So if you call `split` on something that is not a string it gets turned into one if it can. This happens for most functions. Having `split` be the only function that auto-vectorizes against an array would be very

Re: Constructing a number from digits in an arbitrary base

2020-11-02 Thread Brad Gilbert
I believe this is what you were looking for sum 46, 20, 26, 87, 11 Z* (1, 101, 101² … *) sum 1234567890.polymod(101 xx *) Z* (1, 101, 101² … *) On Mon, Nov 2, 2020 at 2:12 PM Sean McAfee wrote: > On Fri, Oct 30, 2020 at 2:19 PM Elizabeth Mattijsen > wrote: > >> > On 30 Oct 2020, at 22

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

2020-11-06 Thread Brad Gilbert
I'm pretty sure you need to use single quotes for your example, as Raku will replace the @_[0] before Perl has a chance to do anything with it. On Thu, Nov 5, 2020, 10:23 PM Paul Procacci wrote: > https://github.com/niner/Inline-Perl5 > > use Inline::Perl5; > > subset test of Str where EVAL "sub

Re: spurt and array question

2020-11-14 Thread Brad Gilbert
The purpose of `spurt` is to: 1. open a NEW file to write to 2. print a single string 3. close the file If you are calling `spurt` more than once on a given file, you are doing it wrong. If you give `spurt` an array, you are probably doing it wrong; unless you want the array turned into a single s

Re: spurt and array question

2020-11-14 Thread Brad Gilbert
{ .put for @LeafpadrcNew; } On Sat, Nov 14, 2020 at 1:07 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-11-14 06:00, Brad Gilbert wrote: > > The purpose of `spurt` is to: > > 1. open a NEW file to write to > > 2. print a single string &

Re: \n and array question

2020-11-14 Thread Brad Gilbert
is the same as Q :single :words < a b c > Note that :single means it acts like single quotes. Single quotes don't do anything to convert '\n' into anything other than a literal '\n'. If you want that to be converted to a linefeed you need to use double quote semantics (or at least tur

Re: Raku modules in Gentoo's Portage

2020-12-01 Thread Brad Gilbert
I suspect that the right way to do this may be to do something like having a subclass of CompUnit::* which does things the Gentoo way. I would assume that the lock is so that only one copy of Rakudo is changing the repository at a time. Presumably Gentoo already prevents more than one thing instal

Re: Missing NullPointerException

2020-12-16 Thread Brad Gilbert
with $drone.engine { .start; say "engine started"; } On Tue, Dec 15, 2020, 11:10 PM Konrad Bucheli via perl6-users < perl6-users@perl.org> wrote: > > Hi Ralph > > Thanks a lot for the extensive answer. > > I still consider it a trap because it does not do what it tells it

Re: How do I address individual elements inside an object

2020-12-19 Thread Brad Gilbert
You can interpolate a method call in a string, but you need the parens. say "$FruitStand.location() has $FruitStand.apples() apples in stock"; On Sat, Dec 19, 2020 at 4:28 AM Laurent Rosenfeld via perl6-users < perl6-users@perl.org> wrote: > Yeah, right. $FruitStand.apples is not a direct ac

Re: Is self a C pointer?

2020-12-20 Thread Brad Gilbert
It doesn't matter if it is a C pointer. Unless you are working on Moarvm, you should consider them arbitrary unique numbers. Like GUID. That said, yes I'm sure that they represent a location in memory. On Sun, Dec 20, 2020, 6:45 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > H

Re: for and ^ question

2020-12-31 Thread Brad Gilbert
It does not look like an array from 0 to ($nCount - 1). It only iterates like that. It is a Range object from 0 to $nCount excluding $nCount. ^9 === Range.new( 0, 9, :excludes-max ) # True 0 ~~ ^9 # True 1 ~~ ^9 # True 0.5 ~~ ^9 # True 8 ~~ ^9 # True 8.9 ~~ ^9 # True

Re: concurrency of asynchronous events - input from multiple keyboards

2021-01-01 Thread Brad Gilbert
I think the simplest way to turn that into a Supply is to use the `supply` keyword my $pm = Audio::PortMIDI.new; my $input = supply { my $stream = $pm.open-input($input-device-number, 32); DONE { $stream.close; } loop { emit $

Re: Extra . needed

2021-01-03 Thread Brad Gilbert
You've already asked a similar question. https://stackoverflow.com/questions/54033524/perl6-correctly-passing-a-routine-into-an-object-variable When you call $a.f() you are getting the value in &!f which is a function. When you call $a.f().() you are getting the value in &!f, and then also calli

Re: surprise with start

2021-01-05 Thread Brad Gilbert
What is happening is that the `start` happens on another thread. That thread is not the main thread. The program exits when the main thread is done. Since the main thread doesn't have anything else to do it exits before that `sleep` is done. The more correct way to handle it would be to wait for

Re: LTA documentation page

2021-01-05 Thread Brad Gilbert
There really shouldn't be that much difference between what the documentation says and how your version works. The biggest thing would be new functions that you don't have yet. (Which you could just copy the code from the sources into your program if you need them.) Even if rakudoc did install, i

Re: dimensions in a multidimensional array

2021-02-05 Thread Brad Gilbert
There is a reason that you can't just ask for the dimensions of an unspecified multidimensional array. It may be multiple dimensions. [[1,2,3], [4,5,6,7,8,9,10]].shape If it gave a result it would be something like: (2,3|7) On Fri, Feb 5, 2021 at 8:50 AM Theo van den Heuvel wrote:

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

2021-03-11 Thread Brad Gilbert
If you interpolate a regex, it is a sub regex. If you have something like a sigil, then the match data structure gets thrown away. You can put it back in as a named > $input ~~ / 「9 million」 pattern => 「9 million」 0 => 「9」 1 => 「million」 Or as a numbered: > $input

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

2021-03-13 Thread Brad Gilbert
ests such a change, I will vehemently fight to prevent it from happening. I would be more likely to accept <=$pattern> being added as a synonym to . On Sat, Mar 13, 2021 at 3:30 PM Joseph Brenner wrote: > Thanks much for your answer on this. I think this is the sort of > trick I

Re: Objects, TWEAK and return

2021-03-13 Thread Brad Gilbert
I think that this is caused because it is returning a 「Sequence」 that is not getting sunk. This is because the last value from a function is never sunk in that function. You could also use 「eager」 「sink」 or follow it with 「Nil」 or some other value (instead of 「return」) eager $!filelist.lines»

Re: Objects, TWEAK and return

2021-03-13 Thread Brad Gilbert
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. This is intended behaviour. It is up to the code that calls a function to sink the result if that is the desired behaviour. sub foo { 'a b c'.words».uc.map: *.s

Re: gather take eager syntax

2021-04-20 Thread Brad Gilbert
A Hash either takes some number of pairs my %h = a => 1, b => 2; or an even number of elements, which become key value pairs my %h = 'a', 1, 'b', 2; `eager` returns an eager Sequence/List etc (eager a => 1).raku # (:a(1),) A Sequence/List is itself a thing. Which means that it can

Re: [naive] hash assingment

2021-07-14 Thread Brad Gilbert
Honestly I would advise against using ==> at the moment. For one thing it doesn't even work like it is intended. Each side of it is supposed to act like a separate process. There are also issues with the syntax that are LTA. The fact that you have to tell it the left side is actually a list is on

Re: intermixed types and resulting types

2021-08-30 Thread Brad Gilbert
The multi infix:<+>( \a, \b ) candidate is the one that accepts non Numeric values. What it does is try to convert the two values into Numeric ones, and then redispatch using those values. If either one produces an error instead of a Numeric, that error is passed along. On Mon, Aug 30, 2021 at 9

Re: Order of multi sub definitions can resolve dispatch ambiguity

2021-09-24 Thread Brad Gilbert
This is intended behavior. Since subsets are just code it would be difficult to impossible to determine all of the ones that can match without actually running them all. This would slow down every call that uses multiple subsets. By most narrow candidate, it means by type. All subsets "of" the sa

Re: Order of multi sub definitions can resolve dispatch ambiguity

2021-09-25 Thread Brad Gilbert
( 1 --> 1 ){} multi factorial ( UInt \n ){ factorial(n - 1) * n } say factorial( 1 ); # ERROR: both UInt and 1 subsets match. You could modify the general case, but that is tedious and error prone. multi factorial ( Int \n where {$_ >= 0 && $_ != 0 && $_ != 1

Re: Grammar Help

2021-12-26 Thread Brad Gilbert
I'm on mobile, but without checking, I think the problem is here rule pairlist { * % \; } Specifically it's the missing % rule pairlist { * %% \; } JSON doesn't allow trailing commas or semicolons, so JSON::Tiny uses just %. Your data does have trailing semicolons, so you want t

Re: author specification

2022-05-02 Thread Brad Gilbert
Auth is for more than just the author. It is for author, authority, and authentication. CPAN can't authenticate github or fez modules, and vice versa. There is a reason the field is only the first four letters. That they are seen as different modules is an intended feature, not a bug. I would lik

Re: author specification

2022-05-03 Thread Brad Gilbert
There could be a way for one of them to only act as a middle man. Basically have fez defer to CPAN and just host a copy of it. On Tue, May 3, 2022, 10:59 AM Marcel Timmerman wrote: > Hi Brad, > > Auth is for more than just the author. It is for author, authority, and > authentication. > > There

Re: author specification

2022-05-11 Thread Brad Gilbert
After thinking on it, :auth<> is sort of an authentication chain. Just a really short one. To authenticate a module with :auth you have to first authenticate zef. On Wed, May 11, 2022 at 4:02 PM Darren Duncan wrote: > This discussion thread has excellent timing, because I was otherwise about >

Re: Ping Larry Wall: excessive compile times

2022-08-29 Thread Brad Gilbert
Actually Raku is faster to compile than Perl5. If you consider all of the features it comes with. For example, in Raku everything is an object with meta features. If you add Moose or similar to Perl5 then the compile times will often take longer than the equivalent Raku times. That's not the only

Re: Ping Larry Wall: excessive compile times

2022-08-29 Thread Brad Gilbert
; perl6-users@perl.org> wrote: > On 8/29/22 11:50, Brad Gilbert wrote: > > Actually Raku is faster to compile than Perl5. If you consider all of > > the features it comes with. > > > > For example, in Raku everything is an object with meta features. If you > > add

Re: Regex surprises

2022-09-12 Thread Brad Gilbert
Raku removed all of the regex cruft that has accumulated over the years. (Much of that cruft was added by Perl.) I'm not going to respond to the first part of your email, as I think it is an implementation artifact. On Mon, Sep 12, 2022 at 3:06 PM Sean McAfee wrote: > Hello-- > > I stumbled acr

Re: Help with %?RESOURCES variable

2023-04-19 Thread Brad Gilbert
Unless things have changed since I was last active, only modules are precompiled. `?` Twigilled variables are set at compile time. So if it had any values, they wouldn't be useful, because they would be created anew every time. On Mon, Apr 17, 2023, 11:48 AM David Santiago wrote: > > Hi Polgár >

Re: File::Copy ??

2017-03-21 Thread Brad Gilbert
For basic copy and move, the built-in subs should work https://docs.perl6.org/routine/copy https://docs.perl6.org/routine/move On Wed, Mar 22, 2017 at 12:24 AM, ToddAndMargo wrote: > Hi All, > > Do we have anything like > > http://perldoc.perl.org/File/Copy.html > > under another name? > > Nothi

Re: Am I suppose to be able to change a variable's type on the fly?

2017-03-21 Thread Brad Gilbert
The default type constraint is Mu, with a default of Any (everything is of type Mu, and most are of type Any) You shouldn't be able to change the type constraint of a scalar container (used for rw variables) Changing the type of a value, of course makes no sense. (a Str is always a Str, even when

Re: Can this OR be shortened?

2017-03-24 Thread Brad Gilbert
On Fri, Mar 24, 2017 at 8:16 PM, Darren Duncan wrote: > Just speculating, but try replacing the "||" with the "|" operator which > should create an ANY Junction, if I'm not mistaken, which may then do what > you want. -- Darren Duncan > All of these should work if $Terminal ~~ /xterm/ | /lin

Re: Module take-over policy

2017-03-28 Thread Brad Gilbert
Responses inline On Tue, Mar 28, 2017 at 10:37 PM, Richard Hainsworth wrote: > I've seen a couple of references to modules that no longer work; it's > inevitable with a new language. > > There is a balance between having respect for / protecting the original > developer, and also keeping a useful

Re: need help with "next"

2017-05-23 Thread Brad Gilbert
You do realize that `next` immediately stops the current iteration and goes onto the *next* one right? That is, there is no point putting any code after it because it will never be run. On Tue, May 23, 2017 at 11:30 PM, ToddAndMargo wrote: > Hi All, > > I have a test code in progress and I haven'

Re: How do you call the variable types?

2017-06-09 Thread Brad Gilbert
@ does the Positional role % does Associative & does Callable $ causes its value to be an item (its values do not flatten into an outer list when you use `flat`) my %hash is SetHash; Array does Positional, and all of its values are itemized We are unlikely to call $ variables "generic" becau

Re: next

2017-06-19 Thread Brad Gilbert
On Mon, Jun 19, 2017 at 11:15 AM, Andy Bach wrote: > > On Fri, Jun 16, 2017 at 11:11 PM, Gabor Szabo wrote: >> >> If the loop has some action and a condition it will jump to execute >> the action again (increment $i) and check the condition and act >> accordingly doing the next iteration or quit

Re: <<>> question

2017-10-05 Thread Brad Gilbert
On Thu, Oct 5, 2017 at 11:44 AM, Andy Bach wrote: > >> is ><<>> >> synonymous with >qw[] > ? `<<>>` is the same as `qqww<<>>` Which is short for `Q :qq :ww <<>>` the `:qq` is short for `:double`, that is it turns on double quote behaviour `:double` is short for `:scalar :array :hash :fun

Re: tip: case insensitive test

2017-11-07 Thread Brad Gilbert
The way to add `:i` to regex without using `m` is to include it inside of the regex `/:i abcdef/` On Fri, Nov 3, 2017 at 5:30 PM, ToddAndMargo wrote: > Dear List, > > Okay, I am pretty sure there are no copyrights here. > > I had a problem where I had to read through a YUGE log file and > pick ou

Re: Self invoked anonymous functions with no outer scoped ???

2017-12-08 Thread Brad Gilbert
Let's say this keyword throws away everything in the lexical scope, except for what you declare sub compute-G (\a, \b, \c) { my \d = only-use ( a, b, &infix:<+>, &infix:<*>, &infix:<**> ) { a + b * 2 ** 3 } … return g; } I think that would get old real qui

Re: Using HashBags

2018-04-08 Thread Brad Gilbert
You can do the following my %b is BagHash = … or my %b := bag … On Sun, Apr 8, 2018 at 10:54 AM, Vittore Scolari wrote: > I answer myself: with % you get an Hash > > On Sun, Apr 8, 2018 at 5:53 PM, Vittore Scolari > wrote: >> >> Wouldn't here be better to use the % sigil? >> >> my %doc

Re: I need `dir` help

2018-05-10 Thread Brad Gilbert
On Thu, May 10, 2018 at 7:02 PM, ToddAndMargo wrote: > On 05/10/2018 04:56 PM, Brandon Allbery wrote: >> >> I think you'll need to provide a better explanation of what you're trying >> to accomplish. I can think of lots of ways to do useful things with the >> output of dir(), but have no idea whic

Re: any better explanation of look ahead assertions

2018-05-10 Thread Brad Gilbert
On Thu, May 10, 2018 at 8:13 PM, ToddAndMargo wrote: > Hi All, > > Looking at: > https://docs.perl6.org/language/regexes#Lookahead_Assertions > https://docs.perl6.org/language/regexes#Lookbehind_assertions > > I can't tell heads from tails. Does anyone know of a better > reference/explana

Re: any better explanation of look ahead assertions

2018-05-10 Thread Brad Gilbert
On Thu, May 10, 2018 at 9:09 PM, ToddAndMargo wrote: > On 05/10/2018 07:06 PM, Brad Gilbert wrote: >> >> You could read how they work in PCRE > > > What is PCRE? Perl Compatible Regular Expressions, Basically someone reimplemented the regular expression engine found

Re: my keeper on random numbers

2018-05-26 Thread Brad Gilbert
On Sat, May 26, 2018 at 10:59 PM, ToddAndMargo wrote: > On 05/26/2018 05:10 AM, Brian Duggan wrote: >>> >>> To convert to an positive integer, use truncate: >>> $ p6 'say 1000.rand.truncate;' >>> 876 >> >> >> or use pick: >> >> perl6 -e 'say (^1000).pick' >> 209 >> >> Brian > > > Hi Bria

Re: An operation first awaited

2018-05-28 Thread Brad Gilbert
Comments inline. On Mon, May 28, 2018 at 2:02 AM, Norman Gaywood wrote: > T""his simple program creates a thread to read a directory with dir() and > place the files on a channel. $N worker threads read that channel and > "process" (prints) the files. But I'm getting this "An operation first > aw

Re: <> question

2018-06-03 Thread Brad Gilbert
On Sun, Jun 3, 2018 at 3:08 PM, ToddAndMargo wrote: > On 06/03/2018 11:01 AM, Brandon Allbery wrote: > >> Is there something missing in the examples at the link? >> > > Well, a bit. When I see > > chmod 0o755, ; > > I think `myfile1` and `myfile2` are "functions", not > data. > They aren't,

Re: need second pair of eyes

2018-06-03 Thread Brad Gilbert
You can use q[./] instead of \'./\' (especially useful so that it will work on both Windows and Unix But in this case it is even better to use -I and -M p6 -I. -MRunNoShell -e '( my $a, my $b ) = RunNoShell::RunNoShell("ls *.pm6"); say $a;' On Sun, Jun 3, 2018 at 4:47 PM, ToddAndMar

Re: need second pair of eyes

2018-06-03 Thread Brad Gilbert
It's -I. not -I On Sun, Jun 3, 2018 at 5:05 PM, ToddAndMargo wrote: > On 06/03/2018 02:54 PM, Brad Gilbert wrote: >> >> You can use q[./] instead of \'./\' >> (especially useful so that it will work on both Windows and Unix >> >> But in this case

Re: mixin syntax: does vs but

2018-06-12 Thread Brad Gilbert
On Tue, Jun 12, 2018 at 12:55 PM, Joseph Brenner wrote: > Thanks, both your suggestion and JJ Merelo's work, but I think I like > yours for readability: > > # # using binding, suggested by JJ Merelo > # my @y := @x but LookInside; > > # suggested by Elizabeth Mattijsen l...@dijkmat.nl > m

Re: stackoverflow vs the world (and perl6-users)

2018-06-12 Thread Brad Gilbert
On Tue, Jun 12, 2018 at 1:19 PM, Joseph Brenner wrote: > 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 stackoverflo

Re: mixin syntax: does vs but

2018-06-12 Thread Brad Gilbert
On Tue, Jun 12, 2018 at 2:16 PM, JJ Merelo wrote: > This is what the documentation says: https://docs.perl6.org/syntax/WHAT > You can override it, but we'll pay no attention anyway, basically. So you > can't achieve it otherwise, I guess. It is easy to achieve. sub user-made-what ( ::Type )

Re: stackoverflow vs the world (and perl6-users)

2018-06-12 Thread Brad Gilbert
On Tue, Jun 12, 2018 at 2:29 PM, The Sidhekin wrote: > > > On Tue, Jun 12, 2018 at 9:18 PM, Brad Gilbert wrote: >> >> On Tue, Jun 12, 2018 at 1:19 PM, Joseph Brenner wrote: >> > Attention conservation: it's unlikely I'm going to say something >>

Re: stackoverflow vs the world (and perl6-users)

2018-06-12 Thread Brad Gilbert
On Tue, Jun 12, 2018 at 2:42 PM, Brandon Allbery wrote: > On Tue, Jun 12, 2018 at 3:38 PM Brad Gilbert wrote: >> >> > The barrier is non-existent. >> >> I have only ever heard about speculated and imagined barriers. > > > This is not proof that such barr

Re: stackoverflow vs the world (and perl6-users)

2018-06-12 Thread Brad Gilbert
On Tue, Jun 12, 2018 at 3:57 PM, Brandon Allbery wrote: > I replied to this one in private, but I want to make a point in public as > well. > > On Tue, Jun 12, 2018 at 4:24 PM Brad Gilbert wrote: >> >> The barrier is not with Stack Overflow. (←What I obviously meant) >

Re: How do I remove leading zeros?

2018-06-13 Thread Brad Gilbert
On Wed, Jun 13, 2018 at 1:09 PM ToddAndMargo wrote: > > On 06/13/2018 11:06 AM, ToddAndMargo wrote: > > On 06/13/2018 11:03 AM, ToddAndMargo wrote: > >> On 06/13/2018 11:00 AM, Larry Wall wrote: > > > $ p6 'my $x = "01.000.103.006.10"; $x ~~ s:g/«0+)>\d//; say "$x"' > > 1.0.103.6.10 > > Hi

Re: using run

2018-06-21 Thread Brad Gilbert
:out can take an argument On Wed, Jun 20, 2018 at 10:32 AM Theo van den Heuvel wrote: > > Hi all, > > trying to make sense of the documentation on run: > https://docs.perl6.org/routine/run. > In particular the last part. I don't understand the adverbs :out and : > err there. > Can I set it up so

Re: Bailador vs. Cro

2018-07-09 Thread Brad Gilbert
Bailador is based on Perl 5's Dancer which is based on Sinatra (Ruby). (bailador is spanish for dancer) Cro on the other hand was designed specifically around the features that are in Perl 6. This can make things more intuitive for someone proficient in Perl 6. It might also make it easier to expl

Re: MAIN subroutine

2018-07-19 Thread Brad Gilbert
The MAIN sub executes after the mainline. After all should MAIN be called before or after do-it('2') in the following? sub do-it(Str $string) { say $string; } do-it("1"); multi sub MAIN() { say "This is MAIN so this should print after the mainline"; } do-it

Re: Force integers in an array?

2018-08-06 Thread Brad Gilbert
> my Int @a; > @a[0] = '1' Type check failed in assignment to @a; expected Int but got Str ("1") in block at line 1 On Mon, Aug 6, 2018 at 3:39 PM ToddAndMargo wrote: > > Hi All, > > Is there a way to force all the members of an array > to be integers and to error out is a non-integer > is wri

Re: A comparison between P5 docs and p6 docs

2018-09-12 Thread Brad Gilbert
The signatures in the docs are often the exact same signatures as the code they are documenting. > Str.^lookup('contains').candidates.map: *.signature.say (Str:D: Cool:D $needle, *%_) (Str:D: Str:D $needle, *%_) (Str:D: Cool:D $needle, Cool:D $pos, *%_) (Str:D: Str:D $needle, I

Re: Multibyte string in Windows command line

2018-09-13 Thread Brad Gilbert
On Thu, Sep 13, 2018 at 7:22 AM WFB wrote: > > Hi all, > > My perl6 runs an executable and prints its output. This output is printed as > multibyte string. I assume the executable gives back a multibyte string and > perl6 interpret its as one byte string for whatever reasons. > I tried Run with

Re: how do I do this index in p6?

2018-09-13 Thread Brad Gilbert
On Thu, Sep 13, 2018 at 11:52 PM Todd Chester wrote: > > >> Le jeu. 13 sept. 2018 à 23:12, ToddAndMargo >> > a écrit : > >> > > > >> $ p6 'constant c=299792458; say c ~" metres per second";' > >> 299792458 metres per second > >> > >> Hm. Now I am wond

Re: .new?

2018-09-14 Thread Brad Gilbert
On Fri, Sep 14, 2018 at 6:19 AM Todd Chester wrote: > > > > On 09/14/2018 03:34 AM, Simon Proctor wrote: > > I think the docs of objects (sorry on my phone no link) describe object > > creation and the default new quite well. > > They most probably are and most developers would have no issues > fi

Re: .kv ?

2018-09-14 Thread Brad Gilbert
You can read https://en.wikipedia.org/wiki/Option_type for more information Tell me if you find any of the Perl 6 section confusing. https://en.wikipedia.org/wiki/Option_type#Perl_6 On Fri, Sep 14, 2018 at 6:21 AM Todd Chester wrote: > > >> On Fri, Sep 14, 2018 at 7:08 AM Todd Chester >>

Re: need p5/p6 :: help

2018-09-14 Thread Brad Gilbert
lexical means it is only available within that scope, or in sub-scopes { my $a; { $a = 42; } } $a # error { sub foo (){} # my sub foo (){} # identical { foo(); } } foo() # error --- Note that sub foo (){} is really short for my only sub f

Re: need p5/p6 :: help

2018-09-14 Thread Brad Gilbert
On Fri, Sep 14, 2018 at 7:10 PM ToddAndMargo wrote: > > On 09/14/2018 04:37 PM, Brandon Allbery wrote: > > > "{$x}::{$y}" > > Most of my programming before Perl 5 was bash. I > did a lot of "${x}abc" to keep the variables > from being confused with each other. > > I carried the practice over to

  1   2   3   >