Define a new custom operator in D Language.

BoQsc vaidas.boqsc at gmail.com
Mon Oct 2 18:34:13 UTC 2023


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 operator `%` and it might look more 
like this:
```
h(x) M % m
```

This clearly introduces confusion between the source (wikipedia) 
and the implementation (dlang version).

I would like to know how we could define/alia ourselves a `mod` 
operator in D Language.

```
h(x) M mod m
```

---
**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.



More information about the Digitalmars-d-learn mailing list