finished alternative definition of sf_curry using state interface