Use spaces instead of tabs for indentation
This commit is contained in:
parent
1381f0b881
commit
938fd7d41b
@ -5,42 +5,42 @@
|
|||||||
(reverse
|
(reverse
|
||||||
(let iter ((len (string-length line))
|
(let iter ((len (string-length line))
|
||||||
(rem (string-copy line))
|
(rem (string-copy line))
|
||||||
(idx 0)
|
(idx 0)
|
||||||
(res '()))
|
(res '()))
|
||||||
(cond ((>= idx len) (cons rem res))
|
(cond ((>= idx len) (cons rem res))
|
||||||
((char=? #\tab (string-ref rem idx))
|
((char=? #\tab (string-ref rem idx))
|
||||||
(iter (- len idx 1)
|
(iter (- len idx 1)
|
||||||
(substring rem (+ idx 1) len)
|
(substring rem (+ idx 1) len)
|
||||||
0
|
0
|
||||||
(cons (substring rem 0 idx) res)))
|
(cons (substring rem 0 idx) res)))
|
||||||
(else (iter len rem (+ idx 1) res))))))
|
(else (iter len rem (+ idx 1) res))))))
|
||||||
|
|
||||||
(define (vcard name number)
|
(define (vcard name number)
|
||||||
(with-output-to-string
|
(with-output-to-string
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(display "BEGIN:VCARD")
|
(display "BEGIN:VCARD")
|
||||||
(newline)
|
(newline)
|
||||||
(display "N:;")
|
(display "N:;")
|
||||||
(display name)
|
(display name)
|
||||||
(display ";;;")
|
(display ";;;")
|
||||||
(newline)
|
(newline)
|
||||||
(display "TEL;TYPE=cell:")
|
(display "TEL;TYPE=cell:")
|
||||||
(display number)
|
(display number)
|
||||||
(newline)
|
(newline)
|
||||||
(display "END:VCARD")
|
(display "END:VCARD")
|
||||||
(newline))))
|
(newline))))
|
||||||
|
|
||||||
(define (tsv-contact->vcard line)
|
(define (tsv-contact->vcard line)
|
||||||
(let* ((fields (tsv-fields line))
|
(let* ((fields (tsv-fields line))
|
||||||
(number (list-ref fields 0))
|
(number (list-ref fields 0))
|
||||||
(name (list-ref fields 1)))
|
(name (list-ref fields 1)))
|
||||||
(vcard name number)))
|
(vcard name number)))
|
||||||
|
|
||||||
(define (foreach-line thunk)
|
(define (foreach-line thunk)
|
||||||
(let loop ()
|
(let loop ()
|
||||||
(let ((line (get-line (current-input-port))))
|
(let ((line (get-line (current-input-port))))
|
||||||
(unless (eof-object? line)
|
(unless (eof-object? line)
|
||||||
(display (thunk line))
|
(display (thunk line))
|
||||||
(loop)))))
|
(loop)))))
|
||||||
|
|
||||||
(foreach-line tsv-contact->vcard)
|
(foreach-line tsv-contact->vcard)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user