Somewhat OT: defining algebras in D

Nick Sabalausky (Abscissa) SeeWebsiteToContactMe at semitwist.com
Fri Feb 9 02:40:06 UTC 2018


On 02/08/2018 04:37 PM, Amorphorious wrote:
> On Thursday, 8 February 2018 at 15:23:05 UTC, Simen Kjærås wrote:
>> So I was bored in a meeting and decided to implement a generic 
>> template for defining complex numbers, dual numbers, quaternions and 
>> many other possible algebras by simply defining a set of rules and the 
>> components on which they act:
>>
>> source:
>>
>> https://gist.github.com/Biotronic/833680b37d4afe774c8562fd21554c6b
>>

Cool. Took me a while to start to understand it and still not 100% 
grokked (partly because I've never quite been able to fully grasp 
quaternion math (at least, beyond Unity3D's ultra-easy abstraction for 
it) and never heard of dual numbers before), but staring at the complex 
number example helped see how this works. It's a very cool idea!

> It would be nice if you learned how to document your code. It's not 
> always easy for someone on the outside to be able to pick it up and it 
> ultimately means your hard work will be less used as it could be. I know 
> that sometimes comments can be redundant but it can also provide a 
> better understanding.
> 

Well, that's the difference between a formal library package release vs 
sharing a working proof of concept jotted down to pass time ;)


More information about the Digitalmars-d mailing list