Algebraic Data Types in perl6

2013-04-01 Thread Timo Paulssen
Hey perl6 people, I'm crossposting this message from perl.perl6.language, because I feel it's more appropriate here. User phi...@free.fr had asked if ADT and GADT will be available in perl6 any time soon, Carl Mäsak implemented two suggestions (see quoted text below) and I implemented it as a POC

Algebraic Data Type module for perl6

2013-04-01 Thread Timo Paulssen
I'm crossposting this from perl.perl6.language, because I feel this place is more appropriate. Since that mail was written, an ADT module has been added to modules.perl6.org, it's hosted in this github repository: https://github.com/timo/ADT/ Looking forward to comments as well as issues and

Re: Diffrence between is and does in scope of overriding multi methods

2014-06-27 Thread Timo Paulssen
On 27/06/14 10:07, Kamil Kułaga wrote: Hi, I would like to ask for help in understanding difference between this code: use v6; role X { multi method xyz(Any $a) {say Class X} } class Y does X { multi method xyz(Any $a) {say Class Y} } say

Re: Placeholder Variable

2015-03-15 Thread Timo Paulssen
On 03/15/2015 09:41 PM, Tom Browder wrote: On Sun, Mar 15, 2015 at 2:55 PM, Timo Paulssen t...@wakelift.de wrote: ... Thanks, Timo! Subroutine arg handling is an awkward but very exciting improvement for an old but non-expert Perl 5 user. Very briefly, how does one properly translate

Re: Placeholder Variable (was: Perl 6 Debugging)

2015-03-15 Thread Timo Paulssen
On 03/15/2015 08:48 PM, Tom Browder wrote: The initial part of the code for the offending method definition is: method set_custom_ellipsoid { my ($name, $major, $recip) = @_; $name = uc $name; $recip = 0 unless defined $recip; if ($major) { %ellipsoids{$name} = [ $major, $recip ]; }

Re: Need help with: Cannot find method 'postcircumfix:( )'...

2015-03-20 Thread Timo Paulssen
On 03/20/2015 03:40 AM, Brandon Allbery wrote: On Thu, Mar 19, 2015 at 10:33 PM, Tom Browder tom.brow...@gmail.com mailto:tom.brow...@gmail.com wrote: Why do you say that is not a method? The first line says Sorry, somehow I managed to misread that. So you want what I have already

Re: perl6 can't find installed modules, installed by panda

2015-04-27 Thread Timo Paulssen
Hello Marcel, the mangled names of all the installed things is an unfortunate side-effect of the somewhat recent switch to a more database-based installation method. Inspecting the @*INC variable ought to give you some more insight to what's going on. there's also an environment variable

Re: UDP suport in rakudo

2015-06-18 Thread Timo Paulssen
On 06/18/2015 09:47 AM, Kamil Kułaga wrote: Hi, Is it possible to listen UDP port with perl6? IO::Socket::INET seems to be TCP only At least on MoarVM we don't have UDP support yet. I've started in a little branch called udp_sockets in both MoarVM and NQP, but I didn't get terribly far.

Re: Passing a hash to a subroutine: best method?

2015-07-03 Thread Timo Paulssen
On 07/03/2015 07:20 PM, Tom Browder wrote: On Fri, Jul 3, 2015 at 10:26 AM, Tom Browder tom.brow...@gmail.com wrote: While experimenting I've found the first two methods of passing a hash to a subroutine work: # method 1 my %hash1; foo1(%hash1); say %hash1.perl; sub foo1(%hash) {

Re: Passing a hash to a subroutine: best method?

2015-07-03 Thread Timo Paulssen
On 07/03/2015 10:02 PM, yary wrote: On Fri, Jul 3, 2015 at 3:03 PM, Timo Paulssen t...@wakelift.de wrote: but this does not sub takes_int_array(Int @bar) { say @bar } takes_int_array([1, 2, 3]) because the type match is against the defined type. We do not automatically infer that [1, 2, 3

Re: Is creating and Array or Parcel ?

2015-08-03 Thread Timo Paulssen
On 08/02/2015 02:35 PM, Lloyd Fournier wrote: @a = $z[0].list or in a less documented way: @a = $z[0] The idea is that you can store an array in ether a @ or $ variable. Where as in perl5 you could only store a reference in $ variable. The sigil simply tells perl6 how it should behave

Re: Coroutines

2015-08-14 Thread Timo Paulssen
On 08/14/2015 12:04 PM, Matija Papec wrote: Hi, I'm looking for single threaded coroutines in perl6. Will hyper/race make them possible? Will 2015 production Rakudo include async IO? Right now I'm considering golang for scalable websocket service, but also wonder if perl6 would (and

Re: How to profile Perl 6 applications?

2015-10-24 Thread Timo Paulssen
On 24/10/15 09:40, Moritz Lenz wrote: Hi Gabor, On 10/24/2015 09:26 AM, Gabor Szabo wrote: The Devel::NYTProf helped me a lot locating the source of slowness on the Perl Maven site. Is there something similar for Perl 6 so I can try to improve the speed of the Perl 6 Maven site too? Rakudo

Re: Rakudo won't install

2016-01-06 Thread Timo Paulssen
I'm sorry, but the JVM back-end of rakudo is currently known to not compile and/or run very well.

Re: release?

2015-12-28 Thread Timo Paulssen
On 12/28/2015 01:58 PM, Brock Wilcox wrote: > > Rakudo, as far as I know, passes all of the 6.c tests :). But that > might mean that we need more tests! > Actually, there's a whole bunch of tests declared "TODO" or skipped. But rakudo does pass a vast number of the existing tests.

Re: problem installing GTK::Simple

2016-06-22 Thread Timo Paulssen
On 06/22/2016 06:33 PM, Theo van den Heuvel wrote: > Thanks Timo, > > this brings be further, but not quite out of the woods. I now get the > following (Windows 10): > > > # Failed test at t/01-sanity.t line 10 > # Dynamic variable @*INC not found > > with the ensuing failures. > > Any ideas? > >

Re: problem installing GTK::Simple

2016-06-22 Thread Timo Paulssen
I just committed a fix to GTK::Simple's Build.pm. It was using the Z metaop to iterate over download URLs and the hashsums it was expecting, but it forgot to flatten the list before taking 2-at-a-time, so it was getting a URL with a space in it (followed by the hash) as the download URL. It

Re: thread problem

2016-01-14 Thread Timo Paulssen
I regret to inform you that we currently have that limitation. It's due to a design decision in libuv that we haven't found a good/the perfect work-around for in MoarVM. Instead of getting that error, you used to just get empty results, if I recall correctly. I haven't taken the time to read

Re: Can I use my Perl5 .pm modules in Perl6?

2016-01-14 Thread Timo Paulssen
On 14/01/16 08:15, H.Merijn Brand wrote: Here's an example of ported DBI code: --8<--- #!perl6 use v6; use Inline::Perl5; my $p5 = Inline::Perl5.new; $p5.use("Text::CSV_XS"); my @rows; my $csv = $p5.invoke("Text::CSV_XS", "new") or die "Cannot use CSV: ", $p5.invoke("Text::CSV_XS",

Re: Finding and fixing Perl 6 bugs

2016-02-03 Thread Timo Paulssen
AFAICT we usually recommend people report bugs via mail to rakudo...@perl.org Here's the places i could find (by targeted search, of course) that tell people to do it like that: - http://perl6.org/getting-started/ in the "side track", - http://rakudo.org/tickets/ - rakudo.org -> "bug tracker", -

Re: Need help with Nil values

2016-02-22 Thread Timo Paulssen
Hello Emiliano, In this case, I think you may want to use just "Str" instead of "Nil". "Str" is the "type object" for Str objects, and you can check whether it's a string like "foo" or just the Str object by checking $!value.defined. There's a FAQ answer that's about "Any", but it works the

Re: Porting considerations

2016-01-20 Thread Timo Paulssen
On 20/01/16 15:55, Parrot Raiser wrote: How difficult is it to port moar-VM to different versions of Linux, and different processor architectures? I'm thinking particularly of this machine: http://www.parallella.org/ which has multiple processors, designed, as the name suggests, for parallel

Re: A practical benchmark shows speed challenges for Perl 6

2016-03-30 Thread Timo Paulssen
On 30/03/16 13:40, Tom Browder wrote: On Tue, Mar 29, 2016 at 10:29 PM, Timo Paulssen <t...@wakelift.de> wrote: On 03/30/2016 03:45 AM, Timo Paulssen wrote: Could you try using $filename.IO.slurp.lines instead of $filename.IO.lines and see if that makes things any faster? ... Ac

Re: panda seems to need nmake

2016-03-06 Thread Timo Paulssen
On 06/03/16 15:31, Theo van den Heuvel wrote: Hi all, I am running Rakudo 2016-1 on Windows7 (64b) I tried "panda install Linenoise" and get the following result: [snip] From this I deduce that panda wants me to have nmake.exe available. Microsoft seems to have chosen to offer it only to

Re: stdout_is in Perl 6?

2016-03-02 Thread Timo Paulssen
Hello Hiroki Horiuchi, there are two modules that should help you solve your problem: https://github.com/sergot/IO-Capture-Simple - "IO can be captured." https://github.com/zoffixznet/perl6-IO-MiddleMan - "hijack, capture, or mute writes to an IO::Handle" If IO::Capture::Simple or

Re: perl6 --profile-compile | --profile: both very slow and depend on Internet resources

2016-04-01 Thread Timo Paulssen
On 01/04/16 17:08, Tom Browder wrote: Alternatively, there's a qt-based profiler up on tadzik's github that can read the json blob (you will have to --profile-filename=blahblah.json to get that), but it doesn't evaluate as much of the data - it'll potentially even fail completely what with

Re: perl6 --profile-compile | --profile: both very slow and depend on Internet resources

2016-04-01 Thread Timo Paulssen
The profiler's data blob is a massive, gigantic blob of json (ls the file and you'll see). You can easily search the urls to point at local files instead of the CDN. Alternatively, there's a qt-based profiler up on tadzik's github that can read the json blob (you will have to

Re: Two topics not found in docs search: 'constant' and 'heredocs'.

2016-04-04 Thread Timo Paulssen
On 04/04/16 13:42, Shlomi Fish wrote: How are you searching exactly? With which command/which URL? -- Shlomi Probably the search field on the doc page. I can reproduce both terms not giving any results there. I think you'd have to use the X tag in the pod source to create an index

Re: How to use NativeCall with a libc function?

2016-04-04 Thread Timo Paulssen
Hey Tom, in NativeCall, "is rw" has a very special meaning. For example, if you have "int32 $foo is rw", you'll actually give the native function a pointer to an int, and perl6 will make that work out for you properly if you have an "int" or an "Int" variable that you pass. Apparently we

Re: A practical benchmark shows speed challenges for Perl 6

2016-03-29 Thread Timo Paulssen
On 03/29/2016 10:47 PM, Tom Browder wrote: > On Wednesday, February 3, 2016, Tom Browder > wrote: > > I use Perl for heavy duty text processing. A question on Perl Monks > about Perl 5's handling of a large input file got me wondering

Re: A practical benchmark shows speed challenges for Perl 6

2016-03-29 Thread Timo Paulssen
On 02/03/2016 02:59 PM, Tom Browder wrote: > I tried the suggestion from Bart Wiegmans to compile the program: > > $ perl6 --target=mbc --output=read-file-test.moarvm read-file-test.p6 > $ time perl6 read-file-test.moarvm large-1-gb-file.txt > Error while reading from file: Malformed UTF-8 > > So

Re: testing with a "warn"

2016-04-29 Thread Timo Paulssen
I didn't actually read the other mail in this thread yet, but you can catch a control exception (like warn uses) with a CONTROL block. Don't forget to .resume the exception unless you want it to break out of your code, too. Hope to help! - Timo

Re: pod: Missing semantic block

2016-05-16 Thread Timo Paulssen
On 16/05/16 14:00, Hans Ginzel wrote: Hello! Add, please, semantic block "=EXAMPLES" to pod. http://design.perl6.org/S26.html#Semantic_blocks Examples are very often missing in classical man pages. Thank you, Hans Hello Hans, it says in the speculations that all uppercase block typenames

Re: Helping Perl 6: a complete dev environment

2016-04-29 Thread Timo Paulssen
I just have a ~/perl6 where i have a clone of MoarVM/MoarVM, perl6/nqp, and rakudo/rakudo. You just have to provide each Configure.pl with the same --prefiix - in my case that's ~/perl6/install - then everything will find each other. There's some extra paths in my $PATH:

Re: Blobs and IEEE floating point

2016-04-19 Thread Timo Paulssen
On 19/04/16 16:25, Elizabeth Mattijsen wrote: I’ve been looking at nativecast, but haven’t been able to find an > example that I could apply to this? > Liz Right! I should have given a working example, or at least mention that CArray would probably be necessary to make this work.

Re: Blobs and IEEE floating point

2016-04-19 Thread Timo Paulssen
On 19/04/16 01:58, Kevin Pye wrote: […] > 2. Write a simple C function to take a pointer to a double and return > the double, put that into a shared library and then use NativeCall. > […] Fortunately, you don't have to use a library with a custom function. You can just use "nativecast" for

Re: mocking $*OUT

2017-01-24 Thread Timo Paulssen
You're getting a stack trace that's missing the helpful bits, because they go through the core setting, and our default backtrace printer skips those. You can get the vital information you need by supplying --ll-exception directly after perl6. It'll show you that calling the sub "say" will grab

Re: need {} help

2017-02-18 Thread Timo Paulssen
/ doesn't have a meaning in regex, but it's not an alpha character, so if you want to "match literally" it "must be quoted" as the first error message tells you. On top of that, balanced characters like () and {} aren't allowed for the s/// form (only for the assignment form which looks like s{

Re: print to STDERR problem

2017-02-19 Thread Timo Paulssen
Can you suggest how to improve the warnings about its obsolescence? Right now it says: > > This file is part of the Perl 6 Archive > > Note: these documents may be out of date. Do *not* use as reference! > > To see what is currently happening visit http://www.perl6.org/ > And then a bit

Re: sub for die?

2017-02-19 Thread Timo Paulssen
Hi, On 19/02/17 04:48, ToddAndMargo wrote: >"die" is not all that useful, as it always exits > with a "1". With "exit", you can set the exit code. that's leaving out a whole lot of context, though. "die" is a quick way to throw an exception. If an exception reaches the outermost part of

Re: sub for die?

2017-02-18 Thread Timo Paulssen
It is usually considered The Right Thing to output error messages to stderr instead of stdout; you can use "note" to output to stderr (and it'll also put a newline at the end for you, which print doesn't do).

Re: net::SMTP in rpm land?

2017-02-18 Thread Timo Paulssen
Almost no linux distros package perl6 modules for their native package manager yet. The only distro i know of that has any kind of perl6 module packaging at all is archlinux: https://aur.archlinux.org/packages/?O=0=perl6 You need to use panda or zef to install perl6 modules until something

Re: intercept STDERR

2017-02-18 Thread Timo Paulssen
Normally it's enough to override $*ERR for this purpose. I suggest using IO::MiddleMan to do that, or maybe IO::Capture::Simple. HTH - Timo

Re: reverse of .lines?

2017-02-18 Thread Timo Paulssen
On 18/02/17 06:09, ToddAndMargo wrote: > On 02/17/2017 07:44 PM, yary wrote: >> Oh, then chain join on the end: >> >> my $StringReversedLines = >> $StringFullOfLineFeeds.lines.reverse.join("\n") >> >> or >> >> my $StringReversedLines = >> $StringFullOfLineFeeds.split("\n",:v).reverse.join >>

Re: cifs control

2017-02-18 Thread Timo Paulssen
On 18/02/17 06:04, ToddAndMargo wrote: > Hi All, > > Sorry for the 1000 questions today, but I have anb entire > week to think them up. And I have another one. > > In Windows, I am noticing that Cobian Backup and Windows > Explorer (not Internet Explorer) can tool around CIFS > (Windows) shares

Re: print to STDERR problem

2017-02-19 Thread Timo Paulssen
On 02/19/2017 11:15 PM, ToddAndMargo wrote: > On 02/19/2017 07:15 AM, Timo Paulssen wrote: >> Oh, another question: >> >> please tell us how you reached that site? I expect you did a google >> search or something; can you tell us what search terms you've used to >&g

Re: print to STDERR problem

2017-02-19 Thread Timo Paulssen
Oh, another question: please tell us how you reached that site? I expect you did a google search or something; can you tell us what search terms you've used to get there? We should obviously improve the docs so that they get found instead of the archive …

Re: lwp. Where are the directions?

2016-08-21 Thread Timo Paulssen
You might have more luck with HTTP::UserAgent: https://github.com/sergot/http-useragent Hope that helps! - Timo On 21/08/16 09:19, ToddAndMargo wrote: > Hi All, > > Where are the directions to use > > http://modules.perl6.org/#q=LWP > > (I do not have Perl 6 installed yet. I was hoping >

Re: coded size limits on Perl data types?

2016-09-13 Thread Timo Paulssen
I'll answer based on the data structures MoarVM uses internally: On 09/13/2016 05:13 AM, Darren Duncan wrote:> (Pretend the actual hardware has infinite memory so we wouldn't run > out of hardware first.) > > 1. Maximum size of a (non-machine) integer? We're using libtommath, which declares the

Re: grammars and indentation of input

2016-09-13 Thread Timo Paulssen
I haven't read your code, but your question immediately made me think of this module: https://github.com/masak/text-indented Would be interested to hear if this helps you! - Timo

Re: coded size limits on Perl data types?

2016-09-13 Thread Timo Paulssen
On 09/13/2016 03:12 PM, Timo Paulssen wrote:> If one big integer is allowed to be 14 gigabytes big (if we use the > default of 28 bits per "mp digit"; it's also possible to use 31 or > 60.), we can still safely say "limited only by memory" for now. Something else tha

Re: Multithreading, GC

2016-10-05 Thread Timo Paulssen
Hi there, let me answer a few of your questions real quick: On 05/10/16 20:38, Joseph Garvin wrote: > > What is the state of multithreading in Perl 6 (MoarVM)? > Specifically: > > * Can two threads preempt one another? MoarVM has threads that map to operating system level threads. Rakudo exposes

Re: can Perl 6 bootstrap itself (downloading modules and such via git)

2016-08-26 Thread Timo Paulssen
On 26/08/16 11:03, Andreas Mueller wrote: > on Windows i have to install git to download a Module > > maybe, one day there is a 'git' written in P6 > > > Andreas I think we should be able to grab modules without using git if we can rely on github and gitlab and whoever hosts modules to give

Re: Graphical Toolkits

2016-08-25 Thread Timo Paulssen
On 08/25/2016 11:30 AM, Kaare Rasmussen wrote: > Hi > > ISTM that right now the only option if you want to develop a graphical > desktop application is GTK. At least it seems to be the only one on > the modules list. You may very well correct me if I'm wrong. > > I'm thinking if anybody has any

Re: Startup performance on OS X

2016-10-02 Thread Timo Paulssen
On my machine it's about 0.1 seconds. The machine i'm using has this CPU in it: Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz And it runs off an SSD. - Timo

Re: rakudobrew failing to build moar

2016-10-12 Thread Timo Paulssen
It looks like the compilation process just crashes. Could it be you don't have enough RAM? Building the core setting unfortunately takes quite a bit of memory, since it's such a gigantic piece of code. Try re-running with a swap file maybe? Alternatively, cd into the rakudo folder that

Re: What's the Perl 6 equivalent of Python `itertools.chain`?

2016-12-08 Thread Timo Paulssen
Something like this should do what you want: timo@schmand ~> perl6 -e 'my $a = gather for ^5 { say "get from a!"; take $_ }; my $b = gather for ^5 { say "get from b!"; take 10 * $_ + 1 }; .say for (|$a, |$b)' get from a! 0 get from a! 1 get from a! 2 get from a! 3 get from a! 4 get from b! 1 get

Re: zenity sub

2016-12-01 Thread Timo Paulssen
Zenity is already meant to be run by other programs (like shell scripts). Please see these documentation pages for info about how to invoke existing programs: https://docs.perl6.org/syntax/qqx https://docs.perl6.org/language/quoting#Shell_quoting_with_interpolation:_qqx Hope that helps!

Re: zenity sub

2016-12-01 Thread Timo Paulssen
Surely you could already build a decent zenity-like in Perl 6 using GTK::Simple. But I suggest using qx for calling the zenity binary from your system. - Timo

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

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: "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: > !"789" i

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:

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

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: 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 <t...@wakelift.de> wrote: >> I seem to recall you asked about performance recently >> >> the regex engine has a significant overhead. > ... > > Isn't that somewhat mitigated

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

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

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

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

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

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.

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

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

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

2017-03-06 Thread Timo Paulssen
This is because of how xclip works. It keeps running until you kill it, or until the number of pastes has been reached that you specify with -loops. You will want to use Proc::Async or run with an :in parameter instead of shelling into a redirect with echo, here's why: timo@schmand ~> cat

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

2017-03-06 Thread Timo Paulssen
> Is there a way to send and "end of file" marker to terminate the pipe? That is exactly what the call to .close does.

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

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

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

Re: Net::SMTP is messed up

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

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

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

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

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

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

  1   2   >