Re: my zenity adventure

2023-03-26 Thread Timo Paulssen via perl6-users
Hey Todd, Its likely that because you are using the shell sub the < and > characters have been interpreted by the shell to mean redirection. Check for odd files in your working directory that have the text you saw zenity output in them, and perhaps there is even a file with heat the capital

Re: the MAIN questions

2021-12-29 Thread Timo Paulssen
Hey marc, since the default value for a "Bool" is an undefined Bool, you can just boolify whatever happens to be in :$diff, which will be False for "no flag passed" or True for "flag passed and was True". Hope that helps   - Timo On 29/12/2021 13:00, Marc Chantreux wrote: hello rakoons, I

Re: dimensions in a multidimensional array

2021-02-05 Thread Timo Paulssen
Shaped Arrays and Native Shaped Arrays already use one contiguous blob to store all their data; in Shaped Arrays that's an array of pointers to the stored objects, in a Native Shaped Array it'll be like a big array of 32bit integers or whatever you have. Regards   - Timo On 05/02/2021 16:48,

Re: msi of 2020.10?

2020-12-02 Thread Timo Paulssen
Hi todd, please give this a try:     https://setxkbmap.de/rakudo-2020-11-windows-32bit.zip good luck! btw I forgot you wanted 2020.10 so I just made 2020.11. And I assumed you wanted a 32bit build, since that was what I remember you wanted last time? HTH   - Timo On 02/12/2020 22:39,

Re: Missing NullPointerException

2020-12-02 Thread Timo Paulssen
On 02/12/2020 17:18, William Michels via perl6-users wrote: Does this explain why calling "dd" in the REPL returns Nil on the final line, but Nil doesn't seem to be returned on the final line when using "dd" from the Bash shell? user@mbook:~$ raku -e 'dd "0123456789";' "0123456789"

Re: Metamodel parent and return values ...

2020-10-30 Thread Timo Paulssen
On 30/10/2020 07:58, Paul Procacci wrote: Here is what I have ... trimmed. # use JSON::Pretty; use Staticish; unit class MyClass is Static; method client(::?CLASS:D: Str:D $service! --> MyClass) {         my %data := from-json

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

2020-10-10 Thread Timo Paulssen
On 10/10/2020 23:21, William Michels via perl6-users wrote: > So I guess the first question I have is whether the 'auto-joining' of > array elements is specc'ed or not. > > What you seem to be saying is that when calling a function on an > array, the first response is for Raku to call something

Re: zef: too many files in ~/.raku/short

2020-08-08 Thread Timo Paulssen
Hi Fernando, do you happen to have the exact error message? The simplest search through the zef source didn't find anything related, so perhaps it was actually "too many open files" caused by a too-low limit on open file descriptors? `ulimit -a` on my system gives me `Maximum number of open file

Re: Raku version of "The top 10 tricks of Perl one-liners" ?!?

2020-07-22 Thread Timo Paulssen
Try it with a very filled folder, though. I would expect the majority of the time spent is setup and actually going through the lines themselves isn't very slow. On 22/07/2020 22:31, Aureliano Guedes wrote: > That is a little bit disappointing: > > $ time ls -l | perl -lane 'print "$F[7] $F[1]"'

Re: I cannot install any lib with Zef

2020-07-21 Thread Timo Paulssen
I would assume the ffi, tommath, atomic_ops, and uv linker flags come straight from moarvm's linker flags, probably because the build script of Digest::SHA256::Native uses the flags used to compile moarvm itself. If you've compiled your moarvm yourself, this is a safe bet; these libraries are

Re: junctions and parenthesis

2020-06-24 Thread Timo Paulssen
On 22/06/2020 20:12, Joseph Brenner wrote: > > Speculating wildly: could there be a need for a different type of > function with different precedence? I would suggest calling .any on the list, that gives you just the tight preference you want; even if there were no .any method available on the

Re: fill in form

2020-05-13 Thread Timo Paulssen
00:47, ToddAndMargo via perl6-users wrote: > >> Hi All, > >> > >> I want to create a fill in form in Windows: city, > >> state, etc., you fill in the data. > >> > >> Is there some library out there for that? > >> > >> Any w

Re: fill in form

2020-05-12 Thread Timo Paulssen
Hi Todd, normally I'd expect you want to create a grid with labels on the left and text inputs on the right. the examples/ folder in the GTK::Simple distribution (or the source on github) has an example of the Grid class, which is very powerful. The grid is possibly more complicated than you

Re: NativeCall questions

2020-05-08 Thread Timo Paulssen
Hi David, the first thing that catches my eye is that your struct and the class have the members switched around, so you're already almost guaranteed to read a bogus pointer when trying to get the data. Also, please note that returning structs directly, or passing structs directly, as arguments

Re: subst :g and captures in the replacement

2020-04-19 Thread Timo Paulssen
Hi Yary, in the first example you've got a WhateverCode, but in the second one you're actually just passing a string to subst, i.e. you're evaluating $0 before subst is even called. Check this as well: > raku -e '"whoa" ~~ /(.)/; say \'fosdffgg\'.subst(/(f+)/,"( $0 )", :g)' > ( w )osd( w )gg

Re: OAuth2?

2020-03-23 Thread Timo Paulssen
The link was just missing a "../" at the beginning. The example code lives here:     https://github.com/tbrowder/Google-API-Client/blob/master/eg/get-calendar-data.p6 Hope that helps   - Timo On 23/03/2020 04:34, ToddAndMargo via perl6-users wrote: > On 2020-03-22 16:43, Tom Browder wrote: >>

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

2020-03-05 Thread Timo Paulssen
Hi William, The line that has the important difference is where you put a `my` in front of `%stash{'monsters'} = @monsters`. Probably a copy-paste error or something like that. >> my %stash> {}>> my @monsters = <> fingfangfoom>> tingler>>> [godzilla grendel wormface blob fingfangfoom tingler]>>

Re: Question about Blob and Buf

2020-02-11 Thread Timo Paulssen
On 11/02/2020 14:14, David Santiago wrote: > Awesome explanation! Thank you! > > BTW, >> my Blob $read = Buf.new; > Is it creating either a Blob or a Buf? > > Regards, > David Santiago Hi David, "my Blob $read" will define the variable $read to 1) only accept things that typecheck against

Re: Question about Blob and Buf

2020-02-11 Thread Timo Paulssen
On 11/02/2020 10:56, David Santiago wrote: > Hi! > > Can someone explain me why this doesn't work: > > my Blob $read; > $read ~= $socket.read(1024); > > Dies with error: > > X::Buf::AsStr: Cannot use a Buf as a string, but you called the Stringy > method on it > > This also doesn't work: > > my

Re: printf question

2020-02-10 Thread Timo Paulssen
Hi Paul and Todd, just a little extra info: the limitation for nameds to come after positionals is only for declarations of signatures. Usage of subs/methods as well as capture literals (which you don't use often, i imagine, so feel free to disregard) allow you to mix nameds and positionals

Re: NQPMu ??

2020-01-09 Thread Timo Paulssen
Yes, native integers/nums don't work in the REPL (that's any uint or int with number after it, or num32 or num64 or num or int or long etc). On 09/01/2020 19:16, ToddAndMargo via perl6-users wrote: > On 2020-01-09 10:11, ToddAndMargo via perl6-users wrote: >> Hi All, >> >> What am I doing wrong

Re: rmdir question

2019-12-03 Thread Timo Paulssen
On 03/12/2019 04:46, Paul Procacci wrote: > On success it return a Bool::True. > On failure it throws an exception. > It doesn't crash the program. > If you are interested in handling the exception, add logic to handle it. > > Examples: > --- > # mkdir a ; `which perl6` -e

Re: Quoting issue in Windows

2019-11-30 Thread Timo Paulssen
On 30/11/2019 09:05, ToddAndMargo via perl6-users wrote: > One of the weirdest was > > for @Result.kv -> $I, $Line { >    if $I % 2 = 0 > > being told I could not change an immutable object. Here you're trying to assign 0 to the result of $I % 2, if that's actually exactly the code. You want

Re: split to walk into an HoH ?

2019-11-22 Thread Timo Paulssen
Hi Marc, here's a one-liner based on the classify method, which you may find to be an interesting jumping-off-point, or centerpiece: perl6 -e 'use JSON::Fast; my %foo = lines()>>.trim-leading.classify(*.split(",").head(2)); say to-json %foo'     A,1,garbage .     A,2,garbage .    

Re: getting comb to return match objects

2019-11-16 Thread Timo Paulssen
if there might be an issue with > "comb" signatures in general. There exists both a '(Str) routine comb' > and a '(Cool) routine comb'. Maybe these two routines are somehow > interfering with each other? > > Thank you, and any further help appreciated, Bill. > > >

Re: getting comb to return match objects

2019-11-16 Thread Timo Paulssen
Hi Bill, In your repl examples you're actually passing the True or False as a positional parameter, which makes it go into the slot for $limit, not the slot for :$match. In order to pass true or false for the "match" named parameter you have different syntactical options:   comb(/\w/, "a;b;c",

Re: FC31 can't find my module subs

2019-11-04 Thread Timo Paulssen
Todd, can you please double-check if putting a comma in between the :import-tags in the "use" statement makes a difference? Like this: # perl6 -I./p6lib -e 'use ModuleTest :ModuleTest, :ModuleTst; ModuleTest; ModuleTst; # correct' # perl6 -I./p6lib -e 'use ModuleTest :ModuleTest :ModuleTst;

Re: Typed Pairs

2019-09-05 Thread Timo Paulssen
You can try defining a subset type a bit like this: subset StrArrStrsPair of Pair where .key ~~ Str && .value ~~ Positional[Str]; Please be aware that the arrays have to be explicitly created with the type constant of Str for this to work. On 5 September 2019 14:34:05 CEST, Mikkel wrote:

Re: is inlinable trait missing from docs

2019-07-13 Thread Timo Paulssen
Timmerman wrote: > On 7/13/19 12:37 PM, Timo Paulssen wrote: >> I wouldn't put "is inlinable" in the docs; it requires the user to put a >> QAST tree in the value, which isn't a thing an end-user would touch, >> IMO. In fact I'm not sure why we have a trait for tha

Re: is inlinable trait missing from docs

2019-07-13 Thread Timo Paulssen
I wouldn't put "is inlinable" in the docs; it requires the user to put a QAST tree in the value, which isn't a thing an end-user would touch, IMO. In fact I'm not sure why we have a trait for that at all, since it's not used anywhere in rakudo's source. On 13/07/2019 12:33, Marcel Timmerman

Re: Odd Complex behavior

2019-06-14 Thread Timo Paulssen
that it would come up at just the right time to ruin your day :( On 14/06/2019 00:28, Elizabeth Mattijsen wrote: We could potentially give 0e0 and -0e0 the same .WHICH, which would solve the bag issue. On 13 Jun 2019, at 21:02, Timo Paulssen wrote: Unfortunately, that's what the IEEE prescribes, so

Re: Odd Complex behavior

2019-06-13 Thread Timo Paulssen
Unfortunately, that's what the IEEE prescribes, so all we can really do is: *shrug* On 13/06/2019 21:01, Sean McAfee wrote: On Thu, Jun 13, 2019 at 11:12 AM Brad Gilbert > wrote:     > (-i).reals     (-0 -1) Ah, so it's nothing particular to Complex: > bag

Re: LogP6 not working as I expect

2019-05-10 Thread Timo Paulssen
Hi Patrick, It could be that compile time is too early for the logger object to properly be set up; try to see if "my \Log" instead of "constant Log" fixes it, then we can perhaps find a better solution that still has "constant" (for example a feature request for LogP6) Kind Regards   - Timo

Re: Short term Zef fix

2019-04-30 Thread Timo Paulssen
Doesn't updating zef to the latest version fix everything up nicely?   - Timo On 30/04/2019 12:06, Simon Proctor wrote: > Until the p6c system is fixed here's a short term fix that will at > least let zef install modules from cpan. > > zef --help > This lists a config file mine is : > >

Re: library search path ?

2019-04-29 Thread Timo Paulssen
you can use these one-liners:     perl6 -e '.say for $*REPO.repo-chain'     perl6 -e '.perl.say for $*REPO.repo-chain' On 29/04/2019 00:33, ToddAndMargo via perl6-users wrote: > Hi All, > > Could not find xxx::yyy at line zz in: >     file#/home/linuxutil/p6lib >     inst#/home/tony/.perl6 >    

Re: Something happened to the chat line

2019-04-28 Thread Timo Paulssen
I'm just about to go to bed, but you can use this link instead (i think what was there before was just a redirect anyway):     https://webchat.freenode.net/?channels=#perl6 HTH   - Timo On 29/04/2019 00:38, ToddAndMargo via perl6-users wrote: > Hi All, > > Going to > >    

Re: Why so slow

2019-04-28 Thread Timo Paulssen
ast    :   0.000 Stage optimize   :   0.351 Stage mast   :   1.133 Stage mbc    :   0.019 Stage moar   :   0.000 GetUpdates.pl6  <-- my program starts here Mozilla Mirror Debug is OFF The "Stage parse : 13.150" is eating me alive! -T On 4/28/19 12:01

Re: Why so slow

2019-04-28 Thread Timo Paulssen
b.com/perl6/gtk-simple/blob/master/examples/05-bars.pl6 >> >> To check it out and it also takes ten second to start. >> >> What gives? >> >> Many thanks, >> -T On 4/27/19 11:14 PM, Timo Paulssen wrote: You don't happen to have a PERL6LIB or -I pointed at a fo

Re: Why so slow

2019-04-28 Thread Timo Paulssen
You don't happen to have a PERL6LIB or -I pointed at a folder with loads of stuff in it? If that is the case, having a single "use" statement will cause rakudo to iterate through all files and subfolders, which can take a long time if you've got, for example, your home directory in that list

Re: gtk widget?

2019-04-22 Thread Timo Paulssen
Please check out Marcel Timmermann's GTK::Glade module. Here's the readme: https://github.com/MARTIMM/gtk-glade Sadly, modules.perl6.org is currently not available, however, you can download the distribution here: https://www.cpan.org/authors/id/M/MA/MARTIMM/Perl6/gtk-glade-0.8.3.tar.gz or you

Re: Why so slow?

2019-04-22 Thread Timo Paulssen
;>>> One liners are fast, but my own programs are very slow to start. >>>> >>>> I download >>>> >>>> https://github.com/perl6/gtk-simple/blob/master/examples/05-bars.pl6 >>>> >>>> To check it out and it also takes ten secon

Re: Why so slow?

2019-04-22 Thread Timo Paulssen
It's quite possible that when you start that program, you're first waiting for GTK::Simple to be precompiled; the "use lib 'lib'" can interfere with the storage of precompilation results. If you have installed GTK::Simple (for example by going to its folder and running "zef install .") and removed

Re: perl6.org down and documentation

2019-04-21 Thread Timo Paulssen
Hi mimosinnet, we have a fallback live on http://docs.perl6.wakelift.de/ for the docs and http://perl6.wakelift.de/ for the main website. There is an outage somewhere near the server that hosts all our sites. We'll be able to get physical access and fix whatever's wrong on tuesday. I'm not sure

Re: .payload

2019-02-28 Thread Timo Paulssen
NotifyStr\"" ); >>> } >>> >>> >>> But keep pulling the following error: >>> >>>   No such method 'payload' for invocant of type >>>   'X::TypeCheck::Assignment' in block >>>   at ./GetUpdates.pl6 line 60 >

Re: .payload

2019-02-28 Thread Timo Paulssen
As you can see from the routine page for "payload":     https://docs.perl6.org/routine/payload it only exists on X::AdHoc, which if you follow the link "from X::AdHoc" explains:     X::AdHoc is the type into which objects are wrapped if they are thrown as exceptions, but don't inherit from

Re: Typed Arrays and for-loops

2019-02-13 Thread Timo Paulssen
You could use the @ sigil for your files variable, too. Then you can just "for @files". There's two ways to get that to work: my Str @files = "Test", "Test 2"; or my @files := Array[Str].new("Test", "Test 2"); Hope to help   - Timo On 13/02/2019 13:29, Mikkel wrote: > Hello. (recurring

Re: subs and variables speed question

2019-02-11 Thread Timo Paulssen
> On 2/11/19 3:27 AM, Timo Paulssen wrote: > > WHICH doesn't give you a numerical value. just print it as it is. > > > $ p6 'sub a (Buf $b) { say $b.WHICH }; my $c = Buf.new(1,2,3); say > $c.WHICH; a($c);' > Buf|71848984 > Buf|71848984 > > If "moarvm has a

Re: subs and variables speed question

2019-02-11 Thread Timo Paulssen
Please be aware that WHERE will give you the actual memory address of an object, but moarvm has a moving garbage collector, which means that objects can change their memory location. at the moment it will only happen up to two times, i believe. you'll probably have a better result with .WHICH for

Re: filever.exe sub?

2019-02-01 Thread Timo Paulssen
On 01/02/2019 01:33, Bruce Gray wrote: > To call those Windows APIs in Perl 6, you would use NativeCall. > Don't forget that Todd wanted to use this on non-windows with not-wine. NativeCall on linux won't run windows code all by itself. That said, wine is still a good source for info on how

Re: I need m/ help

2019-01-13 Thread Timo Paulssen
CUNEIFORM NUMERIC SIGN NINE U VARIANT FORM On 13/01/2019 09:42, ToddAndMargo via perl6-users wrote: > On 1/12/19 3:04 PM, Timo Paulssen wrote: >> On 12/01/2019 23:40, ToddAndMargo via perl6-users wrote: >>> But this does not.  What is wrong with (<:N>**2)  ? >>> >&g

Re: I need m/ help

2019-01-12 Thread Timo Paulssen
On 12/01/2019 23:40, ToddAndMargo via perl6-users wrote: > But this does not.  What is wrong with (<:N>**2)  ? > > $ perl6 -e 'my Str $Date=DateTime.now.Str; $Date~~m/ (<:N>**4) "-" > (<:N>**2) "-" (<:Nl>**2) "T" .* /; print "$Date\n\t$0  $1  $2\n"' > Use of Nil in string context >   in block at

Re: Exactly what is type match?

2018-12-21 Thread Timo Paulssen
> Like this? > > $ p6 'my $x="11.2."; my Str $D0; my Str $D1; $x~~m{ (<:N>+) > [.] > (\d+)}; $D0 ~= $0; $D1 ~= $1; print "$D0 $D1\n";' > > 11 2 > There's an important difference between "$D1 ~= $0" and "$D1 = ~$0". They only do the same thing if $D0 (and $D1) are empty at that point; if they

Re: Exactly what is type match?

2018-12-21 Thread Timo Paulssen
On 21/12/2018 20:38, ToddAndMargo via perl6-users wrote: > $ p6 'my $x="11.2."; my Str $D0; my Str $D1; $x~~m{ (<:N>+) [.] (\d+) > }; $D0 ~$0; $D1 ~ $1;  print "$D0 $D1\n";' > WARNINGS for -e: > Useless use of "~" in expression "$D1 ~ $1" in sink context (line 1) > Useless use of "~" in

Re: wxWidgets nativecall

2018-11-27 Thread Timo Paulssen
I haven't looked at wxwidgets with perl6, and the last time I used it was with python many moons ago. But I think the "AST converter" you're refering to is probably App::GPTrixie - https://github.com/Skarsnik/gptrixie If you have more questions, feel free to ask on the mailing list, or on Stack

Re: How to use sub/method 'dir'

2018-11-24 Thread Timo Paulssen
The dir method gives you entries in the directory you pass. If you don't pass a test it'll use the default test which is none(".", ".."), i.e. "anything except . and ..". I'm not sure why using { .IO.d } as the test would not give you b, though. Can you check what "a/b".IO.d outputs? Maybe that

Re: sub name has unexpected interaction with s///

2018-10-23 Thread Timo Paulssen
Hi Richard, I wouldn't call s/// a routine. It's actually (implemented as) a kind of quote, like Q, q, qq, qw, and also rx, and tr. I consider that an important distinction, because the syntax with which you call s/// is very different from how you call a sub. You can't just `say '(' ~ ')' 1234`,

Re: Testing Was: Appropriate last words

2018-10-21 Thread Timo Paulssen
u there, and not some random exception like "file not found". On 21/10/2018 10:32, Richard Hainsworth wrote: > How does this answer the question about testing? > > Ok so there is code, but where do I go to find what that code is? > Where in the Rakudo repo would I start looking,

Re: Testing Was: Appropriate last words

2018-10-21 Thread Timo Paulssen
https://docs.perl6.org/language/variables#index-entry-%24%2AEXIT this should help you get to where you want to be. Someone™ can feel free to open up a ticket on the doc repository that the routine page for exit doesn't have a link to or explanation of &*EXIT. HTH   - Timo

Re: Run tests only if a module is available

2018-10-11 Thread Timo Paulssen
I'd go with run-time loading and if the module doesn't exist, just "flunk" or "skip" or what Test.pm6 offers. Here's a link that explains checking if a module is installed and loading it if it is:     https://rakudo.org/post/lexical-require-upgrade-info Hope that helps!   - Timo On 11/10/2018

Re: Use of the --output flag

2018-10-09 Thread Timo Paulssen
--output is for the compiler's compilation stages for example: > timo@schmand ~> perl6 --output=/tmp/outputtest --target=mbc -e 'say "hi"' > timo@schmand ~> moar --dump /tmp/outputtest | head > > MoarVM dump of binary compilation unit: > >   SC_0 : B1DFAD9164F11E967B354508CC458ABAB8DEDC27 >  

Re: routine declaration line question

2018-10-05 Thread Timo Paulssen
You're probably thinking of ;; in a signature. On 05/10/2018 20:02, Trey Harris wrote: > But right now we have a situation where “everything within the > signature /except for/ the return constraint can participate in multi > dispatch”, which does feel weird. But is that actually true? >

Re: bitwise or?

2018-10-05 Thread Timo Paulssen
It's important to point out that inside metaoperators ("composed operators", "combined operators", ...) the [ ] are just for bracketing things together — sometimes it's needed to disambiguate, but you can put it in anyway to make things clearer. This has nothing to do with [+] 1, 2, 3, which is a

Re: routine declaration line question

2018-10-03 Thread Timo Paulssen
I just spotted a grave mistake in my earlier mail: the --> constraints are validated at *run* time, not *compile* time; that's a very big difference, and an important one. Of course "every time a sub or method returns" doesn't make much sense if i had meant "compile time", but I felt i should

Re: What are the official names?

2018-10-02 Thread Timo Paulssen
I just saw that this was already kind of answered in the other thread, sorry about that!

Re: What are the official names?

2018-10-02 Thread Timo Paulssen
On 03/10/2018 01:50, ToddAndMargo wrote: > On 10/2/18 4:47 PM, David Green wrote: >> On 2018-10-02 4:06 pm, ToddAndMargo wrote: >>> What is the official Perl syntaxland name of the [] subroutine? >> If you search for "[]" at https://docs.perl6.org, it will turn up the >> routine "postcircumfix [

Re: need doc help with []

2018-10-02 Thread Timo Paulssen
Hi Todd, On 03/10/2018 02:14, ToddAndMargo wrote: > sub postcircumfix:<[ ]>(@container, **@index, >     :$k, :$v, :$kv, :$p, :$exists, :$delete) > > 1  Why the <[]>?  I have always used [] with out the <>. >    Why would I want to use one over the other? > > 2)  Where does it

Re: Could this be any more obscure?

2018-09-26 Thread Timo Paulssen
You're still missing that the words method doesn't "take the [2,4]". The operation that [2,4] does takes place after the words() thing has already done its work. You could actually say that every method takes [0]. Try it! Your confusion looks a bit similar to seeing     multi sub exp(Cool:D

Re: Ping Larry and Friends: Need NativeCall help

2018-09-18 Thread Timo Paulssen
Hey Todd, XLib is indeed very difficult to use even from C, and Perl 6 alone doesn't help terribly much. However, there is a library called xcb that is meant to give you what XLib has, but less terrible. I haven't used it myself, nor really looked at it, but I hear it's much less painful. Hope

Re: need p5/p6 :: help

2018-09-14 Thread Timo Paulssen
It's important for the PrintRed sub inside PrintColors to be declared "our", otherwise it is "my" scoped, i.e. limited to the lexical extent of the module file. On 14/09/2018 12:59, Todd Chester wrote: > Hi All, > > I am in the process of converting a YUGE program I wrote in > Perl 5 to Perl 6. 

Re: I need -M help

2018-09-14 Thread Timo Paulssen
The equivalent of "use lib 'blah'" on the commandline is "-I blah", just like "-M bloop" is the equivalent of "use 'bloop'" in code. HTH   - Timo On 14/09/2018 12:52, Todd Chester wrote: > Hi All, > > With a one liner, how to I load a module that resides in the > current directory? > > $ ls

Re: .new?

2018-09-14 Thread Timo Paulssen
The doc website creates the pages under "routine/" by collecting every type's methods and relevant subs of that name and putting them all on a page. It's a very unfortunate accident that the one for Telemetry::Sampler ends up at the top, because right below that is the one for Mu, which is the

Re: how do I do this index in p6?

2018-09-11 Thread Timo Paulssen
On 11/09/18 17:11, yary wrote: > "Nil... it's a constant, so you have to use =:= to check for equality." > > Can you elaborate on that requirement? == works for an equality checks > with numeric constants- must be more than Nil's constant-ness that > makes one use =:= - perhaps that Nil doesn't

Re: Please explain this to me

2018-09-11 Thread Timo Paulssen
On 11/09/18 12:50, ToddAndMargo wrote: > On 09/11/2018 03:09 AM, ToddAndMargo wrote: >> multi method contains(Str:D: Cool:D $needle, Int(Cool:D) $pos) > > What the heck (not my exact word) is "multi method"? > > What is wrong with calling it a "function"? Multi Methods are methods that do

Re: Please explain this to me

2018-09-11 Thread Timo Paulssen
On 11/09/18 12:38, Curt Tilmes wrote: > > On Tue, Sep 11, 2018 at 6:27 AM ToddAndMargo > wrote: > > method ($a: @b, %c) {};       # first argument is the invocant > > > I might say rather that $a is a parameter for the invocant.  The @b > parameter holds all the

Re: Please explain this to me

2018-09-11 Thread Timo Paulssen
On 11/09/18 12:18, JJ Merelo wrote: > > > El mar., 11 sept. 2018 a las 12:15, Timo Paulssen ( <mailto:t...@wakelift.de>>) escribió: > > The colon at the end of "Str:D:" signifies that it's a type > constraint on what you call the method on. For ex

Re: "contains" beginning, end?

2018-09-07 Thread Timo Paulssen
It does not, but there are methods .starts-with and .ends-with that probably do what you need. HTH   - Timo On 08/09/18 02:00, ToddAndMargo wrote: > Hi All, > > Does "contains" have options for "at the start of" and > "at the end" of matches? > > > Many thanks, > -T

Re: A grammar to provide substitution

2018-08-29 Thread Timo Paulssen
I should point out that the trans method has a mode that lets you pass placeholders and substitutions and it will Do The Right Thing regarding overlaps and order and everything. On 29/08/18 16:21, Timo Paulssen wrote: > There's a problem with your code, if any of the substitutions conta

Re: A grammar to provide substitution

2018-08-29 Thread Timo Paulssen
There's a problem with your code, if any of the substitutions contains something that looks like the placeholder thing, and if it comes later in the iteration of the hash keys (which is randomized now) it will substitute again. This is very likely not what you want, though. HTH   - Timo On

Re: How do I test my substitutions?

2018-08-14 Thread Timo Paulssen
You're putting your starting string in a variable, $x, but aren't telling the s/// operator specifically what to operate on, so it defaults to $_, which is still at its default value. On 14/08/18 13:08, ToddAndMargo wrote: > Hi All, > > The Perl 5 guys have it pounded into my head that I >

Re: I need the rules for running modules from the command line

2018-08-14 Thread Timo Paulssen
Please be aware that passing a folder with many files in it as the -I path will cause a tremendous slowdown when loading modules, since it goes through the whole file hierarchy starting at that path. If /home/linuxutil is actually a typical home folder with dotfiles and documents and what have

Re: I need the rules for running modules from the command line

2018-08-14 Thread Timo Paulssen
You can just put -I lib on your commandline, but what's more important is that you forgot to pass -e, so it was taking your code and interpreting it as a filename. It's very unlikely that you have a file called 'PrintBlue( "Blue\n" );' in the current directory, though. perl6 -Ilib -MPrintColors

Re: Special token names, or my mistake

2018-08-12 Thread Timo Paulssen
The grammar will never by itself try to call a subroutine, it only looks for methods in the action object. However, there is a "sum" method that An-Action inherits from Any. You can find it here: https://github.com/rakudo/rakudo/blob/master/src/core/Any.pm6#L440 It's probably a good idea to put

Re: string to integer?

2018-08-07 Thread Timo Paulssen
oops, i only now saw the thread you had about it. never mind, then! On 07/08/18 15:31, Timo Paulssen wrote: > dd is a function that outputs a value, and dd returns Nil. You're > assigning the result of dd to $x, which resets the variable to its > default value, which is the (Str) you

Re: string to integer?

2018-08-07 Thread Timo Paulssen
dd is a function that outputs a value, and dd returns Nil. You're assigning the result of dd to $x, which resets the variable to its default value, which is the (Str) you see, i.e. an undefined String. Just throw out the dd, you don't need it to stringify things, only the ~ or + prefix is

Re: need regex help

2018-08-03 Thread Timo Paulssen
any number of times, but at least once, and the $ at the end, together with the ^ at the start, ensures that every character in the string has to match, not just any character. Hope that makes sense   - Timo On 03/08/18 20:04, ToddAndMargo wrote: > On 08/02/2018 05:18 AM, Timo Paulssen wrote: &g

Re: need regex help

2018-08-02 Thread Timo Paulssen
Is this what you want? perl6 -e 'say "12345" ~~ /^<+alnum -alpha>+$/' 「12345」 perl6 -e 'say "123a45" ~~ /^<+alnum -alpha>+$/' Nil HTH   - Timo

Re: parsing in different modes

2018-08-01 Thread Timo Paulssen
Hello Theo, have you considered placing the code for the actions directly inside the grammar's tokens and rules instead? You can just { make 123 } right in the middle and it'll have the same effect as doing that in an action method, but you'll be able to put code after it, too. HTH   - Timo

Re: EVAL?

2018-06-14 Thread Timo Paulssen
If it's literally just the name of a sub that you'll immediately invoke, you can side-step EVAL completely     ::('&' ~ $RunSpecific)() should do the trick. ::("") will give you the sub object, and putting () after it will immediately call it. It will allow access to all subs, even from the

Re: mixin syntax: does vs but

2018-06-12 Thread Timo Paulssen
You can override WHAT with a method, you just have to use a syntax that's not literally .WHAT, like this:     class Test { method WHAT() { say "i'm here" } }; Test."WHAT"();     # → i'm here

Re: need second pair of eyes

2018-06-12 Thread Timo Paulssen
My recommendations:     if $line.contains(all("wine-patched/archive/staging-/", ".tar.gz")){ }     # if the path has to be at the beginning and the extension at the end,     # which your original regex doesn't require, but it's probably right     if

Re: need sort help

2018-06-09 Thread Timo Paulssen
The magic trick is that the last line in the code block is the return value. when you pass a function that takes a single argument (in this case just the $_) to sort, it will call your function for every element in the input array and use the result of that function to sort the elements by. The

Re: need sort help

2018-06-08 Thread Timo Paulssen
your list @x has only a single item, because you're slurping the whole file contents into it. replacing slurp with lines should do the trick. On 09/06/18 07:23, ToddAndMargo wrote: > On 06/08/2018 09:51 PM, Timo Paulssen wrote: >> That's unnecessarily long and complicated, here's how y

Re: need sort help

2018-06-08 Thread Timo Paulssen
If you want to make it robust in the case of fields being different length, like having entries with the day as "5" instead of "05", you can put a >>.Int after the .comb(/\d+/) and that'll give you proper numeric sorting for all fields regardless of width. On 09/06/18

Re: need sort help

2018-06-08 Thread Timo Paulssen
That's unnecessarily long and complicated, here's how you can do it much easier:     @x.sort: {     my ($month, $day, $year, $hour, $minute, $second) = .comb(/\d+/);     ($year // 0, $month // 0, $day // 0, $hour // 0, $minute // 0, $second // 0, $_);     } Trying it on some input data:

Re: Need match character help

2018-05-18 Thread Timo Paulssen
On 18/05/18 13:30, The Sidhekin wrote: > On Thu, May 17, 2018 at 12:51 PM, Timo Paulssen <t...@wakelift.de > <mailto:t...@wakelift.de>> wrote: > > character classes are fundamentally the wrong thing for "phrases", > since they describe only a charac

Re: Need match character help

2018-05-17 Thread Timo Paulssen
ably leads to an infinite loop (the regex engine tries to make you proud by matching it as often as it possibly can. which if the assertion is true, is infinitely often. it is very diligent, but it does not really think much about what it does). Hope that helps   - Timo On 17/05/18 12:51, Tim

Re: Need match character help

2018-05-16 Thread Timo Paulssen
On 16/05/18 00:10, ToddAndMargo wrote: > What would the syntax be for d..z, but not g or m? You can subtract [gm] from [d..z] like this:     say "c" ~~ /<[d..z]-[gm]>/;     say "d" ~~ /<[d..z]-[gm]>/;     say "f" ~~ /<[d..z]-[gm]>/;     say "g" ~~ /<[d..z]-[gm]>/;

Re: number of letters question

2018-05-16 Thread Timo Paulssen
That is absolutely correct, thanks!

Re: number of letters question

2018-05-15 Thread Timo Paulssen
I'd suggest combing for the regex instead of combing and then grepping with the regex: say + "abcrd-12.3.4".comb(//); though from the problem question it sounds a lot more like what todd wants is     my $input = "abcrd-12.3.4";     my $letters = $input.comb(/<[a..z]>/);     my $numbers =

Re: Need match character help

2018-05-15 Thread Timo Paulssen
On 15/05/18 14:03, ToddAndMargo wrote: > On 05/15/2018 04:49 AM, ToddAndMargo wrote: >> Hi All, >> >> This should be a "no".  What am I doing wrong? >> >> $ perl6 -e 'my $x="rd"; if $x~~/<[rc]+[a]+[b]+[.]>/ {say >> "yes"}else{say "no"}' >> yes >> >> >> Many thanks, >> -T > > And how do I turn this

  1   2   3   >