[sf-perl] Perl 6 Informal Study Session: 1pm Sunday April 22nd, at the Oakland Museum

Joseph Brenner doomvox at gmail.com
Sat Apr 28 14:04:03 PDT 2018


I'm not sure where you think the bug is there, Yary.   Do you get that
this is supposed to be a function that grows insanely fast?   It works
like:

2 ^ 2
3 ^ 3 ^ 3
4 ^ 4 ^ 4 ^ 4
5 ^ 5 ^ 5 ^ 5 ^ 5
6 ^ 6 ^ 6 ^ 6 ^ 6 ^ 6

(Heinlein used to say that that was the actual "number of the beast".)

The emacs calc package agrees on the value for 3.
I'm not sure if it'd call the value for 4 infinity, I wasn't willing
to wait for it to finish.

In perl6 I might do it like this:

for (1 .. 4) -> $i {  # line 7
    my $r = $i;
    for (2 .. $i) {
      $r = $i ** $r;   # line 10
     }
   print "$i: $r\n";  # line 12
 }


Running that it behaves similarly, throwing an overflow error.   It's
funny that it reports three line numbers, though:

1: 1
2: 4
3: 7625597484987
Numeric overflow
  in block  at /home/doom/End/Cave/Eye/bin/davids_insane_func.pl6 line 10
  in block <unit> at /home/doom/End/Cave/Eye/bin/davids_insane_func.pl6 line 7

Actually thrown at:
  in block <unit> at /home/doom/End/Cave/Eye/bin/davids_insane_func.pl6 line 12




On Sun, Apr 22, 2018 at 10:30 PM, yary <not.com at gmail.com> wrote:
>
>
> -y
>
> On Sun, Apr 22, 2018 at 10:09 PM, David Christensen
> <dpchrist at holgerdanske.com> wrote:
>>
>>
>>
>> print join ' ', $_, f($_), "\n" for 1 .. 4;
>>
>>
>> 2018-04-22 19:03:30 dpchrist at vstretch ~/sandbox/perl
>> $ perl6 growth
>> 1 1
>> 2 4
>> 3 7625597484987
>> Numeric overflow
>>   in sub f at growth line 6
>>   in block <unit> at growth line 11
>>
>> Actually thrown at:
>>   in block <unit> at growth line 11
>
>
> That looks like a bug- have you reported it? Not that I know where to
> report/check for bugs...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Vanity Alias - Joe Brenner" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to doom+unsubscribe at kzsu.stanford.edu.
>
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
>
> --
> You received this message because you are subscribed to the Google Groups
> "Vanity Alias - Joe Brenner" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to doom+unsubscribe at kzsu.stanford.edu.
>


More information about the SanFrancisco-pm mailing list