ABC problem: Difference between revisions
→{{header|Logtalk}}
Ttmrichter (talk | contribs) |
|||
Line 5,853:
:- public(spell_no_spell/3).
:- uses(character, [lower_upper/2,
:- uses(term_io, [write_to_chars/2 as atom_to_codes/2]).
Line 5,862 ⟶ 5,861:
atom_to_codes(Atom, Codes),
to_lower(Codes, Lower),
spell_no_spell(Words, Spellable, Unspellable) :-
Line 5,873 ⟶ 5,871:
can_spell(Blocks0, [H|T]) :-
( list::selectchk(b(H,_), Blocks0, Blocks1)
; list::selectchk(b(_,H), Blocks0, Blocks1)
),
can_spell(Blocks1, T).
to_lower(Codes, Lower) :-
meta::map( [C,L] >> ( is_upper_case(C)
; C = L),
Codes, Lower).
|