From 76037adf002640f886c57e558b170e1513de95b6 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Tue, 26 Nov 2019 20:07:46 +0100 Subject: Make use of multi-argument concat builtin --- tests/lispparser.lisp | 18 ++++++++---------- tests/stdlib.lisp | 4 ++-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/tests/lispparser.lisp b/tests/lispparser.lisp index df1ed32..13ed8d2 100644 --- a/tests/lispparser.lisp +++ b/tests/lispparser.lisp @@ -14,7 +14,7 @@ (= ch "\0") "\\0" (= ch "\"") "\\\"" (= ch "\\") "\\\\" - (< n 32) (concat "\\x" (concat (hexdigit (/ n 16)) (hexdigit (mod n 16)))) + (< n 32) (concat "\\x" (hexdigit (/ n 16)) (hexdigit (mod n 16))) ch))) (rec (substr 1 -1 str) (concat yet out))))))) (go str ""))) @@ -28,7 +28,7 @@ (= clr 'blue) "34" (= clr 'cyan) "36" (error "Unknown color in ansi-color" clr)))) - (concat (concat "\x1B[" (concat style "m")) (concat str "\x1B[0m")))) + (concat "\x1B[" style "m" str "\x1B[0m"))) ; char string -> bool (define str-elem (ch str) @@ -185,21 +185,20 @@ (= tag 'quote) (ansi-color 'green "'") (= tag 'string) - (ansi-color 'yellow (concat "\"" (concat (string-escape field) "\""))) + (ansi-color 'yellow (concat "\"" (string-escape field) "\"")) (= tag 'number) (ansi-color 'blue (number->string field)) (= tag 'name) field (= tag 'include) - (concat (concat (ansi-color 'cyan "#include") " ") (ansi-color 'yellow (concat "\"" (concat (string-escape field) "\"")))) + (concat (ansi-color 'cyan "#include") " " (ansi-color 'yellow (concat "\"" (string-escape field) "\""))) (error "Invalid token tag in pretty-token" tag)))) ; tokens -> string (define pretty-token-list (tokens) (if (null? tokens) "" - (concat (pretty-token (car tokens)) - (concat " " (pretty-token-list (cdr tokens)))))) + (concat (pretty-token (car tokens)) " " (pretty-token-list (cdr tokens))))) ; (define logged-token-fn (name fn) ; (lambda (x) @@ -282,7 +281,7 @@ (= (car ast) 'program) (intercalate " " (map pretty-ast-compact (cdr ast))) (= (car ast) 'list) - (concat "(" (concat (intercalate " " (map pretty-ast-compact (cadr ast))) ")")) + (concat "(" (intercalate " " (map pretty-ast-compact (cadr ast))) ")") (= (car ast) 'quote) (concat "'" (pretty-ast-compact (cadr ast))) (= (car ast) 'string) @@ -303,8 +302,7 @@ (rest (drop-while isnotnl? str))) (if (= rest "") line - (concat line - (concat "\n " (rec (substr 1 -1 rest)))))))) + (concat line "\n " (rec (substr 1 -1 rest))))))) (indent-items (lambdarec rec (items) (if (null? items) "" @@ -325,7 +323,7 @@ (= (car ast) 'program) (print-program (cdr ast)) (= (car ast) 'list) - (concat "(" (concat (indent-items (cadr ast)) ")")) + (concat "(" (indent-items (cadr ast)) ")") (= (car ast) 'quote) (concat "'" (pretty-ast-compact (cadr ast))) (= (car ast) 'string) diff --git a/tests/stdlib.lisp b/tests/stdlib.lisp index 9acee4b..e6c7eee 100644 --- a/tests/stdlib.lisp +++ b/tests/stdlib.lisp @@ -40,7 +40,7 @@ (cons (car l) (take-while-list f (cdr l))) '())) -(define bracket (s) (concat "<" (concat s ">"))) +(define bracket (s) (concat "<" s ">")) (define take-while-str (f s) (cond @@ -135,4 +135,4 @@ "" (null? (cdr l)) (car l) - (concat (concat (car l) sep) (intercalate sep (cdr l))))) + (concat (car l) sep (intercalate sep (cdr l))))) -- cgit v1.2.3-54-g00ecf