mirror of
https://github.com/peklaiho/madlisp.git
synced 2024-11-22 13:24:46 +00:00
capitalize constants
This commit is contained in:
parent
be9ffae2e8
commit
c0fb53742a
@ -338,10 +338,10 @@ The following constants are defined by default:
|
||||
|
||||
Name | PHP constant
|
||||
------- | ------------
|
||||
dirsep | DIRECTORY_SEPARATOR
|
||||
homedir | $_SERVER['HOME']
|
||||
ln | PHP_EOL
|
||||
pi | M_PI
|
||||
DIRSEP | DIRECTORY_SEPARATOR
|
||||
HOME | $_SERVER['HOME']
|
||||
EOL | PHP_EOL
|
||||
PI | M_PI
|
||||
|
||||
## Extending
|
||||
|
||||
|
@ -41,14 +41,14 @@
|
||||
((first cmd) args))))))
|
||||
|
||||
;; Define a file for readline and load it
|
||||
(def readlineFile (str homedir "calc_history"))
|
||||
(def readlineFile (str HOME "calc_history"))
|
||||
(readlineLoad readlineFile)
|
||||
|
||||
;; Main loop: Read input from user, add it to readline, and parse it
|
||||
(def mainLoop (fn () (let (inp (readline "> "))
|
||||
(do (readlineAdd inp)
|
||||
(readlineSave readlineFile)
|
||||
(print (str (parseInput inp) "\n"))
|
||||
(print (str (parseInput inp) EOL))
|
||||
true))))
|
||||
|
||||
;; Run it
|
||||
|
@ -8,8 +8,8 @@ class IO implements ILib
|
||||
{
|
||||
public function register(Env $env): void
|
||||
{
|
||||
$env->set('dirsep', \DIRECTORY_SEPARATOR);
|
||||
$env->set('homedir', $_SERVER['HOME'] . \DIRECTORY_SEPARATOR);
|
||||
$env->set('DIRSEP', \DIRECTORY_SEPARATOR);
|
||||
$env->set('HOME', $_SERVER['HOME'] . \DIRECTORY_SEPARATOR);
|
||||
|
||||
$env->set('wd', new CoreFunc('wd', 'Get the current working directory.', 0, 0,
|
||||
fn () => getcwd() . \DIRECTORY_SEPARATOR
|
||||
|
@ -10,7 +10,7 @@ class Math implements ILib
|
||||
{
|
||||
// Constants
|
||||
|
||||
$env->set('pi', \M_PI);
|
||||
$env->set('PI', \M_PI);
|
||||
|
||||
// Basic arithmetic
|
||||
|
||||
|
@ -9,7 +9,7 @@ class Strings implements ILib
|
||||
{
|
||||
public function register(Env $env): void
|
||||
{
|
||||
$env->set('ln', \PHP_EOL);
|
||||
$env->set('EOL', \PHP_EOL);
|
||||
|
||||
$env->set('trim', new CoreFunc('trim', 'Remove whitespace from beginning and end of string.', 1, 1,
|
||||
fn (string $a) => trim($a)
|
||||
|
Loading…
Reference in New Issue
Block a user