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 05:02, Norman Gaywood wrote: > One question I have is what is the first | for? It was probably easy to miss, but the explanation was in the first mail I wrote. Feel free to reply again if you have more questions about this point, though. >> * you are allowed to put a | not only

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 <mailto:t...@wakelift.de>> wrote: > > character classes are fundamentally the wrong thing for "phrases", > since they describe only a character. > > >   You

Re: Need match character help

2018-05-17 Thread Timo Paulssen
r assertion makes no sense and probably 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 help

Re: Need match character help

2018-05-17 Thread Timo Paulssen
character classes are fundamentally the wrong thing for "phrases", since they describe only a character. Your current regex (before changing [gm] to ["gm"]) was expressing "from the start of the string, there's any amount of characters d through z (but neither g nor m) and then the end of the stri

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 = $input.

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

Re: Need match character help

2018-05-15 Thread Timo Paulssen
On 15/05/18 13:49, 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 what you've put in your regex here is a character class combined of four individual

Re: Slides for "8 ways to do concurrency and parallelism in Perl 6"?

2018-04-11 Thread Timo Paulssen
https://jnthn.net/papers/2018-conc-par-8-ways.pdf Here you go! :) Taken from this tweet: https://twitter.com/jnthnwrthngtn/status/983817396401180672 HTH   - Timo

Re: Junctions now being stringified as one alternative per line?

2018-02-26 Thread Timo Paulssen
on.gist" will stay the way it is, either. Sorry for the improper information before   - Timo On 25/02/18 17:04, Timo Paulssen wrote: > > That was the behaviour before those commits. It was explicitly changed > to how it works now, I believe. > > > On 25/02/18 16:54, yary wr

Re: Junctions now being stringified as one alternative per line?

2018-02-25 Thread Timo Paulssen
gt; > On Sun, Feb 25, 2018 at 11:48 AM, Timo Paulssen <mailto:t...@wakelift.de>> wrote: > > That's right. Say will also call .gist on what you pass to it, but > say doesn't declare that it handles junctions, so before it can > call .gist on what it g

Re: Junctions now being stringified as one alternative per line?

2018-02-25 Thread Timo Paulssen
and the result will be re-combined into a junction again. On 25/02/18 12:05, yary wrote: > I don't have Rakudo handy, is the answer to "how to make junctions > show as Sean expects" > > say $junction.gist ; > > ? > > -y > > On Sat, Feb 24, 2018

Re: Junctions now being stringified as one alternative per line?

2018-02-24 Thread Timo Paulssen
I'm pretty sure you're running up against this change in rakudo: https://github.com/rakudo/rakudo/blob/master/docs/ChangeLog#L203 >     + Made print/say/put/note handle junctions correctly [07616eff] >    [9de4a60e][8155c4b8][3405001d] the relevant commits being: https://github.com/rakudo/ra

UDP Datagram API, an RFC

2018-02-17 Thread Timo Paulssen
Hello Perl6 users, I've recently been made aware of a hole in our UDP support: you can't get the source address and port of datagrams you receive, which is an integral part of the UDP experience. I've sketched out a piece of code to implement passing address and port from moarvm to rakudo, but I'

Re: Error Handling with IO::Socket.:Async::SLL

2017-10-16 Thread Timo Paulssen
It took me a while, but I just found jnthn's automatic retry code for supply-based things again. It's in these slides http://jnthn.net/papers/2017-perl6-concurrency-pcp.pdf on page 83 You'll want to use "supply" instead of "react" for your server and pass that to the auto-retry function.

Re: Perl 6 Object Construction - General Advice

2017-10-05 Thread Timo Paulssen
The main difference between BUILD and TWEAK is that BUILD will replace all default and requiredness handling, while TWEAK keeps it intact. TWEAK gets run after these aspects had their turn, so if you have an "is required" attribute that doesn't get a value passed, the BUILDALL process will throw th

Re: Perl 6 Object Construction - General Advice

2017-10-01 Thread Timo Paulssen
I wrote another more in-depth (but potentially less useful to you) mail about this further down the thread, but I thought it'd be good to point this out near the top: I think the /self.bless(|%args)!initialize/ idiom is a work-around for /submethod TWEAK/ not yet existing when this code was writte

Re: Perl 6 Object Construction - General Advice

2017-10-01 Thread Timo Paulssen
Here's the internal details of the guts: BUILDALL has so far been sort of an interpreter for something called the "buildplan". When a class gets composed (usually what happens immediately when the parser sees the closing } of the class definition) all attributes are considered along with their def

Re: Tip: assign a value to a hash using a variable as a key

2017-09-30 Thread Timo Paulssen
This doc page should help you a lot with this topic: https://docs.perl6.org/language/subscripts#Basics

Re: Need append help

2017-09-29 Thread Timo Paulssen
On 09/29/2017 09:27 PM, ToddAndMargo wrote: > $ perl6 -e 'my $x="abc"; $x [R~]= "yyz"; say $x;' > Potential difficulties: >     Useless use of [R~]= in sink context >     at -e:1 >     --> my $x="abc"; $x ⏏[R~]= "yyz"; say $x; > yyzabc This is the correct one. The warning about "useless use" h

Re: -f ???

2017-09-29 Thread Timo Paulssen
> This sounds broken, actually; I understand that a Failure treated as > a Bool > prevented it from throwing, so it should have simply returned > False. > > Checking it for .defined *does* prevent throwing. Still seems like a > bug. It doesn't get "treated as a Bool"; any Failure makes it through

undeclared variables inside double-quoted string lwas: Re: Need a second pair of eyes]

2017-09-26 Thread Timo Paulssen
On 26/09/17 04:26, Brandon Allbery wrote: > On Mon, Sep 25, 2017 at 10:23 PM, ToddAndMargo > wrote: > > On 09/25/2017 07:25 AM, Brandon Allbery wrote: > > So as to make this not entirely content-free: I would suggest > that the string language note

Re: Need a second pair of eyes

2017-09-25 Thread Timo Paulssen
> Second itteration: > > > #!/usr/bin/env perl6 > > say "Full file name <$?FILE>"; > > my $IAm; > my $IAmFrom; > > $?FILE ~~ m|(.*\/)(.*)|; > $IAmFrom = $0; > $IAm = $1; > say "IAm    <$IAm>"; > say "IAmFrom    <$IAmFrom>"; > Please don't use string functions on paths; doing it

Re: help with map and regexp

2017-09-19 Thread Timo Paulssen
You'll have to type the $_ of the block as "is copy" if you want to do this. Another way would be to have "is rw" but that can of course only work if a container is present in what you map over; there isn't in this case.     perl6 -e '.perl.say for "hello, how, are, you".split(",").map: -> $_ is c

Re: What is P6 for P5 `use Term::ReadKey`?

2017-09-16 Thread Timo Paulssen
On 16/09/17 05:19, ToddAndMargo wrote: > On 09/13/2017 01:36 PM, Trey Harris wrote: >> L1 is an “ordinary method” (denoted, obviously enough, with the >> declarator |method|), which as described in the Typesystem >> doc, “defines >> objects of ty

Re: what am I doing wrong here?

2017-09-14 Thread Timo Paulssen
You're reaching deep into rakudo's internals here, reaching an object that doesn't know about pretty much any methods you might want to have, and there's also no support for them in things like the ~~ operator, for example. You're getting the error because you're calling ~~ with the NQPRoutine obj

Re: takeWhile ?

2017-09-11 Thread Timo Paulssen
the first expression uses ^ as a prefix operator on *, so it gives you "a list of numbers 0 through * - 1" instead of "the number *" to compare against *, so it's as if you had rounded the value up before comparing to 2.

Re: takeWhile ?

2017-09-11 Thread Timo Paulssen
If I understand your problem correctly, you can simply use ...^ to leave out the last element :) On 09/11/2017 10:01 PM, Marc Chantreux wrote: > hello, > > doing maths with my kid, i just translated his spreadsheet with those > lines of haskell: > > rebonds height loss = height : rebonds (h

Re: What is P6 for P5 `use Term::ReadKey`?

2017-09-09 Thread Timo Paulssen
The important part of the page is actually the one titled "Waiting for potential combiners". You'll want to either use binary encoding instead of utf8 (the default) or use an encoding that doesn't have combiners, like latin1 or ascii. > Problem: also from the link: > > method getc(IO::Handle:

Re: What is P6 for P5 `use Term::ReadKey`?

2017-09-09 Thread Timo Paulssen
This should be enlightening: https://docs.perl6.org/routine/getc

Re: zef install --/test cro

2017-08-31 Thread Timo Paulssen
Scratch that, the openssl docs say ERR_load_error_strings(), SSL_load_error_strings() and ERR_free_strings() are available in all versions of SSLeay and OpenSSL. So maybe it's a different ssl implementation that provides libssl.so ?!?! On 08/31/2017 02:21 PM, Timo Paulssen wrote:

Re: zef install --/test cro

2017-08-31 Thread Timo Paulssen
The error for a missing libssl.so looks like Cannot locate native library 'libwhatevenisthis.so': libwhatevenisthis.so: cannot open shared object file: No such file or directory so in this case the library can be found but the symbol SSL_load_error_strings isn't in it. it might be an incompat

Re: Floating point Num addition produces rationals?

2017-08-29 Thread Timo Paulssen
Here's a C program that simulates exactly how rakudo creates nums from strings and shows the same problem: https://gist.github.com/zoffixznet/46ae8dd7d85096d58dc557f60f82a179 Here's an IRC conversation with the author of the post you linked to followed by investigation and discovery of this probl

Re: Floating point Num addition produces rationals?

2017-08-29 Thread Timo Paulssen
This is an insidious bug rooted in how we parse floating point numbers, combined with a caching-related problem that causes the order of 0.1e0 vs 1e-1 to matter for all further outcomes. I wasn't able to find a ticket for this in our bug tracker, but it most definitely is something we will fix.

Re: another one liner

2017-08-04 Thread Timo Paulssen
Sorry, i typo'd ifconfig | perl6 -e 'lines.grep(/flags/).map(*.words[0]).sort[1].chop' On 08/05/2017 05:41 AM, ToddAndMargo wrote: > On 08/04/2017 08:14 PM, Timo Paulssen wrote: >> ifconfig | perl6 -e 'lines.grep("flags").map(*.words[0]).sort[1].chop&#

Re: another one liner

2017-08-04 Thread Timo Paulssen
ifconfig | perl6 -e 'lines.grep("flags").map(*.words[0]).sort[1].chop' this should do the trick. i'm not sure if 2,2p is meant to "output just the second result" and if it's okay to just unconditionally remove the last character. hth - Timo

ignore my previous mail [was: Re: how do you pipe to perl6?]

2017-08-04 Thread Timo Paulssen
Should have read the other threads first where this was answered by others

Re: how do you pipe to perl6?

2017-08-04 Thread Timo Paulssen
This is not what you meant to do: $ echo -e "abc\ndef\nghi" | perl6 -e 'my @y = split "\n", lines; say @y.perl ["abc def ghi"] the lines sub already gives you a list of lines that perl6 gets fed, you're calling split on that array that then gets coerced to a string (which joins the lines with spa

Re: Need sub for `LWP::UserAgent`

2017-07-28 Thread Timo Paulssen
there's an example in the readme that goes like this: my $curl = LibCurl::Easy.new(:verbose, :followlocation); the followlocation part should be right for you

Re: Need sub for `LWP::UserAgent`

2017-07-28 Thread Timo Paulssen
If you use the other interface where you create a curl object a la LibCurl::Easy.new, you can just $my_curl_object.Host("the-host.com"); $my_curl_object.referer("example.com"); $my_curl_object.cookie("the-cookie"); $my_curl_object.useragent("me"); hth - Timo

Re: Need sub for `LWP::UserAgent`

2017-07-28 Thread Timo Paulssen
Did you not see this part of the readme? # And if you need headers, pass them inside a positional Hash: say post 'https://httpbin.org/post?foo=42&bar=x', %(:Some), :some, :42args;

Re: : question

2017-07-28 Thread Timo Paulssen
This article uses httpbin.org which is a nice service that'll take any kind of request and tell you exactly what it saw. It shows what it got as a json dictionary literal. Here's an example for your browser, so you can just click it: http://httpbin.org/anything?hello-todd-how-are-you=very-go

Re: : question

2017-07-28 Thread Timo Paulssen
The first one is valid perl 6 code and the bottom one is not. It's likely you were looking at JSON (or equivalently JavaScript) and confused that with perl6 code.

Re: Bi-directional communication with another process

2017-07-27 Thread Timo Paulssen
We have Proc::Async which removes the need for the select call itself

Re: Bi-directional communication with another process

2017-07-27 Thread Timo Paulssen
You'll want to just pass :in and then use "$cat.in.print($input); $cat.in.close;" We just had a thread about this on reddit with zoffix and me weighing in: https://www.reddit.com/r/perl/comments/6pwqcy/how_do_i_interact_with_a_shell_program_using_perl/ On 07/28/2017 01:49 AM, Norman Gaywood

Re: Announce: Rakudo Star Release 2017.07

2017-07-25 Thread Timo Paulssen
Were there any failures before the "Building NQP ..." step? Somehow the moarvm that's packaged with the rakudo star didn't end up getting installed into your .local/bin, so you're getting the previous version, which - unsurprisingly - isn't new enough for current NQP and Rakudo.

Re: set (+) set = bag ?

2017-07-21 Thread Timo Paulssen
You want (|) to get the union of two sets as a set. https://docs.perl6.org/language/setbagmix#Set%2FBag_Operators hth - Timo

Re: Memory usage

2017-07-20 Thread Timo Paulssen
On 19/07/17 21:52, Gabor Szabo wrote: > Hi, > > is it possible to get the size of memory used by the current Perl 6 > process? (From inside the code) > Is it possible to get the size of the individual variables? > > Gabor I'm not aware of something cross-platform that rakudo offers for memory use

Re: Why is my class rejecting new()?

2017-07-20 Thread Timo Paulssen
On 20/07/17 11:51, Mark Carter wrote: > > I have a class definition: > > class Etran { > has $.dstamp is rw; > has $.folio is rw; > has $.ticker is rw; > has $.qty is rw; > has $.amount is rw; > has $.desc is rw; > > method new($line) { >

Re: Net::SMTP raw, where is the username and password?

2017-07-10 Thread Timo Paulssen
Did you read my very long post on the Net::SMTP issue you opened?

Re: [retupmoca/P6-Net-SMTP] RFE: attachments (#14)

2017-07-10 Thread Timo Paulssen
On 10/07/17 06:48, ToddAndMargo wrote: > Hi Timo, > > I don't understand. How do you sent this to Net::SMTP? > Where is the SMTP server's address and user name? In > Net::SMTP by chance? > > I have successfully used Net::SMTP before, but I don't get what you > are saying. > > I am confused. :'(

Re: Net::SMTP raw, where is the username and password?

2017-07-10 Thread Timo Paulssen
It seems like you don't know the internals of the SMTP protocol. In that case, it's a bad idea to try to use the raw mode, when the simple mode is much simpler to handle. In the list of simple mode methods you can find the method "auth" that will try the authentication methods the server accepts i

Re: ping TImo: buf as a print

2017-07-09 Thread Timo Paulssen
If you want to look at what the Buf contains, you need to "say $image" or "print $image.gist" or "print $image.perl". If you want to put it into a file, use spurt (which can accept a Buf and realize it's supposed to write out binary), or use the write method on a file handle (best opened with :bin

Re: Net::SMTP is messed up

2017-07-08 Thread Timo Paulssen
The fix is now in rakudo master. HTH - Timo

Re: Net::SMTP is messed up

2017-07-08 Thread Timo Paulssen
This comes from IO::Socket not properly handling non-list values of the nl-in property. This change came in with the recent refactor to make encoders customizable in perl6 code. I'm going to push a fix to rakudo soon. It sounds like you're using a rakudo version that's not an official release? Th

Re: Travis for Perl 6

2017-07-07 Thread Timo Paulssen
Yes, we have deb packages for rakudo that you can use: https://gfldex.wordpress.com/2017/04/14/speeding-up-travis/ hth - Timo

Re: getting help in the REPL

2017-06-14 Thread Timo Paulssen
timo@schmetterling ~> perl6 -e '#| this is sub foo documentation sub foo() { }; say &foo.WHY; say &foo.WHY.WHEREFOR' this is sub foo documentation No such method 'WHEREFOR' for invocant of type 'Pod::Block::Declarator'. Did you mean

Re: getting help in the REPL

2017-06-14 Thread Timo Paulssen
WHY and WHEREFOR are "fully" supported, it's just that we've not put any pod into the core setting and we don't have helper code that loads it "lazily" when WHY is called the first time on a core class or sub …

Re: contains question

2017-06-13 Thread Timo Paulssen
Yup, you can use it as a method call like this: perl6 -e '"foobar".&[~~](/foo/).say' 「foo」 HTH - Timo

Re: ding!

2017-06-02 Thread Timo Paulssen
We have portaudio, which you can write PCM data to, and it'll play.

Re: Creating an array of a single hash

2017-06-01 Thread Timo Paulssen
Yeah, you can use the prefix $ to itemize things, like so: timo@schmand ~> perl6 -e 'my @y = ${ name => "Foo" }; say @y.gist; say @y.^name; say @y[0].^name' [{name => Foo}] Array Hash HTH - Timo

Re: list named argument in MAIN

2017-06-01 Thread Timo Paulssen
It seems like this only works if you supply --dirs= multiple times perl6 -e 'sub MAIN (List :$dirs=[]) { .say for @$dirs }' --dirs=d1 --dirs=d2 --dirs=d3 d1 d2 d3 HTH - Timo

Re: .add missing from IO::Path?

2017-05-28 Thread Timo Paulssen
what version of rakudo are you on?

Re: Task::Star and Panda

2017-05-26 Thread Timo Paulssen
On 05/26/2017 07:28 PM, Will Coleda wrote: > Again, panda is not actually broken. Sounds like it was missing in a > travis > config, but that isn't an issue with panda, per se. It's that almost all travis configs start with "rakudobrew build panda" which now dies, so immediately a whole bunch of m

Re: Are sigils required?

2017-05-26 Thread Timo Paulssen
You can bind an explicitly created scalar into a sigil-less variable and it'll be variable rather than constant

Re: Compiling Rakudo in parallel

2017-05-25 Thread Timo Paulssen
Sadly, the majority of rakudo's and nqp's compilation is serialized (due to the dependencies between the individual pieces). If you build more than one backend at the same time, i.e. moar + jvm, you can build both in parallel. On the other hand, the biggest chunk of time is spent compiling the co

Re: How to pin down a bug in Rakudo?

2017-05-24 Thread Timo Paulssen
Have you considered the effects of lazy evaluation for the hash's values method? .sort will eagerly evaluate the whole .values list (i.e. snapshot it) while iterating over it will include added keys and such.

Re: Task::Star and Panda

2017-05-24 Thread Timo Paulssen
I removed the recommendation to install Task::Star yesterday, so as of writing of your email it shouldn't have been on rakudo's website at least. did you find a reference to Task::Star somewhere else?

Re: Task::Star and Panda

2017-05-23 Thread Timo Paulssen
On 05/23/2017 08:21 PM, ToddAndMargo wrote: > Would substituting "broken" for "stinks" be polite enough? That's wrong, though. You can still install modules with panda, it's not broken, just no longer in development.

Re: Invoking method by name found in variable

2017-05-23 Thread Timo Paulssen
> Funny, first I tried $o.$method() but that did not work. That is syntax for > when you have a method object or other kind of routine stored in your $method variable

Re: Parse a string into a regex?

2017-05-11 Thread Timo Paulssen
The only way that comes to mind is to use EVAL, but that's not golf-friendly at all. Perhaps you can find something sufficiently short based on .contains, .index, .starts-with, .ends-with, and friedns?

Re: Debugging and Perl6::HookGrammar

2017-04-19 Thread Timo Paulssen
Sadly, the debugger has bitrotted a little bit. I tried the obvious fix which was to replace setlang with define_slang, but that just gets it up to the next error, which looks like the behavior of Perl6::Grammar has changed and Perl6::HookGrammar hasn't been updated to match or something. I'll pus

Re: dies-ok can return ok on everything dying

2017-04-18 Thread Timo Paulssen
You will be delighted to learn of the existence of the "throws-like" subroutine in rakudo's Test.pm There's also lots and lots of examples for its usage (and its power!) in perl6/roast. HTH - Timo

Re: write string requires an object with REPR MVMOSHandle

2017-03-29 Thread Timo Paulssen
As part of the IOwesome grant, zoffix is going to fix this error. It's what you get when you try to write to or read from or do anything with a closed IO::Handle. When you use "LEAVE:" you're just declaring a label called "LEAVE". There are no labels with special function, so your code is equivale

Re: gtk::simple progress bar?

2017-03-27 Thread Timo Paulssen
On 03/27/2017 09:40 PM, ToddAndMargo wrote: > Hi All, > > Can GTK::Simple do a progress bar? > > Not seeing an example here: > https://github.com/perl6/gtk-simple/tree/master/examples > > -T > It's not documented, but it's implemented: https://github.com/perl6/gtk-simple/blob/master/lib/GTK/Simpl

Re: What module do I use to create a "windows"?

2017-03-27 Thread Timo Paulssen
On 03/27/2017 09:25 PM, ToddAndMargo wrote: > Hi Timo, > > Thank you! > > Just out of curiosity -- I don't need it now -- is > there a similar module for Windows? > > -T > GTK::Simple is already portable across linux, mac os, and windows. Here's someone who patched zenity so it compiles to windo

Re: What module do I use to create a "windows"?

2017-03-27 Thread Timo Paulssen
Do it with GTK::Simple, or shell out to zenity On 27/03/17 20:52, ToddAndMargo wrote: > Hi All, > > RHEL 7.2 and Fedora 25. > > I would like to create a window that presents the user > with a dynamically generated list for him to choose from, > along with a "next" and a "cancel" button. > > What

Re: "not" question

2017-03-27 Thread Timo Paulssen
On 27/03/17 19:26, ToddAndMargo wrote: > and `none("789")` is the opposite of `contains`? Nah, the fact that anything in the junction means "contains" is just because you're feeding the junction through the contains method. Junction evaluation happens with something we call "autothreading" (even

Re: "not" question

2017-03-27 Thread Timo Paulssen
" }' Yes This uses a "none" junction, which takes part in the whole junction evaluation process, as opposed to the prefix: which just negates a value straight-up and doesn't know it's being used inside a junction. HTH - Timo On 27/03/17 19:11, Timo Paulssen wrote: >

Re: regex and performance question

2017-03-27 Thread Timo Paulssen
Yeah, junctions are super useful, but not very fast. compare these two pieces of code: so "hello how are you today?".contains("hello" & "u t") for ^1_000_000 and my $target = "hello how are you today?"; so $target.contains("hello") && $target.contains("u t") for ^1_000_000 On my machi

Re: "not" question

2017-03-27 Thread Timo Paulssen
!"789" is just False. On 27/03/17 18:53, ToddAndMargo wrote: > Hi All, > > What am I doing wrong in my "AND not 789"? > > $ perl6 -e 'my $x="abc123def456"; > my $y="123"; if $x.contains( $y & "abc" & ! "789" ) > {say "Yes"} else {say "no"};' > > no > > -T >

Re: Failed to open file .. too many open files

2017-03-26 Thread Timo Paulssen
Please use "$.source_dir/authors.txt".IO.lines instead of open + lines. with the former you're expressing you really only want to read all the lines out of the file and be done with it. when you open and then call .lines, you're saying nothing about what you want to do with the file handle afterwar

Re: Failed to open file .. too many open files

2017-03-25 Thread Timo Paulssen
i highly suggest you slurp instead of open + slurp-rest, because that will automatically close the file for you, too. other than that, you can pass :close to the slurp-rest method and it'll also close the file. if you're not closing the files you're opening, you'll be relying on the garbage colle

Re: Can this OR be shortened?

2017-03-25 Thread Timo Paulssen
On 25/03/17 12:53, Tom Browder wrote: > On Fri, Mar 24, 2017 at 10:36 PM, Timo Paulssen wrote: >> I seem to recall you asked about performance recently >> >> the regex engine has a significant overhead. > ... > > Isn't that somewhat mitigated by defining

Re: Can this OR be shortened?

2017-03-25 Thread Timo Paulssen
On 25/03/17 06:15, ToddAndMargo wrote: >> while || tries the left side first, then the right side. >> Basically use | in regexes unless you need ||. > > Would this be the logical AND equivalent? > > if $Terminal ~~ /xterm && linux/ {} > > Thank you! > > -T > There is no &&, but there is &. th

Re: Can this OR be shortened?

2017-03-24 Thread Timo Paulssen
I seem to recall you asked about performance recently the regex engine has a significant overhead. Your regex is equivalent to $Terminal.contains('xterm' | 'linux') though of course if you only test this once at the beginning of the program, you can ignore that.

Re: Question for the developers on splice

2017-03-21 Thread Timo Paulssen
Shifting from the front will just move the "beginning" pointer one slot forwards, and popping will decrease the "element count" number. I'm not sure if splice with an empty "insertion" list that happens to be at the end will also just reduce the number of elements or if it does a bit of unnecessar

Re: debugging modules

2017-03-16 Thread Timo Paulssen
On 03/16/2017 04:44 PM, Theo van den Heuvel wrote: > Earlier I tried using rakudobrew, before I learnt that that was > actually discouraged, > despite comments in doc/perlintro.pdf. I think I made a full clean-up. perl6intro.com, which is where the pdf is generated from, has been updated to no lon

Re: my command line notes:

2017-03-15 Thread Timo Paulssen
On 14/03/17 20:58, ToddAndMargo wrote: > > #!/usr/bin/perl6 > > if not @*ARGS.elems > 0 { say "command line is empty"; exit 0; } > > say "\@\*ARGS has " ~ @*ARGS.elems ~ " elements"; > say " \@\*ARGS = <" ~ @*ARGS ~ ">"; > say " \@\*ARGS.perl = <" ~ @*ARGS.perl ~ ">\n"; > > say "say

Re: Fwd: Re: Variables in modules

2017-03-10 Thread Timo Paulssen
I don't quite understand what's wrong with just my $TheValue = $?FILE.subst(/.* "/"/, "" :g); near the top of your module?

Re: debugging modules

2017-03-10 Thread Timo Paulssen
Heyo, the way the debugger works is by changing the compiler to generate code that communicates with the debugger at every step. That means that if you want a module to be debuggable, it has to be compiled by the debugger's compiler, too. There's apparently currently no way to just force a full

Re: Your thoughts on Padre?

2017-03-09 Thread Timo Paulssen
On 09/03/17 08:29, ToddAndMargo wrote: > https://atom.io/ > > as it is specifically written for Perl 6 Not quite. It's a general-purpose code editor that you could say comes from the javascript corner of programming. However, we do have active devs improving the perl6-related plugins for atom

Re: How to defined reversed word in a perl6 grammar ?

2017-03-09 Thread Timo Paulssen
Hi, Wouldn't it be enough to use something that backtracks? As you might know, "token" is "regex + ratcheting" and "rule" is "token + sigspace". HTH - Timo

Re: issues with

2017-03-09 Thread Timo Paulssen
Hey, X11::Xlib::Raw is buggy. It has to have all modules it uses internally inside its "provides" section in the META6.json, otherwise "use" will not find them. I'll open a ticket with the module author. HTH - Timo On 08/03/17 22:08, ToddAndMargo wrote: > Hi All, > > What is wrong with this?

Re: Variables in modules

2017-03-09 Thread Timo Paulssen
"my" variables are lexically scoped to the curly braces that contain them. That means that your $IAm is limited exactly to that init block. Also, =~ isn't in perl6. You can put "my $IAm" outside that block and assign to it inside the block, though. HTH - Timo

Re: I need the rules for qx with a pipe inside

2017-03-07 Thread Timo Paulssen
> For example: > > sub WriteSecondaryClipboard ( $Str ) { # >my $Cmd = "echo \"$Str\" | xclip -selection clipboard"; > shell $Cmd; > } > > > problem solved. Please don't forget that if $Str can be modified by a user or outside process somehow, you've opened the door to remote code execution

Re: Design question re: function parameters

2017-03-07 Thread Timo Paulssen
On 07/03/17 17:59, Sean McAfee wrote: > […] If I want to freely accept both numbers and strings in the manner > of > Perl 5, it looks like I must type all of my function arguments as > Cool, or omit the types altogether. […] Don't forget you can use a coercive type in parameter lists: sub po

Re: program/script question

2017-03-07 Thread Timo Paulssen
On 07/03/17 10:54, Brandon Allbery wrote:> Perl compiles to an internal AST, as does Python --- but there are > "compilers" for both, at various levels [...] more precisely, python code compiles down to bytecode rather than sticking around at an AST level.

<    1   2   3   >