home
/
code
/
tt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Stop using vector-empty?
[tt.git]
/
tt.rkt
diff --git
a/tt.rkt
b/tt.rkt
index
c606b2e
..
421af36
100644
(file)
--- a/
tt.rkt
+++ b/
tt.rkt
@@
-34,6
+34,9
@@
; - d | download
; - u | upload
; - calls user-configured command to upload user's own feed file to their server
; - d | download
; - u | upload
; - calls user-configured command to upload user's own feed file to their server
+;
+; Looks like a better CLI parser than "racket/cmdline":
+; https://docs.racket-lang.org/natural-cli/
#lang racket
#lang racket
@@
-50,6
+53,7
@@
(struct feed (nick uri))
(define (concurrent-filter-map num_workers f xs)
(struct feed (nick uri))
(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)
(define parent (current-thread))
; TODO switch from mailboxes to channels
(define (make-worker id f)
(define parent (current-thread))
@@
-83,6
+87,15
@@
(for-each thread-wait threads)
results)
(for-each thread-wait threads)
results)
+(module+ test
+ (define n-workers 10)
+ (define given (list
+ (λ (x) (if (even? x) x #f))
+ (range 11)))
+ (check-equal?
+ (sort (apply concurrent-filter-map (cons n-workers given)) <)
+ (sort (apply filter-map given ) <)))
+
(define (msg-print out-format odd msg)
(printf
(match out-format
(define (msg-print out-format odd msg)
(printf
(match out-format
@@
-206,7
+219,7
@@
(define user-agent
(let*
([prog-name "tt"]
(define user-agent
(let*
([prog-name "tt"]
- [prog-version "0.3.
4
"]
+ [prog-version "0.3.
5
"]
[prog-uri "https://github.com/xandkar/tt"]
[user-feed-file (expand-user-path "~/twtxt-me.txt")]
[user
[prog-uri "https://github.com/xandkar/tt"]
[user-feed-file (expand-user-path "~/twtxt-me.txt")]
[user
@@
-239,7
+252,7
@@
(define args (current-command-line-arguments))
(define feeds
(define args (current-command-line-arguments))
(define feeds
- (if (
vector-empty? args
)
+ (if (
= 0 (vector-length args)
)
(we-are-twtxt)
(file->feeds (vector-ref args 0))))
(define out-format 'multi-line)
(we-are-twtxt)
(file->feeds (vector-ref args 0))))
(define out-format 'multi-line)
This page took
0.024524 seconds
and
4
git commands to generate.