Implement ndarray.fill and ndarray.copy, miscellaneous bugs #386

Merged
sb10q merged 1 commits from enhance/issue-149-ndarray into master 2024-08-17 17:37:21 +08:00
Collaborator
  • Implement ndarray.fill and ndarray.copy
  • Refactored to use BTreeMap to store type variable mapping
  • Fix ndarray subscript operator returning the wrong object
  • Added more print statements to standalone demos
- Implement `ndarray.fill` and `ndarray.copy` - Refactored to use `BTreeMap` to store type variable mapping - Fix `ndarray` subscript operator returning the wrong object - Added more `print` statements to standalone demos
derppening added 3 commits 2024-03-07 13:18:34 +08:00
77de24ef74 core: Use BTreeMap for type variable mapping
There have been multiple instances where I had the need to iterate over
type variables, only to discover that the traversal order is arbitrary.

This commit fixes that by adding SortedMapping, which utilizes BTreeMap
internally to guarantee a traversal order. All instances of VarMap are
now refactored to use this to ensure that type variables are iterated in
 the order of its variable ID, which should be monotonically incremented
 by the unifier.
sb10q reviewed 2024-03-07 13:19:51 +08:00
@ -29,0 +38,4 @@
"-Wextra",
"-o",
"-",
],
Owner

If the only thing that changes is -O, put the match on that?

If the only thing that changes is -O, put the match on that?
Author
Collaborator

Updated to inline match into one of the arguments.

Updated to inline `match` into one of the arguments.
derppening force-pushed enhance/issue-149-ndarray from e0d95bb0d8 to 2edc1de0b6 2024-03-07 14:59:59 +08:00 Compare
sb10q reviewed 2024-03-07 15:38:26 +08:00
@ -409,1 +430,3 @@
("unwrap".into(), unwrap_ty.0, DefinitionId(13)),
("is_some".into(), is_some_ty.0, DefinitionId(PRIMITIVE_DEF_IDS.option.0 + 1)),
("is_none".into(), is_some_ty.0, DefinitionId(PRIMITIVE_DEF_IDS.option.0 + 2)),
("unwrap".into(), unwrap_ty.0, DefinitionId(PRIMITIVE_DEF_IDS.option.0 + 3)),
Owner

Why are those three not PRIMITIVE_DEF_IDS entries of their own?

Why are those three not PRIMITIVE_DEF_IDS entries of their own?
Author
Collaborator

We currently only include classes in PRIMITIVE_DEF_IDS. We can also include def ids for functions when we refactor that into an enum as suggested in #385.

We currently only include classes in `PRIMITIVE_DEF_IDS`. We can also include def ids for functions when we refactor that into an enum as suggested in #385.
sb10q merged commit 2edc1de0b6 into master 2024-03-08 14:35:11 +08:00
sb10q deleted branch enhance/issue-149-ndarray 2024-03-08 14:35:11 +08:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 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#386
No description provided.