Jump to content

Compare a list of strings: Difference between revisions

m
m (Spacing)
Line 2,601:
=={{header|Rust}}==
 
<lang rust>fn strings_are_equal(seq: &[&str]) -> bool {
<lang rust>// Note that this solution uses the feature 'slice_patterns' which is available Rust nightly!
#![feature(slice_patterns)]
 
fn strings_are_equal(seq: &[&str]) -> bool {
match seq {
&[] | &[_] => true,
&[x, y, ref tail @ ..] if x == y => strings_are_equal(&[&[y], tail].concat()),
_ => false
}
Line 2,615 ⟶ 2,612:
match seq {
&[] | &[_] => true,
&[x, y, ref tail @ ..] if x < y => asc_strings(&[&[y], tail].concat()),
_ => false
}
Cookies help us deliver our services. By using our services, you agree to our use of cookies.