Talk:ABC problem: Difference between revisions

Content added Content deleted
Line 131: Line 131:
I think this is a little bit more consice (at least it is definitely shorter). I'm not sure about adding it in addition to the old one / instead?
I think this is a little bit more consice (at least it is definitely shorter). I'm not sure about adding it in addition to the old one / instead?
<code>
<code>
(defun word-possible-p (word alphabet)
(defun word-possible-p (word alphabet)
(labels ((%usablep (b)
(labels ((%first-or-second (b)
(find (char-upcase (char word 0)) b)))
(find (char-upcase (char word 0)) b)))
(or (zerop (length word))
(or (zerop (length word))
(iter
(iter
(for candidate :in (remove-if-not #'%usablep alphabet))
(for candidate :in (remove-if-not #'%first-or-second alphabet))
(when (word-possible-p
(when (word-possible-p
(subseq word 1) (remove candidate alphabet :count 1))
(subseq word 1) (remove candidate alphabet :count 1))
(return t))))))
(return t))))))
</code>
</code>
[[User:Wvxvw|Wvxvw]] ([[User talk:Wvxvw|talk]]) 13:37, 5 April 2015 (UTC)
[[User:Wvxvw|Wvxvw]] ([[User talk:Wvxvw|talk]]) 13:37, 5 April 2015 (UTC)