Arrow functions in twig or craft cms I tried to use reduce function in template, but got error. It seems twig/craftcms can not work with such functions.
Reduce function docs: https://docs.craftcms.com/v3/dev/filters.html#reduce

My example:

{% set data = craft.entries.section("faqChannel").orderBy('faqOrder').all() %}
{% set types = data|reduce((acc, v) =&gt; v.faqType is not in acc ? acc|merge([v.faqType]) : acc, []) %}


Error:
Twig Syntax Error – Twig_Error_Syntax
An opened parenthesis is not properly closed. Unexpected token "punctuation" of value "," ("punctuation" expected with value ")").
Twig didn’t add arrow function support until v2.10.0, so you need to be on at least Craft 3.1.29 if you want to use them.