Grouping keys of an associative list


/ Published in: Scheme
Save to your folder(s)

Given an an associative list ((k1 . v1) (k2 . v2) ... (kn . vn)), with possibly equal values for ki, it returns another alist where all cells have distinct keys and where values originally associated to the same key have been grouped as a list in the new cons cell. Ouch! This is much harder to explain than to code. Just check the commented example in the code.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.