Skip to content

Commit

Permalink
[interpreters] fix floats
Browse files Browse the repository at this point in the history
  • Loading branch information
andreoss committed May 13, 2015
1 parent 35d4a0c commit da5775c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions categories/interpreters/lisp.pl
Expand Up @@ -12,7 +12,8 @@
=end pod


subset Number of Str where * ~~ /^^ <[0..9.]>+ $$/;
subset Number of Str where -> $x {
so $x ~~ /^^ \d+ ( '.' \d* )? $$/ }

class Func {
has Callable $.code;
Expand Down Expand Up @@ -229,7 +230,7 @@ sub repl {
my Int $balance = 0;
loop {
try {
exit unless my $p = prompt($exp eq '' ?? "> " !! ("--" xx $balance) ~ "> ");
exit unless defined my $p = prompt($exp eq '' ?? "> " !! ("--" xx $balance) ~ "> ");
$exp ~= "$p ";
$exp ~~ s:i/ ';' ** 1..* .*? $$//;
$balance = balanced $exp;
Expand Down Expand Up @@ -260,6 +261,7 @@ sub repl {
multi to-string(Symbol $exp) { $exp }

multi to-string(Bool $x ) { $x ?? "#t" !! "#f" }
multi to-string(Any $x) { $x.perl }


sub MAIN(Bool :$run-tests = False,
Expand Down Expand Up @@ -348,5 +350,4 @@ sub tests {
ok eval("(sqrt 4)").Int == 2, 'sqrt example';

done;

}

0 comments on commit da5775c

Please sign in to comment.