Re: tail call optimization

2016-11-17 Thread Andrew Kirkpatrick
Perl5 goto &func definitely doesn't grow the stack: perl -E '$n = 0; sub wah { return if $_[0] < 1; $n++; @_=($_[0]-1); goto &wah; }; wah(shift); say "done $n"' 1000 But IIRC goto &func is more about fooling caller() than TCO, so its not that really fast thing some users expect. On 18 Novemb

Re: tail call optimization

2016-11-17 Thread Elizabeth Mattijsen
Hiroki, > On 17 Nov 2016, at 10:49, Hiroki Horiuchi wrote: > I think the tail call is optimized in the following Perl 5 code. Are you sure? Have you benchmarked it? I seem to recall that using goto like that in Perl 5 only makes sure that any backtrace doesn’t get longer. But that it comes

Re: perl 5?

2016-11-17 Thread ToddAndMargo
On 11/17/2016 05:34 AM, yary wrote: Addning to Jan's answer, PerlMonks is still a great place for answers on Perl5 topics (and even some Perl6) http://perlmonks.org/ > I still do not have perl 6 suppor

Re: perl 5?

2016-11-17 Thread Brandon Allbery
On Thu, Nov 17, 2016 at 3:03 PM, ToddAndMargo wrote: > And quiet a few perl 5 programmers are REALLY GRUMPY/CRABBY > about perl 6. I don't get it. > I think mostly this is history: the original perl 6 development team languished for many years producing basically nothing while promising everyth

Re: perl 5?

2016-11-17 Thread ToddAndMargo
On 11/17/2016 08:18 AM, Brandon Allbery wrote: On Thu, Nov 17, 2016 at 2:08 AM, ToddAndMargo wrote: Would you guys tolerate a perl 5 question every so often?

Re: perl 5?

2016-11-17 Thread ToddAndMargo
On 11/16/2016 11:27 PM, Jan Ingvoldstad wrote: On Thu, Nov 17, 2016 at 8:08 AM, ToddAndMargo wrote: Hi All, Would you guys tolerate a perl 5 question every s

Re: perl 5?

2016-11-17 Thread Brandon Allbery
On Thu, Nov 17, 2016 at 2:08 AM, ToddAndMargo wrote: > Would you guys tolerate a perl 5 question every so often? Quite a few of the folks who work on Perl 6 don't know Perl 5, or at least know it only incidentally. -- brandon s allbery kf8nh sine nomine associate

Re: perl 5?

2016-11-17 Thread yary
Addning to Jan's answer, PerlMonks is still a great place for answers on Perl5 topics (and even some Perl6) http://perlmonks.org/ > I still do not have perl 6 support on rhel 7.2 Don't know how much of an "early adopter" you want to be- if that's an option, try building Rakudo from source, so yo

tail call optimization

2016-11-17 Thread Hiroki Horiuchi
Hello. I think the tail call is optimized in the following Perl 5 code. How can I do the same in Perl 6? -- #!/usr/bin/env perl v5; use strict; use warnings; local $\ = "\n"; sub reduce_sum($$) { my ($sum, $range) = @_; return $$sum unless @$range; my $lhs = shift @$ran