You probably want to use LATERAL JOIN, which will compute the subquery for each left hand row. Otherwise it's computed just once.
I like that though, I have a preference for REPL style development and fleshing things out interactively. Enough so that I build Java like that, hacking things out directly in tests.