The following is not currently supported as Set is not exposed standalone to be passed to Cypher.Pattern:
MATCH p=(start)-[*]->(finish)
WHERE start.name = 'A' AND finish.name = 'D'
FOREACH (n IN nodes(p) | SET n.marked = true)
Note that Cypher.Pattern(...).set will generate a SET statement after FOREACH which is also valid: