| Date: Sat, 22 Oct 2011 21:15:59 +0200 | From: Denis Washington <[email protected]> | | ... | Also, a destructuring let form would be a much better solution. | For instance, in Clojure you can write something like: | | (let [[_ specs end & body] exp] | ...) | | We could have something similar in WG2: | | (let (((_ specs end . body) exp)) | ...) | | Even better, we could also have an "if-let" form whose execution | path depends on whether the destructuring is possible: | | (if-let (((_ specs end . body) exp)) | ... | (syntax-error))
How does destructuring work with mutation? Does assigning to a bound variable alter the matched structure? Writing calls to SET-CAR! and SET-CDR! would require binding the pair containing the pointer to be changed. That would destroy the obviousness of destructuring, but is easy to deal with using C*R: just remove the first character after the "C" (CR is the identity function). | Such destructuring forms would remove most reasons for having cadr | etc. in the standard. I disagree. _______________________________________________ Scheme-reports mailing list [email protected] http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports
