changed two lets into one let

main
m455 2018-04-28 09:31:39 -04:00
parent d9aea661a1
commit 22cecf9a11
1 changed files with 15 additions and 15 deletions

View File

@ -28,11 +28,11 @@
(empty? (rest (file->string-list lst)))) (empty? (rest (file->string-list lst))))
(define (get-removed-item lst args) (define (get-removed-item lst args)
(list-ref lst (string->number args))) (list-ref lst (string->number args)))
(define (quote-item args) (define (quote-item args)
(display (display
(string-append "\"" args "\""))) (string-append "\"" args "\"")))
(define (number-list lst) (define (number-list lst)
(map string-append (map string-append
@ -74,9 +74,9 @@
path path
#:mode 'text #:mode 'text
#:exists 'replace) #:exists 'replace)
(d-hash-ref messages 'item-added-prefix) (d-hash-ref messages 'item-added-prefix)
(quote-item args) (quote-item args)
(d-hash-ref messages 'item-added-suffix))) (d-hash-ref messages 'item-added-suffix)))
(define (add-item args) (define (add-item args)
(if (if
@ -90,16 +90,16 @@
(define (remove-item-from-file args) (define (remove-item-from-file args)
(let ([removed-item (let ([removed-item
(get-removed-item (file->string-list path) args)]) (get-removed-item (file->string-list path) args)]
(let ([new-list [new-list
(remove (remove
(list-ref (file->string-list path) (string->number args)) (list-ref (file->string-list path) (string->number args))
(file->string-list path))]) (file->string-list path))])
(display-to-file (display-to-file
(string-join new-list "\n" #:after-last "\n") (string-join new-list "\n" #:after-last "\n")
path path
#:mode 'text #:mode 'text
#:exists 'replace)) #:exists 'replace)
(d-hash-ref messages 'item-removed-prefix) (d-hash-ref messages 'item-removed-prefix)
(quote-item removed-item) (quote-item removed-item)
(d-hash-ref messages 'item-removed-suffix))) (d-hash-ref messages 'item-removed-suffix)))