# NOT RUN {
type := ZERO | ONE(x) | TWO(x,y)
zero <- ZERO
one <- ONE(1)
two <- TWO(1,2)
as.list(test_pattern(zero, ZERO)) # returns an empty binding
test_pattern_(one, quote(ZERO)) # returns NULL
as.list(test_pattern_(one, quote(ONE(v)))) # returns a binding for v
as.list(test_pattern(two, TWO(v,w))) # returns a binding for v and w
# }
Run the code above in your browser using DataLab