emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] scratch/add-vdiff 3d8e224 127/258: Simplify insertion arrow code


From: Justin Burkett
Subject: [elpa] scratch/add-vdiff 3d8e224 127/258: Simplify insertion arrow code
Date: Wed, 17 May 2017 08:13:36 -0400 (EDT)

branch: scratch/add-vdiff
commit 3d8e2246a7acb8864fbfaca04ec3f663fc583c26
Author: justbur <address@hidden>
Commit: justbur <address@hidden>

    Simplify insertion arrow code
---
 vdiff.el | 36 +++++++++++++++++-------------------
 1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/vdiff.el b/vdiff.el
index 64d690a..174364b 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -538,26 +538,24 @@ of a \"word\"."
 ;; * Add overlays
 
 (defvar vdiff--insertion-arrow-bits
-  (apply
+  (cl-map
    #'vector
-   (mapcar
-    (lambda (line)
-      (let* ((ex (1- (length line))))
-        (apply '+
-               (mapcar
-                (lambda (el)
-                  (prog1
-                      (* el (expt 2 ex))
-                    (cl-decf ex))) line))))
-    '((0 0 1 1 1 1 1 1)
-      (0 0 0 1 1 1 1 1)
-      (0 0 0 0 1 1 1 1)
-      (0 0 0 1 1 1 1 1)
-      (0 0 1 1 1 0 1 1)
-      (0 1 1 1 0 0 0 1)
-      (1 1 1 0 0 0 0 0)
-      (1 1 0 0 0 0 0 0)
-      (1 0 0 0 1 1 1 1)))))
+   (lambda (line)
+     (let ((ex (length line)))
+       (cl-reduce
+        (lambda (acc el)
+          (+ acc (* el (expt 2 (cl-decf ex)))))
+        line
+        :initial-value 0)))
+   '((0 0 1 1 1 1 1 1)
+     (0 0 0 1 1 1 1 1)
+     (0 0 0 0 1 1 1 1)
+     (0 0 0 1 1 1 1 1)
+     (0 0 1 1 1 0 1 1)
+     (0 1 1 1 0 0 0 1)
+     (1 1 1 0 0 0 0 0)
+     (1 1 0 0 0 0 0 0)
+     (1 0 0 0 1 1 1 1))))
 
 (define-fringe-bitmap
   'vdiff--insertion-arrow vdiff--insertion-arrow-bits nil 8 'top)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]