Count unique values in an array or a queue

In reply to tharindu:

The first method is known as function chaining. This syntax was just added to the upcoming IEEE 1800-2023 SystemVerilog LRM. Some tools, like Questa, already support it. Check with your tool vendor.