I think you underestimate how hard it really is. I don’t think anyone I know who isn't a professional programmer (and some who are) would have found either of your examples easy.