What does a comma in the guard syntax do?

Guards are described in Haskell 2010 section 3.13, Case Expressions (that section is about case expressions, not top-level declarations, but presumably the semantics are the same): guards → | guard1, …, guardn (n ≥ 1) guard → pat <- infixexp (pattern guard) | let decls (local declaration) | infixexp (boolean guard) For each guarded expression, … Read more

Language support for chained comparison operators (x < y < z)

It should be more common, but I suspect it is not because it makes parsing languages more complex. Benefits: Upholds the principle of least surprise Reads like math is taught Reduces cognitive load (see previous 2 points) Drawbacks: Grammar is more complex for the language Special case syntactic sugar As to why not, my guesses … Read more

What is the ..= (dot dot equals) operator in Rust?

This is the inclusive range operator. The range x..=y contains all values >= x and <= y, i.e. “from x up to and including y”. This is in contrast to the non-inclusive range operator x..y, which doesn’t include y itself. fn main() { println!(“{:?}”, (10..20) .collect::<Vec<_>>()); println!(“{:?}”, (10..=20).collect::<Vec<_>>()); } // Output: // // [10, 11, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)