diff options
author | Leah Neukirchen <leah@vuxu.org> | 2022-10-27 21:07:31 +0200 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2022-10-27 21:07:31 +0200 |
commit | f7b1fca131331f2dacae8aa8f58d7d3d68682cec (patch) | |
tree | 20d1c03f6f851e327cbfed249cda0f95c16b1af2 | |
parent | 387547558464ef9fa4c659fc5603d55d2f5eb488 (diff) | |
download | mew-f7b1fca131331f2dacae8aa8f58d7d3d68682cec.tar.gz mew-f7b1fca131331f2dacae8aa8f58d7d3d68682cec.tar.xz mew-f7b1fca131331f2dacae8aa8f58d7d3d68682cec.zip |
make set return the value of the assignment
-rw-r--r-- | mew.scm | 10 | ||||
-rw-r--r-- | mew.svnwiki | 4 |
2 files changed, 10 insertions, 4 deletions
diff --git a/mew.scm b/mew.scm index e56d4ea..147b538 100644 --- a/mew.scm +++ b/mew.scm @@ -13,7 +13,7 @@ one-of op prn puts rep - str slurp + set str slurp tbl time while until @@ -69,7 +69,6 @@ (reexport (rename (scheme) - (set! set) (begin seq) (lambda fun) (apply app) @@ -104,6 +103,13 @@ ((_ . rest) (define . rest)))) + (define-syntax set + (syntax-rules () + ((_ id expr) + (let ((val expr)) + (set! id val) + val)))) + (define-syntax esc (syntax-rules () ((_ return body ...) diff --git a/mew.svnwiki b/mew.svnwiki index 73e460f..c3671f4 100644 --- a/mew.svnwiki +++ b/mew.svnwiki @@ -39,9 +39,9 @@ See Module%20(chicken%20base)#rec or SRFI-31. Often, using {{def}} in an inner scope is preferable to using {{rec}}. -<syntax>(set <variable> <expression>)</syntax> +<syntax>(set <location> <expression>)</syntax> -Alias for {{set!}}. +Like {{set!}}, but also return the value of {{<expression>}}. == Control flow |