Eric Smith wrote:
> ; (rm1 "abc" 0) ==> "bc" (rm1 "tea" 1) ==> "ta"
> (defun rm1 (seq which)
> (remove-if #'true seq :start which :end (1+ which)))
>
> ; (consword #\a "bc") ==> "abc"
> (defun consword (char word)
> (concatenate 'string (string char) word))
>
> ; (anagrams "ah") ==> ("ah" "ha")
> (defun anagrams (word)
> (if (= (length word) 1) (list word)
> (loop as x across word
> as i upfrom 0
> as subword = (rm1 word i)
> nconc (loop as y in (anagrams subword)
> collect (consword x y)))))
> (map list->string (permutations (string->list "jug")))
'("jug" "ujg" "jgu" "gju" "ugj" "guj")
--
[Amazon bans history book after it received 300 5-star reviews.]
http://archive.org/details/nolies