Last active
December 15, 2015 05:19
-
-
Save Wilfred/5208113 to your computer and use it in GitHub Desktop.
Replace all occurrences of atom FROM with TO in an arbitrarily nested list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (require 'dash) | |
| (defun replace-nested-list (from to list) | |
| "Replace all occurrences of atom FROM with TO in an arbitrarily nested LIST." | |
| (--map | |
| (cond | |
| ((consp it) (in-ns--replace-nested-list from to it)) | |
| ((eq it from) to) | |
| ('t it)) | |
| list)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment