See how easy that is?! But the best part is that this customizable pattern matching is available to Nulan. The implementation is decoupled from the interface, because I'm using objects.
Anyways, how dictionary splicing works is...
> (var [@a "foo" b] ["foo" 1 "bar" 2 "qux" 3])
a -> ["foo" 1 "bar" 2 "qux" 3]
b -> 1
> (var ["foo" a @b] ["foo" 1 "bar" 2 "qux" 3])
a -> 1
b -> ["bar" 2 "qux" 3]
What happened is that in the first one, it took the entire dictionary and bound it to "a", then it bound the "foo" key to "b".
In the second one, it bound the "foo" key to "a", and then bound everything except the "foo" key to "b".
Thus, depending on where you splice, you get different results. The first one is like Haskell's "as" patterns:
The second one is the more traditional "put everything except these keys into this variable" approach. And of course you can combine them as much as you like:
> (var ["foo" a @b "bar" 2 @c] ["foo" 1 "bar" 2 "qux" 3])
a -> 1
b -> ["bar" 2 "qux" 3]
c -> ["qux" 3]
And for fun, you can nest things inside the splice too:
> (var ["foo" a @["bar" b]] ["foo" 1 "bar" 2 "qux" 3])
a -> 1
b -> 2
The above is exactly the same as (var ["foo" a "bar" b] ["foo" 1 "bar" 2 "qux" 3]) except that it needed to do a bit more work. Useful? Who knows, but it's awesome.
---
By the way, for the sake of clarity, I used Nulan notation for all the above stuff. But the reader isn't implemented yet, so for now you have to use (dict ...) rather than [...] and (splice ...) rather than @...
In addition, it no longer hardcodes the "splice" symbol, but now the only way to splice is to use @. I plan to fix this so that you can use both in a hygienic way.