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: 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

Re: Ping Larry Wall: excessive compile times

2022-08-29 Thread Brad Gilbert
-us...@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 Moose or

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

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: 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-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

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

Re: Order of multi sub definitions can resolve dispatch ambiguity

2021-09-25 Thread Brad Gilbert
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} ){ factorial(n - 1) * n } (The rea

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

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

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

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: 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:

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

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

2021-03-13 Thread Brad Gilbert
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 was looking for: > > Brad Gilbert wrote: > > > You can put it back in as a name

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: >

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: 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,

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: 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

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: 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: Checking for nil return

2020-12-28 Thread Brad Gilbert
Nil and not its Failure descendents? > > This example under https://docs.raku.org/type/Nil shows what I think is a > less-than-awesome specification, and I am curious about the reasoning > behind it being defined as valid > > sub a( --> Int:D ) { return Nil } > > > > -

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-us...@perl.org> wrote: >

Re: Checking for nil return

2020-12-20 Thread Brad Gilbert
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, 2020, 8:17 PM yary wrote: > Is this a known issue, or my misunderstanding? > > > subset non-Nil where * !=== Nil; > (non-Nil) > > sub out-check($out) returns non-Nil {

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-us...@perl.org> wrote: > Yeah, right. $FruitStand.apples is not a direct

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-us...@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: 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

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

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-us...@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: 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

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

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

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: "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

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: 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

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

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

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

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

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

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

2020-07-28 Thread Brad Gilbert
; star > start > startl > startli > startlin > startling > user@mbook:~$ raku -ne '.put if /star/ ff /start/ ;' startling.txt > star > start > startl > startli > startlin > startling > user@mbook:~$ > > I'm all in favor of improving the "ff" and &qu

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-us...@perl.org> wrote: > Hello, > > I'm trying to learn the "ff" (flipflop) infix

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

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

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: 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: 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

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-us...@perl.org> wrote: > I evaluated Joe's code using Patrick's explanation of

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

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: regex interpolation of array

2020-06-13 Thread Brad Gilbert
int \im, int \monkey, $, $, \context, *%_) > in block at line 1 > > > 'TrueFalse' ~~ / <{ Bool.say }> / > (Bool) > > say $*VM > moar (2020.02.1) > > exit > mbook:~ homedir$ perl6 --version > This is Rakudo version 2020.02.1..1 built on MoarVM v

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: 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: 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

Re: I need help testing for Nil

2020-05-26 Thread Brad Gilbert
t; >> 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 at -e line 1 > &g

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

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

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

Re: I do not understand method":"

2020-05-25 Thread Brad Gilbert
gt; >> 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 the `:` do? > >

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

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: 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: *%_ -->

Re: Raku -npe command line usage

2020-05-08 Thread Brad Gilbert
The 「@i」 is defined within the 「BEGIN」 block, so it is scoped to the 「BEGIN」 block. If you didn't want that, don't use a *block* with 「BEGIN」. BEGIN my @i; Also you wrote the 「if」 wrong. There shouldn't be a 「;」 before the 「if」. You also don't need to use 「$_ ~~ 」 with 「/^WARN/」 as that

Re: readchars, seek back, and readchars again

2020-04-24 Thread Brad Gilbert
In UTF8 characters can be 1 to 4 bytes long. UTF8 was designed so that 7-bit ASCII is a subset of it. Any 8bit byte that has its most significant bit set cannot be ASCII. So multi-byte codepoints have the most significant bit set for all of the bytes. The first byte can tell you the number of

Re: sleep 3600 vs task scheduler

2020-04-07 Thread Brad Gilbert
Run code once an hour: react whenever Supply.interval(60 * 60) { say "it's been an hour" } Right now that gets about 0.01 seconds slower every time the interval runs. (At least on my computer.) So it will get 1 second later every 4 days. Or if you want more precise control, you

Re: How to read a particular environmental variable?

2020-04-07 Thread Brad Gilbert
Of course %*ENV is case sensitive, hashes are case sensitive. say %*ENV.^name; # Hash %*ENV gets populated with the values before your code runs. Other than that it is fairly ordinary. On Tue, Apr 7, 2020 at 7:20 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > >> On Tue,

Re: Can a sub be released?

2020-04-07 Thread Brad Gilbert
You do NOT want to use `fork`. MoarVM has several threads that are running, and `fork` doesn't handle that. A simple way is to just use the `start` statement prefix sub child-process () { sleep 2; say 'child says hi' } say 'starting child'; start child-process();

Re: unflattering flat

2020-04-06 Thread Brad Gilbert
[*] is also a meta prefix op say [*] 4, 3, 2; # 24 But it also looks exactly the same as the [*] postfix combination of operators my @a = 1,2,3; say @a[*]; # (1 2 3) There is supposed to be one that looks like [**] my @b = [1,], [1,2], [1,2,3]; say @b[**]; # (1 1 2 1 2

Re: How do I open Raku in the background?

2020-03-30 Thread Brad Gilbert
There is a bit in the executable that tells windows to open a terminal. If you copy the executable to say rakudo_no_terminal.exe and change that bit in the copy, then Windows won't show you a terminal. On Mon, Mar 30, 2020 at 8:14 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: >

Re: perl6 vs ruby

2020-03-05 Thread Brad Gilbert
There isn't currently a way to compile to a single file, but there was a GSOC project that started on it. On Thu, Mar 5, 2020, 7:17 AM Aureliano Guedes wrote: > I have another question for you. Maybe it must be better done in another > thread... > But, there is a way to compile Raku code in a

Re: PCRE -> Perl 6 RE

2020-02-18 Thread Brad Gilbert
The \p{L} syntax is done by using :L inside of <> instead /\p{L}/ /<:L>/ You can combine them /[\p{L}\p{Z}\p{N}]/ /<:L + :Z + :N>/ Character classes are also done inside of <> /[_.:/=+\-@]/ /<[_.:/=+\-@]>/ They of course can also be combined with the previous

Re: Metamethods: WHERE

2020-02-12 Thread Brad Gilbert
If you want to find out if two variables are bound to the same data, there is an operator for that my $a = 3; my $b = 3; say $a =:= $b; # False my $c := $b; say $b =:= $c; # True On Wed, Feb 12, 2020 at 7:27 AM Aureliano Guedes wrote: > Thank you. > > So, I'd like to find

Re: Question about Blob and Buf

2020-02-11 Thread Brad Gilbert
The problem is that you are using ~ with an uninitialized Buf/Blob my Buf $read; $read ~ Buf.new; # Use of uninitialized value element of type Buf in string context. Note that it is not complaining about it being a Buf. It is complaining about it being uninitialized. If you

Re: Hash Constraints w/in subset's

2020-02-01 Thread Brad Gilbert
I wouldn't use a subset like this: subset PhoneBook of Hash[Int, Str]; I would instead use a constant: constant PhoneBook = Hash[Int, Str]; Then you can use that for creating new instances. PhoneBook.new(); # Hash[Int, Str].new() # or my %pb is PhoneBook; # my Int

Re: troubles with with base(2)

2020-01-20 Thread Brad Gilbert
Why would you think that? The numeric binary xor operator is +^. my $v = 0b00101101 +^ 0b1001; say $v.base(2); # 100100 ^ is the junctive xor operator. my $v = 1 ^ 2 ^ 'a'; $v eq 'a'; # True $v == 1; # True $v == 2; # True $v == 3; # False There is also the stringy

Re: Using raku/perl6 as unix "cat"....

2020-01-20 Thread Brad Gilbert
.say for lines On Mon, Jan 20, 2020 at 1:59 AM William Michels via perl6-users < perl6-us...@perl.org> wrote: > Hi Yary (and Todd), > > Thank you both for your responses. Yary, the problem seems to be with > "get". I can change 'while' to 'for' below, but using 'get' raku/perl6 > actually

Re: definition confusion of + and +^

2020-01-18 Thread Brad Gilbert
Most operators in Raku are subroutines. 1 + 2 infix:<+>( 1, 2 ) -1 prefix:<->( 1 ) You can add your own operators by creating such a subroutine. sub postfix: ( UInt \n ) { [×] 2..n } say 5!; # 120 Because it is so easy to add operators. Operators only do one thing.

Re: Bug to report: cardinal called an integer

2020-01-13 Thread Brad Gilbert
Ok looking into it, zero is inside of the set of cardinal numbers. It is still wrong to call a uint a cardinal number. It's just wrong for a different reason. Looking through various definitions, a cardinal number is a number which represents a count of sets. So a uint could be used to

Re: Bug to report: cardinal called an integer

2020-01-13 Thread Brad Gilbert
According to the description you copied, a cardinal can never be zero. any of the numbers that express amount, as one, two, three, etc. So it is more accurate to call it an integer. On Mon, Jan 13, 2020 at 1:32 AM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > On

Re: How do I convert integer to cardinal on the fly?

2020-01-07 Thread Brad Gilbert
my int16 $x = 0xABCD; my uint16 $y = $x; say $x.base(16); say $y.base(16) -5433 ABCD If you just want to coerce to uint16 (my uint16 $ = $x) say (my uint16 $ = $x).base(16) On Tue, Jan 7, 2020 at 10:20 AM ToddAndMargo via perl6-users <

Re: null and native call question

2019-12-27 Thread Brad Gilbert
A Null pointer is just a pointer that points to the address 0. So if you are dealing with it as an integer it will be 0. On Fri, Dec 27, 2019 at 6:06 AM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > Hi All, > > https://docs.perl6.org/language/nativecall > > "As you may

Re: about 'use v6.d'

2019-12-13 Thread Brad Gilbert
There should probably be a way to require a minimum version of the compiler. use rakudo v2019.07; On Fri, Dec 13, 2019, 3:14 AM MT wrote: > Hello all, > > In the light of renaming to Raku I was wondering if the statement 'use > v6.*' is still useful. > > First there is no version 6 of Raku

Re: Precedence: assignment vs smartmatch? (...was Re: where is my map typo)

2019-12-09 Thread Brad Gilbert
e gets assigned > to $/ and LHS "probe" gets overwritten with appropriate "substitution" > characters between second two solidi of s/// or S/// : > ( "match" --> $/ ) ; ( RHS_"substitution" --> "probe" ) ; > > [ 4.

Re: How do I do literal quotes in a regex?

2019-12-08 Thread Brad Gilbert
I like to use them, but I am not you. On Sun, Dec 8, 2019 at 8:19 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > On 2019-12-08 18:04, Brad Gilbert wrote: > > I do not quite understand the question. > > > > I told you how to directly enter unicode b

Re: How do I do literal quotes in a regex?

2019-12-08 Thread Brad Gilbert
, Dec 8, 2019 at 6:46 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > On 2019-12-08 06:22, Brad Gilbert wrote: > > Personally though I just use 「Ctrl+Shift+u f f 6 2 Space」 and > > 「Ctrl+Shift+u f f 6 3 Space」 > > > > Hi Brad, > &g

Re: pass by reference

2019-12-08 Thread Brad Gilbert
Either use `rw` or `raw` Use `rw` if you need it to be mutable. Use `raw` if you just want to make sure you are getting the actual variable. That really only applies to `$` parameters though. --- `@` and `%` parameters are `raw` already. sub pop-random( @_ ) { @_.splice(

Re: Perl6 vs Julia

2019-12-08 Thread Brad Gilbert
>> The belief that Yet Another Programming Language is the answer to the >> world's problems is a persistent, but (IMNSHO) a naive one. Some people might think that applies to Raku. Not me, but some people. On Sun, Dec 8, 2019 at 2:09 PM Parrot Raiser <1parr...@gmail.com> wrote: > Who initiated

Re: Precedence: assignment vs smartmatch? (...was Re: where is my map typo)

2019-12-08 Thread Brad Gilbert
ence of the > > smartmatch operator relative to either lowercase-triple-solidus > > operators such as s/// and tr/// , or relative to > > uppercase-triple-solidus operators such as S/// and TR/// ? > > > > This really makes me wonder if anyone has plans to add "~~"

Re: How do I do literal quotes in a regex?

2019-12-08 Thread Brad Gilbert
; ( my $y = $x ) ~~ s/ Q[\\] /x/; say $y > > \:\\:: > > > > Nor does this: > > my $x = Q[\:\\::]; ( my $y = $x ) ~~ s/ [\\] /x/; say $y > > x:\\:: > > > > Many thanks, > > -T > > On 2019-12

Re: Precedence: assignment vs smartmatch? (...was Re: where is my map typo)

2019-12-07 Thread Brad Gilbert
The return value of s/// is the same as $/ If you want the resulting string instead you can use S/// instead. > $_ = 'abc' > my $r = S/b/./ > say $r a.c Note that it warns you try to use S/// with ~~ > my $r = 'abc' ~~ S/b/./ Potential difficulties: Smartmatch

Re: How do I do literal quotes in a regex?

2019-12-07 Thread Brad Gilbert
The shortcut spelling of Q[…] is to use 「 and 」 (U+FF62 and U+FF63) my $x = 「\:\\::」; ( my $y = $x ) ~~ s/ 「\\」 /x/; say $y \:\\:: The case could be made that \Q[\\] should work as well. (It would need to be added). (Along with \q[…] and \qq[…]) Note that \Q[…] doesn't work in string

Re: comment on the new name change

2019-12-06 Thread Brad Gilbert
History lesson: Rakudo is short for Rakuda Do Rakuda Do is supposed to have meant "the way of the camel" The first book about Perl was Learning Perl. It had a Camel on the front cover. (Note also that the name of the butterfly logo is named Camelia, and that the first 5 characters spell Camel.)

Re: which windows am I in?

2019-11-23 Thread Brad Gilbert
Windows before Windows 10 had different internal and external numbers. https://www.gaijin.at/en/infos/windows-version-numbers On Sat, Nov 23, 2019, 2:03 AM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > On 2019-11-22 23:41, ToddAndMargo via perl6-users wrote: > > Hi All, > > > >

Re: Question about "colon syntax" for calling other methods on 'self' inside a method

2019-11-19 Thread Brad Gilbert
$ by itself is a an anonymous state variable. So these two lines would be exactly the same. $.foo (state $).foo A feature was added where $.foo would instead be used for public attributes. Since a public attribute just adds a method, it was allowed to use it to call any method. Which

Re: processing a file in chunks

2019-10-22 Thread Brad Gilbert
CatHandle is the mechanism behind $*ARGFILES. If you want to read several files as it they were one, you can use IO::CatHandle. my $combined-file = IO::CatHandle.new( 'example_000.txt', *.succ ... 'example_010.txt' ); Basically it works similar to the `cat` command-line utility. (Hence its

Re: What is a LoweredAwayLexical?

2019-10-22 Thread Brad Gilbert
The optimizer can lower lexical variables into local variables. When it does so, it keeps track of this so that it can give you this error message. The `given` block and the `when` blocks are optimized away. If you move the first `$a` declaration to inside the `given` block the error goes away.

Re: order of execution

2019-10-21 Thread Brad Gilbert
Programs are compiled in memory, it just isn't written out to disk. On Mon, Oct 21, 2019 at 3:33 AM Marcel Timmerman wrote: > @yary > > Thanks for your answer. I've done it too and saw the same kind of result. > But then I thought I've read it somewhere that programs are not compiled, > only

  1   2   3   >