home
/
code
/
tt.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
3877a0c
)
Replace inappropriate underscores
author
Siraaj Khandkar
<siraaj@khandkar.net>
Mon, 22 Mar 2021 00:07:06 +0000
(20:07 -0400)
committer
Siraaj Khandkar
<siraaj@khandkar.net>
Mon, 22 Mar 2021 00:07:06 +0000
(20:07 -0400)
tt.rkt
patch
|
blob
|
blame
|
history
diff --git
a/tt.rkt
b/tt.rkt
index
0eb9fcd
..
6914d7a
100644
(file)
--- a/
tt.rkt
+++ b/
tt.rkt
@@
-24,7
+24,7
@@
'new->old))
(struct msg
'new->old))
(struct msg
- ([ts
_
epoch : Integer]
+ ([ts
-
epoch : Integer]
[ts-orig : String]
[nick : String]
[uri : Url]
[ts-orig : String]
[nick : String]
[uri : Url]
@@
-36,7
+36,7
@@
[uri : Url])
#:type-name Feed)
[uri : Url])
#:type-name Feed)
-(define (concurrent-filter-map num
_
workers f xs)
+(define (concurrent-filter-map num
-
workers f xs)
; TODO preserve order of elements OR communicate that reorder is expected
; TODO switch from mailboxes to channels
(define (make-worker id f)
; TODO preserve order of elements OR communicate that reorder is expected
; TODO switch from mailboxes to channels
(define (make-worker id f)
@@
-65,7
+65,7
@@
[(cons x xs) (begin
(thread-send thd (cons 'unit x))
(dispatch ws xs ys))])])))
[(cons x xs) (begin
(thread-send thd (cons 'unit x))
(dispatch ws xs ys))])])))
- (define workers (range num
_
workers))
+ (define workers (range num
-
workers))
(define threads (map (λ (id) (thread (make-worker id f))) workers))
(define results (dispatch workers xs '()))
(for-each thread-wait threads)
(define threads (map (λ (id) (thread (make-worker id f))) workers))
(define results (dispatch workers xs '()))
(for-each thread-wait threads)
@@
-91,12
+91,12
@@
['single-line
(printf "~a \033[1;37m<~a>\033[0m \033[0;~am~a\033[0m~n"
(parameterize ([date-display-format 'iso-8601])
['single-line
(printf "~a \033[1;37m<~a>\033[0m \033[0;~am~a\033[0m~n"
(parameterize ([date-display-format 'iso-8601])
- (date->string (seconds->date [msg-ts
_
epoch msg]) #t))
+ (date->string (seconds->date [msg-ts
-
epoch msg]) #t))
nick color text)]
['multi-line
(printf "~a (~a)~n\033[1;37m<~a ~a>\033[0m~n\033[0;~am~a\033[0m~n~n"
(parameterize ([date-display-format 'rfc2822])
nick color text)]
['multi-line
(printf "~a (~a)~n\033[1;37m<~a ~a>\033[0m~n\033[0;~am~a\033[0m~n~n"
(parameterize ([date-display-format 'rfc2822])
- (date->string (seconds->date [msg-ts
_
epoch msg]) #t))
+ (date->string (seconds->date [msg-ts
-
epoch msg]) #t))
(msg-ts-orig msg)
nick uri color text)])))))
(msg-ts-orig msg)
nick uri color text)])))))
@@
-191,9
+191,9
@@
[actual (str->msg nick uri (string-append ts tab text))]
[expected (msg 1605756129 ts nick uri text)])
(check-equal?
[actual (str->msg nick uri (string-append ts tab text))]
[expected (msg 1605756129 ts nick uri text)])
(check-equal?
- (msg-ts
_
epoch actual)
- (msg-ts
_
epoch expected)
- "str->msg ts
_
epoch")
+ (msg-ts
-
epoch actual)
+ (msg-ts
-
epoch expected)
+ "str->msg ts
-
epoch")
(check-equal?
(msg-ts-orig actual)
(msg-ts-orig expected)
(check-equal?
(msg-ts-orig actual)
(msg-ts-orig expected)
@@
-349,9
+349,9
@@
(uri-download uri)))
(: timeline-download (-> Integer (Listof Feed) Void))
(uri-download uri)))
(: timeline-download (-> Integer (Listof Feed) Void))
-(define (timeline-download num
_
workers feeds)
+(define (timeline-download num
-
workers feeds)
; TODO No need for map - can just iter
; TODO No need for map - can just iter
- (void (concurrent-filter-map num
_
workers feed-download feeds)))
+ (void (concurrent-filter-map num
-
workers feed-download feeds)))
; TODO timeline contract : time-sorted list of messages
(: timeline-read (-> Timeline-Order (Listof Feed) (Listof Msg)))
; TODO timeline contract : time-sorted list of messages
(: timeline-read (-> Timeline-Order (Listof Feed) (Listof Msg)))
@@
-360,7
+360,7
@@
['old->new <]
['new->old >]))
(sort (append* (filter-map feed->msgs feeds))
['old->new <]
['new->old >]))
(sort (append* (filter-map feed->msgs feeds))
- (λ (a b) (cmp (msg-ts
_epoch a) (msg-ts_
epoch b)))))
+ (λ (a b) (cmp (msg-ts
-epoch a) (msg-ts-
epoch b)))))
(: start-logger (-> Log-Level Void))
(define (start-logger level)
(: start-logger (-> Log-Level Void))
(define (start-logger level)
@@
-399,16
+399,16
@@
(current-command-line-arguments (list->vector args))
(match command
[(or "d" "download")
(current-command-line-arguments (list->vector args))
(match command
[(or "d" "download")
- (let ([num
_
workers 15]) ; 15 was fastest out of the tried: 1, 5, 10, 20.
+ (let ([num
-
workers 15]) ; 15 was fastest out of the tried: 1, 5, 10, 20.
(command-line
#:program
"tt download"
#:once-each
[("-j" "--jobs")
njobs "Number of concurrent jobs."
(command-line
#:program
"tt download"
#:once-each
[("-j" "--jobs")
njobs "Number of concurrent jobs."
- (set! num
_
workers (string->number njobs))]
+ (set! num
-
workers (string->number njobs))]
#:args (filename)
#:args (filename)
- (timeline-download num
_
workers (file->feeds filename))))]
+ (timeline-download num
-
workers (file->feeds filename))))]
[(or "u" "upload")
(command-line
#:program
[(or "u" "upload")
(command-line
#:program
This page took
0.033529 seconds
and
4
git commands to generate.