I was wondering if it would be possible to add a built-in version of cond that uses match/unify to match and then create a local scope for the matched condition's body, such as:
Code: Select all
(define (foo) (match-cond (args) ((A B C) (do something where A B C are declared as local)) ((A B) (do something when (args) only has A and B)) (true (catch-all clause)))
I've worked on this as a macro, but it ended up being so slow that it wasn't worth using. However, this would give us modern functional pattern matching syntax, and allow some really nice, concise coding.