Support for factorial
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- PHP
- Stars
- 26
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Something like this
$parser = Parser::createDefault();
$expression = $parser->parse("2! + 3!");
var_dump($expression->evaluate()); // int(8)
or
$parser = Parser::createDefault();
$expression = $parser->parse("fact(2) + fact(3)");
// https://www.php.net/manual/en/function.gmp-fact.php
var_dump($expression->evaluate()); // int(8)
2! + 3! instead of 1*2 + 1*2*3
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at Parser::createDefault(), then trace parse() and evaluate() for how operators and functions are represented. Compare the proposed 2! + 3! and fact(2) + fact(3) forms, including their precedence and evaluation behavior. Done means factorial expressions produce the demonstrated result of 8.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100