From 5ab726d27c2a300fefbcc843ad01a7c04590ff15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 23 Feb 2023 02:18:57 +0100 Subject: Change group-by to return direct pairs. Each value in the return of group-by must have exactly two values, so cons pairs (instead of lists) is much better. --- module/hnh/util.scm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'module/hnh/util.scm') diff --git a/module/hnh/util.scm b/module/hnh/util.scm index 36b56c58..ba2a8a59 100644 --- a/module/hnh/util.scm +++ b/module/hnh/util.scm @@ -330,10 +330,7 @@ (for value in lst (let ((key (proc value))) (hash-set! h key (cons value (hash-ref h key '()))))) - ;; TODO change this 'list' to 'cons'. - ;; It will give a "proper" alist, and also allows the output to work - ;; with assq-merge - (hash-map->list list h))) + (hash-map->list cons h))) ;; (split-by '(0 1 2 3 4 2 5 6) 2) ;; ⇒ ((0 1) (3 4) (5 6)) -- cgit v1.2.3