From 4cd529362108086eeec25d4d465261415cff45b3 Mon Sep 17 00:00:00 2001 From: "(unmatched-parenthesis ew syntax" Date: Fri, 28 Apr 2023 20:19:05 +0100 Subject: records: Add MATCH-RECORD-LAMBDA. * guix/records.scm (match-record-lambda): New syntax. * tests/records.scm ("match-record-lambda"): New test. Signed-off-by: Josselin Poiret --- tests/records.scm | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/records.scm b/tests/records.scm index 4f0aeb3903..8ee306bddc 100644 --- a/tests/records.scm +++ b/tests/records.scm @@ -590,4 +590,16 @@ Description: 1st line, (match-record rec (normal thunked) (list normal thunked))))) +(test-equal "match-record-lambda" + '("thing: foo" "thing: bar") + (begin + (define-record-type* with-text make-with-text + with-text? + (text with-text-text)) + + (map (match-record-lambda (text) + (string-append "thing: " text)) + (list (with-text (text "foo")) + (with-text (text "bar")))))) + (test-end) -- cgit 1.4.1