utils: Simplify prettify.
authorRicardo Wurmus <rekado@elephly.net>
Wed, 22 Apr 2020 22:26:14 +0000 (00:26 +0200)
committerRicardo Wurmus <rekado@elephly.net>
Wed, 22 Apr 2020 22:26:14 +0000 (00:26 +0200)
mumi/web/view/utils.scm

index 9e9e11f70ccac7758b691e2e7a8c20c6b95d3b0e..782f73700bc226ddcf46832c55bb4049590df5be 100644 (file)
                        ((#:result res #:context context)
                         (receive (processed new-context)
                             (process line context)
-                          `(#:result ,(append (list processed '(br)) res)
+                          `(#:result ,(cons* '(br) processed res)
                             #:context ,(if new-context
                                            (cons new-context context)
                                            context))))))
                    '(#:result () #:context ())
                    (string-split text #\newline))))
-    ;; Drop the first line break, because it's for an eof
-    ;; read.
-    (match (reverse (cadr (find-tail (cut eq? #:result <>) res)))
-      ((_ . rest) rest)
-      (() '()))))
+    (reverse (and=> (memq #:result res) cadr))))
 
 (define colors
   (circular-list "#8dd3c7" "#bebada" "#fb8072"