From f8dd3392021754225dae6925d0931ff08d06dd00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 20 Dec 2021 22:06:44 +0100 Subject: Remove procedure map-each Was only used once, and wasn't even optimized. --- module/calp/util.scm | 9 --------- module/vulgar/termios.scm | 5 +++-- 2 files changed, 3 insertions(+), 11 deletions(-) (limited to 'module') diff --git a/module/calp/util.scm b/module/calp/util.scm index 1f423756..044e4a95 100644 --- a/module/calp/util.scm +++ b/module/calp/util.scm @@ -297,19 +297,10 @@ (define-public (as-symb s) (if (string? s) (string->symbol s) s)) - - (define-public (enumerate lst) (zip (iota (length lst)) lst)) -;; Map with index -(define-syntax-rule (map-each proc lst) - (map (lambda (x i) (proc x i)) - lst (iota (length lst)))) - -(export map-each) - ;; Takes a procedure returning multiple values, and returns a function which ;; takes the same arguments as the original procedure, but only returns one of ;; the procedures. Which procedure can be sent as an additional parameter. diff --git a/module/vulgar/termios.scm b/module/vulgar/termios.scm index 75181ff3..f88882c9 100644 --- a/module/vulgar/termios.scm +++ b/module/vulgar/termios.scm @@ -102,7 +102,7 @@ ;; Macro for creating accessor bindings for slots in a list, which are wrapped ;; inside a record. Called exactly once below. (define-macro (create-bindings! . symbols) - `(begin ,@(map-each + `(begin ,@(map (lambda (symb i) `(define-public ,symb (make-procedure-with-setter @@ -110,7 +110,8 @@ (lambda (t v) (let ((lst (as-list t))) (list-set! lst ,i v) (set-list! t lst)))))) - symbols))) + symbols + (iota (length symbols))))) (create-bindings! ; accessors iflag oflag cflag lflag line cc ispeed ospeed) -- cgit v1.2.3