#361
Stock checking
Difficulty: | Easy |
Topics: | Real life cases List of Maps |
Mission: "Stock Summary Report" memerlukan elo untuk membuat ringkasan stok produk dari sebuah gudang. Data produk disediakan dalam list of maps, dengan setiap map mengandung :product, :category, dan :quantity. Buatlah summary report yang mengelompokkan total quantity per :category.
(= (__ [{:product "Laptop" :category "Electronics" :quantity 30} {:product "Smartphone" :category "Electronics" :quantity 50} {:product "Desk" :category "Furniture" :quantity 15}]) {"Electronics" 80, "Furniture" 15}) | |
(= (__ [{:product "Chair" :category "Furniture" :quantity 5} {:product "Table" :category "Furniture" :quantity 10} {:product "Lamp" :category "Decor" :quantity 5}]) {"Furniture" 15, "Decor" 5}) | |
(= (__ [{:product "Notebook" :category "Stationery" :quantity 20} {:product "Pen" :category "Stationery" :quantity 100} {:product "Eraser" :category "Stationery" :quantity 50}]) {"Stationery" 170}) | |
(= (__ []) {}) |