Created
September 6, 2011 03:49
-
-
Save zev/1196530 to your computer and use it in GitHub Desktop.
programming-praxis remove dup chars
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
;; solution for part 1 http://programmingpraxis.com/2011/09/02/two-string-exercises/ | |
(defun rdup (str) | |
(defun rdup_ (str res) | |
(if (null str) | |
res | |
(if (member (car str) res) | |
(rdup_ (cdr str) res) | |
(rdup_ (cdr str) (append res (list (car str))))))) | |
(concat (rdup_ (string-to-list str) '()))) | |
(rdup "aabbccd") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment