From 05be4a61ddfde13ea4f01dca29877992c7b4f965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 24 May 2020 17:30:29 +0200 Subject: Minor change. --- module/util.scm | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'module/util.scm') diff --git a/module/util.scm b/module/util.scm index 617a2ea6..08152c7c 100644 --- a/module/util.scm +++ b/module/util.scm @@ -58,21 +58,19 @@ (begin f ...))])) -(define-syntax aif - (lambda (stx) - (syntax-case stx () - [(_ condition true-clause false-clause) - (with-syntax ((it (datum->syntax stx 'it))) - #'(let ((it condition)) - (if it true-clause false-clause)))]))) - -(define-syntax awhen - (lambda (stx) - (syntax-case stx () - [(_ condition body ...) - (with-syntax ((it (datum->syntax stx 'it))) - #'(let ((it condition)) - (when it body ...)))]))) +(define-syntax (aif stx) + (syntax-case stx () + [(_ condition true-clause false-clause) + (with-syntax ((it (datum->syntax stx 'it))) + #'(let ((it condition)) + (if it true-clause false-clause)))])) + +(define-syntax (awhen stx) + (syntax-case stx () + [(_ condition body ...) + (with-syntax ((it (datum->syntax stx 'it))) + #'(let ((it condition)) + (when it body ...)))])) #; (define-macro (awhen pred . body) @@ -280,7 +278,7 @@ (comperator (get a) (get b))))) -;; Sorts the list @var{items}. @em{May} destroy the input list in the process +;; Sorts the list @var{items}. @emph{May} destroy the input list in the process (define* (sort*! items comperator #:optional (get identity)) "A sort function more in line with how python's sorted works" (sort! items (lambda (a b) -- cgit v1.2.3