Get rid of `anagram-p' toy

This commit is contained in:
Gerard Vermeulen 2024-03-06 15:11:29 +01:00
parent bd304dd881
commit beaceae39b

View File

@ -4301,31 +4301,6 @@ abbreviation definitions in this file by means of:
(setq-default abbrev-mode t)) (setq-default abbrev-mode t))
#+end_src #+end_src
Listing [[lst:word-games]] defines the =anagram-p= function that might be used games.
#+caption[Word games]:
#+caption: Word games.
#+name: lst:word-games
#+begin_src emacs-lisp -n :results silent
;; https://funcall.blogspot.com/2022/07/lets-play-wordle.html
;; https://github.com/tabatkins/wordle-list
(defun anagram-p (evil vile)
"Check whether strings EVIL and VILE are anagrams of each other."
(if (string= evil vile)
nil
(string= (cl-sort evil #'<) (cl-sort vile #'<))))
;; https://funcall.blogspot.com/2020/01/palindromes-redux-and-sufficiently.html
;; https://irreal.org/blog/?p=8570
(defun palindrome-p (word)
"Check whether the string WORD is a palindrome."
(cl-do ((head 0 (1+ head))
(tail (1- (length word)) (1- tail))
(ok t))
((or (not ok) (>= head tail) ok)
(setq ok (= (aref word head) (aref word tail))))))
#+end_src
*** TODO [[https://dict.org/bin/Dict][DICT.org]] local server fails on Darwin *** TODO [[https://dict.org/bin/Dict][DICT.org]] local server fails on Darwin
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: sec:writing-dict :CUSTOM_ID: sec:writing-dict