Skip to content

Instantly share code, notes, and snippets.

@zoffixznet

zoffixznet/p6.p6 Secret

Created September 26, 2018 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoffixznet/90c3c48e621cf77a180afb4d1a3e6c49 to your computer and use it in GitHub Desktop.
Save zoffixznet/90c3c48e621cf77a180afb4d1a3e6c49 to your computer and use it in GitHub Desktop.
class Point {
has $!x;
has $!y;
}
my $total := 0;
my int $i;
while ++$i <= 1_000_000 {
my $p := nqp::create(Point);
nqp::bindattr($p, Point, '$!x', 2);
nqp::bindattr($p, Point, '$!y', 3);
$total := $total + nqp::getattr($p, Point, '$!x') + nqp::getattr($p, Point, '$!y');
}
say($total);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment