EdgeVerve / feel

Expression Language for creating and executing business rules in decision table based on DMN 1.1 specification for conformance level 3
MIT License
93 stars 48 forks source link

list indexing should be one-based #24

Closed PaulChernoch-Shell closed 3 years ago

PaulChernoch-Shell commented 3 years ago

List indexing and several list functions are defined in the DMN spec as being one-based, not zero based.

Rule: data[2]
context: {data: ["hug", "kiss", "slap"]}
Expected result: "kiss"

DMN 1.1 spec, p124, Table 54 says the index is a 0 scale number, which means integer instead of real. It does not mean zero-based. Section 10.3.4.4 List functions, Table 61, page 132, the semantics for the "remove" function clearly show the use of one-based index. Unfortunately, "sublist" and "insert before" examples in the spec appear incorrect!!!

Page 148 of the DMN 1.2 spec has the examples corrected for these two functions.

I have tried this at https://nikku.github.io/feel-playground and that implementation uses one-based indexing.

deostroll commented 3 years ago

Hi. Thanks for the observation. We have updated corresponding string and list functions.