Actually we do have nested scripts in HS, using the
subscript syntax. They are lexically scoped but can not yet form closures, because there is not yet a way to obtain a reference to a subscript (and the main reason for that is that it requires garbage collection). A lambda
expression by definition evaluates to a callable object (although it could just be a script ID, I'm moving to objects instead of IDs), and hence can potentially form a closure, which is why I mentioned them, but I am aware that they are completely different things.
I also think the syntax using -> or => is nice. I guess => is better than -> if it's more common. x, y -> x.type == LATENT could be tricky to parse, so I also listed (x, y) -> x.type == LATENT instead.
I'm very happy to discuss this, there's a lot of decisions to be made, which I plan to slowly send out to the OHR mailing list.
Closely related to lambdas are list comprehensions. I'm not sure whether to imitate Python/JS syntax as closely as possible, or use a more HS-typical syntax like "newlist := foreach(iterator, list) return(expression)" (to mirror a new "foreach(iterator, list) do(...)" construct)