alex-yashin / php-simple-lisp
1.0.0
2021-08-29 14:16 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- phpunit/phpunit: 6.*
This package is auto-updated.
Last update: 2025-03-30 19:56:01 UTC
README
Usage
$machine = new \SimpleLisp\LispMachine();
$machine->setState([
'param1' => 5,
'param2' => 1,
'param3' => 0,
]);
echo $machine->run('5'); //5
echo $machine->run('param1'); //5
echo $machine->run('(AND 1 0)'); //false
echo $machine->run('(AND param1 param2)'); //true
echo $machine->run('(defun fibonacci (n) (if (> n 1) (+ (fibonacci (- n 1)) (fibonacci (- n 2))) n)) (fibonacci 7)'); //13