feat: Add generic types and Complex numbers #21

Merged
glen merged 2 commits from generic_complex into main 2025-04-22 01:48:53 +00:00
Owner

The basic idea is that generic types can be called with argument(s) to produce a new type object, and if all types supplied as arguments are concrete, then the result will be a concrete type. The test of a generic type must determine if the entity is an instance of any specialization of the type; and it must also have a refine method that takes such an instance and returns its fully-specialized concrete type. It must also have a method specializesTo that takes a concrete type and returns whether that concrete type is a specialization of this generic type.

Remaining to do: implement all of the number/complex functions from pocomath that don't depend on config.predictable and test them.

The basic idea is that generic types can be called with argument(s) to produce a new type object, and if all types supplied as arguments are concrete, then the result will be a concrete type. The test of a generic type must determine if the entity is an instance of any specialization of the type; and it must also have a `refine` method that takes such an instance and returns its fully-specialized concrete type. It must also have a method `specializesTo` that takes a concrete type and returns whether that concrete type is a specialization of this generic type. Remaining to do: implement all of the number/complex functions from pocomath that don't depend on config.predictable and test them.
glen added 2 commits 2025-04-21 18:39:57 +00:00
glen changed title from WIP: feat: Add generic types and Complex numbers to feat: Add generic types and Complex numbers 2025-04-22 01:42:41 +00:00
Author
Owner

Actually, since this has reached a working point which essentially fulfills the original goals of the PR, I'm going to merge this so that #12 can be addressed before there's even more code to refactor. Then we can come back and implement the other complex functions in a subsequent PR.

Actually, since this has reached a working point which essentially fulfills the original goals of the PR, I'm going to merge this so that #12 can be addressed before there's even more code to refactor. Then we can come back and implement the other complex functions in a subsequent PR.
glen merged commit 491e207fad into main 2025-04-22 01:48:53 +00:00
glen deleted branch generic_complex 2025-04-22 01:48:53 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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: StudioInfinity/nanomath#21
No description provided.