Alternade words: Difference between revisions

Content added Content deleted
(→‎{{header|Ruby}}: Added Ruby)
(→‎{{header|Ruby}}: bsearch block)
Line 2,545: Line 2,545:
next if word.size < 6
next if word.size < 6
splitted = word.each_char.partition.with_index{|_,i| i.even? }.map(&:join)
splitted = word.each_char.partition.with_index{|_,i| i.even? }.map(&:join)
next unless splitted.all?{|split| words.bsearch{|w| w >= split } == split}
next unless splitted.all?{|split| words.bsearch{|w| split <=> w} }
"#{word}: #{splitted.join(", ")}"
"#{word}: #{splitted.join(", ")}"
end
end
Line 2,611: Line 2,611:
twirly: til, wry
twirly: til, wry
</pre>
</pre>

=={{header|Rust}}==
=={{header|Rust}}==
<lang rust>use std::collections::BTreeSet;
<lang rust>use std::collections::BTreeSet;