From 0f4885b162b7a4d5c23fca456be60d44f03d80ef Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 3 Jun 2019 12:47:49 +0200 Subject: modules: Use string-null? instead of (equal? "" ...). * modules/language/python/bytes.scm (replace): Use string-null?. * modules/language/python/completer.scm (complete-fkn): Likewise. * modules/language/python/module/io.scm (StringIO): Likewise. * modules/language/python/spec.scm (cc): Likewise. * modules/language/python/string.scm (py-replace): Likewise. --- modules/language/python/bytes.scm | 2 +- modules/language/python/completer.scm | 2 +- modules/language/python/module/io.scm | 2 +- modules/language/python/spec.scm | 4 +++- modules/language/python/string.scm | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/language/python/bytes.scm b/modules/language/python/bytes.scm index e3d8245..6e08300 100644 --- a/modules/language/python/bytes.scm +++ b/modules/language/python/bytes.scm @@ -1052,7 +1052,7 @@ (reverse (let lp ((s s) (r '())) (let ((l (py-partition s old))) - (if (equal? (cadr l) "") + (if (string-null? (cadr l)) (cons s r) (lp (list-ref l 2) (cons (car l) r)))))) n diff --git a/modules/language/python/completer.scm b/modules/language/python/completer.scm index 73f96bd..047248e 100644 --- a/modules/language/python/completer.scm +++ b/modules/language/python/completer.scm @@ -38,7 +38,7 @@ (set! strs d) (set! pp p) (set! regexp (string-append - "^" (if (equal? t "") + "^" (if (string-null? t) "[^_]" (regexp-quote t)))) (compl text #t))) diff --git a/modules/language/python/module/io.scm b/modules/language/python/module/io.scm index 3c7809c..e48abcf 100644 --- a/modules/language/python/module/io.scm +++ b/modules/language/python/module/io.scm @@ -536,7 +536,7 @@ (define __init__ (lam (self (= initial_value "") (= newline "\n")) (set self 'newline newline) - (if (equal? initial_value "") + (if (string-null? initial_value) (set self '_port (open-output-string)) (set self '_port (open-input-string initial_value))))) diff --git a/modules/language/python/spec.scm b/modules/language/python/spec.scm index 7814d2c..ea545ac 100644 --- a/modules/language/python/spec.scm +++ b/modules/language/python/spec.scm @@ -31,7 +31,9 @@ (define (c int x) (pr (comp int (pr (p (pr x)))))) (define (cc int port x) - (if (equal? x "") (read port) (c int x))) + (if (string-null? x) + (read port) + (c int x))) (define (e x) (eval (c #t x) (current-module))) diff --git a/modules/language/python/string.scm b/modules/language/python/string.scm index b3708b5..26b3482 100644 --- a/modules/language/python/string.scm +++ b/modules/language/python/string.scm @@ -361,7 +361,7 @@ (reverse (let lp ((s s) (r '())) (let ((l (py-partition s old))) - (if (equal? (cadr l) "") + (if (string-null? (cadr l)) (cons s r) (lp (list-ref l 2) (cons (car l) r)))))) new))) -- cgit v1.2.3