Browse Source

use the `define-predicate` trick

master
Epi Morphism 3 months ago
parent
commit
9149384d8d
1 changed files with 4 additions and 5 deletions
  1. +4
    -5
      api.rkt

+ 4
- 5
api.rkt View File

@@ -43,16 +43,15 @@

;; is it a reply to the /users command?

(define-predicate names-list? (Listof String))

(: get-users-reply (-> JSExpr (U False (Listof String))))
(define (get-users-reply js)
(match js
[(hash-table ('Type DTHidden)
('Data (hash-table ('Type CdUsers)
('Data (list users ...)))))
;; TODO: here I would like to match on
;; (list (? string? users) ...) but that
;; doesn't seem to work
(filter string? users)]
('Data (? names-list? users)))))
users]
[_ #f]))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Loading…
Cancel
Save