asc-community / asc-community/AngouriMath

Syntax for Piecewise?

Open
#326 1 comment 0 reactions 0 assignees View on GitHub
Opinions wanted
Dominant language
C#
Stars
831
Forks
79
Avg merge
3h 23m
Merged PRs (30d)
309

Description

What would be a good syntax for piecewise-defined function? Currently, it's
- `Piecewise(a provided b, c provided d)` without the otherwise case
- `Piecewise(a provided b, c provided d, e)` with the otherwise case.

By this time, multiple ideas have been considered:
- `a if b else c` (but how to expand for more than two cases?)
- `(a if b, c if d, ..., e)` (but will there be no conflicts in the future?)
- `(a if b else c if d else ..., e)` (is it readable enough?)
- `piecewise((a, b), (c, d), ..., e)` (sympy's way)
- `if a then b elif c then d ... else e` (is it convenient?)

Your ideas are welcomed

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the current Piecewise syntax described in the issue and the alternative forms under consideration. Compare how each option would represent multiple conditions and an otherwise case; done means the project has selected and documented a syntax to implement.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.