diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-01-12 00:48:43 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-01-12 00:48:43 -0800 |
commit | 3a21909c1dadf6cf5672d0df8ded5498016c3e0b (patch) | |
tree | f241a34d3085cbac9db63ca501155fe5ccd1a114 /txr.1 | |
parent | 40be9337d126862cd99a460dd473ba65d8885ef4 (diff) | |
download | txr-3a21909c1dadf6cf5672d0df8ded5498016c3e0b.tar.gz txr-3a21909c1dadf6cf5672d0df8ded5498016c3e0b.tar.bz2 txr-3a21909c1dadf6cf5672d0df8ded5498016c3e0b.zip |
doc: shorten param macro memoization example.
* txr.1: Replace silly loop with idiomatic code.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 7 |
1 files changed, 1 insertions, 6 deletions
@@ -28646,12 +28646,7 @@ The function is then memoized. (sethash %memo% sym (hash :equal-based)))) (define-param-expander :memo (param body) - (let* ((piter param) - ;; memoize over required args - (memo-parm (build - (whilet ((p (pop piter)) - (x (and p (neq p :)))) - (add p)))) + (let* ((memo-parm [param 0..(posq : param)]) (hash (gensym)) (key (gensym))) ^(,param (let ((,hash (ensure-memo ',hash)) |