Talk:ABC problem: Difference between revisions
Content added Content deleted
m (→Definition please: added an article.) |
(→Alternative Common Lisp version: new section) |
||
Line 126: | Line 126: | ||
\/_________________/ |
\/_________________/ |
||
</pre> |
</pre> |
||
== Alternative Common Lisp version == |
|||
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> |
|||
(defun word-possible-p (word alphabet) |
|||
(labels ((%usablep (b) |
|||
(find (char-upcase (char word 0)) b))) |
|||
(or (zerop (length word)) |
|||
(iter |
|||
(for candidate :in (remove-if-not #'%usablep alphabet)) |
|||
(when (word-possible-p |
|||
(subseq word 1) (remove candidate alphabet :count 1)) |
|||
(return t)))))) |
|||
</code> |
|||
[[User:Wvxvw|Wvxvw]] ([[User talk:Wvxvw|talk]]) 13:37, 5 April 2015 (UTC) |