diff options
author | Marek Paśnikowski <marek@marekpasnikowski.pl> | 2024-01-19 21:17:47 +0100 |
---|---|---|
committer | Marek Paśnikowski <marek@marekpasnikowski.pl> | 2024-01-19 21:17:47 +0100 |
commit | eae4a41113d8c59d7ebea64e1c08b61d215b4b9b (patch) | |
tree | 4c80db1efabcf2fd565c05890540ee0e5e08b391 | |
parent | 87454b301ab77b37aa264c38bae87d4c174a88b0 (diff) |
Learn to use "named" lambdas in closures.
Rewrite the builder code with use of a property list.
-rw-r--r-- | www/build-site.el | 12 | ||||
-rw-r--r-- | www/www.org | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/www/build-site.el b/www/build-site.el index 575bfe2..2146334 100644 --- a/www/build-site.el +++ b/www/build-site.el @@ -4,10 +4,10 @@ ( defun publication-builder () ( let ( ( report-success "Build complete!" ) ) - ( lambda () - ( message report-success ) - ( ) ) ) ) + ( list + :success-report + ( lambda () + ( message report-success ) + ( ) ) ) ) ) -( defvar publish ( publication-builder ) ) - -( funcall publish ) +( funcall ( plist-get ( publication-builder ) :success-report ) ) diff --git a/www/www.org b/www/www.org index 1b0a362..7a4b615 100644 --- a/www/www.org +++ b/www/www.org @@ -49,13 +49,13 @@ are also published, in the sequence given. ( defun publication-builder () ( let ( ( report-success "Build complete!" ) ) - ( lambda () - ( message report-success ) - ( ) ) ) ) + ( list + :success-report + ( lambda () + ( message report-success ) + ( ) ) ) ) ) - ( defvar publish ( publication-builder ) ) - - ( funcall publish ) + ( funcall ( plist-get ( publication-builder ) :success-report ) ) #+END_SRC * EOF |