[−][src]Macro sugars::cmap
Macro to HashMap
collection comprehensions
Supports 2 types of grammars: Haskell-like and Python-like
Limitations: Only 1 nested comprehensions and pattern support only works with python syntax
Examples:
use sugars::cmap; let a = 10; // Haskell-like let x = cmap!{x => x+a; x <- 1..10}; let y = cmap!{x => x+a; x <- 1..10, if x%2 == 0}; // Python-like let w = cmap!{x => x+a; for x in 1..10}; let z = cmap!{x => x+a; for x in 1..10, if x%2 == 0};