From 6783b97add7bf59e4445201a141fbfade7ac6894 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Fri, 3 Mar 2023 10:21:31 +0100 Subject: [PATCH] Use table->unary-function in table->function/list. --- functions.rkt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/functions.rkt b/functions.rkt index 68130e4..1f6f084 100644 --- a/functions.rkt +++ b/functions.rkt @@ -280,11 +280,10 @@ (: table->function/list (All (a) (-> (Listof (Listof a)) (-> (Listof a) a)))) (define (table->function/list table) - (define ht-tab - (for/hash ([line (in-list table)]) : (HashTable (Listof a) a) - (define-values (x fx) (split-at-right line 1)) - (values x (car fx)))) - (λ (x) (hash-ref ht-tab x))) + (table->unary-function + (for/list ([line (in-list table)]) : (Listof (List (Listof a) a)) + (define-values (ins out) (split-at-right line 1)) + (list ins (car out))))) (module+ test (test-case "table->function/list"