I am currently working on the anagram task and I have included my solution below. When I run this in the emacs scratchpad it works just fine providing an appropriate output in the message area. I have no idea why this is wrong, nor do I know how else I should output the answer (as the question doesn’t ask for the output to be in a particular form).
Any help would be greatly appreciated.
;;; anagram.el — Anagram (exercism) -- lexical-binding: t; --
;;; Commentary:
(defun anagrams-for (subject candidates)
;;; Code:
(setq list1 ())
(setq val nil)
(dolist (val candidates)
;(insert “%s” val)
(if (not (equal (downcase subject) (downcase val)))
(setq list1 (cons val list1))
))
(setq subn (sort (string-to-list (downcase subject)) '<))
(setq list2 'nil)
(dolist (i list1)
(if (equal subn (sort (string-to-list (downcase i)) '<) )
(setq list2 (cons i list2))
))
(message (format “%s” list2))
)
(provide 'anagram)
;;; anagram.el ends here