MappingByFunction( D, E, fun )
MappingByFunction returns a mapping map with source D and range E
such that each element d of D is mapped to the element  fun(d),
where fun is a GAP function.
    gap> g := Group( (1,2,3,4), (1,2) );;  g.name := "g";;
    gap> m := MappingByFunction( g, g, x -> x^2 );
    MappingByFunction( g, g, function ( x )
        return x ^ 2;
    end )
    gap> (1,2,3) ^ m;
    (1,3,2)
    gap> IsHomomorphism( m );
    false 
MappingByFunction  constructs  the mapping  in  the obvious  way.   For
example the  image of  an  element  under  map is  simply  computed  by
applying fun to the element.
GAP 3.4.4