perl: Use more string interpolation in the printer.
authorBen Harris <bjh21@bjh21.me.uk>
Mon, 29 Jul 2019 23:07:43 +0000 (00:07 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Tue, 30 Jul 2019 08:56:25 +0000 (09:56 +0100)
perl/printer.pm

index 21ca73f..64e7cc0 100644 (file)
@@ -33,16 +33,16 @@ sub _pr_str {
            $str =~ s/\\/\\\\/g;
            $str =~ s/"/\\"/g;
            $str =~ s/\n/\\n/g;
-           return '"' . $str . '"';
+           return qq'"$str"';
        } else {
            return $$obj;
        }
     } elsif ($obj->isa('Mal::Atom')) {
        return '(atom ' . _pr_str($$obj) . ")";
     } elsif ($obj->isa('Mal::Function')) {
-        return '<fn* ' . $obj . '>';
+        return "<fn* $obj>";
     } elsif ($obj->isa('Mal::Macro')) {
-        return '<macro* ' . $obj . '>';
+        return "<macro* $obj>";
     } else {
         return $$obj;
     }