add destructuring-define

This commit is contained in:
Yuichi Nishiwaki 2014-08-06 03:01:17 +09:00
parent b0b60d3f01
commit 5a3443a881
1 changed files with 12 additions and 1 deletions

View File

@ -33,4 +33,15 @@
(body (cdr (cdr form)))) (body (cdr (cdr form))))
`(lambda formal# (bind ,args formal# ,@body)))))) `(lambda formal# (bind ,args formal# ,@body))))))
(export (rename destructuring-lambda lambda))) (define-syntax destructuring-define
(ir-macro-transformer
(lambda (form inject compare)
(let ((maybe-formal (cadr form)))
(if (symbol? maybe-formal)
`(define ,@(cdr form))
`(destructuring-define ,(car maybe-formal)
(destructuring-lambda ,(cdr maybe-formal)
,@(cddr form))))))))
(export (rename destructuring-lambda lambda)
(rename destructuring-define define)))