partial solution for p18, just need to recursively implement reduce
completed problem 18, very elegantly if i do say so myself
solved for p67