target := expr expr as target expr -> target target given target = expr
let target = expr : target expr ;
Although in general "target:=exp" seems the most palatable of these to me, there is one nice benefit to the "given" syntax:
Suppose you have a comprehension wherein you want to pass forward an internal "state" between iterations, but not return it as the output:
In today's python, you'd to:
outputs = []
state = initial_state
for inp in inputs:
out, state = my_update_func(state)
outputs.append(state)
This could not be neatly compacted into:
state = initial_state
outputs = [out given out, state = my_update_func(inp, state) for inp in inputs]
Or maybe:
outputs = [out given out, state = my_update_func(inp, state) for inp in inputs given state=initial_state]
Though I agree for the much more common case of assigning a value inline "x given x=y" seems messily redundant.