How to use [for-each]
The reference page of for-each has its arguments, constraints and declaration.
[for-each] iterates through each node being the result of an expression, and evaluates its lambda object, passing in the currently iterated node as a [.dp] argument, containing the node currently iterated by reference.
.data
foo1
foo2
for-each:x:-/*
set-value:x:@.dp/#
.:hello
See the documentation for the [reference] slot to understand how reference nodes works.