A method of implementing Hartree–Fock calculations with zero- and finite-range interactions