From f8076e6b66d019c7656fd6198b152e5b849f3add Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 18 Mar 2025 19:44:08 +0100 Subject: [PATCH] Add chain helper method to library --- showbits-thermal-printer/src/documents/lib/main.typ | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/showbits-thermal-printer/src/documents/lib/main.typ b/showbits-thermal-printer/src/documents/lib/main.typ index eeb35fb..2db96e9 100644 --- a/showbits-thermal-printer/src/documents/lib/main.typ +++ b/showbits-thermal-printer/src/documents/lib/main.typ @@ -23,3 +23,8 @@ // Determined by experiments so that the top and bottom white border are roughly // the same size after tearing off the paper. #let feed = v(64pt + 32pt) + +#let chain(..args) = { + assert(args.pos().len() > 0, message: "args required") + args.pos().slice(0, -1).rev().fold(args.pos().at(-1), (x, f) => f(x)) +}