Odd words: Difference between revisions

Content added Content deleted
m (→‎{{header|Phix}}: use GT_LF_STRIPPED)
Line 220: Line 220:


=={{header|Phix}}==
=={{header|Phix}}==
<lang Phix>sequence words = split_any(get_text("demo/unixdict.txt")," \r\n")
<lang Phix>sequence words = get_text("demo/unixdict.txt",GT_LF_STRIPPED)
function odd(integer /*ch*/, idx) return remainder(idx,2)=1 end function
function odd(integer /*ch*/, idx) return remainder(idx,2)=1 end function
function oddch(string word) return filter(word,odd) end function
function oddch(string word) return filter(word,odd) end function
Line 232: Line 232:
=== Alternative ===
=== Alternative ===
Slightly more traditional, same output.
Slightly more traditional, same output.
<lang Phix>sequence words = split_any(get_text("demo/unixdict.txt")," \r\n"),
<lang Phix>sequence words = get_text("demo/unixdict.txt",GT_LF_STRIPPED),
res = {}
res = {}
for i=1 to length(words) do
for i=1 to length(words) do