# Counting the frequency of an element in a list?

**URL:** <https://cl.desmos.com/t/counting-the-frequency-of-an-element-in-a-list/8326>\
**Category:** Questions\
**Created:** [October 22, 2025, 9:21pm UTC](https://cl.desmos.com/t/counting-the-frequency-of-an-element-in-a-list/8326 "2025-10-22T21:21:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![French](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/french/32/4354_2.png) [@French](https://cl.desmos.com/u/French)\
**Post date:** [October 22, 2025, 9:21pm UTC](https://cl.desmos.com/t/counting-the-frequency-of-an-element-in-a-list/8326/1 "2025-10-22T21:21:52Z")

</div>

Is there a way to count how frequent an element in a list shows up?

For example if L=[1, 1, 1, 1, 1, 1, 3] and asked how many 1’s showed up, it would give me 6.

Thanks for any help!

---

<div class="post-metadata">

**Author:** ![Guzman\_Tierno](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/guzman_tierno/32/6149_2.png) [@Guzman\_Tierno](https://cl.desmos.com/u/Guzman_Tierno)\
**Post date:** [October 22, 2025, 10:01pm UTC](https://cl.desmos.com/t/counting-the-frequency-of-an-element-in-a-list/8326/2 "2025-10-22T22:01:21Z")

</div>

[https://www.desmos.com/calculator/ninnulcf2j](https://www.desmos.com/calculator/ninnulcf2j)

---

<div class="post-metadata">

**Author:** ![ClayRehmel](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/clayrehmel/32/7144_2.png) [@ClayRehmel](https://cl.desmos.com/u/ClayRehmel)\
**Post date:** [October 23, 2025, 7:18pm UTC](https://cl.desmos.com/t/counting-the-frequency-of-an-element-in-a-list/8326/3 "2025-10-23T19:18:14Z")

</div>

If you’re wanting to do it in the CL in Activity Builder, you do something like:

```auto
List = [1, 1, 1, 1, 1, 1, 3]

num = 1

count = List.reduce(0, (acc,curr) => when curr = num numericValue(`${acc}+1`) otherwise acc)

```

---

<div class="post-metadata">

**Author:** ![NTMDev](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/ntmdev/32/7141_2.png) [@NTMDev](https://cl.desmos.com/u/NTMDev)\
**Post date:** [October 23, 2025, 7:32pm UTC](https://cl.desmos.com/t/counting-the-frequency-of-an-element-in-a-list/8326/4 "2025-10-23T19:32:15Z")

</div>

What’s the `0` in `List.reduce(0, (acc,curr)`? Is that the index of the list? I believe it is `list.function(index, element)`, so maybe I just answered my own question.

---

<div class="post-metadata">

**Author:** ![French](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/french/32/4354_2.png) [@French](https://cl.desmos.com/u/French)\
**Post date:** [October 23, 2025, 7:33pm UTC](https://cl.desmos.com/t/counting-the-frequency-of-an-element-in-a-list/8326/5 "2025-10-23T19:33:54Z")

</div>

For what I need right now I just need it in the graph. But this is really helpful!

---

<div class="post-metadata">

**Author:** ![French](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/french/32/4354_2.png) [@French](https://cl.desmos.com/u/French)\
**Post date:** [October 23, 2025, 7:34pm UTC](https://cl.desmos.com/t/counting-the-frequency-of-an-element-in-a-list/8326/6 "2025-10-23T19:34:13Z")

</div>

This is great! Thanks!

---

<div class="post-metadata">

**Author:** ![ClayRehmel](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/clayrehmel/32/7144_2.png) [@ClayRehmel](https://cl.desmos.com/u/ClayRehmel)\
**Post date:** [October 24, 2025, 9:33am UTC](https://cl.desmos.com/t/counting-the-frequency-of-an-element-in-a-list/8326/7 "2025-10-24T09:33:19Z")

</div>

For most list functions, it’s `list.function(element, index)`. For reduce, it’s `list.reduce(starting value, (accumulator value, current value, current index)`.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/desmos/original/2X/f/f5bd144684474e9a2f333002cde9840e52c5dbd3.png) [@system](https://cl.desmos.com/u/system)\
**Post date:** [October 26, 2025, 9:34am UTC](https://cl.desmos.com/t/counting-the-frequency-of-an-element-in-a-list/8326/8 "2025-10-26T09:34:15Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
