/* Generate lower case ASCII alphabet in Picat. http://rosettacode.org/wiki/Generate_lower_case_ASCII_alphabet """ Generate an array, list, lazy sequence, or even an indexable string of all the lower case ASCII characters, from a to z. If the standard library contains such a sequence, show how to access it, but don't fail to show how to generate a similar sequence. For this basic task use a reliable style of coding, a style fit for a very large program, and use strong typing if available. It's bug prone to enumerate all the lowercase characters manually in the code. During code review it's not immediate obvious to spot the bug in a Tcl line like this contained in a page of code: set alpha {a b c d e f g h i j k m n o p q r s t u v w x y z} """ This program was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ main => go. go => alpha(Alpha1), Alpha1.remove_dups.len == 26, % checking Alpha2 = (0'a..0'z).map(chr), Alpha2 == Alpha1, Alpha3 = [chr(I) : I in 97..122], Alpha3 == Alpha1, println(Alpha1), println(Alpha2), println(Alpha3), println(ok), nl. % Another variant % Not in production code go2 => Alpha = "The quick brown fox jumps over the lazy dog".filter(lowercase).sort_remove_dups, println(Alpha), nl. % placed in a module alpha("abcdefghijklmnopqrstuvwxyz"). filter(L,P) = [E : E in L, call(P,E)].