Many Prolog systems implement this feature ---but not SICStus.
?- current_functor(atom,atom(fred)). yes
yes