@a_cowley So to be clear, I haven’t benchmarked this, but I can’t imagine it’s great if you’re calling/replacing those higher-order functions a lot. Thunks aren’t free. But that’s going to be the case with anything where you’re traversing trees/replacing subtrees repeatedly, too.
@a_cowley And some things, like repeated substitutions (inlining!) of globals, can be performed by composing onto the function in O(1), deferring the actual *work* just like with difference lists.
Jan 3, 2019 • 7 tweets • 3 min read
@a_cowley Pattern matching on the argument to the higher-order function is definitely a mistake, which PHOAS resolves by making it impossible. Learned that one the hard way!
@a_cowley Additionally, the basic treatment of it as e.g.:
data Expr = App Expr Expr | Lam (Expr -> Expr)
doesn’t really allow for free variables, which you often want—e.g. distinguishing locals, represented by variables in the metalanguage, from globals, represented as a constructor.
Dec 13, 2018 • 9 tweets • 2 min read
Mentoring is challenging. You have to:
- be mindful of the power gradient between yourself and your mentee;
- be mindful of your mentee’s current level of understanding;
- provide context around *why*, and not just *what* things are done;
- come up with explanations on the fly;
- let your mentee make mistakes so they can learn to diagnose & recover from them;
- give them challenges that are *just* outside their current reach;
- make a psychologically safe environment for them to be wrong;
- gently explore their decisions & understanding via questions;