Use table->unary-function in table->function/list.
This commit is contained in:
parent
09c14907ca
commit
6783b97add
1 changed files with 4 additions and 5 deletions
|
@ -280,11 +280,10 @@
|
||||||
(: table->function/list (All (a) (-> (Listof (Listof a))
|
(: table->function/list (All (a) (-> (Listof (Listof a))
|
||||||
(-> (Listof a) a))))
|
(-> (Listof a) a))))
|
||||||
(define (table->function/list table)
|
(define (table->function/list table)
|
||||||
(define ht-tab
|
(table->unary-function
|
||||||
(for/hash ([line (in-list table)]) : (HashTable (Listof a) a)
|
(for/list ([line (in-list table)]) : (Listof (List (Listof a) a))
|
||||||
(define-values (x fx) (split-at-right line 1))
|
(define-values (ins out) (split-at-right line 1))
|
||||||
(values x (car fx))))
|
(list ins (car out)))))
|
||||||
(λ (x) (hash-ref ht-tab x)))
|
|
||||||
|
|
||||||
(module+ test
|
(module+ test
|
||||||
(test-case "table->function/list"
|
(test-case "table->function/list"
|
||||||
|
|
Loading…
Reference in a new issue