From c8317f28aaec140bf9854b3a021d8dac78abe395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 1 May 2019 18:14:13 +0200 Subject: Add names to components of 'attr'. --- module/vcomponent.scm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/module/vcomponent.scm b/module/vcomponent.scm index e052f97e..4ef8f794 100644 --- a/module/vcomponent.scm +++ b/module/vcomponent.scm @@ -86,11 +86,16 @@ (define-public attr* get-attr) +(define (get-first c a) + (and=> (car (get-attr c a)) car)) + +(define (set-first! c a v) + (and=> (car (get-attr c a)) + (lambda (f) (set! (car f) v)))) + (define-public attr (make-procedure-with-setter - (lambda (c a) (and=> (car (get-attr c a)) car)) - (lambda (c a v) (and=> (car (get-attr c a)) - (lambda (f) (set! (car f) v)))))) + get-first set-first!)) ;; value ;; (define-public v -- cgit v1.2.3