How to count "appearances" of element in a list

How can I use the Graphing Calculator to make a count function, so that if I did:

count(1, [1,1,1,2,2,3,3])

It would return 3 (because 1 appears in the list three times)?

Here is a fairly simple way to do it.

Or like this:
https://www.desmos.com/calculator/xgxsgtyptt

Count(item, List) = count( List[List=item] )

I will mark @Daniel_Wekselgreene ‘s reply as the solution since he said it first, but thank you both!

1 Like