From d23d487849f69edbb88af654f6d48dcc7fb05405 Mon Sep 17 00:00:00 2001 From: Sam Caldwell Date: Tue, 20 Oct 2015 08:34:34 -0400 Subject: [PATCH] add structure-capture bit to FAQ --- FAQ.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/FAQ.md b/FAQ.md index 247ca4e..0233016 100644 --- a/FAQ.md +++ b/FAQ.md @@ -156,6 +156,14 @@ (compile-projection `(posn ,? ,(?!)))) ``` and get the result `(set (list 3))`. + - an entire structure can be captured by passing a pattern as an argument to + `(?!)`. + + ```racket + (matcher-project/set (patch-added p) + (compile-projection (?! `(posn ,? ,?)))) + ``` + with the same example yields `(set (list ('posn 2 3))`. - `matcher-project/set/single` is like calling `set-first` on the result of `matcher-project/set` - `patch-project/set` uses `values` to return the result of matching a projection