Skip to content

Instantly share code, notes, and snippets.

View JustThisGuyAZ's full-sized avatar

JustThisGuyAZ

View GitHub Profile
@JustThisGuyAZ
JustThisGuyAZ / exists.p6
Created July 16, 2018 00:43
Exists test
my %node;
%node<1,2> = 1;
for 0..3 -> Int $x {
for 0..3 -> Int $y {
my Int $cost;
say "$x,$y";
$cost = %node<$x,$y>:exists ?? 100 !! 1;
say $cost;
@JustThisGuyAZ
JustThisGuyAZ / multi-exists.p6
Last active July 16, 2018 00:42
Exists test on multidimensional hash
my %node;
%node<1><2> = 1;
for 0..3 -> Int $x {
for 0..3 -> Int $y {
my Int $cost;
say "$x,$y";
$cost = %node<$x><y>:exists ?? 100 !! 1;
say $cost;
use v6;
class DBM::GDBM {
use NativeCall;
constant GDBM_BLOCKSIZE = 0;
constant GDBM_WRCREAT = 2;
constant GDBM_REPLACE = 1;