This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C:\Users\grond>panda install Readline | |
==> Readline depends on LibraryCheck | |
==> Fetching LibraryCheck | |
==> Building LibraryCheck | |
==> Testing LibraryCheck | |
no such file or directory | |
in sub run-and-gather-output at C:\rakudo\share\perl6\site\sources\5AEF9DA5AE15E5AB5CB2ADB58A455E007FA7839E line 85 | |
in block at C:\rakudo\share\perl6\site\sources\FB10E7A100D50F6DB505EC4DC538BEAB5154DED3 line 22 | |
in sub indir at C:\rakudo\share\perl6\site\sources\5AEF9DA5AE15E5AB5CB2ADB58A455E007FA7839E line 20 | |
in method test at C:\rakudo\share\perl6\site\sources\FB10E7A100D50F6DB505EC4DC538BEAB5154DED3 line 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use nqp; | |
sub permutations(int $n where $n > 0) { | |
Seq.new: | |
class :: does Iterator { | |
# See: L<https://en.wikipedia.org/wiki/Permutation#Generationn_lexicographic_order> | |
has int $!n; | |
has Mu $!permutation; | |
submethod BUILD(:$n) { $!n = $n; $!permutation := nqp::list(); self } | |
#method is-lazy { True } | |
method pull-one { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grammar circuit { | |
rule TOP { <wiring>+ } | |
rule wiring { <expression> '->' <destination=identifier> } | |
rule expression { <NOT> | <AND> | <OR> | <RSHIFT> | <LSHIFT> | <value> } | |
token value { <literal> | <identifier> } | |
token literal { <.digit>+ } | |
token identifier { <.alpha>+ } | |
rule NOT { NOT <value> } | |
rule AND { <left=value> AND <right=value> } | |
rule OR { <left=value> OR <right=value> } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub permutations(int $n) { | |
Seq.new: | |
class :: does Iterator { | |
has int $!n; | |
submethod BUILD { $!n = $n; self } | |
method pull-one { | |
return (^$!n).List unless (state $i = 0)++; | |
return IterationEnd if $i >= self.count-only; | |
return map { |(state @ = ^$!n).splice($_, 1) }, $i.polymod($!n ... 2); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>^^v^<>v<<<v<v^>>v^^^<v<>^^><^<<^vv>>>^<<^>><vv<<v^<^^><>>><>v<><>^^<^^^<><>>vv>vv>v<<^>v<>^>v<v^<>v>><>^v<<<<v^vv^><v>v^>>>vv>v^^^<^^<>>v<^^v<>^<vv^^<^><<>^>><^<>>><><vv><>v<<<><><>v><<>^^^^v>>^>^<v<<vv^^<v<^<^>^^v^^^^^v<><^v><<><^v^>v<<>^<>^^v^<>v<v^>v>^^<vv^v><^<>^v<><^><v^><><><<<<>^vv^>^vvvvv><><^<vv^v^v>v<<^<^^v^<>^<vv><v<v^v<<v<<^^>>^^^v^>v<><^vv<<^<>v<v><><v^^><v<>^^>^^>v^>^<<<<v><v<<>v><^v>^>><v^^<^>v<vvvv<>>>>>^v^^>v<v<^<vv>^>^vv^>vv^^v<<^<^^<>v>vv^v>><>>>v^>^>^^v<>^<v<<>^vv>v^<<v>v<<><v>^vvv<v<vvv^v<vv<v^^^>v><<^<>><v^^>^v^>>^v<^<><v<>>v^<>>v<>>v^^^><^>>vvvv>^v<^><<>>^<>^>vv><v<<>>^^>v^^^><^<<^^v>v<^<<>v>^^vvv^v^>v^<>^^<>v^v>v>v<v^>vv>^^v<>v>>^<>><>v>v^<<vvvv<vvv><v^<^>^v<>>^><v>><>^<v>v<v>vv^>>vvv<>v>v<v^>>^>>v<<>^<>^<>>>^v<<<^<^v>vv^>><<><v^>^v^^^v<>^^vv><>><>>^>v^<v<>v<>>^<<^v>^^^<>^v^><>v<<v>vv^>vv<<>>><<^v^<>v<vv>>>^^<>^><<^>vv>>^<<v^^vv<>>><v>v><^<v<<>>>^^<>>^<^v><>vv^^^v>vvv>^><<>^^>^<<v^<v<^v<<>vvv<^<<>^>^v<vv<^>vvv>v>vv^<v^><>>^vv<^^^vv><^vv<v^<><v^vvv><<^>^^><v<<vv^>v<vv<v>^<>^v<<>v<v^v^> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use feature qw<say>; | |
my @directions = split //, <DATA>; | |
my ($i, $j) = (0, 0); | |
my %houses = ("0:0" => 1); | |
for (@directions) { | |
next unless /[><^v]/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://en.wikipedia.org/wiki/Exponentiation_by_squaring | |
sub exp-by-squaring-iterative(Numeric $x is copy, int $n is copy) { | |
return 1 if $n == 0; | |
if $n < 0 { | |
$x = 1 / $x; | |
$n = -$n; | |
} | |
my $y = 1; | |
while $n > 1 { | |
$y = $y * $x if $n +& 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See: L<https://en.wikipedia.org/wiki/Permutation#Generation_in_lexicographic_order> | |
use nqp; | |
sub permutations(int $n) { | |
Seq.new( | |
class :: does Iterator { | |
has int $!n; | |
has @!a; | |
submethod BUILD(:$n) { $!n = $n; self } | |
#method is-lazy { True } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub permutations(int $n) { | |
my int $i; | |
$n == 1 ?? ( (0,), ) !! | |
gather { | |
my @permutations = permutations($n - 1); | |
while $i < $n { | |
my Int @i; | |
my int $j; | |
@i.push($j++) while $j < $i; | |
$j = $i + 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="gl-matrix-min.js"></script> | |
<script> | |
function webGLStart() { | |
var shader_sources = { | |
fragment : [ |