Chained Comparison Operators for ndarrays #392

Open
opened 2024-04-05 15:38:34 +08:00 by derppening · 0 comments
Collaborator

Example:

1 > 2 < np_identity(2)  # True
1 < 2 < np_identity(2)  # ndarray([[False, False], [False, False])
0 < 1 <= np_identity(2) # ndarray([[True, False], [False, True]))

To-Do List:

  • Change how calls are stored in CodeGenContext
    • Calls are currently stored in a HashMap<CodeLocation, CallId>, meaning that two calls referenced in the same location will have the same ID
    • Change parser to include location information for each comparison operator within a compare expression, or
    • Change CodeGenContext.calls to use other keys to differentiate different calls, or
  • Check if union type annotations are supported
  • Implement chained comparison operator logic
Example: ``` 1 > 2 < np_identity(2) # True 1 < 2 < np_identity(2) # ndarray([[False, False], [False, False]) 0 < 1 <= np_identity(2) # ndarray([[True, False], [False, True])) ``` To-Do List: - [ ] Change how calls are stored in `CodeGenContext` - Calls are currently stored in a `HashMap<CodeLocation, CallId>`, meaning that two calls referenced in the same location will have the same ID - [ ] Change parser to include location information for each comparison operator within a compare expression, or - [ ] Change `CodeGenContext.calls` to use other keys to differentiate different calls, or - [ ] Check if union type annotations are supported - [ ] Implement chained comparison operator logic
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nac3#392
There is no content yet.