Is the set $\{\langle \varnothing, a \rangle ,\langle \{ \varnothing \}, b \rangle \}$ considered as function? The set defined as
$$F=\{\langle\varnothing,a \rangle, \langle \{\varnothing\},b\rangle\}$$
a function?
Assuming you're using the &quot;functions-as-sets-of-ordered-pairs&quot; approach, then yes, it is: its domain is $\{\emptyset,\{\emptyset\}\}$, it sends $\emptyset$ to $a$, and it sends $\{\emptyset\}$ to $b$. Crucially $\emptyset\not=\{\emptyset\}$, so there's no inconsistency here.
(The other standard approach to functions views a function as a set of ordered pairs together with a specific mention of domain and codomain. Of course the domain is determined by the set of ordered pairs (at least, if we don't allow partial functions), but the codomain is not, so this is a genuinely different approach. If we take this stance then what you've written is not a function.)
EDIT: note that the parenthetical remark is exactly the point Arturo Magidin makes in his comment above.
Yes, it is a function, and if you adopt the usual definition that $0 = \varnothing$, $1 = \{ \varnothing \}$, then this function maps from $\{ 0, 1 \}$ to real (or complex) numbers, and its explicit form is: $F(0) = a, F(1) = b$.