WDYT? +(define (set-packages!) + (let ((count 0)) + (set! packages + (fold-packages (lambda (pkg res) + (set! count (+ 1 count)) + (vhash-consq (object-address pkg) pkg res)) + vlist-null)) + (set! packages-table (make-hash-table count)) + (vlist-for-each (lambda (elem) + (let* ((pkg (cdr elem)) + (key (name+version->key + (package-name pkg) + (package-version pkg))) + (ref (hash-ref packages-table key))) + (hash-set! packages-table key + (if ref (cons pkg ref) (list pkg))))) + packages))) + +(set-packages!) Given that ‘set-packages!’ has only on call site, what about removing it, and instead writing directly: (define %packages (fold-packages ... vlist-null)) (define %package-count (length %packages)) (define %package-table (vlist-fold ...)) It’s also best to prefix global variable names with ‘%’. I should point out that we try to stick to functional style (in host-side code at least.) Thus any identifier with an exclamation mark gives you a -1 during review. ;-) See “Coding Style” in HACKING. >> • Add a section in the manual, probably under “Package Management”, >> describing the interface (probably as a separate .texi file >> @included from the main one.) It can come later. > > This is new subject for me as well; I'll write it as soon as possible. > > For now the most important part of the documentation is that after > installing guix with emacs UI, it may be used by putting: > > (require 'guix-init) > > into ".emacs". After that autoloaded "guix-..." commands should be > available. Cool! Thanks, Ludo’.