I just started learning Prolog (based on “Programming in Prolog”) and in doing so I’ve been trying to write code as much as I can.

So far, my little collection of tiny predicates have seemed OK, to my mind.

However, I’m not sure if I’m confident about the most recent piece of Prolog code I’ve written: https://github.com/bahmanm/prolog-etudes/blob/main/basic-list-techniques/mapping_nested.prolog

Which is why I’m asking if I could please get a code review from the experts. Any hint/feedback is highly appreciated 🙏