Loading Builtin.pm +9 −2 Original line number Diff line number Diff line Loading @@ -17,11 +17,16 @@ use Util; use Eval; use Interp; # helper functions # Builtins get their arguments directly as a Lisp list, have names # beginning with 'B', and are defined here (except for, well, exceptions) sub Brandom { my ($arglist) = @_; my ($limit) = checkargs($arglist, ':n'); $limit = 1 if is_nil($limit); return rand($limit); } sub Bsqrt { my ($arglist) = @_; my ($arg) = checkargs($arglist, 'n'); Loading Loading @@ -1028,6 +1033,8 @@ my @builtins = # [name, func, is_special, doc] "split STRING into parts SEPARATED by SEP and return the list"], ["sqrt", \&Bsqrt, 0, "return the square root of numeric ARG"], ["isqrt", \&Bsqrt, 0, "return the integer square root of numeric ARG"], ["random", \&Brandom, 0, "return a random number a with 0 <= a < LIMIT (or 1)"] ); for my $b (@builtins) { Loading Loading
Builtin.pm +9 −2 Original line number Diff line number Diff line Loading @@ -17,11 +17,16 @@ use Util; use Eval; use Interp; # helper functions # Builtins get their arguments directly as a Lisp list, have names # beginning with 'B', and are defined here (except for, well, exceptions) sub Brandom { my ($arglist) = @_; my ($limit) = checkargs($arglist, ':n'); $limit = 1 if is_nil($limit); return rand($limit); } sub Bsqrt { my ($arglist) = @_; my ($arg) = checkargs($arglist, 'n'); Loading Loading @@ -1028,6 +1033,8 @@ my @builtins = # [name, func, is_special, doc] "split STRING into parts SEPARATED by SEP and return the list"], ["sqrt", \&Bsqrt, 0, "return the square root of numeric ARG"], ["isqrt", \&Bsqrt, 0, "return the integer square root of numeric ARG"], ["random", \&Brandom, 0, "return a random number a with 0 <= a < LIMIT (or 1)"] ); for my $b (@builtins) { Loading