On Mon, Sep 23, 2024 at 09:42:38PM +0000, Heime wrote: > > I have an alist composed of keys and associated directory paths, and want > to output an alist made of the same keys with values being a validation flag. > Perhaps the problem is the call to mapcar. In the case of the hash table I have > to call output-table after the maphash. > > (defun dirpath-validation (input-table-or-alist) > "Test validity of directory path for each key." > > (cond > > ((hash-table-p input-table-or-alist) > > ;; Make hash-table for output > (let ( (output-table (make-hash-table :test 'equal)) ) > (maphash (lambda (key dirpath) > (puthash key (not (file-directory-p dirpath)) output-table)) > input-table-or-alist) > output-table)) > > (t > (mapcar (lambda (entry) > (let ( (key (car entry)) > (dirpath (cdr entry)) ) > (cons key (not (file-directory-p dirpath)))) ) > input-table-or-alist)) )) I've some difficulties figuring out what your question is. Is it that you want to write a function which "does the same" as output-table does, but for alist? Then we don't know what output-table does, so we can only guess. Assuming it writes its content into a buffer, each entry on one line, key and value separated by space, then this might do as a rough prototype: (insert (mapc (lambda (k v) (format "%s %s\n) k v) input-table-or-alist)) Cheers -- t