Filter Dict()

I have a very basic question. When I was looking up how to filter values in Dict(), I came across this documentation

What does p represent, and what do last(p) and first(p) mean?

1 Like

p is an argument that is passed to the anonymous function. For example, x->x+2 is an anonymous function that adds 2 to the input value, x.

1 Like

See the docs on anonymous functions.

(Also, please quote your code instead of screenshots).

I try to answer the meaning of the question, I hope I am forgiven for inaccuracies in the language.
As you can see mydict is a list of ‘key => val’ pairs.
the filter (f, dict) function applies the f function to all elements of the dict list in turn. The generic element p has two components (as we have seen).
If you want to evaluate the key (the first example) you can get it as firts (p) or as last (p) if you want to evaluate the value which is the second (and also the last) element of the pair (the second example) .