Skip to content

Edge case: diff([1]) #2412

@gwhitney

Description

@gwhitney

Currently, math.evaluate('diff([1])') returns [1]. It seems to me that to be consistent with diff() called on any array of length > 1 (where it returns an array of length one less than the input), the value of diff([x]) ought to be [] no matter what x is. In other words , there are no consecutive differences of a list of length 1. (diff([]) would continue to produce [] as it currently does; there are also no consecutive differences of a list of length 0.)

If there's agreement that the current behavior is anomalous and should be corrected, I will be happy to supply the small PR needed to fix.

Incidentally, it seems to me that issue #1634 asking for diff in the first place can be closed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions