Mercerenies / fifi-calculator

1 stars 0 forks source link

Incomplete objects #12

Closed Mercerenies closed 2 months ago

Mercerenies commented 4 months ago

For inputting things like vectors or complex numbers

Mercerenies commented 3 months ago

Note: I think we'll represent incomplete objects not as a new atom but as a wrapped string. So the incomplete object [ will be represented as incomplete("[") (where the argument is a string literal). The default pretty-printer will know to print this in a special way, but the parser-friendly printer will write it in its full form (since the parser won't have any special behavior for this)

Mercerenies commented 2 months ago

Currently, the only incomplete objects we need are

There's no mixing of delimiters, so a [ must always be terminated with the ] command (and eqv for ( and )).

New commands:

Design note: Incomplete objects are meant to be extremely transient objects and should exist for only a few seconds to allow input for other, more complete objects. If you end up with a nontrivial expression containing an incomplete object (like a vector containing a [, a summation containing a (, etc), then you've very likely done something wrong. I intend to be provide no support for evaluating expressions containing incomplete objects, because it makes little sense to do so.

Mercerenies commented 2 months ago

Also, another design note for completeness: Since we're using infix operators for intervals (#71) instead of brackets as Emacs does, we do NOT support input of intervals using incomplete objects.

Mercerenies commented 2 months ago

Incomplete objects are complete: eaae2ef

Will need to expand ( ... ) to support quaternions (#9) eventually, but otherwise done.