mirror of
https://github.com/peklaiho/madlisp.git
synced 2024-11-26 07:04:27 +00:00
add values for PI and newline to library
This commit is contained in:
parent
427327003d
commit
0ecc4a7b73
@ -8,6 +8,10 @@ class Math implements ILib
|
|||||||
{
|
{
|
||||||
public function register(Env $env): void
|
public function register(Env $env): void
|
||||||
{
|
{
|
||||||
|
// Constants
|
||||||
|
|
||||||
|
$env->set('pi', \M_PI);
|
||||||
|
|
||||||
// Basic arithmetic
|
// Basic arithmetic
|
||||||
|
|
||||||
$env->set('+', new CoreFunc('+', 'Return the sum of all arguments.', 1, -1,
|
$env->set('+', new CoreFunc('+', 'Return the sum of all arguments.', 1, -1,
|
||||||
|
@ -9,6 +9,8 @@ class Strings implements ILib
|
|||||||
{
|
{
|
||||||
public function register(Env $env): void
|
public function register(Env $env): void
|
||||||
{
|
{
|
||||||
|
$env->set('ln', \PHP_EOL);
|
||||||
|
|
||||||
$env->set('trim', new CoreFunc('trim', 'Remove whitespace from beginning and end of string.', 1, 1,
|
$env->set('trim', new CoreFunc('trim', 'Remove whitespace from beginning and end of string.', 1, 1,
|
||||||
fn (string $a) => trim($a)
|
fn (string $a) => trim($a)
|
||||||
));
|
));
|
||||||
|
Loading…
Reference in New Issue
Block a user