Re: Define a new custom operator in D Language.

2023-10-10 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 2 October 2023 at 18:34:13 UTC, BoQsc wrote: --- **This might lead to less gaps between math formulas and the implementation.** Or at the very least would allow to define a formula in the source code for further implementation and introduce some consistency. You could write a

Re: Define a new custom operator in D Language.

2023-10-08 Thread IchorDev via Digitalmars-d-learn
On Monday, 2 October 2023 at 21:37:56 UTC, bachmeier wrote: On Monday, 2 October 2023 at 19:28:32 UTC, BoQsc wrote: I'm unable to see how the operator overloading would allow to define a new custom operator. And I don't expect that to change. This has come up many times. With a parameter

Re: Define a new custom operator in D Language.

2023-10-02 Thread bachmeier via Digitalmars-d-learn
On Monday, 2 October 2023 at 19:28:32 UTC, BoQsc wrote: Overloading seems to only overload behaviour of existing operator, like: ``` + - * / % ^^ & | ^ <<>>>>>~ in ``` I'm unable to see how the operator overloading

Re: Define a new custom operator in D Language.

2023-10-02 Thread Imperatorn via Digitalmars-d-learn
On Monday, 2 October 2023 at 19:28:32 UTC, BoQsc wrote: On Monday, 2 October 2023 at 18:39:41 UTC, Imperatorn wrote: On Monday, 2 October 2023 at 18:34:13 UTC, BoQsc wrote: [...] https://dlang.org/spec/operatoroverloading.html#binary Overloading seems to only overload behaviour of

Re: Define a new custom operator in D Language.

2023-10-02 Thread BoQsc via Digitalmars-d-learn
On Monday, 2 October 2023 at 18:39:41 UTC, Imperatorn wrote: On Monday, 2 October 2023 at 18:34:13 UTC, BoQsc wrote: Here is my issue: I've found a formula on Wikipedia. It's called **Hashing by division**. ![](https://i.imgur.com/UJPAWIW.png) As you can see it uses **mod** keyword to achieve

Re: Define a new custom operator in D Language.

2023-10-02 Thread Imperatorn via Digitalmars-d-learn
On Monday, 2 October 2023 at 18:34:13 UTC, BoQsc wrote: Here is my issue: I've found a formula on Wikipedia. It's called **Hashing by division**. ![](https://i.imgur.com/UJPAWIW.png) As you can see it uses **mod** keyword to achieve the modulus operation. In D language we use modulus