Skip to content

Instantly share code, notes, and snippets.

@TimToady
TimToady / gist:780361
Created January 14, 2011 22:07
traceback of mono run/Niecza.exe -e 'say 1'
$ mono run/Niecza.exe -e 'say 1'
Unhandled exception: Unable to resolve method keys in class Array
at /home/larry/perl6/niecza/lib/SAFE.setting line 922 (SAFE keys @ 2)
at /home/larry/perl6/niecza/src/Metamodel.pm6 line 192 (Metamodel Namespace.list_stash @ 7)
at /home/larry/perl6/niecza/src/Metamodel.pm6 line 603 (Metamodel Unit.list_stash @ 3)
at /home/larry/perl6/niecza/src/Metamodel.pm6 line 683 (Metamodel C268_ANON @ 23)
at /home/larry/perl6/niecza/src/Metamodel.pm6 line 92 (Metamodel visitor @ 3)
at /home/larry/perl6/niecza/src/Metamodel.pm6 line 95 (Metamodel visitor @ 11)
at /home/larry/perl6/niecza/src/Metamodel.pm6 line 99 (Metamodel Namespace.visit_stashes @ 4)
at /home/larry/perl6/niecza/src/Metamodel.pm6 line 690 (Metamodel Unit.create_syml @ 13)
@TimToady
TimToady / gist:780377
Created January 14, 2011 22:14
new longer traceback
mono run/Niecza.exe -e 'say 1'
Unhandled exception: Unable to resolve method keys in class Array
at /home/larry/perl6/niecza/boot/lib/SAFE.setting line 922 (SAFE keys @ 2)
at /home/larry/perl6/niecza/src/Metamodel.pm6 line 192 (Metamodel Namespace.list_stash @ 7)
at /home/larry/perl6/niecza/src/Metamodel.pm6 line 603 (Metamodel Unit.list_stash @ 3)
at /home/larry/perl6/niecza/src/Metamodel.pm6 line 683 (Metamodel C268_ANON @ 23)
at /home/larry/perl6/niecza/src/Metamodel.pm6 line 92 (Metamodel visitor @ 3)
at /home/larry/perl6/niecza/src/Metamodel.pm6 line 95 (Metamodel visitor @ 11)
at /home/larry/perl6/niecza/src/Metamodel.pm6 line 99 (Metamodel Namespace.visit_stashes @ 4)
at /home/larry/perl6/niecza/src/Metamodel.pm6 line 690 (Metamodel Unit.create_syml @ 13)
@TimToady
TimToady / gist:789935
Created January 21, 2011 16:34
build problem with 2.8.2 on 64-bit ubuntu
4b253e61e4a0ec231c50eecb3.
edo:~/perl6/niecza 10> make
rm -rf boot/
mkdir boot
wget --no-check-certificate -Oboot/niecza.zip $(cat FETCH_URL)
--2011-01-21 08:25:43-- https://github.com/downloads/sorear/niecza/niecza-1.51.zip
Resolving github.com... 207.97.227.239
Connecting to github.com|207.97.227.239|:443... connected.
WARNING: certificate common name `*.github.com' doesn't match requested host name `github.com'.
HTTP request sent, awaiting response... 302 Found
@TimToady
TimToady / gist:819913
Created February 10, 2011 03:55
viv boot failure
perl -MExtUtils::Command -e rm_rf boot/syml
perl ./viv --boot --noperl6lib --compile-setting CORE.setting
perl ./viv --boot --noperl6lib -5 -o STD.pm5 STD.pm6
Compiled lib/DEBUG.pm6
Compiled lib/NAME.pm6
Compiled lib/Stash.pm6
Compiled ./CursorBase.pm6
Compiled ./Cursor.pm6
Can't locate package VAST::Assignment_operator for @VAST::infix__S_VertVert::ISA at /home/larry/perl6/std/Actions.pm line 345.
Can't locate package VAST::Assignment_operator for @VAST::infix__S_VertVert::ISA at /home/larry/perl6/std/Actions.pm line 345.
my $pairs = 5;
my $size = $pairs + 1;
my @x;
@x[0] = 1 xx $size;
for 1 ..^ $size -> $row {
for reverse 0 .. ($size - $row - 1) -> $col {
@x[$row][$col] = (@x[$row][$col+1]//0) + @x[$row-1][$col];
}
sub bentley_clever($seed) {
constant $mod = 1_000_000_000;
my @state;
sub subrand() {
push @state, (my $x = (@state.shift - @state[*-24]) % $mod);
$x;
}
my @seed = ($seed % $mod, 1, (* - *) % $mod ... *)[^55];
#!./perl6
grammar CSV::File {
token TOP { ^ <line>* <empty_line>? [ $ || { say $¢.pos,' ', $¢.orig.substr($¢.pos,20) } <!> ] }
token line { <value> ** ',' \n }
token value {
| <pure_text>
| \h* \" <quoted_contents> \" \h*
}
token quoted_contents { [<-["]> | '""' ]* }
sub shell($cmd) {
my $proc = CLR::<System.Diagnostics.Process,System,PublicKeyToken=b77a5c561934e089>.new;
$proc.EnableRaisingEvents = False;
$proc.StartInfo.FileName = 'bash-c';
$proc.StartInfo.Arguments = $cmd;
$proc.Start();
$proc.WaitForExit();
}
bash-c:
./perl6 --setting=NULL --optimize=3 --target=pir --output=src/gen/CORE.setting.pir src/gen/CORE.setting
Method 'update' not found for invocant of class 'Hash'
current instr.: 'nqp;Perl6;Metamodel;MROBasedMethodDispatch;_block2441' pc 40206 (src/gen/perl6-metamodel.pir:11978) (src/gen/Metamodel.pm:799)
called from Sub 'nqp;Perl6;Metamodel;MROBasedMethodDispatch;publish_method_cache' pc 40028 (src/gen/perl6-metamodel.pir:11889) (src/gen/Metamodel.pm:799)
called from Sub 'nqp;Perl6;Metamodel;ClassHOW;compose' pc 61392 (src/gen/perl6-metamodel.pir:22257) (src/gen/Metamodel.pm:2003)
called from Sub 'nqp;Perl6;SymbolTable;pkg_compose' pc 24548 (src/gen/perl6-symboltable.pir:9854) (src/Perl6/SymbolTable.pm:1318)
called from Sub 'nqp;Perl6;Actions;package_def' pc 54210 (src/gen/perl6-actions.pir:21242) (src/Perl6/Actions.pm:1168)
called from Sub 'nqp;Regex;Cursor;!reduce' pc 2703 (src/Regex/Cursor.pir:1023)
called from Sub 'nqp;Regex;Cursor;!cursor_pass' pc 2116 (src/Regex/Cursor.pir:660)
called from Sub 'nqp;Perl6;
constant @primes = 2, 3, -> $n is copy { repeat { $n += 2 } until $n %% none @primes ... * > sqrt $n; $n; } ... *;
multi factors(1) { 1 }
multi factors(Int $remainder is copy) {
gather for @primes -> $factor {
if $factor * $factor > $remainder {
take $remainder if $remainder > 1;
last;
}