[−][src]Macro sugars::cbtmap
Macro to BTreeMap
collection comprehensions
Supports 3 types of grammars: Haskell-like, Python-like, Just-in
Limitations
- Only 1 nested comprehensions
- Haskell-like cannot accept patterns
Examples:
use sugars::cbtmap; let a = 10; // Haskell-like let x = cbtmap!{x => x+a; x <- 1..10}; let y = cbtmap!{x => x+a; x <- 1..10, if x%2 == 0}; // Python-like let w = cbtmap!{x => x+a; for x in 1..10}; let z = cbtmap!{x => x+a; for x in 1..10, if x%2 == 0}; // Just-in let w = cbtmap!{x => x+a; x in 1..10}; let z = cbtmap!{x => x+a; x in 1..10, if x%2 == 0};