Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #57726
| From | "Robert L." <No_spamming@noWhere_7073.org> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Rosetta: Pangram checker |
| Date | 2017-04-21 16:44 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <oddct4$1lso$1@gioia.aioe.org> (permalink) |
> A pangram is a sentence that contains all the letters of the
> English alphabet at least once.
>
> For example: The quick brown fox jumps over the lazy dog.
>
> Task
>
> Write a function or method to check a sentence to see if it is
> a pangram (or not) and show its use.
> Forth[edit]
>
> : pangram? ( addr len -- ? )
> 0 -rot bounds do
> i c@ 32 or [char] a -
> dup 0 26 within if
> 1 swap lshift or
> else drop then
> loop
> 1 26 lshift 1- = ;
def pangram? s
('A'..'Z').to_a - s.upcase.chars == []
end
pangram? "The five boxing wizards jump quickly."
==>true
pangram? "The five boxing wizards jump uickly."
==>false
pangram? 'How vexingly quick daft zebras jump!'
==>true
pangram? "ABC.D.E.FGHI*J/KL-M+NO*PQ R\nSTUVWXYZ"
==>true
pangram? "This sentence contains A-Z but not the whole alphabet."
==>false
--
It is the same instinct that made one [Swedish] female refugee aid worker and
her colleagues hush up her recent rape at the hands of some recent arrivals.
They feared that mentioning the rape might exacerbate anti-immigrant sentiment
in Europe.
theoccidentalobserver.net/2015/11/douglas-murrays-warning-to-the-jewish-community
Back to comp.lang.forth | Previous | Next | Find similar | Unroll thread
Rosetta: Pangram checker "Robert L." <No_spamming@noWhere_7073.org> - 2017-04-21 16:44 +0000
csiph-web