Add tags

Add tags to the following comment

書き捨てっぽく。引き数でファイル名を取って標準出力へ。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
(use srfi-1)
(use text.csv)

(define (main args)
  (receive (header body) (call-with-input-file (cadr args)
                           (lambda (port)
                             (car+cdr (port->list (make-csv-reader #\tab)
                                                  port))))
    (for-each
     (cute (make-csv-writer #\tab) (current-output-port) <>)
     (cons (list (first header) (third header) (second header) (fourth header))
           (map (cut map x->string <>)
                (sort
                 (map (lambda (vs)
                        (list (string->number (first vs))
                              (third vs)
                              (second vs)
                              (+ (string->number (fourth vs)) 1)))
                      body)
                 (lambda (v1 v2) (< (first v1) (first v2)))))))))

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...