Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created September 27, 2016 16:33
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/7ae7a2551609c67bd9dd8764319078c6 to your computer and use it in GitHub Desktop.
Save zoffixznet/7ae7a2551609c67bd9dd8764319078c6 to your computer and use it in GitHub Desktop.
use nqp;
sub dd(|) {
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 @var = ^10;
dd @var
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment