Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created September 27, 2016 16:46
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/9b02fb4fef88137a5523afc910aa7b96 to your computer and use it in GitHub Desktop.
Save zoffixznet/9b02fb4fef88137a5523afc910aa7b96 to your computer and use it in GitHub Desktop.
use nqp;
sub ddd(|) {
my $args := nqp::p6argvmarray();
if nqp::elems($args) {
while $args {
my $var := nqp::shift($args);
my $varname := try $var.VAR.?name;
my $vartype := $var.VAR.of.^name;
my $val := $var.?is-lazy
?? $var[^10].perl.chop ~ "... (lazy list)"
!! $var.perl;
my $valtype = $var.^name;
note ($varname and "$vartype $varname = "), $val, " ($valtype)";
}
}
else { # tell where we are
note .name ?? "{lc .^name} {.name}" !! "({lc .^name})"
with callframe(1).code;
}
return
}
my Numeric $x = 41; my Numeric $y = 42; my Numeric $z = 43; my Numeric $w = 44;
my %hash{Any} =
foo => [ $x, $y, $z, $w ],
bar => [ $x, $y, $z, $w ],
;
{ print "OLD: "; dd $_; print "NEW: "; ddd $_ }() given %hash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment